KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
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
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(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
// 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;
}
KVMultiDetArray * gMultiDetArray
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
const Bool_t kTRUE
Bool_t HandledRawData() const
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:770
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 *va_(fmt),...)
void FillTree(TTree &myTree, const RooDataSet &data)