ROOT logo
Podd » SRC » THaCutList

class THaCutList


 THaCutList

 Class to manage dynamically-defined cuts (tests).


Function Members (Methods)

public:
THaCutList()
THaCutList(const THaCutList& clst)
THaCutList(const THaVarList* lst)
virtual~THaCutList()
static TClass*Class()
virtual voidClear(Option_t* opt = "")
virtual voidClearAll(Option_t* opt = "")
virtual voidClearBlock(const char* block = kDefaultBlockName, Option_t* opt = "")
virtual voidCompile()
virtual Int_tDefine(const char* cutname, const char* expr, const char* block = kDefaultBlockName)
virtual Int_tDefine(const char* cutname, const char* expr, const THaVarList* lst, const char* block = kDefaultBlockName)
virtual Int_tEval()
virtual Int_tEvalBlock(const char* block = kDefaultBlockName)
static Int_tEvalBlock(const TList* plist)
THaNamedList*FindBlock(const char* block) const
THaCut*FindCut(const char* name) const
const THashList*GetBlockList() const
const THashList*GetCutList() const
Int_tGetNblocks() const
Int_tGetSize() const
virtual TClass*IsA() const
virtual Int_tLoad(const char* filename = kDefaultCutFile)
virtual voidPrint(Option_t* option = "") const
virtual voidPrintBlock(const char* block = kDefaultBlockName, Option_t* option = "") const
virtual voidPrintCut(const char* cutname, Option_t* option = "") const
virtual Int_tRemove(const char* cutname)
virtual Int_tRemoveBlock(const char* block = kDefaultBlockName)
virtual voidReset()
virtual Int_tResult(const char* cutname = "", THaCutList::EWarnMode mode = kWarn)
virtual voidSetList(THaVarList* lst)
virtual voidShowMembers(TMemberInspector&)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
protected:
static voidMakePrintOption(THaPrintOption& opt, const TList* plist)
virtual voidPrintHeader(const THaPrintOption& opt) const

Data Members

public:
enum EWarnMode { kWarn
kNoWarn
};
public:
static const char *constkDefaultBlockName
static const char *constkDefaultCutFile
protected:
THaHashList*fBlocksHash list holding blocks of cuts.
THaHashList*fCutsHash list holding all cuts
const THaVarList*fVarListPointer to list of variables

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

THaCutList()
 Default constructor. No variable list is defined. Either define it
 later with SetList() or pass the list as an argument to Define().
 Allowing this constructor is not very safe ...
THaCutList(const THaCutList& clst)
 Copy constructor
THaCutList(const THaVarList* lst)
 Constructor from variable list. Create the main lists and set the variable
 list.
~THaCutList()
 Default destructor. Deletes all cuts and lists.
void Clear(Option_t* opt = "")
 Remove all cuts and all blocks
void ClearAll(Option_t* opt = "")
 Clear the results of all defined cuts
void ClearBlock(const char* block = kDefaultBlockName, Option_t* opt = "")
 Clear the results of the defined cuts in the named block
void Compile()
 Compile all cuts in the list.
 Since cuts are compiled when we Define() them, this routine typically only
 needs to be called when global variable pointers need to be updated.
Int_t Define(const char* cutname, const char* expr, const char* block = kDefaultBlockName)
 Define a new cut with given name in given block. If the block does not
 exist, it is created.  This is the normal way to define a cut since
 there is usually just one variable list.

 Cut names MUST be unique and cannot be empty. Quotes and whitespace are
 illegal in cut names; any other characters are allowed.

 Symbolic variables in expressions must only refer to variables defined
 in the variable list OR to previously defined cuts.

 It is possible to use cut names from one block in definitions for a
 different block. This should be done with care, however, since such
 "external" cuts are not necessarily updated with the same frequency
 as the current block, depending on the design of the application.

 A return value of 0 indicates success, negative numbers indicate error.

Int_t Define(const char* cutname, const char* expr, const THaVarList* lst, const char* block = kDefaultBlockName)
 Define a new cut with given name in given block with variables from
 given list.  See description of Define() above.

Int_t Eval()
 Evaluate all tests in all blocks.  Because of possible dependences between
 blocks, each block is evaluated separately in the order in which the blocks
 were defined.
Int_t EvalBlock(const TList* plist)
 Evaluate all cuts in the given list in the order in which they were defined.
 This is a static member function that can be called externally.
 Only TObject* in the given list that inherit from THaCut* are evaluated.
Int_t EvalBlock(const char* block = kDefaultBlockName)
 Evaluate all tests in the given block in the order in which they were defined.
 If no argument is given, the default block is evaluated.
Int_t Load(const char* filename = kDefaultCutFile)
 Read cut definitions from a file and create the cuts. If no filename is
 given, the file ./cutdef.dat is used.

 Lines starting with # or "//" are treated as comments.
 Blank lines and leading spaces are ignored.

 A valid cut definition consists of two fields, a cut name and the
 corresponding expression.  The fields are separated by whitespace.
 Comments following the cut expression are ignored.

 Block names can be set using "Block:" as the cut name (without quotes)
 followed by the name of the block.

 Cuts are defined via the Define() method; see the description of
 Define() for more details.  Examples:

 # This is a comment. Blank lines are ignored, so are leading spaces.

 xcut  x>1
 cut1  x+y<10

 Block: Target_cuts
 cut2  x<10 || x>20   // Comment goes here
 zcut  (z^2-2)>0      # This text is ignored

 A return value of 0 indicates success. Negative values indicate severe
 errors (e.g. file not found, read error).  Positive numbers indicate the
 number of unprocessable lines (e.g. illegal expression, bad cutname) for
 which no cuts were defined.

void MakePrintOption(THaPrintOption& opt, const TList* plist)
 If the print option is either "LINE" or "STATS", determine the widths
 of the text fields of all the cuts in the given list and append them
 to the print option.
 This is an internal utility function used by Print() and PrintBlock().
void Print(Option_t* option = "") const
 Print all cuts in all blocks.
 For options see THaCut.Print(). The default mode is "LINE". The
 widths of the text fields are determined automatically.
 For "LINE" and "STATS", cuts are printed grouped in blocks.
void PrintBlock(const char* block = kDefaultBlockName, Option_t* option = "") const
 Print all cuts in the named block.
void PrintCut(const char* cutname, Option_t* option = "") const
 Print the definition of a single cut
void PrintHeader(const THaPrintOption& opt) const
 Print header for Print() and PrintBlock().
 This is an internal function.
void Reset()
 Reset all cut and block counters to zero
Int_t Result(const char* cutname = "", THaCutList::EWarnMode mode = kWarn)
 Return result of the last evaluation of the named cut
 (0 if false, 1 if true).
 If cut does not exist, return -1. Also, print warning if mode=kWarn.
Int_t Remove(const char* cutname)
 Remove the named cut completely
Int_t RemoveBlock(const char* block = kDefaultBlockName)
 Remove all cuts contained in the named block.
void SetList(THaVarList* lst)
 Set the pointer to the list of global variables to be used by default.
 Other variable lists can be used for individual cut definitions.
THaCut* FindCut(const char* name) const
{ return static_cast<THaCut*>(fCuts->FindObject( name )); }
THaNamedList* FindBlock(const char* block) const
{ return static_cast<THaNamedList*>(fBlocks->FindObject( block )); }
const THashList* GetCutList() const
{ return fCuts; }
const THashList* GetBlockList() const
{ return fBlocks; }
Int_t GetNblocks() const
{ return fBlocks->GetSize(); }
Int_t GetSize() const
{ return fCuts->GetSize(); }