1 CUT
  Syntax: CUT
       or CUT command
  where:      command is one of ?|NEW|NAME|FILE|EDIT|COMPILE|
              CHANGE|DELETE|LIST|USE|END

  Specifies  what  cuts to  use when  making  a  projection of  a plot, or
  modifies, deletes or lists existing  cuts. To define cuts you can either
  use a FORTRAN syntax  (`.EQ., .NE., .LT., .LE.,  .GT., .GE.') or symbols
  (`=, <>,  <, <=, >,  >=').  Cuts can  either be  expressions  or a COMIS
  function.  If the  nearest  integer  to the  return  value of  the Comis
  function is 1, the cut is passed.

  If the command is included on the  same line as `CUT' then you will exit
  `CUT' after the command has been executed.

  If the histogram is an  Ntuple or has been  made with the M_BOOK package
  the variable names are  as you gave them at  booking time, otherwise the
  default names are `x',`y' and `z' for the first 3 dimensions.

  The sequence to use is `CUT NEW' or `CUT NAME' to define the cuts
  you want to use and then use the `CUT USE' command to say how they
  should be strung together using the usual FORTRAN syntax with
  `.AND.' and `.OR.'. You can also use the symbols (`&' and `|'). For
  a COMIS function you can also give the value of the argument that it
  is called with. When you have finished cut give the command `END' or
  hit `<CR>'. Then give the `PROJECT' command to implement the cuts
  you have selected (see HELP NTUPLE PROJECT for more details).

  For a  short  description of  the  commands see HELP CUT Menu. See the
  individual topics for more information.

  WARNING: In versions before 4.07/30, if you combined simple cuts
  (where the expression2 (see HELP CUT NEW) was a number or a
  register) with more complicated ones that had to be parsed (Ntuple
  variables, or arithmetic expressions), and the more complicated
  expression was specified later in the `CUT USE' command the cut
  value of another cut could be overwritten.

2 Menu
  The following is the list of `CUT' commands.
  For more details see HELP CUT and the individual subtopics:

  NEW      Specifies a new cut.
  NAME     Specifies or changes a named cut.
  CHANGE   Changes an existing cut.
  FILE     Gives a COMIS filename to be used as a cut function.
  EDIT     Edits and then compiles a COMIS cut.
  COMPILE  Compiles a COMIS cut.
  DELETE   Deletes one or more cuts.
  LIST     Lists the currently defined cuts.
  USE      Specifies the cuts to use when making a projection.
  END      Ends a list of cut commands.

2 NEW
  Syntax: CUT NEW expression1 condition expression2
  where:  expression1  is a variable name or an expression
          condition    can be one of .LT., .LE., .GT., .GE., .EQ., .NE.
                       or <, <=, >, >=, =, <>
          expression2  is a variable name or an expression

  Specifies a new cut. In its simplest form `expression1' is the name of
  a variable and `expression2' is a number. A number can be given in the
  form  of a  number,  register,   parameter  etc. For  more  details on
  expressions see HELP Expressions.

  Note that you cannot use the form `x.lt..4' for a cut, although
  `x<.4' is OK. In general it makes it easier if you leave spaces between
  the expressions and the conditions. This problem may be fixed in a
  future version of Mn_Fit.

  If your cut expression starts with a parenthesis then you should
  enclose the whole expression in parentheses:

  cut new ((a+b)/(c+d))

  The text of the cut will be  stored and then parsed when you ask for a
  projection. Thus if you use  registers etc. in the cut their values at
  the time that the projection is made will be used.

2 NAME
  Syntax: CUT NAME name expression1 condition expression2
  where:  name         is a name for the cut
          expression1  is a variable name or an expression
          condition    can be one of .LT., .LE., .GT., .GE., .EQ., .NE.
                       or <, <=, >, >=, =, <>
          expression2  is a variable name or an expression

  Specifies or modifies a named cut. The name of the cut can be use
  later with the `CUT USE' command. In its simplest form `expression1'
  is the name of a variable and `expression2' is a number. A number
  can be given in the form of a number, register, parameter etc. For
  more details on expressions see HELP Expressions.

  The name of the cut should start with a letter. All names will be
  converted to upper case and only the first 10 letters are
  significant. If the name already exists you will modify an
  exisiting cut. If the name does not exist it will be added as a new
  cut. Names cannot be abbreviated in either the `CUT NAME' or the
  `CUT USE' commands.

  Note that you cannot use the form `x.lt..4' for a cut, although
  `x<.4' is OK. In general it makes it easier if you leave spaces between
  the expressions and the conditions. This problem may be fixed in a
  future version of Mn_Fit.

  If your cut expression starts with a parenthesis then you should
  enclose the whole expression in parentheses:

  cut new ((a+b)/(c+d))

  The text of the cut will be  stored and then parsed when you ask for a
  projection. Thus if you use  registers etc. in the cut their values at
  the time that the projection is made will be used.

2 CHANGE
  Syntax: CUT CHANGE [ncut] expression1 condition expression2
  where   ncut  is the cut number to change
          expression1  is a variable name or an expression
          condition    can be one of .LT., .LE., .GT., .GE., .EQ., .NE.
                       or <, <=, >, >=, =, <>
          expression1  is a variable name or an expression

  Change a cut (use the = sign if you don't want to change something).
  Note that you must use `==' if you want to keep the same condition,
  as `=' would change the condition to `.EQ.':

  cut new x>0.5
  cut
  CHANGE 1 = == 1.0
  end

  would change  the above cut `X  .GT. 0.5' to `X  .GT. 1.0'. Registers,
  parameters etc.  can be used for  the value of the  cut. Remember that
  they only get evaluated when the cut is used in making a projection.
  You should use the `PARSE' command if you want the values to be
  translated immediately.

2 FILE
  Syntax: CUT FILE filename [id[&idb]] Y|N
  where   filename  is the name of a file containing a COMIS function
          id        is the plot number associated with the cut.
          Y|N       decides if the file is to be edited before compilation

  Adds a new cut that  is a COMIS function. The  function will be called
  for  each  event in  the  Ntuple  or each  bin  in the   n-dimensional
  histogram. If the  nearest integer to the  return value is 1 the event
  will pass the cut.

  If the filename does not exist a skeleton file will be written. If you
  give a plot number then the variable names from that plot will be used
  to make the skeleton file.  Therefore I recommend always giving a plot
  number when you make a new file.

  Information on the Ntuple is available in
  3 common blocks: `PAWIDN, MNTPL1, MNTPL2'. For the contents  of  these
  common blocks and when and how they are filled see HELP NTUPLE.

2 EDIT
  Syntax: CUT EDIT filename
       or CUT EDIT ncut
  where   filename  is the name of a file containing a COMIS function
          ncut      is a cut number which is a COMIS function

  Edits the file with the default editor (set with the SET EDIT command)
  and then recompiles the cut.

2 COMPILE
  Syntax: CUT COMPILE filename
       or CUT COMPILE ncut
  where   filename  is the name of a file containing a COMIS function
          ncut      is a cut number which is a COMIS function

  Recompiles the cut. You can use  this command if you edit the cut from
  outside Mn_Fit or just with the  `EDIT' command instead of `CUT EDIT'.
  Note that  the cut  is always   recompiled just  before it  is used in
  `NTUPLE PROJECT or PLOT'.

2 DELETE
  Syntax: CUT DELETE [ncut]
  where   ncut  is the cut number to change

  Deletes a cut (`DELETE 0' means delete all cuts).

2 LIST
  Syntax: CUT LIST

  Lists the cuts already specified.

2 USE
  Syntax: CUT USE expression
  where   expression  is the list of cuts to use and how to combine them

  Gives the  list and  order of  cuts to use  e.g. `1 .and.  (2 .or. 3)'
  including whatever  parentheses are  necessary. You can use `.AND.' or
  `.OR.' or the symbols `&' and `|'.  If you do not include the complete
  cut in  parentheses they  will be added  for you. If a  cut is a COMIS
  function you can give  the argument with  which the function should be
  called.   e.g.  `1  .and.  2(0.5)'   would  call  the  COMIS  function
  corresponding to cut 2 with the argument value 0.5.

  The are 3 special values of the expression allowed:
      0 means no cuts are to be used
     -1 means all cuts should be ANDed
     -2 means all cuts should be ORed

2 END
  Syntax: CUT END

  Exits cut.

2 Examples

!\begin{enumerate}
!\item
!^
  Example 1:
  Define the cuts:
    CUT NEW
    X .GT. 0.5
    CUT
    NEW X< 2.0
    NEW Y.LT.7.0
    NEW Y.GT.10.0
    file cut.for

  Specify which cuts to use. The COMIS function will be called with
  argument 1:
    CUT USE 1 .AND. 2 .AND. (3 | 4) & 5(1)
    END

  Make a projection:
    PROJECT id X &idb

  Change one of the cuts:
    CUT CHANGE 3
    = .LE. 4
    END

  Make a second projection:
    PROJECT id X &idb2

!\item
!^
  Example 2:
  Use a more complicated expression for a cut. Also illustrate how to
  use `CUT NAME'. Assume you have an Ntuple with 3 variables,
  gaus1, gaus2 and flat:
    cut del 0
    cut name gauss gaus1 > gaus2
    cut new abs(flat-0.5) < 0.5*(gaus1+gaus2)
    cut use -1
    ntuple plot 31 (gaus1-gaus2) &1 50 -5 5
    cut use gauss
    ntuple plot 31 (gaus1-gaus2) &2 50 -5 5

!\end{enumerate}

