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

Manage a list of global variables.

The KVGVList class handles a list of global variables. A list can be used in the following schematic way to calculate several global variables at once:

Creation & initialisation

KVVGList VGlist;
VGlist.Add( new SomeVarGlob("var1") ); // add variable using explicit call to constructor
VGlist.AddGV("SomeOtherVarGlob", "var2"); // add variable using class name
...
VGlist.Init(); // initialise all variables

Treatment of 1 event

VGlist.CalculateGlobalVariables( [event] ); // calculate contribution of each particle to each variable
if( !VGlist.AbortEventAnalysis() ) // in case cuts for event selection were set - see below
{
auto valueOfvar1 = VGlist.GetGV("var1")->GetValue(); // retrieve value of "var1" for event
}

Automatic TTree branch creation and filling

One or more branches can be added to a TTree and filled with the values of all or some of the global variables in the list using method MakeBranches(TTree*). For each single-valued variable a branch with name

[varName]

will be added. For multi-valued variables (those for which KVVarGlob::GetNumberOfValues() returns >1) we add

[varName].[value0_name]
[varName].[value1_name]
...
[varName].[valueN_name]

branches for each named value defined for the variable (see KVFlowTensor for an example of a multi-valued variable). The total number of branches added is determined by KVVarGlob::SetMaxNumBranches(): calling this method with argument 0 will prevent any branch being added for the variable in question.

Once variables have been calculated, calling FillBranches() will prepare the TTree for filling. Note that you have to call TTree::Fill() after calling this method.

Event selection criteria

Conditions ('cuts') can be set on each variable which decide whether or not to retain an event for analysis. If any variable in the list fails the test, processing of the list is abandoned.

Selection criteria are set using lambda expressions. In this example, the variable "mtot" must have a value of at least 4 for the event to be retained:

KVGVList vglist;
auto mtot = vglist.AddGV("KVMult","mtot");
mtot->SetEventSelection([](const KVVarGlob* v){ return v->GetValue()>=4; });
Manage a list of global variables.
Definition: KVGVList.h:121
KVVarGlob * AddGV(const Char_t *class_name, const Char_t *name)
Definition: KVGVList.cpp:615
Base class for all global variable implementations.
Definition: KVVarGlob.h:217
void SetEventSelection(const EventSelector &f)
Definition: KVVarGlob.h:656
v

Any event selection criterion is tested as soon as each variable has been calculated. If the test fails, no further variables are calculated and the KVGVList goes into 'abort event' mode:

KVEvent* event_to_analyse;
vglist.CalculateGlobalVariables( event_to_analyse );
if( !vglist.AbortEventAnalysis() )
{
... do further analysis, mtot is >=4
}
Base class container for multi-particle events.
Definition: KVEvent.h:176
void CalculateGlobalVariables(KVEvent *e)
Definition: KVGVList.cpp:189
bool AbortEventAnalysis() const
Definition: KVGVList.h:199

Definition of new kinematical frames

One or more variables in the list can be used to define new kinematical frames which can in turn be used by any variables which occur after them in the list. In order to do so, call method SetNewFrameDefinition() for the variable(s) in question with a lambda function having the following signature:

[](KVEvent* e, const KVVarGlob* vg){ e->SetFrame("_frame_name_", ...); }
#define e(i)

When called (e.g. by KVGVList), the KVVarGlob pointer gives access to the global variable.

As an example of use, imagine that KVZmax is used to find the heaviest (largest Z) fragment in the forward CM hemisphere, then the velocity of this fragment is used to define a "QP_FRAME" in order to calculate the KVFlowTensor in this frame:

KVGVList vglist;
auto vg = vglist.AddGV("KVZmax", "zmax");
vg->SetFrame("CM");
vg->SetSelection( {"V>0", [](const KVNucleus* n){ return n->GetVpar()>0; }} );
vg->SetNewFrameDefinition(
[](KVEvent* e, const KVVarGlob* v){
e->SetFrame("QP_FRAME", static_cast<const KVZmax*>(v)->GetZmax(0)->GetVelocity());
});
vg = AddGV("KVFlowTensor", "qp_tensor");
vg->SetFrame("QP_FRAME"); // frame will have been defined before tensor is filled
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:125
void SetFrame(const Char_t *ref)
Definition: KVVarGlob.h:474
Global variable used to sort particles in order of decreasing atomic number
Definition: KVZmax.h:33
const Int_t n

Event classification

Event classifier (KVEventClassifier) objects can be defined for any global variable in the list using method AddEventClassifier():

AddGV("KVMult", "mtot");
auto mt_cuts = AddEventClassifier("mtot");
KVEventClassifier * AddEventClassifier(const TString &varname)
Definition: KVGVList.cpp:526

which returns a pointer to the event classifier, in order to set up either cuts or bins.

mtot_EC is the default name for an event classification based on mtot and will be used for the branch added to the user's analysis TTree by method MakeBranches().

Examples
globvars_kvzmax.C.

Definition at line 121 of file KVGVList.h.

Public Member Functions

 KVGVList (const KVGVList &a)
 
 KVGVList (void)
 
virtual ~ KVGVList (void)
 
bool AbortEventAnalysis () const
 
virtual void Add (TObject *obj)
 
KVEventClassifierAddEventClassifier (const TString &varname)
 
virtual void AddFirst (TObject *obj)
 
KVVarGlobAddGV (const Char_t *class_name, const Char_t *name)
 
KVVarGlobAddGVFirst (const Char_t *class_name, const Char_t *name)
 
void CalculateGlobalVariables (KVEvent *e)
 
void FillBranches ()
 
KVVarGlobGetGV (const Char_t *nom) const
 Return pointer to global variable in list with name 'nom'. More...
 
KVVarGlobGetGVType (const Char_t *class_name)
 Returns first global variable in list with given class. More...
 
Bool_t Has1BodyVariables ()
 returns kTRUE if list contains 1-body variables More...
 
Bool_t Has2BodyVariables ()
 returns kTRUE if list contains 2-body variables More...
 
Bool_t HasNBodyVariables ()
 returns kTRUE if list contains N-body variables More...
 
void Init (void)
 
void MakeBranches (TTree *)
 
void Reset (void)
 Reset all variables before treating an event. More...
 
- Public Member Functions inherited from KVUniqueNameList
 KVUniqueNameList (Bool_t R=kFALSE)
 Default constructor. More...
 
virtual ~KVUniqueNameList ()
 Destructor. More...
 
virtual void AddAfter (const TObject *after, TObject *obj)
 
virtual void AddAt (TObject *obj, Int_t idx)
 
virtual void AddBefore (const TObject *before, TObject *obj)
 
virtual void AddLast (TObject *obj)
 
Bool_t ObjectAdded () const
 
void ReplaceObjects (Bool_t yes=kTRUE)
 
- Public Member Functions inherited from KVHashList
 KVHashList (Int_t capacity=TCollection::kInitHashTableCapacity, Int_t rehash=2)
 
virtual ~KVHashList ()
 Destructor. More...
 
Float_t AverageCollisions () const
 
template<typename T >
Bool_t ContainsObjectWithName (const T &o)
 
const TListGetListForObject (const char *name) const
 
const TListGetListForObject (const TObject *obj) const
 
void Rehash (Int_t newCapacity=0)
 
void Sort (Bool_t order=kSortAscending)
 
- Public Member Functions inherited from KVSeqCollection
 KVSeqCollection ()
 Default constructor. More...
 
 KVSeqCollection (const Char_t *collection_classname)
 
 KVSeqCollection (const KVSeqCollection &)
 
virtual ~KVSeqCollection ()
 
virtual TObjectAfter (const TObject *obj) const
 
virtual TObjectAt (Int_t idx) const
 
virtual TObjectBefore (const TObject *obj) const
 
virtual void Clear (Option_t *option="")
 
const Char_tCollectionClassName () const
 
virtual void Copy (TObject &obj) const
 
virtual void Delete (Option_t *option="")
 
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 TObjectFindObject (const char *name) const
 
virtual TObjectFindObject (const TObject *obj) const
 
virtual TObjectFindObjectAny (const Char_t *att, const Char_t *keys, Bool_t contains_all=kFALSE, Bool_t case_sensitive=kTRUE) const
 
TObjectFindObjectByClass (const Char_t *) const
 Return (first) object in embedded list with given class. More...
 
TObjectFindObjectByClass (const TClass *) const
 Return (first) object in embedded list with given class. More...
 
virtual TObjectFindObjectByLabel (const Char_t *) const
 
virtual TObjectFindObjectByName (const Char_t *name) const
 
virtual TObjectFindObjectByNumber (UInt_t num) const
 
virtual TObjectFindObjectByTitle (const Char_t *) const
 Will return object with given title (value of TObject::GetTitle() method). More...
 
virtual TObjectFindObjectByType (const Char_t *) const
 
virtual TObjectFindObjectWithMethod (const Char_t *retvalue, const Char_t *method) const
 
virtual TObjectFindObjectWithNameAndType (const Char_t *name, const Char_t *type) const
 
virtual TObjectFirst () const
 
template<typename T >
Tget_object (const char *name) const
 
TSeqCollectionGetCollection () const
 
virtual TObject ** GetObjectRef (const TObject *obj) const
 Return reference to object. More...
 
virtual Int_t GetSize () const
 
KVSeqCollectionGetSubListWithClass (const Char_t *class_name) const
 
KVSeqCollectionGetSubListWithClass (const TClass *_class) const
 
KVSeqCollectionGetSubListWithLabel (const Char_t *retvalue) const
 
KVSeqCollectionGetSubListWithMethod (const Char_t *retvalue, const Char_t *method) const
 
KVSeqCollectionGetSubListWithName (const Char_t *retvalue) const
 
KVSeqCollectionGetSubListWithType (const Char_t *retvalue) const
 
virtual Bool_t IsCleanup () const
 
virtual Bool_t IsSendingModifiedSignals () const
 
virtual Bool_t IsSortable () const
 
virtual Bool_t IsSorted () const
 
virtual TObjectLast () const
 
virtual TIteratorMakeIterator (Bool_t dir=kIterForward) const
 Make and return iterator for the list. More...
 
virtual void Modified ()
 
KVSeqCollectionoperator= (const KVSeqCollection &)
 
virtual void RecursiveRemove (TObject *obj)
 
virtual TObjectRemove (TObject *obj)
 Remove object from list. More...
 
virtual void SendModifiedSignals (Bool_t yes=kTRUE)
 
virtual void SetCleanup (Bool_t enable=kTRUE)
 
virtual void SetOwner (Bool_t enable=kTRUE)
 
- Public Member Functions inherited from TSeqCollection
virtual ~TSeqCollection ()
 
virtual Int_t GetLast () const
 
virtual Int_t IndexOf (const TObject *obj) const
 
Int_t LastIndex () const
 
Long64_t Merge (TCollection *list)
 
virtual void RemoveAfter (TObject *after)
 
virtual TObjectRemoveAt (Int_t idx)
 
virtual void RemoveBefore (TObject *before)
 
virtual void RemoveFirst ()
 
virtual void RemoveLast ()
 
void UnSort ()
 
- Public Member Functions inherited from TCollection
virtual ~TCollection ()
 
virtual void AddAll (const TCollection *col)
 
void AddVector (TObject *obj1,...)
 
Bool_t AssertClass (TClass *cl) const
 
TIter begin () const
 
void Browse (TBrowser *b)
 
Int_t Capacity () const
 
virtual TObjectClone (const char *newname="") const
 
Int_t Compare (const TObject *obj) const
 
Bool_t Contains (const char *name) const
 
Bool_t Contains (const TObject *obj) const
 
virtual void Draw (Option_t *option="")
 
virtual void Dump () const
 
TIter end () const
 
virtual Int_t GetEntries () const
 
virtual const char * GetName () const
 
virtual Int_t GrowBy (Int_t delta) const
 
ULong_t Hash () const
 
Bool_t IsArgNull (const char *where, const TObject *obj) const
 
virtual Bool_t IsEmpty () const
 
virtual Bool_t IsFolder () const
 
Bool_t IsOwner () const
 
R__ALWAYS_INLINE Bool_t IsUsingRWLock () const
 
virtual void ls (Option_t *option="") const
 
virtual TIteratorMakeReverseIterator () const
 
virtual Bool_t Notify ()
 
TObjectoperator() (const char *name) const
 
virtual void Paint (Option_t *option="")
 
virtual void Print (Option_t *option, const char *wildcard, Int_t recurse=1) const
 
virtual void Print (Option_t *option, Int_t recurse) const
 
virtual void Print (Option_t *option, TPRegexp &regexp, Int_t recurse=1) const
 
virtual void Print (Option_t *option="") const
 
void RemoveAll ()
 
virtual void RemoveAll (TCollection *col)
 
void SetCurrentCollection ()
 
void SetName (const char *name)
 
virtual bool UseRWLock ()
 
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 Member Functions inherited from TObject
 TObject ()
 
 TObject (const TObject &object)
 
virtual ~TObject ()
 
void AbstractMethod (const char *method) const
 
virtual void AppendPad (Option_t *option="")
 
ULong_t CheckedHash ()
 
virtual const char * ClassName () const
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 
virtual void DrawClass () const
 
virtual TObjectDrawClone (Option_t *option="") const
 
virtual void Error (const char *method, const char *msgfmt,...) const
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 
virtual Option_tGetDrawOption () const
 
virtual const char * GetIconName () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 
virtual UInt_t GetUniqueID () const
 
virtual Bool_t HandleTimer (TTimer *timer)
 
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
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
R__ALWAYS_INLINE Bool_t IsZombie () 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 Pop ()
 
virtual Int_t Read (const char *name)
 
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
 

Protected Member Functions

void Calculate ()
 Calculate all 1-body observables after filling. More...
 
void Calculate2 ()
 Calculate all 2-body observables after filling. More...
 
void CalculateN ()
 Calculate all N-body observables after filling. More...
 
void Fill (const KVNucleus *c)
 
void Fill2 (const KVNucleus *c1, const KVNucleus *c2)
 
void FillN (const KVEvent *e)
 Calls KVVarGlob::FillN(KVEvent*) method of all N-body variables in the list. More...
 
void init_KVGVList (void)
 
- Protected Member Functions inherited from KVSeqCollection
void _GetSubListWithClass (KVSeqCollection *, TCollection *, const TClass *) const
 
virtual void _GetSubListWithMethod (KVSeqCollection *, TCollection *, const Char_t *, const Char_t *) const
 
virtual void Changed ()
 
virtual KVSeqCollectionNewCollectionLikeThisOne () const
 
virtual void PrintCollectionHeader (Option_t *option) const
 Overrides TCollection::PrintCollectionHeader to show the class name of the embedded list. More...
 
virtual void SetCollection (const Char_t *)
 
- Protected Member Functions inherited from TSeqCollection
 TSeqCollection ()
 
- Protected Member Functions inherited from TCollection
 TCollection ()
 
virtual const char * GetCollectionEntryName (TObject *entry) const
 
virtual void PrintCollectionEntry (TObject *entry, Option_t *option, Int_t recurse) const
 
- 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

TList fVG1
 one-body variables More...
 
TList fVG2
 two-body variables More...
 
TList fVGN
 N-body variables. More...
 
- Protected Attributes inherited from KVSeqCollection
TSeqCollectionfCollection
 Pointer to embedded ROOT collection. More...
 
- Protected Attributes inherited from TSeqCollection
Bool_t fSorted
 
- Protected Attributes inherited from TCollection
TString fName
 
Int_t fSize
 
 kIsOwner
 
 kUseRWLock
 
- Protected Attributes inherited from TObject
 kOnlyPrepStep
 

Private Member Functions

TString NameSanitizer (const Char_t *s) const
 
KVVarGlobprepareGVforAdding (const Char_t *class_name, const Char_t *name)
 

Private Attributes

bool fAbortEventAnalysis
 set to false if a global variable fails its own event selection criterion More...
 
std::vector< Double_tfBranchVar
 used for automatic creation & filling of TTree branches More...
 
std::vector< Int_tfIBranchVar
 used for automatic creation & filling of TTree branches More...
 
Int_t fNbBranch
 
Int_t fNbIBranch
 

Additional Inherited Members

- Public Types inherited from TObject
enum  EDeprecatedStatusBits
 
enum  EStatusBits
 
- Static Public Member Functions inherited from KVSeqCollection
static KVSeqCollectionMakeListFromFile (TFile *file)
 
static KVSeqCollectionMakeListFromFileWithClass (TFile *file, const Char_t *class_name)
 
static KVSeqCollectionMakeListFromFileWithClass (TFile *file, const TClass *_class)
 
static KVSeqCollectionMakeListFromFileWithMethod (TFile *file, const Char_t *retvalue, const Char_t *method)
 
static void RehashCleanupList ()
 
- Static Public Member Functions inherited from TSeqCollection
static Int_t ObjCompare (TObject *a, TObject *b)
 
static void QSort (TObject **a, Int_t first, Int_t last)
 
static void QSort (TObject **a, Int_t nBs, TObject ***b, Int_t first, Int_t last)
 
static void QSort (TObject **a, TObject **b, Int_t first, Int_t last)
 
- Static Public Member Functions inherited from TCollection
static void EmptyGarbageCollection ()
 
static void GarbageCollect (TObject *obj)
 
static TCollectionGetCurrentCollection ()
 
static void StartGarbageCollection ()
 
- 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)
 
- Public Attributes inherited from TCollection
 kInitCapacity
 
 kInitHashTableCapacity
 
- Public Attributes inherited from TObject
 kBitMask
 
 kCanDelete
 
 kCannotPick
 
 kHasUUID
 
 kInconsistent
 
 kInvalidObject
 
 kIsOnHeap
 
 kIsReferenced
 
 kMustCleanup
 
 kNoContextMenu
 
 kNotDeleted
 
 kObjInCanvas
 
 kOverwrite
 
 kSingleKey
 
 kWriteDelete
 
 kZombie
 
- Protected Types inherited from TCollection
enum  EStatusBits
 

#include <KVGVList.h>

Inheritance diagram for KVGVList:
Inheritance graph
[legend]

Constructor & Destructor Documentation

◆ KVGVList() [1/2]

KVGVList::KVGVList ( void  )

Definition at line 26 of file KVGVList.cpp.

◆ KVGVList() [2/2]

KVGVList::KVGVList ( const KVGVList a)

Definition at line 36 of file KVGVList.cpp.

◆ ~ KVGVList()

virtual KVGVList::~ KVGVList ( void  )
inlinevirtual

Definition at line 158 of file KVGVList.h.

Member Function Documentation

◆ AbortEventAnalysis()

bool KVGVList::AbortEventAnalysis ( ) const
inline

Definition at line 199 of file KVGVList.h.

◆ Add()

void KVGVList::Add ( TObject obj)
virtual

Overrides KVUniqueNameList::Add(TObject*) so that global variable pointers are sorted between the 3 lists used for 1-body, 2-body & N-body variables.

We also print a warning in case the user tries to add a global variable with the same name as one already in the list. In the case we retain only the first global variable, any others with the same name are ignored

Reimplemented from KVUniqueNameList.

Examples
globvars_kvzmax.C.

Definition at line 254 of file KVGVList.cpp.

◆ AddEventClassifier()

KVEventClassifier * KVGVList::AddEventClassifier ( const TString varname)

Add an event classification object to the list, based on the named global variable (which must already be in the list).

Returns a pointer to the object, in order to add either cuts or bins like so:

Using cuts

mtot_cuts->AddCut(5);
mtot_cuts->AddCut(10);
mtot_cuts->AddCut(15);
mtot_cuts->AddCut(20);
mtot_cuts->AddCut(25);
mtot_cuts->AddCut(30);

This will class events according to:

mtot mtot_EC
<5 0
[5, 9] 1
[10, 14] 2
[15, 19] 3
[20, 24] 4
[25, 29] 5
>=30 6

mtot_EC is the default name for an event classification based on mtot and will be used for the branch added to the user's analysis TTree by method MakeBranches().

Using bins

mtot_cuts->AddBin(5,10);
mtot_cuts->AddBin(15,20);
mtot_cuts->AddBin(25,30);

This will class events according to the 2 bins with the following numbers:

mtot mtot_EC
[5, 9] 0
[15, 19] 1
[25, 29] 2
other -1

Note that in this case, any value outside of a defined bin is unclassified.

Definition at line 526 of file KVGVList.cpp.

◆ AddFirst()

void KVGVList::AddFirst ( TObject obj)
virtual

Overrides KVUniqueNameList::AddFirst(TObject*) so that global variable pointers are sorted between the 3 lists used for 1-body, 2-body & N-body variables.

We also print a warning in case the user tries to add a global variable with the same name as one already in the list. In the case we retain only the first global variable, any others with the same name are ignored

Reimplemented from KVUniqueNameList.

Definition at line 291 of file KVGVList.cpp.

◆ AddGV()

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

Add a global variable to the list.

"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 list of global variables. This name can later be used to retrieve the object (see GetGV()).

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, 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(const char*)"

It is assumed that MyNewVarGlob.h and MyNewVarGlob.cpp will be found in $HOME/myVarGlobs (in this example). The constructor taking a single character string argument (name of the variable) must be defined in the class.

Definition at line 615 of file KVGVList.cpp.

◆ AddGVFirst()

KVVarGlob * KVGVList::AddGVFirst ( const Char_t class_name,
const Char_t name 
)

Add a global variable at the beginning of the list.

See AddGV() for details.

Definition at line 701 of file KVGVList.cpp.

◆ Calculate()

void KVGVList::Calculate ( void  )
protected

Calculate all 1-body observables after filling.

Definition at line 119 of file KVGVList.cpp.

◆ Calculate2()

void KVGVList::Calculate2 ( )
protected

Calculate all 2-body observables after filling.

Definition at line 140 of file KVGVList.cpp.

◆ CalculateGlobalVariables()

void KVGVList::CalculateGlobalVariables ( KVEvent e)

This method will calculate all global variables defined in the list for the event 'e'.

Note that for 2-body variables, the Fill2 method will be called for each distinct pair of particles in the event, plus each pair made up of a particle and itself.

For each variable for which an event selection condition was set (see KVVarGlob::SetEventSelection()) the condition is tested as soon as the variable is calculated. If the condition is not satisfied, calculation of the other variables is abandonded and method AbortEventAnalysis() returns kTRUE.

Examples
globvars_kvzmax.C.

Definition at line 189 of file KVGVList.cpp.

◆ CalculateN()

void KVGVList::CalculateN ( )
protected

Calculate all N-body observables after filling.

Definition at line 161 of file KVGVList.cpp.

◆ Fill()

void KVGVList::Fill ( const KVNucleus c)
protected

Calls KVVarGlob::Fill(KVNucleus*) method of all one-body variables in the list for all KVNucleus satisfying the KVParticleCondition given to KVVarGlob::SetSelection() (if no selection given, all nuclei are used).

Definition at line 77 of file KVGVList.cpp.

◆ Fill2()

void KVGVList::Fill2 ( const KVNucleus c1,
const KVNucleus c2 
)
protected

Calls KVVarGlob::Fill(KVNucleus*,KVNucleus*) method of all two-body variables in the list for all pairs of KVNucleus (c1,c2) satisfying the KVParticleCondition given to KVVarGlob::SetSelection() (if no selection given, all nuclei are used).

Definition at line 94 of file KVGVList.cpp.

◆ FillBranches()

void KVGVList::FillBranches ( )

Use this method ONLY if you first use MakeBranches(TTree*) in order to automatically create branches for your global variables. Call this method for each event in order to put the values of the variables in the branches ready for TTree::Fill to be called (note that TTree::Fill is not called in this method: you should do it after this).

Examples
globvars_kvzmax.C.

Definition at line 434 of file KVGVList.cpp.

◆ FillN()

void KVGVList::FillN ( const KVEvent e)
protected

Calls KVVarGlob::FillN(KVEvent*) method of all N-body variables in the list.

Definition at line 108 of file KVGVList.cpp.

◆ GetGV()

KVVarGlob * KVGVList::GetGV ( const Char_t nom) const

Return pointer to global variable in list with name 'nom'.

Definition at line 237 of file KVGVList.cpp.

◆ GetGVType()

KVVarGlob* KVGVList::GetGVType ( const Char_t class_name)
inline

Returns first global variable in list with given class.

Definition at line 171 of file KVGVList.h.

◆ Has1BodyVariables()

Bool_t KVGVList::Has1BodyVariables ( )
inline

returns kTRUE if list contains 1-body variables

Definition at line 179 of file KVGVList.h.

◆ Has2BodyVariables()

Bool_t KVGVList::Has2BodyVariables ( )
inline

returns kTRUE if list contains 2-body variables

Definition at line 185 of file KVGVList.h.

◆ HasNBodyVariables()

Bool_t KVGVList::HasNBodyVariables ( )
inline

returns kTRUE if list contains N-body variables

Definition at line 191 of file KVGVList.h.

◆ Init()

void KVGVList::Init ( void  )

Initialisation of all global variables in list As this method may be called several times we ensure that variables are only initialised once

Examples
globvars_kvzmax.C.

Definition at line 49 of file KVGVList.cpp.

◆ init_KVGVList()

void KVGVList::init_KVGVList ( void  )
protected

Definition at line 16 of file KVGVList.cpp.

◆ MakeBranches()

void KVGVList::MakeBranches ( TTree tree)

Create a branch in the TTree for each global variable in the list. A leaf with the name of each global variable will be created to hold the value of the variable (result of KVVarGlob::GetValue() method). For multi-valued global variables we add a branch for each value with name

GVname.ValueName

To avoid problems with TTree::Draw, 'GVName' will be sanitized i.e. any mathematical symbols will be replaced by '_'.

Any variable for which KVVarGlob::SetMaxNumBranches() was called with argument 0 will not be added to the TTree.

Examples
globvars_kvzmax.C.

Definition at line 336 of file KVGVList.cpp.

◆ NameSanitizer()

TString KVGVList::NameSanitizer ( const Char_t s) const
inlineprivate

Definition at line 130 of file KVGVList.h.

◆ prepareGVforAdding()

KVVarGlob * KVGVList::prepareGVforAdding ( const Char_t class_name,
const Char_t name 
)
private

Definition at line 657 of file KVGVList.cpp.

◆ Reset()

void KVGVList::Reset ( void  )

Reset all variables before treating an event.

Examples
globvars_kvzmax.C.

Definition at line 63 of file KVGVList.cpp.

Member Data Documentation

◆ fAbortEventAnalysis

bool KVGVList::fAbortEventAnalysis
private

set to false if a global variable fails its own event selection criterion

Definition at line 127 of file KVGVList.h.

◆ fBranchVar

std::vector<Double_t> KVGVList::fBranchVar
private

used for automatic creation & filling of TTree branches

Definition at line 123 of file KVGVList.h.

◆ fIBranchVar

std::vector<Int_t> KVGVList::fIBranchVar
private

used for automatic creation & filling of TTree branches

Definition at line 124 of file KVGVList.h.

◆ fNbBranch

Int_t KVGVList::fNbBranch
private

Definition at line 125 of file KVGVList.h.

◆ fNbIBranch

Int_t KVGVList::fNbIBranch
private

Definition at line 126 of file KVGVList.h.

◆ fVG1

TList KVGVList::fVG1
protected

one-body variables

Definition at line 144 of file KVGVList.h.

◆ fVG2

TList KVGVList::fVG2
protected

two-body variables

Definition at line 145 of file KVGVList.h.

◆ fVGN

TList KVGVList::fVGN
protected

N-body variables.

Definition at line 146 of file KVGVList.h.


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