![]() |
KaliVeda
Toolkit for HIC analysis
|
General purpose analysis base class for TTree containing KVEvent objects.
This is a specialised version of the ROOT TSelector class. Classes derived from this one can be used to analyse KVEvent data in TTree branches. Analyses can be performed sequentially or in parallel using the PROOFLite facility. The user needs only to implement/override the following methods in their analysis class:
In most cases, it is sufficient to implement only the InitAnalysis() and Analysis() methods.
The analysis can be performed like for TSelector with a TChain or TTree my_tree:
where [options] is a list of options in the form BranchName=toto, ....
The following options MUST be given:
The following are optional options:
When AuxFiles is used, the user can access the events in these files in her Analysis() method by doing the following:
Any other options can be defined by the user and parsed in her analysis class with methods IsOptGiven() and GetOpt()
The 5 methods listed above will be called in the following order during a typical analysis:
User's histograms and/or TTrees are initialised in InitAnalysis().
(see KVDataAnalysisTreeHistoHandler::AddHisto()).
Histograms can also be declared 'on the fly' in the Analysis() method in the same way;
Call method SetJobOutputFileName() with the required filename at the end of your InitAnalysis() method.
To add an STL vector to a TTree branch, use the helper methods (defined in KVTreeVectorBranchHandler):
Only int, float and double are supported for the moment.
Then in your Analysis() method, do the following:
Global variables for the analysis should be declared in InitAnalysis() using method AddGV(). These variables are calculated automatically for each event before user's Analysis() method is called. See the Users Guide chapter Global Variables for more details.
If the user needs to define new reference frames for the data which must exist before global variables are automatically calculated in the analysis loop, she can do so by overriding the method SetAnalysisFrame(), like so:
Note that the global variables are only calculated using particles which have their "OK" status set, for example because they correspond to the global particle selection criteria given to SetParticleConditions(). Any further particle selections applied to individual global variables will then select from among these "OK" particles.
If one or more global variables have event selection conditions defined (i.e. cuts on the values of the global variables) - see KVVarGlob::SetEventSelection() and KVGVList - then for each event which does not satisfy all conditions the Analysis() method will not be called.
If, at the end of processing, you want to generate a histogram from one or more histograms filled in your analysis, for example generate a TProfile from a 2D histogram, or store the result of dividing one histogram by the other, you need to do the following:
Definition at line 202 of file KVEventSelector.h.
#include <KVEventSelector.h>

Public Member Functions | |
| KVEventSelector (TTree *=0) | |
| KVVarGlob * | AddGV (const Char_t *class_name, const Char_t *name) |
| void | AddGV (KVVarGlob *vg) |
| KVGVList * | AddGVList (const KVString &list_name, const KVParticleCondition &selection=KVParticleCondition()) |
| virtual Bool_t | Analysis () |
| void | Begin (TTree *tree) override |
| virtual void | EndAnalysis () |
| virtual void | EndRun () |
| const Char_t * | GetBranchName () const |
| Int_t | GetEntry (Long64_t entry, Int_t getall=0) override |
| KVEvent * | GetEvent () const |
| Int_t | GetEventNumber () const |
| KVEvent * | GetFriendEvent () const |
| Int_t | GetFriendTreeEntry (Long64_t entry, Int_t getall=0) |
| KVVarGlob * | GetGV (const Char_t *name) const |
| KVGVList * | GetGVList (const KVString &list_name="default") |
| const KVGVList * | GetGVList (const KVString &list_name="default") const |
| TString | GetOpt (const Char_t *option) const |
| TList * | GetOutputList () const override |
| void | Init (TTree *tree) override |
| virtual void | InitAnalysis () |
| virtual void | InitRun () |
| Bool_t | IsOptGiven (const Char_t *option) |
| Bool_t | Notify () override |
| Bool_t | Process (Long64_t entry) override |
| virtual void | SaveHistos (const Char_t *="", Option_t *="recreate", Bool_t=kFALSE) |
| virtual void | SetAdditionalBranchAddress () |
| void | SetBranchName (const Char_t *n) |
| virtual void | SetCurrentRun (KVDBRun *) |
| void | SetEventsReadInterval (Long64_t N) |
| void | SetInputList (TList *input) override |
| void | SetJobOutputFileName (const TString &filename) |
| void | SetObject (TObject *obj) override |
| void | SetOpt (const Char_t *option, const Char_t *value) |
| void | SetParticleConditions (const KVParticleCondition &cond) |
| void | SetTriggerConditionsForRun (int run) |
| void | SlaveBegin (TTree *tree) override |
| void | SlaveTerminate () override |
| void | Terminate () override |
| void | UnsetOpt (const Char_t *opt) |
| Int_t | Version () const override |
Public Member Functions inherited from TSelector | |
| TSelector () | |
| ~TSelector () override | |
| virtual void | Abort (const char *why, EAbort what=kAbortProcess) |
| virtual EAbort | GetAbort () const |
| virtual TList * | GetInputList () const |
| const char * | GetOption () const override |
| virtual Long64_t | GetStatus () const |
| virtual void | ImportOutput (TList *output) |
| TClass * | IsA () const override |
| virtual Bool_t | ProcessCut (Long64_t) |
| virtual void | ProcessFill (Long64_t) |
| virtual void | ResetAbort () |
| virtual void | SetOption (const char *option) |
| virtual void | SetStatus (Long64_t status) |
| void | Streamer (TBuffer &) override |
| void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Public Member Functions inherited from TObject | |
| TObject () | |
| TObject (const TObject &object) | |
| virtual | ~TObject () |
| void | AbstractMethod (const char *method) const |
| virtual void | AppendPad (Option_t *option="") |
| virtual void | Browse (TBrowser *b) |
| ULong_t | CheckedHash () |
| virtual const char * | ClassName () const |
| virtual void | Clear (Option_t *="") |
| virtual TObject * | Clone (const char *newname="") const |
| virtual Int_t | Compare (const TObject *obj) const |
| virtual void | Copy (TObject &object) const |
| virtual void | Delete (Option_t *option="") |
| virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
| virtual void | Draw (Option_t *option="") |
| virtual void | DrawClass () const |
| virtual TObject * | DrawClone (Option_t *option="") const |
| virtual void | Dump () const |
| virtual void | Error (const char *method, const char *msgfmt,...) const |
| virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
| virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
| virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
| virtual void | Fatal (const char *method, const char *msgfmt,...) const |
| virtual TObject * | FindObject (const char *name) const |
| virtual TObject * | FindObject (const TObject *obj) const |
| virtual Option_t * | GetDrawOption () const |
| virtual const char * | GetIconName () const |
| virtual const char * | GetName () const |
| virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
| virtual const char * | GetTitle () const |
| virtual UInt_t | GetUniqueID () const |
| virtual Bool_t | HandleTimer (TTimer *timer) |
| virtual ULong_t | Hash () const |
| Bool_t | HasInconsistentHash () const |
| virtual void | Info (const char *method, const char *msgfmt,...) const |
| virtual Bool_t | InheritsFrom (const char *classname) const |
| virtual Bool_t | InheritsFrom (const TClass *cl) const |
| virtual void | Inspect () const |
| void | InvertBit (UInt_t f) |
| Bool_t | IsDestructed () const |
| virtual Bool_t | IsEqual (const TObject *obj) const |
| virtual Bool_t | IsFolder () const |
| R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
| virtual Bool_t | IsSortable () const |
| R__ALWAYS_INLINE Bool_t | IsZombie () const |
| virtual void | ls (Option_t *option="") const |
| void | MayNotUse (const char *method) const |
| void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
| void | operator delete (void *ptr) |
| void | operator delete (void *ptr, void *vp) |
| void | operator delete[] (void *ptr) |
| void | operator delete[] (void *ptr, void *vp) |
| void * | operator new (size_t sz) |
| void * | operator new (size_t sz, void *vp) |
| void * | operator new[] (size_t sz) |
| void * | operator new[] (size_t sz, void *vp) |
| TObject & | operator= (const TObject &rhs) |
| virtual void | Paint (Option_t *option="") |
| virtual void | Pop () |
| virtual void | Print (Option_t *option="") const |
| virtual Int_t | Read (const char *name) |
| virtual void | RecursiveRemove (TObject *obj) |
| void | ResetBit (UInt_t f) |
| virtual void | SaveAs (const char *filename="", Option_t *option="") const |
| virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
| void | SetBit (UInt_t f) |
| void | SetBit (UInt_t f, Bool_t set) |
| virtual void | SetDrawOption (Option_t *option="") |
| virtual void | SetUniqueID (UInt_t uid) |
| void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
| virtual void | SysError (const char *method, const char *msgfmt,...) const |
| R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
| Int_t | TestBits (UInt_t f) const |
| virtual void | UseCurrentStyle () |
| virtual void | Warning (const char *method, const char *msgfmt,...) const |
| virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) |
| virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
Public Member Functions inherited from KVDataAnalysisTreeHistoHandler< KVEventSelector > | |
| HistoType * | AddHisto (Args &&... args) |
| TTree * | AddTree (const TString &name, const TString &title="") |
| void | FillHisto (const Char_t *histo_name, const Char_t *label, Double_t weight=1) |
| Fill histogram with given name according to label bin and weight. More... | |
| void | FillHisto (const Char_t *histo_name, Double_t x, Double_t y=1, Double_t z=1, Double_t w=1) |
| Fill previously-declared histogram with given name and required arguments. More... | |
| void | FillTree (std::optional< TString > tree_name={}) |
| TH1 * | GetHisto (const Char_t *name) const |
| const KVHashList * | GetHistoList () const |
| TTree * | GetTree (const Char_t *name) const |
| const KVHashList * | GetTreeList () const |
| GetTreeList. More... | |
Friends | |
| class | KVDataAnalysisTreeHistoHandler< KVEventSelector > |
Additional Inherited Members | |
Public Types inherited from TSelector | |
| enum | EAbort |
Public Types inherited from TObject | |
| enum | EDeprecatedStatusBits |
| enum | EStatusBits |
Static Public Member Functions inherited from TSelector | |
| static TClass * | Class () |
| static const char * | Class_Name () |
| static constexpr Version_t | Class_Version () |
| static const char * | DeclFileName () |
| static TSelector * | GetSelector (const char *filename) |
| static Bool_t | IsStandardDraw (const char *selec) |
Static Public Member Functions inherited from TObject | |
| static TClass * | Class () |
| static const char * | Class_Name () |
| static constexpr Version_t | Class_Version () |
| static const char * | DeclFileName () |
| static Longptr_t | GetDtorOnly () |
| static Bool_t | GetObjectStat () |
| static void | SetDtorOnly (void *obj) |
| static void | SetObjectStat (Bool_t stat) |
Static Public Member Functions inherited from KVDataAnalysisTreeHistoHandler< KVEventSelector > | |
| static const Char_t * | Class_Name () |
Public Attributes inherited from TSelector | |
| kAbortFile | |
| kAbortProcess | |
| kContinue | |
Public Attributes inherited from TObject | |
| kBitMask | |
| kCanDelete | |
| kCannotPick | |
| kHasUUID | |
| kInconsistent | |
| kInvalidObject | |
| kIsOnHeap | |
| kIsReferenced | |
| kMustCleanup | |
| kNoContextMenu | |
| kNotDeleted | |
| kObjInCanvas | |
| kOverwrite | |
| kSingleKey | |
| kWriteDelete | |
| kZombie | |
Protected Member Functions inherited from TObject | |
| virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
| void | MakeZombie () |
Protected Attributes inherited from TSelector | |
| EAbort | fAbort |
| TList * | fInput |
| TObject * | fObject |
| TString | fOption |
| TSelectorList * | fOutput |
| Long64_t | fStatus |
Protected Attributes inherited from TObject | |
| kOnlyPrepStep | |
|
inline |
Definition at line 294 of file KVEventSelector.h.
Create and return a pointer to a new global variable with given name and class. The variable will be added to the default global variable list (see GetGVList())
| class_name | global variable class to use (see list here: Global Variables ) |
| name | name of new global variable |
Definition at line 553 of file KVEventSelector.h.
Add the global variable to the default list (see GetGVList()).
Equivalent to GetGVList()->AddGV(vg)
| vg | pointer to a heap-allocated KVVarGlob object |
Definition at line 538 of file KVEventSelector.h.
|
inline |
Create a new list of global variables with given name and an optional particle selection.
| [in] | list_name | name of new list, can be used to retrieve list with GetGVList() |
| [in] | selection | [optional] selection criteria for particles to be used by global variables, default is no selection |
Definition at line 481 of file KVEventSelector.h.
The Analysis() method is called for each accepted event in the TTree or TChain. Events may be rejected for two reasons:
A pointer to the current event can be obtained with the GetEvent() method. The user can then iterate over the nuclei in each event using any of the methods detailed in Iterating over nuclei in the Users Guide:
The definition of which nuclei are OK or not is carried out before this method is called (see InitRun()). This will affect iterations such as:
as well as any global variables which are defined using the default global variable list (see GetGVList()).
When analysing experimental or filtered data the "cm" frame corresponding to the centre of mass of the reaction being studied is defined for each nucleus in the event before this method is called.
Reimplemented in KVEventFiltering, and KVDataQualityAuditSelector.
Definition at line 461 of file KVEventSelector.h.
Reimplemented from TSelector.
Definition at line 23 of file KVEventSelector.cpp.
|
inlinevirtual |
Reimplemented in KVEventFiltering, and KVDataQualityAuditSelector.
Definition at line 469 of file KVEventSelector.h.
|
inlinevirtual |
Reimplemented in KVEventFiltering, and KVDataQualityAuditSelector.
Definition at line 465 of file KVEventSelector.h.
|
inline |
Definition at line 344 of file KVEventSelector.h.
Reimplemented from TSelector.
Reimplemented in KVFAZIASelector.
Definition at line 313 of file KVEventSelector.h.
|
inline |
Access current event when called from Analysis() method
Definition at line 355 of file KVEventSelector.h.
|
inline |
Definition at line 362 of file KVEventSelector.h.
|
inline |
Definition at line 321 of file KVEventSelector.h.
Definition at line 317 of file KVEventSelector.h.
Access global variable in the default list of global variables for the analysis (see GetGVList())
This is equivalent to GetGVList()->GetGV( name ).
| name | name of global variable to retrieve |
Definition at line 566 of file KVEventSelector.h.
| list_name | name of global variable list (default value: "default") |
If no name is given i.e. the list_name = "default" and no such global variable lists has been defined, this will automatically create the "default" list, for which the default particle selection is to only include 'OK' particles (this is for backwards compatibility with existing analysis classes and will change in future to default selection = no selection)
If the list_name = "__internal__" and no such list exists, a list is created with no defined selection and added to the beginning of the list of global variable lists. This is used internally to implement e.g. event selection depending on various trigger criteria etc
For all other cases, global variable lists which were created with AddGVList() can be retrieved with this method
Definition at line 507 of file KVEventSelector.h.
| list_name | name of global variable list to access |
Definition at line 527 of file KVEventSelector.h.
Definition at line 601 of file KVEventSelector.h.
|
inlineoverridevirtual |
Reimplemented from TSelector.
Definition at line 333 of file KVEventSelector.h.
Reimplemented from TSelector.
Reimplemented in KVINDRAEventSelector, KVFAZIASelector, and KVReconEventSelector.
Definition at line 418 of file KVEventSelector.cpp.
This is the 1st method called when a new analysis is started. It is the place to define any histograms and/or TTrees to be filled during the analysis, using AddHisto() and AddTree(), plus optionally the name of the output ROOT file containing them:
(for easy use of std::vector branches in the TTree, see KVTreeVectorBranchHandler::AddVectorBranch()).
Note that by using these methods as shown here
This is also the place to define any global variables which the user wants to use for her analysis (see Global Variables in the Users Guide). Each analysis class can use 1 or more lists of global variables, each with an associated selection of the particles of each event to be included in the calculation of each variable (see AddGVList(), GetGVList(), AddGV() and GetGV() methods).
The user can automatically add branches to be filled with a global variable list to any TTree created here like so:
See KVGVList::MakeBranches() and Automatic TTree branch creation and filling.
Reimplemented in KVEventFiltering, and KVDataQualityAuditSelector.
Definition at line 405 of file KVEventSelector.h.
|
inlinevirtual |
This method is called every time a new file in the TChain is opened (for experimental data, each file represents a new 'run')
When analysing experimental or filtered data, this is the first time in the analysis where
gDataAnalyser->GetKinematics(): see KVDataAnalyser::GetKinematics())gMultiDetArray: see Detector Array Geometries in the Users Guide)This is the last place where the user can modify the definition of 'OK' particles (used by the default global variable list: see GetGVList()) when analysing experimental or filtered data:
Reimplemented in KVDataQualityAuditSelector_E789, KVEventFiltering, KVDataQualityAuditSelector, and KVDataQualityAuditSelector_E818.
Definition at line 426 of file KVEventSelector.h.
Definition at line 597 of file KVEventSelector.h.
|
overridevirtual |
Reimplemented from TSelector.
Reimplemented in KVFAZIASelector.
Definition at line 491 of file KVEventSelector.cpp.
Reimplemented from TSelector.
Definition at line 128 of file KVEventSelector.cpp.
|
inlinevirtual |
Definition at line 588 of file KVEventSelector.h.
|
inlinevirtual |
To implement in child classes if user needs to initialize other branches in the analysed TTree/TChain in addition to the one containing the KVEvent objects
Access the analysed TTree/TChain through member variable fChain
Definition at line 616 of file KVEventSelector.h.
Definition at line 340 of file KVEventSelector.h.
Reimplemented in KVINDRAEventSelector, and KVReconEventSelector.
Definition at line 348 of file KVEventSelector.h.
Definition at line 299 of file KVEventSelector.h.
Reimplemented from TSelector.
Definition at line 329 of file KVEventSelector.h.
Call in InitAnalysis() to set the name of the output file containing all histograms and TTrees produced by analysis.
For interactive jobs or jobs using PROOF, filename will be used for the ROOT file.
For jobs using a batch system to execute many jobs in parallel, this will be replaced by the job name plus the '.root' extension.
| filename | name to use for ROOT file |
Definition at line 629 of file KVEventSelector.h.
Reimplemented from TSelector.
Definition at line 325 of file KVEventSelector.h.
Definition at line 593 of file KVEventSelector.h.
|
inline |
Use this method to set further criteria for selecting "OK" particles in each event (in addition to any which may be set by default: see InitRun()).
This method must be called in the user's InitAnalysis() or InitRun() method.
| cond | particle selection criteria (see KVParticleCondition) |
Definition at line 583 of file KVEventSelector.h.
|
inline |
Call this method in your InitRun() method with the current run number in order to automatically reject events which are not consistent with the acquisition trigger
| run | current run number |
Definition at line 643 of file KVEventSelector.h.
Reimplemented from TSelector.
Reimplemented in KVFAZIASelector.
Definition at line 65 of file KVEventSelector.cpp.
|
overridevirtual |
Reimplemented from TSelector.
Definition at line 192 of file KVEventSelector.cpp.
|
overridevirtual |
Reimplemented from TSelector.
Definition at line 219 of file KVEventSelector.cpp.
Definition at line 605 of file KVEventSelector.h.
|
inlineoverridevirtual |
Reimplemented from TSelector.
Definition at line 303 of file KVEventSelector.h.
|
friend |
Definition at line 1 of file KVEventSelector.h.