KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
KVVarGlob Class Referenceabstract

Base class for all global variable implementations.

Abstract base class for the management of global variables. A global variable is an analysis tool for condensing the information in a multibody event into one or a few characteristic values. A simple example is the event multiplicity (the number of particles in each event), which can be used to characterize heavy-ion collision events in terms of violence or centrality.

In KaliVeda, the base class for a multibody event is KVEvent, which is basically a collection of nuclei (base class KVNucleus). Therefore the global variable classes below can be used with any event described by a class derived from KVEvent, containing particles described by a class which inherits from KVNucleus.

Each global variable class implements the calculation of a given observable for any set of nuclei; this is done independently of the selection of the nuclei in the set, or in what reference frame kinematics should be calculated for either selection purposes or for the calculation of the observable. The way the observable is calculated is defined by the implementation of the fill(const KVNucleus*) (for 1-body observables: see below) and Calculate() methods.

Global variables can be of different types:

Derived global variable classes of 2-body or N-body type must set the fType member variable to the appropriate type (kTwoBody or kNBody) and define the fill2(const KVNucleus*,const KVNucleus*) method (for 2-body variables) or the fillN(KVEvent*) method (for N-body variables).

This is handled semi-automatically when using method

MakeClass(const Char_t * classname, const Char_t * classdesc, int type)
char Char_t
static void MakeClass(const Char_t *classname, const Char_t *classdesc, int type=kOneBody)
Definition: KVVarGlob.cpp:45

to generate a skeleton '.h' and '.cpp' file for the implementation of a new global variable class.

By default, global variables are 1-body and must define the fill(const KVNucleus*) method.

In addition, implementations in daughter classes must define the following methods:

Usage

Creation & initialisation

SomeVarGlob VG("var1"); // daughter class implementing 1-body global variable
VG.SetSelection( [particle selection criteria] );
VG.SetFrame( [reference frame for kinematics] );
VG.Init(); // perform any necessary initialisations

Analysis loop

while( [loop over events] )
{
while( [loop over particles in event] )
{
VG.Fill( [particle] );
}
VG.Calculate(); // perform any necessary calculations
auto vg = VG.GetValue(); // retrieve unique or principal value of variable
auto vh = VG.GetValue(2); // retrieve value with index 2 from multi-valued variable (implementation-dependent)
auto vi = VG.GetValue("Toto"); // retrieve value named "Toto" from multi-valued variable (implementation-dependent)
auto vv = VG.GetValueVector(); // retrieve vector containing all values of multi-valued variable
for(auto V : vv) // print all values
{
std::cout << V << std::endl;
}
VG.Reset(); // reinitialise prior to analysis of next event
}

Note that although the Fill() method is called for all particles, only those which satsify the conditions given to SetSelection() will be used to calculate the variable. Also, the internal fill(const KVNucleus*) etc. methods of each global variable class actually receive a pointer to each nucleus with as default kinematics those of the frame chosen with SetFrame().

Global variable lists

The KVGVList class handles a list of global variables. The recommended way to use global variables is through a list of this type (even if only one). The user analysis classes derived from KVEventSelector all have an internal KVGVList for definition and calculation of global variables. See KVGVList and KVEventSelector class documentation for more details.

Options, parameters, reference frames, particle selection, etc.

Particle selection

The selection of particles which are taken into account is handled by the variable itself by calling method SetSelection().

Kinematical reference frames

To change the reference frame used by the variable to calculate kinematical properties of particles (including those used for particle selection), call method SetFrame() (see KVEvent::SetFrame() and KVParticle::GetFrame() for how to define and access different frames).

Options and parameters

In order to give greater flexibility to global variable classes without the need to add member variables and the associated Get/Set methods, we provide methods to handle generic 'options' and 'parameters' for all variables.

An 'option' is a name-value pair, the value is a character string. Methods to use are:

void SetOption(const Char_t* option, const Char_t* value)
Bool_t IsOptionGiven(const Char_t* option)
KVString& GetOptionString(const Char_t* option) const
void UnsetOption(const Char_t* opt)
bool Bool_t
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
void SetOption(const Char_t *option, const Char_t *value)
Definition: KVVarGlob.h:490
void UnsetOption(const Char_t *opt)
Definition: KVVarGlob.h:511
TString GetOptionString(const Char_t *opt) const
Definition: KVVarGlob.h:505
Bool_t IsOptionGiven(const Char_t *opt)
Definition: KVVarGlob.h:498

A 'parameter' is a name-value pair, the value is a double-precision float value. Methods to use are:

void SetParameter(const Char_t* par, Double_t value)
void UnsetParameter(const Char_t* par)
double Double_t
void SetParameter(const Char_t *par, Double_t value)
Definition: KVVarGlob.h:518
Double_t GetParameter(const Char_t *par) const
Definition: KVVarGlob.h:545
Bool_t IsParameterSet(const Char_t *par)
Definition: KVVarGlob.h:538
void UnsetParameter(const Char_t *par)
Definition: KVVarGlob.h:557

Normalization

The value(s) returned by the variable will all be divided by the normalization factor set with one of the following methods:

SetParameter("Normalization", Double_t)
void SetNormalization(Double_t norm)
Definition: KVVarGlob.h:533

Definition of event selection criteria [ROOT6]

When used in a KVGVList of global variables, 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

This mechanism is implemented in KVEventSelector, i.e. in all user analysis classes.

Definition of new kinematical frames [ROOT6]

When used in a KVGVList of global variables, a variable can be used to define a new kinematical frame which can in turn be used by any variables which occur after them in the list. In order to do so, call method SetNewFrameDefinition() 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 = vglist.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
Authors
D. Cussol (LPC Caen), J.D. Frankland (GANIL)
Date
2004-2020
Examples
ExampleFilteredSimDataAnalysis.cpp, and ExampleINDRAAnalysis.cpp.

Definition at line 217 of file KVVarGlob.h.

Public Types

enum  { kOneBody , kTwoBody , kNBody }
 
- Public Types inherited from KVBase
enum  EKaliVedaBits { kIsKaliVedaObject = BIT(23) }
 
- Public Types inherited from TObject
enum  EDeprecatedStatusBits
 
enum  EStatusBits
 

Public Member Functions

 KVVarGlob ()
 
 KVVarGlob (const Char_t *nom)
 
virtual ~KVVarGlob (void)
 
void AddSelection (const KVParticleCondition &sel)
 
Double_t AsDouble () const
 
virtual void Calculate ()=0
 
void Copy (TObject &obj) const
 Make a copy of this object. More...
 
void DefineNewFrame (KVEvent *e) const
 
void Fill (const KVNucleus *c)
 
void Fill2 (const KVNucleus *n1, const KVNucleus *n2)
 
virtual void FillN (const KVEvent *)
 
const TStringGetFrame () const
 
Int_t GetNameIndex (const Char_t *name) const
 
Double_t GetNormalization () const
 
Int_t GetNumberOfBranches () const
 
virtual Int_t GetNumberOfValues () const
 
TString GetOptionString (const Char_t *opt) const
 
Double_t GetParameter (const Char_t *par) const
 
Double_t GetValue (const Char_t *name) const
 
Double_t GetValue (Int_t i) const
 
Double_t GetValue (void) const
 
virtual TString GetValueName (Int_t i) const
 
virtual Char_t GetValueType (Int_t) const
 
virtual std::vector< Double_tGetValueVector (void) const
 
virtual void Init ()=0
 
virtual Bool_t IsGlobalVariable () const
 
Bool_t IsNBody () const
 
Bool_t IsOneBody () const
 
Bool_t IsOptionGiven (const Char_t *opt)
 
Bool_t IsParameterSet (const Char_t *par)
 
Bool_t IsTwoBody () const
 
void ListInit ()
 
 operator double () const
 
Double_t operator() (const Char_t *name) const
 
Double_t operator() (Int_t i) const
 
Double_t operator() (void) const
 
void Print (Option_t *="") const
 
virtual void Reset ()=0
 
void SetEventSelection (const EventSelector &f)
 
void SetFrame (const Char_t *ref)
 
void SetMaxNumBranches (Int_t n)
 
void SetNewFrameDefinition (const FrameSetter &f)
 
void SetNormalization (Double_t norm)
 
void SetOption (const Char_t *option, const Char_t *value)
 
void SetParameter (const Char_t *par, Double_t value)
 
void SetSelection (const KVParticleCondition &sel)
 
bool TestEventSelection () const
 
void UnsetOption (const Char_t *opt)
 
void UnsetParameter (const Char_t *par)
 
- Public Member Functions inherited from KVBase
 KVBase ()
 Default constructor. More...
 
 KVBase (const Char_t *name, const Char_t *title="")
 Ctor for object with given name and type. More...
 
 KVBase (const KVBase &)
 copy ctor More...
 
virtual ~ KVBase ()
 
virtual void Clear (Option_t *opt="")
 Clear object properties : name, type/title, number, label. More...
 
const Char_tGetLabel () const
 
UInt_t GetNumber () const
 
UInt_t GetNumberOfObjects () const
 
virtual TObjectGetObject () const
 
const Char_tGetType () const
 
Bool_t HasLabel () const
 
virtual Bool_t IsCalled (const Char_t *name) const
 
Bool_t IsLabelled (const Char_t *l) const
 
virtual Bool_t IsType (const Char_t *typ) const
 
virtual void List ()
 
KVBaseoperator= (const KVBase &)
 copy assignment operator More...
 
Double_t ProtectedGetX (const TF1 *func, Double_t val, int &status, Double_t xmin=0.0, Double_t xmax=0.0) const
 
void SetLabel (const Char_t *lab)
 
virtual void SetNumber (UInt_t num)
 
virtual void SetType (const Char_t *str)
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 
virtual TObjectClone (const char *newname="") const
 
virtual Int_t Compare (const TObject *obj) const
 
virtual void FillBuffer (char *&buffer)
 
virtual const char * GetName () const
 
virtual const char * GetTitle () const
 
virtual ULong_t Hash () const
 
virtual Bool_t IsSortable () const
 
virtual void ls (Option_t *option="") const
 
TNamedoperator= (const TNamed &rhs)
 
virtual void SetName (const char *name)
 
virtual void SetNameTitle (const char *name, const char *title)
 
virtual void SetTitle (const char *title="")
 
virtual Int_t Sizeof () 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="")
 
virtual void Browse (TBrowser *b)
 
ULong_t CheckedHash ()
 
virtual const char * ClassName () 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 char * GetObjectInfo (Int_t px, Int_t py) const
 
virtual Option_tGetOption () 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
 
virtual Bool_t IsFolder () const
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
void MayNotUse (const char *method) const
 
virtual Bool_t Notify ()
 
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 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
 

Static Public Member Functions

static void MakeClass (const Char_t *classname, const Char_t *classdesc, int type=kOneBody)
 
- Static Public Member Functions inherited from KVBase
static Bool_t AreEqual (Double_t x, Double_t y, Long64_t maxdif=1)
 Comparison between two 64-bit floating-point values. More...
 
static void BackupFileWithDate (const Char_t *path)
 
static void CombineFiles (const Char_t *file1, const Char_t *file2, const Char_t *newfilename, Bool_t keep=kTRUE)
 
static void Deprecated (const char *method, const char *advice)
 
static Bool_t FindClassSourceFiles (const Char_t *class_name, KVString &imp_file, KVString &dec_file, const Char_t *dir_name=".")
 
static Bool_t FindExecutable (TString &exec, const Char_t *path="$(PATH)")
 
static const Char_tFindFile (const Char_t *search, TString &wfil)
 
static const Char_tGetBINDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetDATABASEFilePath ()
 
static const Char_tGetDATADIRFilePath (const Char_t *namefile="")
 
static Bool_t GetDataSetEnv (const Char_t *dataset, const Char_t *type, Bool_t defval)
 
static const Char_tGetDataSetEnv (const Char_t *dataset, const Char_t *type, const Char_t *defval)
 
static Double_t GetDataSetEnv (const Char_t *dataset, const Char_t *type, Double_t defval)
 
static const Char_tGetETCDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetExampleFilePath (const Char_t *library, const Char_t *namefile)
 Return full path to example file for given library (="KVMultiDet", "BackTrack", etc.) More...
 
static const Char_tGetINCDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetKVBuildDate ()
 Returns KaliVeda build date. More...
 
static const Char_tGetKVBuildDir ()
 Returns top-level directory used for build. More...
 
static const Char_tGetKVBuildTime ()
 Returns KaliVeda build date. More...
 
static const Char_tGetKVBuildType ()
 Returns KaliVeda build type (cmake build: Release, Debug, RelWithDebInfo, ...) More...
 
static const Char_tGetKVBuildUser ()
 Returns username of person who performed build. More...
 
static const Char_tGetKVSourceDir ()
 Returns top-level directory of source tree used for build. More...
 
static const Char_tGetKVVersion ()
 Returns KaliVeda version string. More...
 
static const Char_tGetLIBDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetListOfPlugins (const Char_t *base)
 
static const Char_tGetListOfPluginURIs (const Char_t *base)
 
static const Char_tGetPluginURI (const Char_t *base, const Char_t *plugin)
 
static void GetTempFileName (TString &base)
 
static const Char_tGetTEMPLATEDIRFilePath (const Char_t *namefile="")
 
static const Char_tGetWORKDIRFilePath (const Char_t *namefile="")
 
static const Char_tgitBranch ()
 Returns git branch of sources. More...
 
static const Char_tgitCommit ()
 Returns last git commit of sources. More...
 
static void InitEnvironment ()
 
static bool is_gnuinstall ()
 
static Bool_t IsThisAPlugin (const TString &uri, TString &base)
 
static TPluginHandlerLoadPlugin (const Char_t *base, const Char_t *uri="0")
 
static Bool_t OpenContextMenu (const char *method, TObject *obj, const char *alt_method_name="")
 
static void OpenTempFile (TString &base, std::ofstream &fp)
 
static void PrintSplashScreen ()
 Prints welcome message and infos on version etc. More...
 
static Bool_t SearchAndOpenKVFile (const Char_t *name, std::ifstream &file, const Char_t *kvsubdir="", KVLockfile *locks=0)
 
static Bool_t SearchAndOpenKVFile (const Char_t *name, std::ofstream &file, const Char_t *kvsubdir="", KVLockfile *locks=0)
 
static Bool_t SearchKVFile (const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
 
static const Char_tWorkingDirectory ()
 
- 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)
 

Protected Member Functions

void ClearNameIndex ()
 
virtual void fill (const KVNucleus *)
 
virtual void fill2 (const KVNucleus *, const KVNucleus *)
 
int GetIndexAtListPosition (int pos) const
 
TString GetNameAtListPosition (int pos) const
 
KVNameValueListGetParameters ()
 
const KVNameValueListGetParameters () const
 
virtual Double_t getvalue_char (const Char_t *name) const
 
virtual Double_t getvalue_int (Int_t) const =0
 
virtual Double_t getvalue_void () const
 
void SetNameIndex (const Char_t *name, Int_t index)
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 
void MakeZombie ()
 

Static Protected Member Functions

static void AddFillMethod (KVClassFactory &cf, int type)
 
static void AddFillMethodBody (KVClassFactory &cf, KVString &body, int type)
 
static void AddInitMethod (KVClassFactory &cf, KVString &body)
 
static void FillMethodBody (KVString &body, int type)
 
static void ImplementInitMethod (KVClassFactory &cf, KVString &body, int type)
 

Protected Attributes

Int_t fType
 type of variable global; = kOneBody, kTwoBody or kNBody More...
 
Char_t fValueType
 type (='I' integer or 'D' double) of global variable value More...
 
- Protected Attributes inherited from KVBase
TString fLabel
 label for the object More...
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 
- Protected Attributes inherited from TObject
 kOnlyPrepStep
 

Private Types

using EventSelector = std::function< bool(const KVVarGlob *)>
 
using FrameSetter = std::function< void(KVEvent *, const KVVarGlob *)>
 

Private Member Functions

void init ()
 

Static Private Member Functions

static void AddExtraInitMethodComment (KVClassFactory &cf, KVString &body)
 

Private Attributes

EventSelector fEventSelector
 used to select events in analysis based on value of variable More...
 
KVString fFrame
 (optional) name of reference frame used for kinematics More...
 
FrameSetter fFrameSetter
 used to define a new kinematical frame for event based on variable More...
 
Bool_t fIsInitialized
 flag set after initialisation More...
 
Int_t fMaxNumBranches
 max number of branches to create for multi-valued variable More...
 
Double_t fNormalization
 optional normalization parameter More...
 
KVNameValueList fOptions
 list of options More...
 
KVNameValueList fParameters
 list of parameters More...
 
KVParticleCondition fSelection
 (optional) condition used to select particles More...
 
KVNameValueList nameList
 correspondence between variable name and index More...
 

Additional Inherited Members

- Public Attributes inherited from TObject
 kBitMask
 
 kCanDelete
 
 kCannotPick
 
 kHasUUID
 
 kInconsistent
 
 kInvalidObject
 
 kIsOnHeap
 
 kIsReferenced
 
 kMustCleanup
 
 kNoContextMenu
 
 kNotDeleted
 
 kObjInCanvas
 
 kOverwrite
 
 kSingleKey
 
 kWriteDelete
 
 kZombie
 

#include <KVVarGlob.h>

Inheritance diagram for KVVarGlob:
Inheritance graph
[legend]

Member Typedef Documentation

◆ EventSelector

using KVVarGlob::EventSelector = std::function<bool(const KVVarGlob*)>
private

Definition at line 240 of file KVVarGlob.h.

◆ FrameSetter

Definition at line 242 of file KVVarGlob.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kOneBody 
kTwoBody 
kNBody 

Definition at line 220 of file KVVarGlob.h.

Constructor & Destructor Documentation

◆ KVVarGlob() [1/2]

KVVarGlob::KVVarGlob ( )
inline

Definition at line 316 of file KVVarGlob.h.

◆ KVVarGlob() [2/2]

KVVarGlob::KVVarGlob ( const Char_t nom)
inline

Definition at line 321 of file KVVarGlob.h.

◆ ~KVVarGlob()

virtual KVVarGlob::~KVVarGlob ( void  )
inlinevirtual

Definition at line 348 of file KVVarGlob.h.

Member Function Documentation

◆ AddExtraInitMethodComment()

void KVVarGlob::AddExtraInitMethodComment ( KVClassFactory cf,
KVString body 
)
staticprivate

Definition at line 130 of file KVVarGlob.cpp.

◆ AddFillMethod()

void KVVarGlob::AddFillMethod ( KVClassFactory cf,
int  type 
)
staticprotected

PRIVATE method used by MakeClass. add 'Fill', 'Fill2', or 'FillN' method

Definition at line 164 of file KVVarGlob.cpp.

◆ AddFillMethodBody()

void KVVarGlob::AddFillMethodBody ( KVClassFactory cf,
KVString body,
int  type 
)
staticprotected

PRIVATE method used by MakeClass. add body of fill method

Definition at line 191 of file KVVarGlob.cpp.

◆ AddInitMethod()

void KVVarGlob::AddInitMethod ( KVClassFactory cf,
KVString body 
)
staticprotected

PRIVATE method used by MakeClass. add 'init' method

Definition at line 148 of file KVVarGlob.cpp.

◆ AddSelection()

void KVVarGlob::AddSelection ( const KVParticleCondition sel)
inline

Use this method to add a condition which will be applied to select particles to contribute to the global variable.

The final selection will be a logical 'AND' between any previously set conditions and this one

See also
SetSelection()

Definition at line 581 of file KVVarGlob.h.

◆ AsDouble()

Double_t KVVarGlob::AsDouble ( ) const
inline

Definition at line 594 of file KVVarGlob.h.

◆ Calculate()

virtual void KVVarGlob::Calculate ( )
pure virtual

◆ ClearNameIndex()

void KVVarGlob::ClearNameIndex ( )
inlineprotected

Delete previously defined associations between variable name and index

Definition at line 251 of file KVVarGlob.h.

◆ Copy()

void KVVarGlob::Copy ( TObject obj) const
inlinevirtual

Make a copy of this object.

Copy this to obj

Reimplemented from KVBase.

Reimplemented in KVZmax, KVVGObjectSum< SumObject >, KVVGObjectSum< KVNucleus >, KVVGObjectSum< TVector3 >, KVVarGlobMean, and KVVarGlob1.

Definition at line 328 of file KVVarGlob.h.

◆ DefineNewFrame()

void KVVarGlob::DefineNewFrame ( KVEvent e) const
inline

If method SetFrameDefinition() was called with a valid function to define a new kinematical frame for events, it will be used here to define the frame for all particles in the event.

Definition at line 697 of file KVVarGlob.h.

◆ fill()

virtual void KVVarGlob::fill ( const KVNucleus )
inlineprotectedvirtual

abstract method which must be overriden in child classes describing one-body global variables.

Reimplemented in KVZVtot, KVSource, KVPtot, KVFlowTensor, KVDirectivity, KVZmax, KVVGSum, KVQuadMoment, KVRiso, KVCalorimetry, and KVCaloBase.

Definition at line 286 of file KVVarGlob.h.

◆ Fill()

void KVVarGlob::Fill ( const KVNucleus c)
inline

Evaluate contribution of particle to variable only if it satisfies the particle selection criteria given with SetSelection()/AddSelection(), call fill() with particle in desired frame

Examples
globvars_kvzmax.C.

Definition at line 388 of file KVVarGlob.h.

◆ fill2()

virtual void KVVarGlob::fill2 ( const KVNucleus ,
const KVNucleus  
)
inlineprotectedvirtual

abstract method which must be overriden in child classes describing two-body global variables.

NOTE: this method will be called for EVERY pair of nuclei in the event (i.e. n1-n2 and n2-n1), including pairs of identical nuclei (n1 = n2). If you want to calculate a global variable using only each non-identical pair once, then make sure in your implementation that you check n1!=n2 and divide the result of summing over the pairs by 2 to avoid double-counting.

Reimplemented in KVRelativeVelocity, and KVFoxH2.

Definition at line 293 of file KVVarGlob.h.

◆ Fill2()

void KVVarGlob::Fill2 ( const KVNucleus n1,
const KVNucleus n2 
)
inline

Evaluate contribution of particles to variable only if both satisfy the particle selection criteria given with SetSelection(KVParticleCondition&), call fill() with particle in desired frame

Definition at line 396 of file KVVarGlob.h.

◆ FillMethodBody()

void KVVarGlob::FillMethodBody ( KVString body,
int  type 
)
staticprotected

PRIVATE method used by MakeClass. body of 'fill', 'fill2', or 'FillN' method

Definition at line 87 of file KVVarGlob.cpp.

◆ FillN()

virtual void KVVarGlob::FillN ( const KVEvent )
inlinevirtual

abstract method which must be overriden in child classes describing N-body global variables.

Definition at line 406 of file KVVarGlob.h.

◆ GetFrame()

const TString& KVVarGlob::GetFrame ( ) const
inline

Definition at line 485 of file KVVarGlob.h.

◆ GetIndexAtListPosition()

int KVVarGlob::GetIndexAtListPosition ( int  pos) const
inlineprotected

return index value stored for 'pos'-th parameter stored in NameIndex list

Definition at line 256 of file KVVarGlob.h.

◆ GetNameAtListPosition()

TString KVVarGlob::GetNameAtListPosition ( int  pos) const
inlineprotected

return name value stored for 'pos'-th parameter stored in NameIndex list

Definition at line 261 of file KVVarGlob.h.

◆ GetNameIndex()

Int_t KVVarGlob::GetNameIndex ( const Char_t name) const
Returns
the index corresponding to name
See also
SetNameIndex()

Definition at line 254 of file KVVarGlob.cpp.

◆ GetNormalization()

Double_t KVVarGlob::GetNormalization ( ) const
inline

Definition at line 552 of file KVVarGlob.h.

◆ GetNumberOfBranches()

Int_t KVVarGlob::GetNumberOfBranches ( ) const
inline

Returns number of branches to create for this global variable (see KVGVList::MakeBranches).

This is the same as GetNumberOfValues() unless SetMaxNumBranches() has been called with a different (smaller) value.

Note that if SetMaxNumBranches(0) is called, no branch will be created for this variable.

Definition at line 609 of file KVVarGlob.h.

◆ GetNumberOfValues()

virtual Int_t KVVarGlob::GetNumberOfValues ( ) const
inlinevirtual
Returns
number of values associated with this global variable. This is the number of indices defined using SetNameIndex() method.

Reimplemented in KVVarGlob1.

Definition at line 603 of file KVVarGlob.h.

◆ GetOptionString()

TString KVVarGlob::GetOptionString ( const Char_t opt) const
inline

Returns the value of the option

Definition at line 505 of file KVVarGlob.h.

◆ GetParameter()

Double_t KVVarGlob::GetParameter ( const Char_t par) const
inline

Returns the value of the parameter 'par'

Definition at line 545 of file KVVarGlob.h.

◆ GetParameters() [1/2]

KVNameValueList& KVVarGlob::GetParameters ( )
inlineprotected

Definition at line 306 of file KVVarGlob.h.

◆ GetParameters() [2/2]

const KVNameValueList& KVVarGlob::GetParameters ( ) const
inlineprotected

Definition at line 310 of file KVVarGlob.h.

◆ GetValue() [1/3]

Double_t KVVarGlob::GetValue ( const Char_t name) const
inline
Returns
value of "name" To override behaviour of this method in child classes, redefine the protected method getvalue_char(const Char_t*)

If a "Normalization" parameter has been set, it is applied here

Definition at line 422 of file KVVarGlob.h.

◆ GetValue() [2/3]

Double_t KVVarGlob::GetValue ( Int_t  i) const
inline
Returns
value with index i To override behaviour of this method in child classes, redefine the protected method getvalue_int(Int_t)

If a "Normalization" parameter has been set, it is applied here

Definition at line 432 of file KVVarGlob.h.

◆ GetValue() [3/3]

Double_t KVVarGlob::GetValue ( void  ) const
inline
Returns
principal gobal variable value To override behaviour of this method in child classes, redefine the protected method getvalue_void()

If a "Normalization" parameter has been set, it is applied here

Examples
ExampleFilteredSimDataAnalysis.cpp, and ExampleINDRAAnalysis.cpp.

Definition at line 412 of file KVVarGlob.h.

◆ getvalue_char()

virtual Double_t KVVarGlob::getvalue_char ( const Char_t name) const
inlineprotectedvirtual

By default, this method returns the value of the variable "name" using the name-index table set up with SetNameIndex(const Char_t*,Int_t).

Reimplemented in KVVGSum.

Definition at line 278 of file KVVarGlob.h.

◆ getvalue_int()

virtual Double_t KVVarGlob::getvalue_int ( Int_t  ) const
protectedpure virtual

◆ getvalue_void()

virtual Double_t KVVarGlob::getvalue_void ( ) const
inlineprotectedvirtual

By default, returns value with index 0

Definition at line 273 of file KVVarGlob.h.

◆ GetValueName()

virtual TString KVVarGlob::GetValueName ( Int_t  i) const
inlinevirtual

Returns name of value associated with index 'i', as defined by using SetNameIndex method.

Reimplemented in KVVGSum.

Definition at line 619 of file KVVarGlob.h.

◆ GetValueType()

virtual Char_t KVVarGlob::GetValueType ( Int_t  ) const
inlinevirtual

Returns type of value associated with index i.

This can be either 'I' (integer values) or 'D' (floating-point/double). By default, this method returns the same type (value of member variable fValueType) for all values of i.

This can be overridden in child classes.

Reimplemented in KVSource, KVCaloBase, KVRiso, and KVFlowTensor.

Definition at line 628 of file KVVarGlob.h.

◆ GetValueVector()

virtual std::vector<Double_t> KVVarGlob::GetValueVector ( void  ) const
inlinevirtual
Returns
vector of all values calculated by variable. The order of the values in the vector is the same as the indices defined by calls to SetNameIndex(), these indices correspond to those used with GetValue(Int_t)

If a "Normalization" parameter has been set, it is applied here

Reimplemented in KVZmax, and KVCaloBase.

Definition at line 442 of file KVVarGlob.h.

◆ ImplementInitMethod()

void KVVarGlob::ImplementInitMethod ( KVClassFactory cf,
KVString body,
int  type 
)
staticprotected

Definition at line 111 of file KVVarGlob.cpp.

◆ init()

void KVVarGlob::init ( void  )
private

Definition at line 16 of file KVVarGlob.cpp.

◆ Init()

virtual void KVVarGlob::Init ( )
pure virtual

◆ IsGlobalVariable()

virtual Bool_t KVVarGlob::IsGlobalVariable ( ) const
inlinevirtual

Reimplemented in KVEventClassifier, and KVDummyGV.

Definition at line 369 of file KVVarGlob.h.

◆ IsNBody()

Bool_t KVVarGlob::IsNBody ( ) const
inline
Returns
kTRUE for variables of N-body type for which FillN(KVEvent*) method must be defined

Definition at line 363 of file KVVarGlob.h.

◆ IsOneBody()

Bool_t KVVarGlob::IsOneBody ( ) const
inline
Returns
kTRUE for variables of one-body type for which Fill(KVNucleus*) method must be defined

Definition at line 351 of file KVVarGlob.h.

◆ IsOptionGiven()

Bool_t KVVarGlob::IsOptionGiven ( const Char_t opt)
inline

Returns kTRUE if the option 'opt' has been set

Definition at line 498 of file KVVarGlob.h.

◆ IsParameterSet()

Bool_t KVVarGlob::IsParameterSet ( const Char_t par)
inline

Returns kTRUE if the parameter 'par' has been set

Definition at line 538 of file KVVarGlob.h.

◆ IsTwoBody()

Bool_t KVVarGlob::IsTwoBody ( ) const
inline
Returns
kTRUE for variables of two-body type for which Fill2(KVNucleus*,KVNucleus*) method must be defined

Definition at line 357 of file KVVarGlob.h.

◆ ListInit()

void KVVarGlob::ListInit ( )
inline

Method called by KVGVList::Init Ensures that initialisation of variable is performed only once

Definition at line 374 of file KVVarGlob.h.

◆ MakeClass()

void KVVarGlob::MakeClass ( const Char_t classname,
const Char_t classdesc,
int  type = kOneBody 
)
static

Creates skeleton '.h' and '.cpp' files for a new global variable class which inherits from this class. Give a name for the new class and a short description which will be used to document the class.

By default the new class will be of type 1-body. A fill(const KVNucleus*) method will be generated which the user should complete.

For a 2-body variable, call MakeClass with type = KVVarGlob::kTwoBody. A skeleton fill2(const KVNucleus*,const KVNucleus*) method will be generated.

For a N-body variable, call MakeClass with type = KVVarGlob::kNBody. A skeleton fillN(KVEvent*) method will be generated.

Definition at line 45 of file KVVarGlob.cpp.

◆ operator double()

KVVarGlob::operator double ( ) const
inline

Definition at line 598 of file KVVarGlob.h.

◆ operator()() [1/3]

Double_t KVVarGlob::operator() ( const Char_t name) const
inline

Definition at line 460 of file KVVarGlob.h.

◆ operator()() [2/3]

Double_t KVVarGlob::operator() ( Int_t  i) const
inline

Definition at line 465 of file KVVarGlob.h.

◆ operator()() [3/3]

Double_t KVVarGlob::operator() ( void  ) const
inline

Definition at line 455 of file KVVarGlob.h.

◆ Print()

void KVVarGlob::Print ( Option_t = "") const
virtual

Reimplemented from KVBase.

Definition at line 276 of file KVVarGlob.cpp.

◆ Reset()

virtual void KVVarGlob::Reset ( )
pure virtual

◆ SetEventSelection()

void KVVarGlob::SetEventSelection ( const EventSelector f)
inline

Call this method with a lambda expression in order to define an event selection criterion based on the value of this variable. The signature of the lambda is

[](const KVVarGlob* var){ return var->GetValue()>20; }

i.e. it evaluates to bool based on the value of the global variable passed to it.

If capture by reference is used, the 'cut' can be defined later:

double my_cut;
[&](const KVVarGlob* var){ return var->GetValue("Mean")<my_cut; }

The condition will be tested by KVGVList just after calculation of this variable; if the condition is not met, no further variables will be calculated and the event will be rejected for further analysis.

Definition at line 656 of file KVVarGlob.h.

◆ SetFrame()

void KVVarGlob::SetFrame ( const Char_t ref)
inline

Sets the reference frame used for kinematical calculations. By default, i.e. if this method is not called, we use the default frame of particles which (usually) corresponds to the 'laboratory' or 'detector' frame.

The frame 'ref' must be defined before calculating global variables. See KVParticle::SetFrame and KVEvent::SetFrame methods for defining new reference frames. See KVParticle::GetFrame how to access particle kinematics in different frames.

Definition at line 474 of file KVVarGlob.h.

◆ SetMaxNumBranches()

void KVVarGlob::SetMaxNumBranches ( Int_t  n)
inline

Used for automatic TTree branch creation for multi-valued variables (see KVGVList::MakeBranches).

Normally a branch will be created for each of the \(N\) values declared with the SetNameIndex() method, but if this method is called before analysis begins with \(n<N\), only the first \(n\) branches will be used.

Note that if SetMaxNumBranches(0) is called, no branch will be created for this variable.

Definition at line 640 of file KVVarGlob.h.

◆ SetNameIndex()

void KVVarGlob::SetNameIndex ( const Char_t name,
Int_t  index 
)
protected

For a multi-valued global variable, sets up the correspondance between value name and index.

These can then be used to retrieve values with GetValue("name") or GetValue(index).

When automatic branch creation in a TTree is used (see KVGVList::MakeBranches()), the names given to this method will be used to name the branches as:

  • [varName].[value0_name]
  • [varName].[value1_name]
  • ... etc.

GetNumberOfValues() returns the number of values associated with the variable, corresponding to the number of name-index associations are created by calling this method.

Definition at line 223 of file KVVarGlob.cpp.

◆ SetNewFrameDefinition()

void KVVarGlob::SetNewFrameDefinition ( const FrameSetter f)
inline

Call this method with a lambda expression in order to define a new frame for events based on the calculated value(s) of this variable.

The signature of the lambda is (the KVVarGlob pointer passed will be 'this')

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

Definition at line 686 of file KVVarGlob.h.

◆ SetNormalization()

void KVVarGlob::SetNormalization ( Double_t  norm)
inline

Definition at line 533 of file KVVarGlob.h.

◆ SetOption()

void KVVarGlob::SetOption ( const Char_t option,
const Char_t value 
)
inline

Set a value for an option

Definition at line 490 of file KVVarGlob.h.

◆ SetParameter()

void KVVarGlob::SetParameter ( const Char_t par,
Double_t  value 
)
inline

Set the value for a parameter

before v1.12, certain global variables used a parameter to select particles force analysis to abort in case user has not updated an old analysis class

Definition at line 518 of file KVVarGlob.h.

◆ SetSelection()

void KVVarGlob::SetSelection ( const KVParticleCondition sel)
inline

Use this method to define the condition(s) which will be applied to select particles to contribute to the global variable.

Any previously set conditions are replaced by this.

Note
if a reference frame is defined for this variable, it will automatically be applied to the kinematics of the particle used for the selection. E.g. if the selection is "_NUC_->GetVpar()>0" and the reference frame is "CM", the condition will be applied to the CM parallel velocities.
See also
KVParticleCondition

Definition at line 565 of file KVVarGlob.h.

◆ TestEventSelection()

bool KVVarGlob::TestEventSelection ( ) const
inline

Called by KVGVList just after calculation of this variable; if the condition is not met, no further variables will be calculated and the event will be rejected for further analysis.

Definition at line 676 of file KVVarGlob.h.

◆ UnsetOption()

void KVVarGlob::UnsetOption ( const Char_t opt)
inline

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

Definition at line 511 of file KVVarGlob.h.

◆ UnsetParameter()

void KVVarGlob::UnsetParameter ( const Char_t par)
inline

Removes the parameter 'par' from the internal lists, as if it had never been set

Definition at line 557 of file KVVarGlob.h.

Member Data Documentation

◆ fEventSelector

EventSelector KVVarGlob::fEventSelector
private

used to select events in analysis based on value of variable

Definition at line 241 of file KVVarGlob.h.

◆ fFrame

KVString KVVarGlob::fFrame
private

(optional) name of reference frame used for kinematics

Definition at line 232 of file KVVarGlob.h.

◆ fFrameSetter

FrameSetter KVVarGlob::fFrameSetter
private

used to define a new kinematical frame for event based on variable

Definition at line 243 of file KVVarGlob.h.

◆ fIsInitialized

Bool_t KVVarGlob::fIsInitialized
private

flag set after initialisation

Definition at line 231 of file KVVarGlob.h.

◆ fMaxNumBranches

Int_t KVVarGlob::fMaxNumBranches
private

max number of branches to create for multi-valued variable

Definition at line 236 of file KVVarGlob.h.

◆ fNormalization

Double_t KVVarGlob::fNormalization
private

optional normalization parameter

Definition at line 237 of file KVVarGlob.h.

◆ fOptions

KVNameValueList KVVarGlob::fOptions
private

list of options

Definition at line 233 of file KVVarGlob.h.

◆ fParameters

KVNameValueList KVVarGlob::fParameters
private

list of parameters

Definition at line 234 of file KVVarGlob.h.

◆ fSelection

KVParticleCondition KVVarGlob::fSelection
private

(optional) condition used to select particles

Definition at line 235 of file KVVarGlob.h.

◆ fType

Int_t KVVarGlob::fType
protected

type of variable global; = kOneBody, kTwoBody or kNBody

Definition at line 227 of file KVVarGlob.h.

◆ fValueType

Char_t KVVarGlob::fValueType
protected

type (='I' integer or 'D' double) of global variable value

Definition at line 228 of file KVVarGlob.h.

◆ nameList

KVNameValueList KVVarGlob::nameList
private

correspondence between variable name and index

Definition at line 230 of file KVVarGlob.h.


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