KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
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 {
Int_t Z;
public:
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
void AddHisto(TH1 *histo)
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(new TH1F("Mult", "Number of reconstructed particles in each event", 200, -.5, 199.5));
/*** USING A TREE ***/
CreateTreeFile();//<--- essential
TTree* t = new TTree("myTree", "");
AddTree(t);
t->Branch("ArrayName", &ArrayName);
t->Branch("Z", &Z);
/*** DEFINE WHERE TO SAVE THE RESULTS ***/
// This filename will be used for interactive and PROOFlite 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 run
// GetRunNumber() returns current run number
// GetCurrentRun() returns KVDBRun pointer to current run in database
//When this method is called, the detector geometry has been initialised and
//can be accessed through global pointer gMultiDetArray
Info("InitRun", "Beginning analysis of run %d containing %llu events", GetRunNumber(), 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
// if gMultiDetArray->HandledRawData() 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
while ((rnuc = (KVReconstructedNucleus*)GetReconstructedEvent()->GetNextParticle())) {
// 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
Int_t GetZ() const
Return the number of proton / atomic number.
Nuclei reconstructed from data measured by a detector array .
virtual Bool_t IsZMeasured() const
TString GetArrayName() const
Returns name of array particle was detected in (if known)
virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99)
void Info(const char *location, const char *fmt,...)
void FillTree(TTree &myTree, const RooDataSet &data)
ClassImp(TPyArg)