KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
List of all members | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
KVEventSelector Class Reference

General purpose analysis class for TTree containing KVEvent objects.

Use this TSelector to analyse data in TTrees containing a branch with KVEvent-derived objects:

my_tree->Process("KVEventSelector", "[options]");

where "[options]" is the list of options in the form "BranchName=toto, ...".

The following options MUST be given:

BranchName: name of branch containing the events

The following are optional options:

EventsReadInterval: print info on analysis every N events instead of default value
AuxFiles: list of files containing "friend" TTrees to be made available during analysis. Separate filenames with '|'.
AuxDir: directory in which to find AuxFiles
AuxTreeName: name of tree in AuxFiles containing KVEvent objects
AuxBranchName: name of branch in AuxFiles containing KVEvent objects
#define N
Base class container for multi-particle events.
Definition: KVEvent.h:176

When AuxFiles is used, the user can access the events in these files in her Analysis() method by doing the following:

GetFriendTreeEntry(entry_number);
KVEvent* friend_event = GetFriendEvent();
Int_t GetFriendTreeEntry(Long64_t entry, Int_t getall=0)
KVEvent * GetFriendEvent() const

Any other options can be defined by the user and parsed in her analysis class with methods IsOptGiven() and GetOpt()

Usage

Global Variables

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.

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:

MyAnalysis::SetAnalysisFrame()
{
static TVector3 cmvelocity(0,0,3.0);
GetEvent()->SetFrame("CM", cmvelocity);
}
KVEvent * GetEvent() const
void SetFrame(const Char_t *frame, const KVFrameTransform &ft)
Definition: KVEvent.cpp:762

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.

Use with PROOF(lite)

In order to use a KVEventSelector with PROOF:

void MySelector::InitAnalysis()
{
AddHisto( new TH2F("toto", "tata", 100, 0, 0, 500, 0, 0) );
}
void AddHisto(TH1 *histo)

Histograms can also be declared 'on the fly' in the Analysis() method in the same way;

void MySelector::InitAnalysis()
{
CreateTreeFile("MyTrees.root");
TTree* aTree = new TTree("t1", "Some Tree");
aTree->Branch(...) etc.
AddTree(aTree);
}
Bool_t CreateTreeFile(const Char_t *filename="")
void AddTree(TTree *tree)
virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99)

Histograms & TTrees in the same output file

If you want all results of your analysis to be written in a single file containing both histos and trees, call method SetJobOutputFileName() with the required filename in your InitAnalysis() method;

Generating & saving profiles, divided histograms, etc.

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:

MyEventSelector::EndRun()
{
TProfile* my_profile = ((TH2*)GetHisto("my_histo_2D"))->ProfileX("name_of_my_profile");
GetOutputList()->Add(my_profile);
}
TH1 * GetHisto(const Char_t *name) const
virtual TList * GetOutputList() const
virtual void Add(TObject *obj)
Examples
ExampleFilteredSimDataAnalysis.cpp, and ExampleSimDataAnalysis.cpp.

Definition at line 153 of file KVEventSelector.h.

Public Member Functions

 KVEventSelector (TTree *=0)
 
virtual ~KVEventSelector ()
 
KVVarGlobAddGV (const Char_t *class_name, const Char_t *name)
 
void AddGV (KVVarGlob *vg)
 
template<typename HistoType , typename... Args>
HistoType * AddHisto (Args &&... args)
 
void AddHisto (TH1 *histo)
 
TTreeAddTree (const TString &name, const TString &title="", Int_t splitLevel=99, TDirectory *=gDirectory)
 Add TTree with given name and title to list of TTree to be filled by user's analysis. More...
 
void AddTree (TTree *tree)
 
virtual Bool_t Analysis ()
 
Bool_t AtEndOfRun (void)
 
virtual void Begin (TTree *tree)
 
virtual void CheckEndOfRun ()
 Testing whether EndRun() should be called. More...
 
Bool_t CreateTreeFile (const Char_t *filename="")
 
virtual void EndAnalysis ()
 
virtual void EndRun ()
 
void FillHisto (const Char_t *sname, const Char_t *label, Double_t weight=1)
 Fill 1D histogram with named bins. More...
 
void FillHisto (const Char_t *sname, Double_t one, Double_t two=1, Double_t three=1, Double_t four=1)
 
void FillTree (const Char_t *sname="")
 
const Char_tGetBranchName () const
 
virtual Int_t GetEntry (Long64_t entry, Int_t getall=0)
 
KVEventGetEvent () const
 
Int_t GetEventNumber () const
 
KVEventGetFriendEvent () const
 
Int_t GetFriendTreeEntry (Long64_t entry, Int_t getall=0)
 
KVVarGlobGetGV (const Char_t *name) const
 
KVGVListGetGVList (void)
 
const KVGVListGetGVList (void) const
 
TH1GetHisto (const Char_t *name) const
 
const KVHashListGetHistoList () const
 return the list of created trees More...
 
virtual TString GetOpt (const Char_t *option) const
 
virtual TListGetOutputList () const
 
TTreeGetTree (const Char_t *name) const
 return the tree named tree_name More...
 
const KVHashListGetTreeList () const
 return the list of created trees More...
 
virtual void Init (TTree *tree)
 
virtual void InitAnalysis ()
 
void InitFriendTree (TTree *tree, const TString &branchname)
 
virtual void InitRun ()
 
virtual Bool_t IsOptGiven (const Char_t *option)
 Returns kTRUE if the option 'opt' has been set. More...
 
virtual Bool_t Notify ()
 
virtual void ParseOptions ()
 
virtual Bool_t Process (Long64_t entry)
 
virtual void RecalculateGlobalVariables ()
 
virtual void SaveHistos (const Char_t *filename="", Option_t *option="recreate", Bool_t onlyfilled=kFALSE)
 
virtual void SetAdditionalBranchAddress ()
 
virtual void SetAnalysisFrame ()
 
void SetBranchName (const Char_t *n)
 
virtual void SetCurrentRun (KVDBRun *)
 
void SetEvent (KVEvent *e)
 
void SetEventsReadInterval (Long64_t N)
 
virtual void SetInputList (TList *input)
 
void SetJobOutputFileName (const TString &filename)
 
virtual void SetObject (TObject *obj)
 
virtual void SetOpt (const Char_t *option, const Char_t *value)
 Set a value for an option. More...
 
void SetParticleConditions (const KVParticleCondition &, const KVString &="")
 
void SetParticleConditionsParticleClassName (const KVString &t)
 
void SetTriggerConditionsForRun (int)
 
virtual void SlaveBegin (TTree *tree)
 
virtual void SlaveTerminate ()
 
virtual void Terminate ()
 
virtual void UnsetOpt (const Char_t *opt)
 Removes the option 'opt' from the internal lists, as if it had never been set. More...
 
virtual Int_t Version () const
 
- Public Member Functions inherited from TSelector
 TSelector ()
 
virtual ~TSelector ()
 
virtual void Abort (const char *why, EAbort what=kAbortProcess)
 
virtual EAbort GetAbort () const
 
virtual TListGetInputList () const
 
virtual const char * GetOption () const
 
virtual Long64_t GetStatus () const
 
virtual void ImportOutput (TList *output)
 
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)
 
- 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 TObjectClone (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 TObjectDrawClone (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=0)
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 
virtual TObjectFindObject (const char *name) const
 
virtual TObjectFindObject (const TObject *obj) const
 
virtual Option_tGetDrawOption () 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)
 
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)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (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)
 
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=0, Int_t option=0, Int_t bufsize=0)
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 

Public Attributes

TProofOutputFilemergeFile
 for merging with PROOF More...
 
TFilewriteFile
 
- 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

void add_histo (TH1 *histo)
 
void add_tree (TTree *tree)
 
void FillTH1 (TH1 *h1, Double_t one, Double_t two)
 
void FillTH2 (TH2 *h2, Double_t one, Double_t two, Double_t three)
 
void FillTH3 (TH3 *h3, Double_t one, Double_t two, Double_t three, Double_t four)
 
void FillTProfile (TProfile *h1, Double_t one, Double_t two, Double_t three)
 
void FillTProfile2D (TProfile2D *h2, Double_t one, Double_t two, Double_t three, Double_t four)
 
void SetCombinedOutputFile (const TString &filename)
 
void SetUpAuxEventChain ()
 
- 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

KVEventAuxEvent
 [optional] events in fAuxChain More...
 
TBranchb_Event
 List of branches. More...
 
KVEventEvent
 Declaration of leaf types. More...
 
TTreefAuxChain
 [optional] pointer to another TTree or TChain which may be used during analysis More...
 
KVString fBranchName
 name of branch which contains events to analyse More...
 
TTreefChain
 pointer to the analyzed TTree or TChain More...
 
KVString fCombinedOutputFile
 optional name for single results file with trees and histos More...
 
Bool_t fDisableCreateTreeFile
 used with PROOF More...
 
Long64_t fEventsRead
 number of events read More...
 
Long64_t fEventsReadInterval
 interval at which to print number of events read More...
 
Bool_t fFirstEvent
 set to kFALSE after first event is read More...
 
Bool_t fNotifyCalled
 avoid multiple calls to Notify/InitRun More...
 
KVNameValueList fOptionList
 parsed list of options given to TTree::Process More...
 
KVParticleCondition fPartCond
 (optional) conditions for selecting particles More...
 
KVString fPartName
 (optional) classname for upcasting in KVParticleCondition::Optimize More...
 
Long64_t fTreeEntry
 current tree entry number More...
 
KVGVList gvlist
 List of global variables. More...
 
KVHashListlhisto
 ! More...
 
KVHashListltree
 ! More...
 
- Protected Attributes inherited from TSelector
EAbort fAbort
 
TListfInput
 
TObjectfObject
 
TString fOption
 
TSelectorListfOutput
 
Long64_t fStatus
 
- Protected Attributes inherited from TObject
 kOnlyPrepStep
 

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 TSelectorGetSelector (const char *filename)
 
static Bool_t IsStandardDraw (const char *selec)
 
- Static Public Member Functions inherited from TObject
static Longptr_t GetDtorOnly ()
 
static Bool_t GetObjectStat ()
 
static void SetDtorOnly (void *obj)
 
static void SetObjectStat (Bool_t stat)
 

#include <KVEventSelector.h>

Inheritance diagram for KVEventSelector:
Inheritance graph
[legend]

Constructor & Destructor Documentation

◆ KVEventSelector()

KVEventSelector::KVEventSelector ( TTree = 0)
inline

Definition at line 232 of file KVEventSelector.h.

◆ ~KVEventSelector()

virtual KVEventSelector::~KVEventSelector ( )
inlinevirtual

Definition at line 238 of file KVEventSelector.h.

Member Function Documentation

◆ add_histo()

void KVEventSelector::add_histo ( TH1 histo)
protected

Declare a histogram to be used in analysis. This method must be called when using PROOF.

Definition at line 576 of file KVEventSelector.cpp.

◆ add_tree()

void KVEventSelector::add_tree ( TTree tree)
inlineprotected

Declare a TTree to be used in analysis. This method must be called when using PROOF.

Definition at line 192 of file KVEventSelector.h.

◆ AddGV() [1/2]

KVVarGlob * KVEventSelector::AddGV ( const Char_t class_name,
const Char_t name 
)

Add a global variable to the list of variables for the analysis.

"class_name" must be the name of a valid class inheriting from KVVarGlob, e.g. any of the default global variable classes defined as part of the standard KaliVeda package (see the global variables module), or the name of a user-defined class (see below).

"name" is a unique name for the new global variable object which will be created and added to the internal list of global variables. This name can be used to retrieve the object (see GetGV()) in the user's analysis.

Returns pointer to new global variable object in case more than the usual default initialisation is necessary.

User-defined global variables

The user may use her own global variables in an analysis class, without having to add them to the main libraries. If the given class name is not known, it is assumed to be a user-defined class and we attempt to compile and load the class from the user's source code. For this to work, the user must:

  1. add to the ROOT macro path the directory where her class's source code is kept, e.g. in $HOME/.rootrc add the following line:
+Unix.*.Root.MacroPath: $(HOME)/myVarGlobs
  1. for each user-defined class, add a line to $HOME/.kvrootrc to define a "plugin". E.g. for a class called MyNewVarGlob,
+Plugin.KVVarGlob: MyNewVarGlob MyNewVarGlob MyNewVarGlob.cpp+ "MyNewVarGlob()"

It is assumed that MyNewVarGlob.h and MyNewVarGlob.cpp will be found in $HOME/myVarGlobs (in this example).

Definition at line 442 of file KVEventSelector.cpp.

◆ AddGV() [2/2]

void KVEventSelector::AddGV ( KVVarGlob vg)
inline

Add the global variable "vg" to the list of variables for the analysis. This is equivalent to GetGVList()->Add( vg ).

Definition at line 356 of file KVEventSelector.h.

◆ AddHisto() [1/2]

template<typename HistoType , typename... Args>
HistoType* KVEventSelector::AddHisto ( Args &&...  args)
inline

Add a user histogram to the analysis. The name of the histogram can later be used in calls to FillHisto().

To use, supply a specific histogram type, HistoType, and all necessary arguments for the appropriate constructor. The method returns the address of the newly-created histogram as a pointer of type HistoType*:

// th1 is a pointer to TH1F
auto th1 = AddHisto<TH1F>("h1", "A 1-D histogram", 100, -50., 50.);
// th2 is a pointer to TH2F
auto th2 = AddHisto<TH2F>("h2", "A 2-D histogram", 100, -50., 50., 100, -10., 10.);
auto * th2
auto * th1

Definition at line 395 of file KVEventSelector.h.

◆ AddHisto() [2/2]

void KVEventSelector::AddHisto ( TH1 histo)
inline

Definition at line 387 of file KVEventSelector.h.

◆ AddTree() [1/2]

TTree * KVEventSelector::AddTree ( const TString name,
const TString title = "",
Int_t  splitLevel = 99,
TDirectory dir = gDirectory 
)

Add TTree with given name and title to list of TTree to be filled by user's analysis.

Definition at line 593 of file KVEventSelector.cpp.

◆ AddTree() [2/2]

void KVEventSelector::AddTree ( TTree tree)
inline

Definition at line 415 of file KVEventSelector.h.

◆ Analysis()

virtual Bool_t KVEventSelector::Analysis ( void  )
inlinevirtual

◆ AtEndOfRun()

Bool_t KVEventSelector::AtEndOfRun ( void  )
inline

Check whether the end of run is reached for the current tree

Definition at line 375 of file KVEventSelector.h.

◆ Begin()

void KVEventSelector::Begin ( TTree tree)
virtual

Need to parse options here for use in Terminate Also, on PROOF, any KVDataAnalyser instance has to be passed to the workers via the TSelector input list.

Reimplemented from TSelector.

Definition at line 25 of file KVEventSelector.cpp.

◆ CheckEndOfRun()

void KVEventSelector::CheckEndOfRun ( )
virtual

Testing whether EndRun() should be called.

Reimplemented in KVFAZIASelector.

Definition at line 291 of file KVEventSelector.cpp.

◆ CreateTreeFile()

Bool_t KVEventSelector::CreateTreeFile ( const Char_t filename = "")

For PROOF: This method must be called before creating any user TTree in InitAnalysis(). If no filename is given, default name="TreeFileFrom[name of selector class].root"

Definition at line 165 of file KVEventSelector.cpp.

◆ EndAnalysis()

virtual void KVEventSelector::EndAnalysis ( )
inlinevirtual

◆ EndRun()

virtual void KVEventSelector::EndRun ( )
inlinevirtual

◆ FillHisto() [1/2]

void KVEventSelector::FillHisto ( const Char_t sname,
const Char_t label,
Double_t  weight = 1 
)

Fill 1D histogram with named bins.

Definition at line 644 of file KVEventSelector.cpp.

◆ FillHisto() [2/2]

void KVEventSelector::FillHisto ( const Char_t histo_name,
Double_t  one,
Double_t  two = 1,
Double_t  three = 1,
Double_t  four = 1 
)

Find in the list, if there is an histogram named "sname" If not print an error message If yes redirect to the right method according to its closest mother class to fill it

Definition at line 611 of file KVEventSelector.cpp.

◆ FillTH1()

void KVEventSelector::FillTH1 ( TH1 h1,
Double_t  one,
Double_t  two 
)
protected

Definition at line 662 of file KVEventSelector.cpp.

◆ FillTH2()

void KVEventSelector::FillTH2 ( TH2 h2,
Double_t  one,
Double_t  two,
Double_t  three 
)
protected

Definition at line 686 of file KVEventSelector.cpp.

◆ FillTH3()

void KVEventSelector::FillTH3 ( TH3 h3,
Double_t  one,
Double_t  two,
Double_t  three,
Double_t  four 
)
protected

Definition at line 709 of file KVEventSelector.cpp.

◆ FillTProfile()

void KVEventSelector::FillTProfile ( TProfile h1,
Double_t  one,
Double_t  two,
Double_t  three 
)
protected

Definition at line 674 of file KVEventSelector.cpp.

◆ FillTProfile2D()

void KVEventSelector::FillTProfile2D ( TProfile2D h2,
Double_t  one,
Double_t  two,
Double_t  three,
Double_t  four 
)
protected

Definition at line 698 of file KVEventSelector.cpp.

◆ FillTree()

void KVEventSelector::FillTree ( const Char_t tree_name = "")

Filltree method, the tree named tree_name has to be declared with AddTTree(TTree*) method

if no sname="", all trees in the list is filled

Definition at line 863 of file KVEventSelector.cpp.

◆ GetBranchName()

const Char_t* KVEventSelector::GetBranchName ( ) const
inline

Definition at line 293 of file KVEventSelector.h.

◆ GetEntry()

virtual Int_t KVEventSelector::GetEntry ( Long64_t  entry,
Int_t  getall = 0 
)
inlinevirtual

Reimplemented from TSelector.

Reimplemented in KVFAZIASelector.

Definition at line 262 of file KVEventSelector.h.

◆ GetEvent()

KVEvent* KVEventSelector::GetEvent ( ) const
inline
Examples
ExampleFilteredSimDataAnalysis.cpp.

Definition at line 307 of file KVEventSelector.h.

◆ GetEventNumber()

Int_t KVEventSelector::GetEventNumber ( ) const
inline

Definition at line 315 of file KVEventSelector.h.

◆ GetFriendEvent()

KVEvent* KVEventSelector::GetFriendEvent ( ) const
inline

Definition at line 270 of file KVEventSelector.h.

◆ GetFriendTreeEntry()

Int_t KVEventSelector::GetFriendTreeEntry ( Long64_t  entry,
Int_t  getall = 0 
)
inline

Definition at line 266 of file KVEventSelector.h.

◆ GetGV()

KVVarGlob* KVEventSelector::GetGV ( const Char_t name) const
inline

Access the global variable with name "name" in the list of variables for the analysis. This is equivalent to GetGVList()->GetGV( name ).

Definition at line 366 of file KVEventSelector.h.

◆ GetGVList() [1/2]

KVGVList* KVEventSelector::GetGVList ( void  )
inline

Access to the internal list of global variables

Definition at line 346 of file KVEventSelector.h.

◆ GetGVList() [2/2]

const KVGVList* KVEventSelector::GetGVList ( void  ) const
inline

Access to the internal list of global variables

Definition at line 351 of file KVEventSelector.h.

◆ GetHisto()

TH1 * KVEventSelector::GetHisto ( const Char_t name) const

Definition at line 562 of file KVEventSelector.cpp.

◆ GetHistoList()

const KVHashList * KVEventSelector::GetHistoList ( ) const

return the list of created trees

Definition at line 549 of file KVEventSelector.cpp.

◆ GetOpt()

TString KVEventSelector::GetOpt ( const Char_t opt) const
virtual

Returns the value of the option

Only use after checking existence of option with IsOptGiven(const Char_t* opt)

Definition at line 918 of file KVEventSelector.cpp.

◆ GetOutputList()

virtual TList* KVEventSelector::GetOutputList ( ) const
inlinevirtual

Reimplemented from TSelector.

Definition at line 282 of file KVEventSelector.h.

◆ GetTree()

TTree * KVEventSelector::GetTree ( const Char_t name) const

return the tree named tree_name

Definition at line 845 of file KVEventSelector.cpp.

◆ GetTreeList()

const KVHashList * KVEventSelector::GetTreeList ( ) const

return the list of created trees

Definition at line 832 of file KVEventSelector.cpp.

◆ Init()

void KVEventSelector::Init ( TTree tree)
virtual

The Init() function is called when the selector needs to initialize a new tree or chain. Typically here the branch addresses and branch pointers of the tree will be set. It is normally not necessary to make changes to the generated code, but the routine can be extended by the user if needed. Init() will be called many times when running on PROOF (once per file to be processed). Set object pointer

Reimplemented from TSelector.

Reimplemented in KVReconEventSelector, KVINDRAEventSelector, and KVFAZIASelector.

Definition at line 1018 of file KVEventSelector.cpp.

◆ InitAnalysis()

virtual void KVEventSelector::InitAnalysis ( )
inlinevirtual

◆ InitFriendTree()

void KVEventSelector::InitFriendTree ( TTree tree,
const TString branchname 
)

Set up a "friend" TTree/TChain containing KVEvent-derived objects in branch 'branchname' N.B. this is not a "friend" in the sense of TTree::AddFriend, the main TTree and the "friend" TTree can have different numbers of entries

After calling this method at the beginning of the analysis, you can access any of the events stored in the "friend" by doing:

GetFriendTreeEntry(entry_number);
KVEvent* friend_event = GetFriendEvent();

Definition at line 1064 of file KVEventSelector.cpp.

◆ InitRun()

virtual void KVEventSelector::InitRun ( )
inlinevirtual

◆ IsOptGiven()

Bool_t KVEventSelector::IsOptGiven ( const Char_t option)
virtual

Returns kTRUE if the option 'opt' has been set.

Definition at line 903 of file KVEventSelector.cpp.

◆ Notify()

Bool_t KVEventSelector::Notify ( )
virtual

The Notify() function is called when a new file is opened. This can be either for a new TTree in a TChain or when when a new TTree is started when using PROOF. It is normally not necessary to make changes to the generated code, but the routine can be extended by the user if needed. The return value is currently not used.

Reimplemented from TSelector.

Reimplemented in KVFAZIASelector.

Definition at line 1095 of file KVEventSelector.cpp.

◆ ParseOptions()

void KVEventSelector::ParseOptions ( )
virtual

Analyse comma-separated list of options given to TTree::Process and store all "option=value" pairs in fOptionList. Options can then be accessed using IsOptGiven(), GetOptString(), etc.

BranchName=xxxx : change name of branch in TTree containing data
EventsReadInterval=N: print "+++ 12345 events processed +++" every N events

This method is called by SlaveBegin

Reimplemented in KVFAZIASelector.

Definition at line 968 of file KVEventSelector.cpp.

◆ Process()

Bool_t KVEventSelector::Process ( Long64_t  entry)
virtual

The Process() function is called for each entry in the tree (or possibly keyed object in the case of PROOF) to be processed. The entry argument specifies which entry in the currently loaded tree is to be processed. It can be passed to either KVEventSelector::GetEntry() or TBranch::GetEntry() to read either all or the required parts of the data. When processing keyed objects with PROOF, the object is already loaded and is available via the fObject pointer.

This function should contain the "body" of the analysis. It can contain simple or elaborate selection criteria, run algorithms on the data of the event and typically fill histograms.

Processing will abort cleanly if static flag fCleanAbort has been set by some external controlling process.

Use fStatus to set the return value of TTree::Process().

The return value is currently not used.

Reimplemented from TSelector.

Definition at line 218 of file KVEventSelector.cpp.

◆ RecalculateGlobalVariables()

void KVEventSelector::RecalculateGlobalVariables ( )
virtual

Use this method if you change e.g. the particle selection criteria in your Analysis() method and want to recalculate the values of all global variables for your new selection.

WARNING: the global variables are calculated automatically for you for each event before method Analysis() is called. In order for the correct particles to be included in this calculation, make sure that at the END of Analysis() you reset the selection criteria.

Definition at line 492 of file KVEventSelector.cpp.

◆ SaveHistos()

void KVEventSelector::SaveHistos ( const Char_t filename = "",
Option_t option = "recreate",
Bool_t  onlyfilled = kFALSE 
)
virtual

Write in file all histograms declared with AddHisto(TH1*) This method works with PROOF.

If no filename is specified, set default name : HistoFileFrom[KVEvenSelector::GetName()].root

If a filename is specified, search in gROOT->GetListOfFiles() if this file has been already opened

  • if yes write in it
  • if not, create it with the corresponding option, write in it and close it just after

onlyfilled flag allow to write all (onlyfilled=kFALSE, default) or only histograms (onlyfilled=kTRUE) those have been filled

Definition at line 772 of file KVEventSelector.cpp.

◆ SetAdditionalBranchAddress()

virtual void KVEventSelector::SetAdditionalBranchAddress ( )
inlinevirtual

if user wants to read additional branches of the tree

Definition at line 440 of file KVEventSelector.h.

◆ SetAnalysisFrame()

virtual void KVEventSelector::SetAnalysisFrame ( )
inlinevirtual

If this analysis class is used in a context where the events correspond to a known reaction for which the kinematics have been defined, we can define the centre of mass ("CM") frame for the particles in the event.

Examples
ExampleFilteredSimDataAnalysis.cpp.

Definition at line 297 of file KVEventSelector.h.

◆ SetBranchName()

void KVEventSelector::SetBranchName ( const Char_t n)
inline

Definition at line 289 of file KVEventSelector.h.

◆ SetCombinedOutputFile()

void KVEventSelector::SetCombinedOutputFile ( const TString filename)
inlineprotected

Call in InitAnalysis() to set the name of the single output file containing all histograms and TTrees produced by analysis (but see also SetJobOutputFileName).

This is equivalent to running the analysis with option

CombinedOutputFile=[filename]

but setting this option in InitAnalysis() will not work.

Note that if this method is not called/the option is not given, histograms and TTrees will be written in separate files.

Definition at line 207 of file KVEventSelector.h.

◆ SetCurrentRun()

virtual void KVEventSelector::SetCurrentRun ( KVDBRun )
inlinevirtual

Reimplemented in KVReconEventSelector, and KVINDRAEventSelector.

Definition at line 305 of file KVEventSelector.h.

◆ SetEvent()

void KVEventSelector::SetEvent ( KVEvent e)
inline

Definition at line 311 of file KVEventSelector.h.

◆ SetEventsReadInterval()

void KVEventSelector::SetEventsReadInterval ( Long64_t  N)
inline

Definition at line 247 of file KVEventSelector.h.

◆ SetInputList()

virtual void KVEventSelector::SetInputList ( TList input)
inlinevirtual

Reimplemented from TSelector.

Definition at line 278 of file KVEventSelector.h.

◆ SetJobOutputFileName()

void KVEventSelector::SetJobOutputFileName ( const TString filename)
inline

Call in InitAnalysis() to set the name of the single output file containing all histograms and TTrees produced by analysis.

For interactive jobs or jos using PROOF, filename will be used for the ROOT file. For jobs using a batch system to execute many jobs in parallel, we use the job name with the '.root' extension.

Definition at line 446 of file KVEventSelector.h.

◆ SetObject()

virtual void KVEventSelector::SetObject ( TObject obj)
inlinevirtual

Reimplemented from TSelector.

Definition at line 274 of file KVEventSelector.h.

◆ SetOpt()

void KVEventSelector::SetOpt ( const Char_t option,
const Char_t value 
)
virtual

Set a value for an option.

Definition at line 890 of file KVEventSelector.cpp.

◆ SetParticleConditions()

void KVEventSelector::SetParticleConditions ( const KVParticleCondition cond,
const KVString upcast_class = "" 
)

Use this method to set criteria for selecting particles to include in analysis. The criteria defined in the KVParticleCondition object will be applied to every particle and if they are not satisfied the particle's "OK" flag will be set to false, i.e. the particle's IsOK() method will return kFALSE, and the particle will not be included in iterations such as GetEvent()->GetNextParticle("OK"). Neither will the particle be included in the evaluation of any global variables.

This method must be called in the user's InitAnalysis() or InitRun() method.

If the methods used in the condition are not defined for KVNucleus, you can give the name of the class to which the methods refer (upcast_class), or you can set it before hand (SetParticleConditionsParticleClassName)

Definition at line 523 of file KVEventSelector.cpp.

◆ SetParticleConditionsParticleClassName()

void KVEventSelector::SetParticleConditionsParticleClassName ( const KVString t)
inline

Definition at line 382 of file KVEventSelector.h.

◆ SetTriggerConditionsForRun()

void KVEventSelector::SetTriggerConditionsForRun ( int  run)

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.

Definition at line 946 of file KVEventSelector.cpp.

◆ SetUpAuxEventChain()

void KVEventSelector::SetUpAuxEventChain ( )
protected

Called by SlaveBegin() when user gives the following options:

AuxFiles: list of files containing "friend" TTrees to be made available during analysis
AuxDir: directory in which to find AuxFiles
AuxTreeName: name of tree in AuxFiles containing KVEvent objects
AuxBranchName: name of branch in AuxFiles containing KVEvent objects

Definition at line 727 of file KVEventSelector.cpp.

◆ SlaveBegin()

void KVEventSelector::SlaveBegin ( TTree tree)
virtual

The SlaveBegin() function is called after the Begin() function. When running with PROOF SlaveBegin() is called on each slave server. The tree argument is deprecated (on PROOF 0 is passed).

ParseOptions : Manage options passed as arguments

Called user method InitAnalysis where users can create trees or histos using the appropiate methods : CreateTrees and CreateMethods

Test the presence or not of such histo or tree to manage it properly

Reimplemented from TSelector.

Reimplemented in KVFAZIASelector.

Definition at line 79 of file KVEventSelector.cpp.

◆ SlaveTerminate()

void KVEventSelector::SlaveTerminate ( )
virtual

The SlaveTerminate() function is called after all entries or objects have been processed. When running with PROOF SlaveTerminate() is called on each slave server. if tree have been defined in the CreateTrees method manage the merge of them in ProofLite session

Reimplemented from TSelector.

Definition at line 314 of file KVEventSelector.cpp.

◆ Terminate()

void KVEventSelector::Terminate ( )
virtual

The Terminate() function is the last function to be called during a query. It always runs on the client, it can be used to present the results graphically or save the results to file.

This method call the user defined EndAnalysis where user can do what she wants

Reimplemented from TSelector.

Definition at line 361 of file KVEventSelector.cpp.

◆ UnsetOpt()

void KVEventSelector::UnsetOpt ( const Char_t opt)
virtual

Removes the option 'opt' from the internal lists, as if it had never been set.

Definition at line 933 of file KVEventSelector.cpp.

◆ Version()

virtual Int_t KVEventSelector::Version ( ) const
inlinevirtual

Reimplemented from TSelector.

Definition at line 251 of file KVEventSelector.h.

Member Data Documentation

◆ AuxEvent

KVEvent* KVEventSelector::AuxEvent
protected

[optional] events in fAuxChain

Definition at line 161 of file KVEventSelector.h.

◆ b_Event

TBranch* KVEventSelector::b_Event
protected

List of branches.

Definition at line 164 of file KVEventSelector.h.

◆ Event

KVEvent* KVEventSelector::Event
protected

Declaration of leaf types.

the events to be analysed

Definition at line 160 of file KVEventSelector.h.

◆ fAuxChain

TTree* KVEventSelector::fAuxChain
protected

[optional] pointer to another TTree or TChain which may be used during analysis

Definition at line 157 of file KVEventSelector.h.

◆ fBranchName

KVString KVEventSelector::fBranchName
protected

name of branch which contains events to analyse

Definition at line 169 of file KVEventSelector.h.

◆ fChain

TTree* KVEventSelector::fChain
protected

pointer to the analyzed TTree or TChain

Definition at line 156 of file KVEventSelector.h.

◆ fCombinedOutputFile

KVString KVEventSelector::fCombinedOutputFile
protected

optional name for single results file with trees and histos

Definition at line 184 of file KVEventSelector.h.

◆ fDisableCreateTreeFile

Bool_t KVEventSelector::fDisableCreateTreeFile
protected

used with PROOF

Definition at line 189 of file KVEventSelector.h.

◆ fEventsRead

Long64_t KVEventSelector::fEventsRead
protected

number of events read

Definition at line 176 of file KVEventSelector.h.

◆ fEventsReadInterval

Long64_t KVEventSelector::fEventsReadInterval
protected

interval at which to print number of events read

Definition at line 177 of file KVEventSelector.h.

◆ fFirstEvent

Bool_t KVEventSelector::fFirstEvent
protected

set to kFALSE after first event is read

Definition at line 174 of file KVEventSelector.h.

◆ fNotifyCalled

Bool_t KVEventSelector::fNotifyCalled
protected

avoid multiple calls to Notify/InitRun

Definition at line 183 of file KVEventSelector.h.

◆ fOptionList

KVNameValueList KVEventSelector::fOptionList
protected

parsed list of options given to TTree::Process

Definition at line 187 of file KVEventSelector.h.

◆ fPartCond

KVParticleCondition KVEventSelector::fPartCond
protected

(optional) conditions for selecting particles

Definition at line 171 of file KVEventSelector.h.

◆ fPartName

KVString KVEventSelector::fPartName
protected

(optional) classname for upcasting in KVParticleCondition::Optimize

Definition at line 172 of file KVEventSelector.h.

◆ fTreeEntry

Long64_t KVEventSelector::fTreeEntry
protected

current tree entry number

Definition at line 178 of file KVEventSelector.h.

◆ gvlist

KVGVList KVEventSelector::gvlist
protected

List of global variables.

Definition at line 167 of file KVEventSelector.h.

◆ lhisto

KVHashList* KVEventSelector::lhisto
protected

!

Definition at line 180 of file KVEventSelector.h.

◆ ltree

KVHashList* KVEventSelector::ltree
protected

!

Definition at line 181 of file KVEventSelector.h.

◆ mergeFile

TProofOutputFile* KVEventSelector::mergeFile

for merging with PROOF

Definition at line 227 of file KVEventSelector.h.

◆ writeFile

TFile* KVEventSelector::writeFile

Definition at line 226 of file KVEventSelector.h.


The documentation for this class was generated from the following files: