//-------------------------------------------------------------------------
// Class AliRsnAnalysis
// Reconstruction and analysis of a binary resonance
+// ........................................
+// ........................................
+// ........................................
+// ........................................
+// ........................................
//
// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
//-------------------------------------------------------------------------
#include <TH1.h>
#include <TTree.h>
-#include <TRefArray.h>
-#include <TParticle.h>
-#include <TObjectTable.h>
#include <TDatabasePDG.h>
#include "AliRsnDaughter.h"
//--------------------------------------------------------------------------------------------------------
AliRsnAnalysis::AliRsnAnalysis()
+{
//
// Constructor
// Initializes all pointers and collections to NULL.
//
-{
fMixHistograms = 0;
fHistograms = 0;
fEventsTree = 0;
}
//--------------------------------------------------------------------------------------------------------
void AliRsnAnalysis::AddCutPair(AliRsnDaughterCut *cut)
+{
//
// Add a cut on pairs.
// This cut is global for all pairs.
//
-{
if (!cut->IsPairCut()) {
Warning("AddCutPair", "This is a single cut, cannot be added");
return;
}
//--------------------------------------------------------------------------------------------------------
void AliRsnAnalysis::AddCutSingle(AliPID::EParticleType type, AliRsnDaughterCut *cut)
+{
//
// Add a cut on single particles.
// This cut must be specified for each particle type.
//
-{
if (cut->IsPairCut()) {
Warning("AddCutSingle", "This is a pair cut, cannot be added");
return;
//--------------------------------------------------------------------------------------------------------
void AliRsnAnalysis::AddMixPairDef
(AliPID::EParticleType p1, Char_t sign1, AliPID::EParticleType p2, Char_t sign2)
+{
//
// Adds a new pair definition to create a new histogram,
// for the event mixing step.
// If the pair defs array is NULL, it is initialized here.
//
-{
if (!fMixPairDefs) fMixPairDefs = new TObjArray(0);
fMixPairDefs->AddLast( new AliPairDef(p1, sign1, p2, sign2, 0, kFALSE) );
}
//--------------------------------------------------------------------------------------------------------
void AliRsnAnalysis::AddPairDef
(AliPID::EParticleType p1, Char_t sign1, AliPID::EParticleType p2, Char_t sign2, Bool_t onlyTrue)
+{
//
// Adds a new pair definition to create a new histogram,
// for the signal evaluation (same event) step.
// If the pair defs array is NULL, it is initialized here.
//
-{
if (!fPairDefs) fPairDefs = new TObjArray(0);
fPairDefs->AddLast( new AliPairDef(p1, sign1, p2, sign2, fTrueMotherPDG, onlyTrue) );
}
//--------------------------------------------------------------------------------------------------------
void AliRsnAnalysis::Clear(Option_t* /* option */)
+{
//
// Clear heap
//
-{
fHistograms->Clear("C");
fPairDefs->Clear("C");
}
//--------------------------------------------------------------------------------------------------------
Stat_t AliRsnAnalysis::EventMix(Int_t nmix, Int_t multDiffMax, Double_t vzDiffMax, Bool_t compareTotMult)
+{
//
// Performs event mixing.
// It takes the array of fMixPairDefs and stores results in fMixHistograms.
// analysis->AddMixPairDef(AliRsnEvent::kPion, '+', AliRsnEvent::kKaon, '-');
// analysis->AddMixPairDef(AliRsnEvent::kKaon, '-', AliRsnEvent::kPion, '+');
//
-{
// allocate the histograms array
Int_t i, npairdefs = (Int_t)fMixPairDefs->GetEntries();
fMixHistograms = new TObjArray(npairdefs);
}
//--------------------------------------------------------------------------------------------------------
Stat_t AliRsnAnalysis::Process()
+{
//
// Reads the list 'fPairDefs', and builds an inv-mass histogram for each definition.
// For each event, particle of 'type 1' are combined with particles of 'type 2' as
// It can also be used when one wants to evaluate the 'background' with the 'wrong sign'
// particle pairs.
//
-{
// allocate the histograms array in order to contain
// as many objects as the number of pair definitionss
Int_t i, npairdefs = (Int_t)fPairDefs->GetEntries();
return nPairs;
}
//--------------------------------------------------------------------------------------------------------
-void AliRsnAnalysis::WriteHistograms()
+void AliRsnAnalysis::WriteHistograms() const
+{
//
// Writes histograms in current directory
//
-{
TH1D *histogram;
TObjArrayIter iter(fHistograms);
while ( (histogram = (TH1D*)iter.Next()) ) {
//--------------------------------------------------------------------------------------------------------
Stat_t AliRsnAnalysis::Compute
(AliPairDef *pd, TH1D* &histogram, AliRsnEvent *event1, AliRsnEvent *event2)
+{
//
// Adds to the specified histogram the invariant mass spectrum calculated taking
// particles of type 1 from event 1, and particles of type 2 from event 2.
// Events can be equal (signal) or different (background with event mixing).
//
-{
// define two 'cursor' objects
AliRsnDaughter *track1 = 0, *track2 = 0;
// total 4-momentum
track1->SetMass(pd->GetMass1());
track2->SetMass(pd->GetMass2());
- AliRsnDaughter sum = (*track1) + (*track2);
+ AliRsnDaughter sum = AliRsnDaughter::Sum(*track1, *track2);
// if the choice to get ONLY true pairs is selected, a check is made on the mothers
if (pd->GetOnlyTrue()) {
return nPairs;
}
//--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnAnalysis::SingleCutCheck(Int_t itype, AliRsnDaughter *track)
+Bool_t AliRsnAnalysis::SingleCutCheck(Int_t itype, AliRsnDaughter *track) const
+{
//
// Checks a track against single particle cuts (if defined)
//
-{
if (!fCuts[itype]) return kTRUE;
TObjArrayIter iter(fCuts[itype]);
return kTRUE;
}
//--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnAnalysis::PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *track2)
+Bool_t AliRsnAnalysis::PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *track2) const
+{
//
// Checks a pair against pair cuts (if defined)
//
-{
if (!fPairCuts) return kTRUE;
TObjArrayIter iter(fPairCuts);
AliRsnAnalysis::AliPairDef::AliPairDef
(AliPID::EParticleType p1, Char_t sign1,
AliPID::EParticleType p2, Char_t sign2, Int_t pdgMother, Bool_t onlyTrue)
+{
//
// Constructor for nested class
//
-{
fOnlyTrue = onlyTrue;
fTrueMotherPDG = 0;
if (fOnlyTrue) fTrueMotherPDG = pdgMother;
}
}
//--------------------------------------------------------------------------------------------------------
-Text_t* AliRsnAnalysis::AliPairDef::ParticleName(AliPID::EParticleType part)
+Text_t* AliRsnAnalysis::AliPairDef::ParticleName(AliPID::EParticleType part) const
+{
//
// [PRIVATE]
// Returns the name of the particle in text format
//
-{
if (part == AliPID::kElectron) return ("E");
else if (part == AliPID::kMuon) return ("Mu");
else if (part == AliPID::kPion) return ("Pi");
//-------------------------------------------------------------------------
// Class AliRsnAnalysis
// Reconstruction and analysis of K* Rsn
+// ........................................
+// ........................................
+// ........................................
+// ........................................
//
// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
//-------------------------------------------------------------------------
public:
AliRsnAnalysis();
+ AliRsnAnalysis(const AliRsnAnalysis ©) : TObject(copy) { }
+ AliRsnAnalysis& operator=(const AliRsnAnalysis & /*copy*/) { return (*this); }
virtual ~AliRsnAnalysis() {Clear();}
void AddCutPair(AliRsnDaughterCut *cut);
void SetEventsTree(TTree *tree) {fEventsTree = tree;}
void SetRejectFakes(Bool_t doit=kTRUE) {fRejectFakes = doit;}
void SetTrueMotherPDG(Int_t pdg) {fTrueMotherPDG = pdg;}
- void WriteHistograms();
+ void WriteHistograms() const;
private:
virtual ~AliPairDef() { }
- Char_t GetSign1() {return fSign1;}
- Char_t GetSign2() {return fSign2;}
- Bool_t GetOnlyTrue() {return fOnlyTrue;}
- AliPID::EParticleType GetParticle1() {return fParticle1;}
- AliPID::EParticleType GetParticle2() {return fParticle2;}
- Double_t GetMass1() {return fMass1;}
- Double_t GetMass2() {return fMass2;}
+ Char_t GetSign1() const {return fSign1;}
+ Char_t GetSign2() const {return fSign2;}
+ Bool_t GetOnlyTrue() const {return fOnlyTrue;}
+ AliPID::EParticleType GetParticle1() const {return fParticle1;}
+ AliPID::EParticleType GetParticle2() const {return fParticle2;}
+ Double_t GetMass1() const {return fMass1;}
+ Double_t GetMass2() const {return fMass2;}
void SetSign1(Char_t value) {fSign1 = value;}
void SetSign2(Char_t value) {fSign2 = value;}
void SetParticle1(AliPID::EParticleType p) {fParticle1 = p;}
void SetParticle2(AliPID::EParticleType p) {fParticle2 = p;}
- Text_t* ParticleName(AliPID::EParticleType part);
+ Text_t* ParticleName(AliPID::EParticleType part) const;
private:
Bool_t fOnlyTrue; // flag to be used for spectra of true pairs
Int_t fTrueMotherPDG; // PDG code of true mother (if requested)
- Double_t fMass1; //
- Char_t fSign1; // info about particle 1
- AliPID::EParticleType fParticle1; //
+ Double_t fMass1; // info
+ Char_t fSign1; // about
+ AliPID::EParticleType fParticle1; // particle 1
- Double_t fMass2; //
- Char_t fSign2; // info about particle 2
- AliPID::EParticleType fParticle2; //
+ Double_t fMass2; // info
+ Char_t fSign2; // about
+ AliPID::EParticleType fParticle2; // particle 2
};
Stat_t Compute(AliPairDef *pd, TH1D* &h, AliRsnEvent *ev1, AliRsnEvent *ev2);
- Bool_t SingleCutCheck(Int_t itype, AliRsnDaughter *track);
- Bool_t PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *track2);
+ Bool_t SingleCutCheck(Int_t itype, AliRsnDaughter *track) const;
+ Bool_t PairCutCheck(AliRsnDaughter *track1, AliRsnDaughter *track2) const;
Bool_t fRejectFakes; // reject particles labeled as fake
//-------------------------------------------------------------------------
// Class AliRsnDaughter
-//
+// ----------------------
// A simple object which describes a reconstructed track
// with some references to its related generated particle
// and some facilities which could help in composing its
#include <Riostream.h>
#include <TParticle.h>
-#include <TParticlePDG.h>
#include "AliESDtrack.h"
#include "AliRsnDaughter.h"
//--------------------------------------------------------------------------------------------------------
AliRsnDaughter::AliRsnDaughter()
+{
//
// Default constructor.
// Its unique argument defines how many PID weights are allowed.
// Actually, it should be the same as AliESDtrack::kSPECIES (=5).
-//
-{
+//
fSign = (Char_t)0;
fPDG = (UShort_t)0;
fIndex = (UShort_t)0;
}
//--------------------------------------------------------------------------------------------------------
AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter ©) : TObject(copy)
+{
//
// Copy constructor
//
-{
fSign = copy.fSign;
fPDG = copy.fPDG;
fIndex = copy.fIndex;
}
//--------------------------------------------------------------------------------------------------------
Bool_t AliRsnDaughter::Adopt(const AliESDtrack* esdTrack, Bool_t checkITSRefit)
+{
//
// Copies reconstructed data from an AliESDtrack:
//
// - if the passed label is negative, track is considered as "fake", and
// this info is kept to allow fake tracks exclusion when doing analysis
//
-{
// check for refit in the ITS (if requested)
if (checkITSRefit) {
if ( !(esdTrack->GetStatus() & AliESDtrack::kITSrefit) ) {
}
//--------------------------------------------------------------------------------------------------------
Bool_t AliRsnDaughter::Adopt(TParticle* particle)
+{
//
// Copies data from a generated particle:
//
// When an AliRsnDaughter is copied from a TParticle, it is
// considered always good for analysis and never fake.
//
-{
// get particle sign form the sign of PDG code
Int_t pdg = particle->GetPdgCode();
if (TMath::Abs(pdg) < 20) {
return kTRUE;
}
//--------------------------------------------------------------------------------------------------------
-AliRsnDaughter operator+(AliRsnDaughter t1, AliRsnDaughter t2)
+AliRsnDaughter AliRsnDaughter::Sum(AliRsnDaughter t1, AliRsnDaughter t2)
+{
//
-// Sum operator overloading.
// Builds a new AliRsnDaughter object with the sum of momenta of two particles.
//
-{
// create new AliRsnDaughter with default useless values for datamembers
AliRsnDaughter out;
}
// compute total 4-momentum
- Double_t Etot = t1.GetEnergy() + t2.GetEnergy();
+ Double_t etot = t1.GetEnergy() + t2.GetEnergy();
Double_t pxTot = t1.GetPx() + t2.GetPx();
Double_t pyTot = t1.GetPy() + t2.GetPy();
Double_t pzTot = t1.GetPz() + t2.GetPz();
- Double_t mass = TMath::Sqrt(Etot*Etot - pxTot*pxTot - pyTot*pyTot - pzTot*pzTot);
+ Double_t mass = TMath::Sqrt(etot*etot - pxTot*pxTot - pyTot*pyTot - pzTot*pzTot);
//TLorentzVector v1 = track1.Get4Momentum();
//TLorentzVector v2 = track2.Get4Momentum();
#include "AliPID.h"
#include <TVector3.h>
-#include <TParticle.h>
#include <TLorentzVector.h>
+class TParticle;
class AliESDtrack;
class AliRsnDaughter : public TObject
void SetTruePDG(Short_t pdg) {fTruePDG = pdg;}
void SetVxVyVz(Double_t vx,Double_t vy,Double_t vz) {fV[0]=vx;fV[1]=vy;fV[2]=vz;}
- friend AliRsnDaughter operator+(AliRsnDaughter t1, AliRsnDaughter t2);
+ static AliRsnDaughter Sum(AliRsnDaughter t1, AliRsnDaughter t2);
private:
//-------------------------------------------------------------------------
// Class AliRsnDaughterCut
-//
+// -------------------------
// Implementation of track cuts for analysis.
+// These cuts must be added to the AliRsnAnalysis
+// object in order to make cut on single particles
+// or on pairs of particles.
//
// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
//-------------------------------------------------------------------------
ClassImp(AliRsnDaughterCut)
//--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnDaughterCut::Pass(AliRsnDaughter* /*track1*/, AliRsnDaughter* /*track2*/)
+Bool_t AliRsnDaughterCut::Pass(AliRsnDaughter* /*track1*/, AliRsnDaughter* /*track2*/) const
+{
//
// Virtual method for cut passing.
// This function must be overridden and return kTRUE when cut is passed.
-//
-{
+//
TObject::Error("Pass", "This method must be overridden!");
return kFALSE;
}
//--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnDaughterCutPtSingle::Pass(AliRsnDaughter *track1, AliRsnDaughter* /*track2*/)
+Bool_t AliRsnDaughterCutPtSingle::Pass(AliRsnDaughter *track1, AliRsnDaughter* /*track2*/) const
+{
//
// Cut on single track momentum.
//
-{
if (!track1) return kFALSE;
if (track1->GetPt() < fPtMin) return kFALSE;
if (track1->GetPt() > fPtMax) return kFALSE;
return kTRUE;
}
//--------------------------------------------------------------------------------------------------------
-Bool_t AliRsnDaughterCutPtPair::Pass(AliRsnDaughter *track1, AliRsnDaughter *track2)
+Bool_t AliRsnDaughterCutPtPair::Pass(AliRsnDaughter *track1, AliRsnDaughter *track2) const
+{
//
// Cut on single track momentum.
-//
-{
+//
if (!track1 || !track2) return kFALSE;
- AliRsnDaughter sum = (*track1) + (*track2);
+ AliRsnDaughter sum = AliRsnDaughter::Sum(*track1, *track2);
if (sum.GetPt() < fPtMin) return kFALSE;
if (sum.GetPt() > fPtMax) return kFALSE;
AliRsnDaughterCut() { }
virtual ~AliRsnDaughterCut() { }
- Bool_t IsPairCut() {return fPairCut;}
- virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2 = 0);
+ Bool_t IsPairCut() const {return fPairCut;}
+ virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2 = 0) const;
protected:
- Bool_t fPairCut;
+ Bool_t fPairCut; // this flag is TRUE for all pair cuts
ClassDef(AliRsnDaughterCut,1)
};
AliRsnDaughterCutPtSingle(Double_t min, Double_t max) {fPairCut=kFALSE;fPtMin=min;fPtMax=max;}
virtual ~AliRsnDaughterCutPtSingle() { }
- virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2 = 0);
+ virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2 = 0) const;
protected:
AliRsnDaughterCutPtPair(Double_t min, Double_t max) {fPairCut=kTRUE;fPtMin=min;fPtMax=max;}
virtual ~AliRsnDaughterCutPtPair() { }
- virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2);
+ virtual Bool_t Pass(AliRsnDaughter *track1, AliRsnDaughter *track2) const;
protected:
//-------------------------------------------------------------------------
// Class AliRsnEvent
-// Simple collection of reconstructed tracks, selected from an ESD event
+// -------------------
+// Simple collection of reconstructed tracks
+// selected from an ESD event
+// to be used for analysis.
+// .........................................
//
// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
//-------------------------------------------------------------------------
#include <Riostream.h>
-#include <TTree.h>
#include <TString.h>
-#include <TParticle.h>
#include <TObjArray.h>
-#include <TRefArray.h>
#include <TClonesArray.h>
-#include "AliESD.h"
-#include "AliStack.h"
-#include "AliESDtrack.h"
#include "AliRsnDaughter.h"
#include "AliRsnEvent.h"
fPVy(0.0),
fPVz(0.0),
fMultiplicity(-1)
+{
//
// Default constructor
//
-{
Int_t i;
for (i = 0; i < AliPID::kSPECIES; i++) {
fPos[i] = NULL;
fPVy(event.fPVy),
fPVz(event.fPVz),
fMultiplicity(event.fMultiplicity)
+{
//
// Copy constructor.
// Creates new instances of all collections to store a copy of all objects.
//
+ // clone tracks collections
+ Int_t i;
+ for (i = 0; i < AliPID::kSPECIES; i++) {
+ fPos[i] = 0;
+ fNeg[i] = 0;
+ if (event.fPos[i]) fPos[i] = (TClonesArray*)event.fPos[i]->Clone();
+ if (event.fNeg[i]) fNeg[i] = (TClonesArray*)event.fNeg[i]->Clone();
+ }
+}
+AliRsnEvent& AliRsnEvent::operator=(const AliRsnEvent &event)
{
+//
+// Assignment operator.
+// Creates new instances of all collections to store a copy of all objects.
+//
+ fIsESD = event.fIsESD;
+ fPath = event.fPath;
+ fPVx = event.fPVx;
+ fPVy = event.fPVy;
+ fPVz = event.fPVz;
+ fMultiplicity = event.fMultiplicity;
+
// clone tracks collections
Int_t i;
for (i = 0; i < AliPID::kSPECIES; i++) {
if (event.fPos[i]) fPos[i] = (TClonesArray*)event.fPos[i]->Clone();
if (event.fNeg[i]) fNeg[i] = (TClonesArray*)event.fNeg[i]->Clone();
}
+
+ return (*this);
}
-//--------------------------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------------------------//--------------------------------------------------------------------------------------------------------
void AliRsnEvent::AddTrack(AliRsnDaughter track)
+{
//
// Stores a track into the correct array
//
-{
Int_t pdg, sign, ifirst, ilast;
// if sign is zero, track is not stored
}
//--------------------------------------------------------------------------------------------------------
void AliRsnEvent::Clear(Option_t *option)
+{
//
// Clears list of tracks and references.
// If the string "DELETE" is specified, the collection classes
// are also cleared from heap.
//
-{
// evaluate option
TString opt(option);
Bool_t deleteCollections = opt.Contains("DELETE", TString::kIgnoreCase);
}
//--------------------------------------------------------------------------------------------------------
Int_t AliRsnEvent::GetMultiplicity(Bool_t recalc)
+{
//
// Computes multiplicity.
// If it is already computed (fMultiplicity > -1), it returns that value,
// unless one sets the argument to kTRUE.
//
-{
if (fMultiplicity < 0) recalc = kTRUE;
if (recalc) {
fMultiplicity = 0;
return fMultiplicity;
}
//--------------------------------------------------------------------------------------------------------
-const char * AliRsnEvent::GetOriginFileName()
+const char * AliRsnEvent::GetOriginFileName() const
+{
//
// Returns the path where input file was stored
//
-{
TString str(fPath);
if (fIsESD) {
str.Append("/AliESDs.root");
}
//--------------------------------------------------------------------------------------------------------
TClonesArray* AliRsnEvent::GetTracks(Char_t sign, AliPID::EParticleType type)
+{
//
// Returns the particle collection specified in argument
//
-{
Int_t itype = (Int_t)type;
if (itype >= 0 && itype < AliPID::kSPECIES) {
if (sign == '+') return fPos[type]; else return fNeg[type];
}
//--------------------------------------------------------------------------------------------------------
void AliRsnEvent::Init()
+{
//
// Action 1: define default values for some data members (including pointers).
// Action 2: if 'ntracks' > 0 allocates memory to store tracks.
//
-{
Int_t i;
for (i = 0; i < AliPID::kSPECIES; i++) {
fPos[i] = new TClonesArray("AliRsnDaughter", 0);
}
//--------------------------------------------------------------------------------------------------------
Int_t AliRsnEvent::PDG2Enum(Int_t pdgcode)
+{
//
// Converts a PDG code into the correct slot in the EParticleType enumeration in AliPID
//
-{
Int_t i;
for (i = 0; i < AliPID::kSPECIES; i++) {
if (AliPID::ParticleCode((AliPID::EParticleType)i) == TMath::Abs(pdgcode)) {
}
//--------------------------------------------------------------------------------------------------------
void AliRsnEvent::PrintTracks()
+{
//
// Print data for particles stored in this event
//
-{
cout << endl;
AliRsnDaughter *track = 0;
#ifndef ALIRSNEVENT_H
#define ALIRSNEVENT_H
-#include <TMath.h>
#include "AliPID.h"
class AliRsnDaughter;
public:
AliRsnEvent();
AliRsnEvent(const AliRsnEvent& copy);
+ AliRsnEvent& operator=(const AliRsnEvent& copy);
virtual ~AliRsnEvent() {Clear("DELETE");}
void AddTrack(AliRsnDaughter track);
void Clear(Option_t *option = "");
Int_t GetMultiplicity(Bool_t recalc = kFALSE);
- const char* GetOriginFileName();
- Double_t GetPrimaryVertexX() {return fPVx;}
- Double_t GetPrimaryVertexY() {return fPVy;}
- Double_t GetPrimaryVertexZ() {return fPVz;}
- void GetPrimaryVertex(Double_t &x, Double_t &y, Double_t &z) {x=fPVx;y=fPVy;z=fPVz;}
+ const char* GetOriginFileName() const;
+ Double_t GetPrimaryVertexX() const {return fPVx;}
+ Double_t GetPrimaryVertexY() const {return fPVy;}
+ Double_t GetPrimaryVertexZ() const {return fPVz;}
+ void GetPrimaryVertex(Double_t &x, Double_t &y, Double_t &z) const {x=fPVx;y=fPVy;z=fPVz;}
TClonesArray* GetTracks(Char_t sign, AliPID::EParticleType type);
void Init();
Int_t PDG2Enum(Int_t pdgcode);
void PrintTracks();
- void SetESD(Bool_t yesno = kTRUE) {fIsESD=yesno;}
- void SetPath(TString path) {fPath=path;}
- void SetPrimaryVertex(Double_t x, Double_t y, Double_t z) {fPVx=x;fPVy=y;fPVz=z;}
+ void SetESD(Bool_t yesno = kTRUE) {fIsESD=yesno;}
+ void SetPath(TString path) {fPath=path;}
+ void SetPrimaryVertex(Double_t x, Double_t y, Double_t z) {fPVx=x;fPVy=y;fPVz=z;}
private:
Bool_t fIsESD; // if true, it is ESD event, otherwise it comes from Kine
TString fPath; // complete path where input event file is stored
- Double_t fPVx; //
- Double_t fPVy; // primary vertex
- Double_t fPVz; //
+ Double_t fPVx; // position of
+ Double_t fPVy; // primary
+ Double_t fPVz; // vertex
Int_t fMultiplicity; // global event multiplicity
// Class AliRsnReader
//
// Reader for conversion of ESD or Kinematics output into AliRsnEvent
+// .....
+// .....
+// .....
+// .....
+// .....
+// .....
+// .....
//
// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
//-------------------------------------------------------------------------
#include <TH1.h>
#include <TH3.h>
#include <TFile.h>
-#include <TChain.h>
+#include <TTree.h>
#include <TArrayF.h>
#include <TParticle.h>
#include <TRandom.h>
-#include <TObjString.h>
-#include <TObjectTable.h>
-#include <TOrdCollection.h>
#include "AliRun.h"
#include "AliESD.h"
#include "AliHeader.h"
#include "AliESDtrack.h"
#include "AliRunLoader.h"
-#include "AliGenEventHeader.h"
#include "AliGenPythiaEventHeader.h"
#include "AliRsnDaughter.h"
//--------------------------------------------------------------------------------------------------------
AliRsnReader::AliRsnReader()
+{
//
// Constructor.
// Initializes all working parameters to default values:
// - rejection of non-ITS-refitted tracks
// - maximum distance allowed from primary vertex = 3.0 cm (beam pipe)
//
-{
fPIDMethod = kESDPID;
Int_t i;
for (i = 0; i < AliPID::kSPECIES; i++) fPrior[i] = 1.0;
}
//--------------------------------------------------------------------------------------------------------
AliRsnReader::AliRsnReader(const AliRsnReader ©) : TObject(copy)
+{
//
// Copy constructor.
// Initializes all working parameters to same values of another simlar object.
// TTree data member is not created.
//
+ fPIDMethod = copy.fPIDMethod;
+ Int_t i;
+ for (i = 0; i < AliPID::kSPECIES; i++) fPrior[i] = copy.fPrior[i];
+ fPtLimit4PID = copy.fPtLimit4PID;
+ fProbThreshold = copy.fProbThreshold;
+ fMaxRadius = copy.fMaxRadius;
+
+ fEvents = 0;
+ for (i = AliPID::kElectron; i <= AliPID::kProton; i++) {
+ fEffPos[i] = copy.fEffPos[i];
+ fEffNeg[i] = copy.fEffNeg[i];
+ }
+
+ fResPt = copy.fResPt;
+ fResLambda = copy.fResLambda;
+ fResPhi = copy.fResPhi;
+}
+//--------------------------------------------------------------------------------------------------------
+AliRsnReader& AliRsnReader::operator=(const AliRsnReader ©)
{
+//
+// Assignment operator.
+// Initializes all working parameters to same values of another simlar object.
+// TTree data member is not created.
+//
fPIDMethod = copy.fPIDMethod;
Int_t i;
for (i = 0; i < AliPID::kSPECIES; i++) fPrior[i] = copy.fPrior[i];
fResPt = copy.fResPt;
fResLambda = copy.fResLambda;
fResPhi = copy.fResPhi;
+
+ return (*this);
}
//--------------------------------------------------------------------------------------------------------
void AliRsnReader::Clear(Option_t *option)
+{
//
// Clear collection of filenames.
// If requested with the option "DELETELIST",
// the collection object is also deleted.
//
-{
TString opt(option);
if (!opt.CompareTo("TREE", TString::kIgnoreCase)) {
}
//--------------------------------------------------------------------------------------------------------
Bool_t AliRsnReader::EffSim(Int_t pdg, Double_t pt, Double_t eta, Double_t z)
+{
//
// If efficiency histogram are present, they are used to simulate efficiency.
// Pt, Eta and Z are used to find reconstruction efficiency value to be used
// An extraction is done, and it is supposed that particle must be accepted
// only when this function retunrs kTRUE (= successful extraction).
//
-{
// find particle sign from PDG code
Int_t sign;
if (TMath::Abs(pdg) >= 211) {
return (ran <= ref);
}
//--------------------------------------------------------------------------------------------------------
-Double_t* AliRsnReader::GetPIDprobabilities(AliRsnDaughter track)
+Double_t* AliRsnReader::GetPIDprobabilities(AliRsnDaughter track) const
+{
//
// Computes PID probabilites starting from priors and weights
//
-{
Double_t *prob = new Double_t[AliPID::kSPECIES];
Int_t i;
}
//--------------------------------------------------------------------------------------------------------
void AliRsnReader::Identify(AliRsnDaughter &track)
+{
//
// Identifies a track according to method selected
//
-{
Bool_t doESDPID = (fPIDMethod == kESDPID);
Bool_t keepRecSign = (fPIDMethod == kPerfectPIDwithRecSign);
}
//--------------------------------------------------------------------------------------------------------
TTree* AliRsnReader::ReadParticles(const char *path, Option_t *option)
+{
//
// Opens the file "galice.root" and kinematics in the path specified,
// loads Kinematics informations and fills and AliRsnEvent object
// - "E" --> do efficiency simulation
// - "P" --> do momentum smearing
//
-{
fPIDMethod = kPerfectPID;
TTree *events = new TTree("selection", "AliRsnEvents");
}
//--------------------------------------------------------------------------------------------------------
TTree* AliRsnReader::ReadTracks(const char *path, Option_t *option)
+{
//
// Reads AliESD in a given path, with and "experimental" method.
// When using this method, no Kinematics information is assumed
// - "R" : reject tracks which do not have the flag "kITSRefit" set to TRUE
// - "F" : reject 'fake' tracks (negative label)
//
-{
fPIDMethod = kESDPID;
TTree *events = new TTree("selection", "AliRsnEvents");
}
//--------------------------------------------------------------------------------------------------------
TTree* AliRsnReader::ReadTracksAndParticles(const char *path, Option_t *option)
+{
//
// Reads AliESD in a given path, getting also informations from Kinematics.
// In this case, the PID method used is the one selected with apposite setter.
// - "F" : reject 'fake' tracks (negative label)
// - "M" : use 'true' momentum instead of reconstructed one
//
-{
TTree *events = new TTree("selection", "AliRsnEvents");
TTree::SetBranchStyle(1);
AliRsnEvent *event = new AliRsnEvent;
}
//--------------------------------------------------------------------------------------------------------
void AliRsnReader::SetEfficiencyHistogram(AliPID::EParticleType type, TH3D *h, Bool_t pos)
+{
//
// Sets efficiency histogram for a given particle species.
// If third argument is "true", histo is assigned to positive particles,
// otherwise it is assigned to negative particles.
//
-{
if (type >= AliPID::kElectron && type < AliPID::kPhoton) {
if (pos) fEffPos[type] = h; else fEffNeg[type] = h;
}
}
//--------------------------------------------------------------------------------------------------------
void AliRsnReader::SetPriorProbabilities(Double_t *prior)
+{
//
// Set prior probabilities to be used in case of ESD PID.
//
-{
if (!prior) return;
Int_t i = 0;
}
//--------------------------------------------------------------------------------------------------------
void AliRsnReader::SetPriorProbability(AliPID::EParticleType type, Double_t value)
+{
//
// Sets prior probability referred to a single particle species.
//
-{
if (type >= AliPID::kElectron && type < AliPID::kPhoton) fPrior[type] = value;
}
//--------------------------------------------------------------------------------------------------------
void AliRsnReader::SmearMomentum(Double_t &px, Double_t &py, Double_t &pz)
+{
//
// Use resolution histograms to do smearing of momentum
// (to introduce reconstruction effects)
//
-{
Double_t pt = TMath::Sqrt(px*px + py*py);
Double_t lambda = TMath::ATan2(pz, pt);
Double_t phi = TMath::ATan2(py, px);
}
//--------------------------------------------------------------------------------------------------------
AliPID::EParticleType AliRsnReader::FindType(Int_t pdg)
+{
//
// Finds the enum value corresponding to a PDG code
//
-{
pdg = TMath::Abs(pdg);
switch (pdg) {
case 11: return AliPID::kElectron; break;
}
//--------------------------------------------------------------------------------------------------------
AliRunLoader* AliRsnReader::OpenRunLoader(const char *path)
+{
//
// Open the Run loader with events in a given path
//
-{
// clear gALICE
if (gAlice) {
delete gAlice;
// Class AliRsnEventReader
//
// Reader for conversion of ESD or Kinematics output into AliRsnEvent
+// .....
+// .....
+// .....
+// .....
//
// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
//-------------------------------------------------------------------------
AliRsnReader();
AliRsnReader(const AliRsnReader& copy);
+ AliRsnReader& operator=(const AliRsnReader& copy);
virtual ~AliRsnReader() {Clear("DELTREE");}
void Clear(Option_t *option = "");
Bool_t EffSim(Int_t pdg, Double_t pt, Double_t eta, Double_t z);
TTree* GetEvents() const {return fEvents;}
- Double_t* GetPIDprobabilities(AliRsnDaughter track);
+ Double_t* GetPIDprobabilities(AliRsnDaughter track) const;
void Identify(AliRsnDaughter &track);
TTree* ReadParticles(const char *path, Option_t *option="");
TTree* ReadTracks(const char *path, Option_t *option="R");