KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
ExampleINDRAAnalysis.cpp

Example analysis class for INDRA data

This example for analysis of fully calibrated and identified data shows how to

#ifndef __EXAMPLEINDRAANALYSIS_H
#define __EXAMPLEINDRAANALYSIS_H
class ExampleINDRAAnalysis : public KVINDRAEventSelector {
double ztot_sys, zvtot_sys;
public:
ExampleINDRAAnalysis() {};
virtual ~ExampleINDRAAnalysis() {};
virtual void InitRun();
virtual void EndRun() {}
virtual void InitAnalysis();
virtual Bool_t Analysis();
virtual void EndAnalysis() {}
ClassDef(ExampleINDRAAnalysis, 1) //User analysis class
};
#endif
bool Bool_t
#define ClassDef(name, id)
virtual void InitAnalysis()
virtual void EndRun()
virtual Bool_t Analysis()
virtual void EndAnalysis()
virtual void InitRun()
Base class for analysis of reconstructed INDRA events.
#include "ExampleINDRAAnalysis.h"
#include "KVBatchSystem.h"
#include "KVINDRA.h"
ClassImp(ExampleINDRAAnalysis)
#include "KVDataAnalyser.h"
#include "KVFlowTensor.h"
void ExampleINDRAAnalysis::InitAnalysis(void)
{
// Declaration of histograms, global variables, etc.
// Called at the beginning of the analysis
// The examples given are compatible with interactive, batch,
// and PROOFLite analyses.
/*** ADDING GLOBAL VARIABLES TO THE ANALYSIS ***/
/* These will be automatically calculated for each event before
your Analysis() method will be called */
auto ztot = AddGV("KVZtot", "ztot"); // total charge
// complete event selection: total charge
ztot->SetEventSelection([&](const KVVarGlob * var) {
return var->GetValue() >= 0.8 * ztot_sys; // ztot_sys will be set in InitRun
});
auto zvtot = AddGV("KVZVtot", "zvtot"); // total Z*vpar
zvtot->SetMaxNumBranches(1); // only write "Z" component in TTree
// complete event selection: total pseudo-momentum
zvtot->SetEventSelection([&](const KVVarGlob * var) {
return var->GetValue() >= 0.8 * zvtot_sys
&& var->GetValue() <= 1.1 * zvtot_sys; // zvtot_sys will be set in InitRun
});
AddGV("KVMult", "mtot"); // total multiplicity
AddGV("KVEtransLCP", "et12"); // total LCP transverse energy
auto gv = AddGV("KVFlowTensor", "tensor");
gv->SetOption("weight", "RKE");
gv->SetFrame("CM");// optional - this is the default frame
gv->SetSelection({"Z>4", [](const KVNucleus * n)
{
return n->GetZ() > 4;
}}); // relativistic CM KE tensor for fragments
// Define ellipsoid frame (wrt axes of flow tensor ellipsoid)
gv->SetNewFrameDefinition([](KVEvent * e, const KVVarGlob * vg) {
e->SetFrame("EL", "CM", ((KVFlowTensor*)vg)->GetFlowReacPlaneRotation());
});
/*** DECLARING SOME HISTOGRAMS ***/
AddHisto<TH1F>("zdist", "Charge distribution", 100, -.5, 99.5);
AddHisto<TH2F>("zvpar", "Z vs V_{par} in ellipsoid", 100, -15., 15., 75, .5, 75.5);
/*** USING A TREE ***/
auto t = AddTree("myTree", "");
GetGVList()->MakeBranches(t); // store global variable values in branches
/*** DEFINE WHERE TO SAVE THE RESULTS ***/
SetJobOutputFileName("ExampleINDRAAnalysis_results.root");
}
//_____________________________________
void ExampleINDRAAnalysis::InitRun(void)
{
// Initialisations for each run
// Called at the beginning of each run
// You no longer need to define the correct identification/calibration codes for particles
// which will be used in your analysis, they are automatically selected using the default
// values in variables INDRA.ReconstructedNuclei.AcceptID/ECodes.
//
// You can change the selection (or deactivate it) here by doing:
// gMultiDetArray->AcceptECodes(""); => accept all calibration codes
// gMultiDetArray->AcceptIDCodes("12,33"); => accept only ID codes in list
//
// If the experiment used a combination of arrays, codes have to be set for
// each array individually:
// gMultiDetArray->GetArray("[name]")->Accept.. => setting for array [name]
// set title of TTree with name of analysed system
GetTree("myTree")->SetTitle(GetCurrentRun()->GetSystemName());
// Reject events with less identified particles than the acquisition multiplicity trigger
SetTriggerConditionsForRun(GetCurrentRun()->GetNumber());
// retrieve system parameters for complete event selection
zvtot_sys = kin->GetNucleus(1)->GetVpar() * kin->GetNucleus(1)->GetZ();
ztot_sys = GetCurrentRun()->GetSystem()->GetZtot();
}
//_____________________________________
Bool_t ExampleINDRAAnalysis::Analysis(void)
{
// Analysis method called event by event.
// The current event can be accessed by a call to method GetEvent().
// See KVINDRAReconEvent documentation for the available methods.
GetGVList()->FillBranches(); // update values of all global variable branches
/*** LOOP OVER 'OK' PARTICLES OF EVENT ***/
for (auto& particle : ReconEventOKIterator(GetEvent())) {
// "OK" => using selection criteria of InitRun()
// fill Z distribution
FillHisto("zdist", particle.GetZ());
// fill Z-Vpar(ellipsoid)
FillHisto("zvpar", particle.GetFrame("EL")->GetVpar(), particle.GetZ());
}
// write new results in TTree
return kTRUE;
}
KVDataAnalyser * gDataAnalyser
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
KVReconstructedEvent::EventOKIterator ReconEventOKIterator
#define e(i)
const Bool_t kTRUE
Relativistic binary kinematics calculator.
Definition: KV2Body.h:165
KVNucleus * GetNucleus(Int_t i) const
Definition: KV2Body.cpp:457
virtual const KV2Body * GetKinematics() const
Abstract base class container for multi-particle events.
Definition: KVEvent.h:66
Kinetic energy flow tensor of Gyulassy et al and associated shape variables.
Definition: KVFlowTensor.h:77
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:125
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:770
Double_t GetVpar() const
Definition: KVParticle.h:677
Base class for all global variable implementations.
Definition: KVVarGlob.h:231
Double_t GetValue(void) const
Definition: KVVarGlob.h:441
const Int_t n
void FillTree(TTree &myTree, const RooDataSet &data)