KaliVeda
Toolkit for HIC analysis
ExampleReconRawAnalysis.cpp

Example of an analysis class for reconstructed raw data

This is the analysis class generated by default by KaliVedaGUI for analysis of reconstructed raw data.

#ifndef __EXAMPLERECONRAWANALYSIS_H
#define __EXAMPLERECONRAWANALYSIS_H
#include "KVReconRawDataAnalyser.h"
class ExampleReconRawAnalysis : public KVReconRawDataAnalyser {
TString ArrayName;
Int_t Z;
public:
ExampleReconRawAnalysis() {}
virtual ~ExampleReconRawAnalysis() {}
void InitAnalysis();
void InitRun();
void EndRun() {}
void EndAnalysis() {}
ClassDef(ExampleReconRawAnalysis, 1) //Analysis of reconstructed raw data
};
#endif
int Int_t
bool Bool_t
#define ClassDef(name, id)
virtual Bool_t Analysis()=0
virtual void InitRun()=0
virtual void EndAnalysis()=0
virtual void InitAnalysis()=0
virtual void EndRun()=0
Base class for user analysis of raw data with event reconstruction.
DisplacementVector3D< CoordSystem, U > Mult(const Matrix &m, const DisplacementVector3D< CoordSystem, U > &v)
#include "ExampleReconRawAnalysis.h"
ClassImp(ExampleReconRawAnalysis)
// This class is derived from the KaliVeda class KVReconRawDataAnalyser.
// It is to be used for analysis of events reconstructed from raw data.
//
// The following member functions are called in turn:
//
// InitAnalysis(): called at the very beginning of the analysis
// InitRun(): called every time a run starts
// Analysis(): called for each event
// EndRun(): called every time a run ends
// EndAnalysis(): called after all requested data has been read
//
// Modify these methods as you wish in order to create your analysis class.
// Don't forget that for every class used in the analysis, you must put a
// line '#include' at the beginning of this file.
void ExampleReconRawAnalysis::InitAnalysis()
{
// Declaration of histograms, trees, etc.
// Called at the beginning of the analysis
// The examples given are compatible with interactive and batch analyses.
/*** DECLARING SOME HISTOGRAMS ***/
AddHisto<TH1F>("Mult", "Number of reconstructed particles in each event", 200, -.5, 199.5);
/*** USING A TREE ***/
auto t = AddTree("myTree", "");
t->Branch("ArrayName", &ArrayName);
t->Branch("Z", &Z);
/*** DEFINE WHERE TO SAVE THE RESULTS ***/
// This filename will be used for interactive jobs.
// When running in batch mode, this will automatically use the job name.
SetJobOutputFileName("ExampleReconRawAnalysis_results.root");
}
//____________________________________________________________________________//
void ExampleReconRawAnalysis::InitRun()
{
// Initialisation performed at beginning of each runfile. The experimental setup (KVMultiDetArray
// or KVExpSetUp object) is initialised with the parameters of the run just before calling this method.
//
// Some useful global pointers/methods:
//
// - gMultiDetArray : global pointer to experiment setup description;
// - gExpDB : global pointer to database (KVExpDB) for current dataset;
// - gDataSet : global pointer to current dataset (KVDataSet)
// - GetRunNumber() : returns current run number;
// - GetRunIndexNumber() : returns full run/index of current runfile;
// - GetCurrentRun() : returns pointer to KVDBRun object describing current run in database;
// - GetCurrentRunFile() : return pointer to KVDBRunFile object describing current runfile in database;
// - GetSystem() : return pointer to KVDBSystem object describing current reaction in database.
//
// See parent classes KVRawDataAnalyser, KVDataSetAnalyser and KVDataAnalyser for more.
Info("InitRun", "Beginning analysis of run %s containing %llu events", GetRunIndexNumber().as_string().Data(), GetCurrentRun()->GetEvents());
// Set tree title to name of system being analysed
GetTree("myTree")->SetTitle(GetSystem()->GetName());
}
//____________________________________________________________________________//
Bool_t ExampleReconRawAnalysis::Analysis()
{
//Analysis method called for each event
//
// - GetEventNumber() : returns current event number;
// - GetRunFileReader() : returns object used to read data (KVRawDataReader child class);
// - gMultiDetArray->HandledRawData() : if returns kTRUE, an event was reconstructed and can be accessed through GetReconstructedEvent()
//
// Processing will stop if this method returns kFALSE
if (gMultiDetArray->HandledRawData()) {
// number of reconstructed nuclei
Mult = GetReconstructedEvent()->GetMult();
FillHisto("Mult", Mult);
// loop over reconstructed nuclei in event
for (auto& rnuc : ReconEventIterator(GetReconstructedEvent())) {
// store name of array particle was detected in and its Z (if known)
ArrayName = rnuc.GetArrayName();
Z = -1;
if (rnuc.IsIdentified() && rnuc.IsZMeasured()) Z = rnuc.GetZ();
}
}
return kTRUE;
}
constexpr Bool_t kTRUE
Bool_t HandledRawData() const
Wrapper class for iterating over nuclei in KVReconstructedEvent accessed through base pointer or refe...
void Info(const char *location, const char *fmt,...)
void FillTree(TTree &myTree, const RooDataSet &data)
ClassImp(TPyArg)