KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
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
class ExampleSimDataAnalysis : public KVEventSelector {
public:
ExampleSimDataAnalysis() {}
virtual ~ExampleSimDataAnalysis() {}
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 class for TTree containing KVEvent objects.
virtual void InitAnalysis()
virtual void EndRun()
virtual Bool_t Analysis()
virtual void EndAnalysis()
virtual void InitRun()
#include "ExampleSimDataAnalysis.h"
#include "KVSimNucleus.h"
#include "KVBatchSystem.h"
ClassImp(ExampleSimDataAnalysis)
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
CreateTreeFile();
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 : *GetEvent()) {
if (part.IsIsotope(2, 4)) { //cout << EC << " alpha" << endl;
FillHisto(Form("VparVper_alphas_EC%d", EC),
part.GetVpar(), part.GetVperp());
}
}
GetGVList()->FillBranches();
return kTRUE;
}
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
const 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:125
const Int_t n
void FillTree(TTree &myTree, const RooDataSet &data)