KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
ExampleSimDataAnalysis.cpp

Example of an analysis class for simulated data

A simple example of analysis of simulated data, for use with kaliveda-sim

#ifndef __EXAMPLESIMDATAANALYSIS_H
#define __EXAMPLESIMDATAANALYSIS_H
#include "KVEventSelector.h"
class ExampleSimDataAnalysis : public KVEventSelector {
public:
void InitAnalysis();
void InitRun() {}
void EndRun() {}
void EndAnalysis() {}
ClassDef(ExampleSimDataAnalysis, 1) //Analysis of simulated events
};
#endif
bool Bool_t
#define ClassDef(name, id)
General purpose analysis base class for TTree containing KVEvent objects.
virtual void InitAnalysis()
virtual void EndRun()
virtual Bool_t Analysis()
void AddHisto(TH1 *histo)
virtual void EndAnalysis()
virtual void InitRun()
#include "ExampleSimDataAnalysis.h"
#include "KVSimNucleus.h"
#include "KVBatchSystem.h"
ClassImp(ExampleSimDataAnalysis)
#include "KVSimEvent.h"
void ExampleSimDataAnalysis::InitAnalysis()
{
// INITIALISATION PERFORMED AT BEGINNING OF ANALYSIS
// Here you define:
// - global variables
// - histograms
// - trees
// DEFINITION OF GLOBAL VARIABLES FOR ANALYSIS
AddGV("KVMult", "mult"); // total multiplicity of each event
AddGV("KVMult", "Mcha")->SetSelection({"Z>0", [](const KVNucleus * n)
{
return n->GetZ() > 0;
}}); // charged particle multiplicity
// for sorting events according to multiplicity
KVEventClassifier* ec = GetGVList()->AddEventClassifier("mult");
ec->AddCut(5);
ec->AddCut(10);
ec->AddCut(15);
ec->AddCut(20);
ec->AddCut(25);
// DEFINITION OF HISTOGRAMS
for (int EC = 0; EC <= 5; ++EC)
AddHisto<TH2F>(Form("VparVper_alphas_EC%d", EC),
Form("#alpha particle velocities EC=%d", EC),
250, -15, 15, 250, -15, 15);
// DEFINITION OF TREE USED TO STORE RESULTS
auto t = AddTree("data", GetOpt("SimulationInfos"));
// add a branch to tree for each defined global variable
GetGVList()->MakeBranches(t);
}
//____________________________________________________________________________________
Bool_t ExampleSimDataAnalysis::Analysis()
{
// EVENT BY EVENT ANALYSIS
Int_t EC = GetGV("mult_EC")->GetValue(); // event class according to mult
for (auto& part : SimEventIterator(GetEvent())) {
if (part.IsIsotope(2, 4)) FillHisto(Form("VparVper_alphas_EC%d", EC),
part.GetVpar(), part.GetVperp());
}
GetGVList()->FillBranches();
return kTRUE;
}
int Int_t
constexpr Bool_t kTRUE
char * Form(const char *fmt,...)
Simple class for sorting events according to global variables.
void AddCut(double x)
Description of properties and kinematics of atomic nuclei.
Definition KVNucleus.h:126
Wrapper class for iterating over nuclei in KVSimEvent accessed through base pointer or reference.
const Int_t n
void FillTree(TTree &myTree, const RooDataSet &data)
ClassImp(TPyArg)