4 //* This file is property of and copyright by the ALICE Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
6 //* See cxx source for full Copyright notice *
8 /// @file AliDxHFEToolsMC.h
9 /// @author Hege Erdal, Matthias Richter
11 /// @brief Common Tools for MC particle selection
14 #ifndef ALIDXHFETOOLSMC_H
15 #define ALIDXHFETOOLSMC_H
27 * @class AliDxHFEToolsMC
28 * Common Tools for MC particle selection.
30 class AliDxHFEToolsMC {
33 AliDxHFEToolsMC(const char* options="");
35 virtual ~AliDxHFEToolsMC();
83 kPDGMotherLabelProton,
84 kPDGMotherLabelOthers,
111 /// initialize according to options
112 int Init(const char* /*option*/);
114 /// init MC info from event object
115 int InitMCParticles(const AliVEvent* pEvent);
117 /// Returning MC Array
118 TObjArray* GetMCArray() const {return fMCParticles;}
121 bool IsInitialized() const {return fMCParticles!=NULL;}
123 /// clear internal memory
124 virtual void Clear(const char* option="");
126 /// flag indicating to do the selection on MC first
127 bool MCFirst() const {return fSequence==kMCFirst;}
128 /// flag indicating to do the selection on MC last
129 bool MCLast() const {return fSequence==kMCLast;}
131 /// Return the result on check on initial quark
132 int GetOriginMother() const {return fOriginMother;}
134 /// check if pdg should be rejected
135 /// always false if pdg list is not initialized
136 bool RejectByPDG(AliVParticle* p, bool doStatistics=true, int* pdgParticleResult=NULL);
137 bool RejectByPDG(AliVParticle* p, int* pdgParticleResult) {
138 return RejectByPDG(p, true, pdgParticleResult);
141 /// check if pdg should be rejected by mother
142 /// always false if mother pdg list is not initialized
143 bool RejectByMotherPDG(AliVParticle* p, bool doStatistics=true);
145 /// Finds pdg of first or origin mother and returns value
146 int FindMotherPDG(AliVParticle* p, bool bReturnFirstMother=false);
148 /// step through tree and find the original mother particle
149 /// TODO: this can possibly be const, however, a member is set inside
150 /// check whether this is really necessary
151 int FindPdgOriginMother(AliVParticle* p,bool bReturnFirstMother=false);
153 // Compare pdg to quark and gluon
154 void CheckOriginMother(int pdg);
155 // Tests if particle have been marked as HF quark
156 Bool_t TestIfHFquark(int origin);
158 //Tests of pdg corresponds to HF meson
159 Bool_t TestMotherHFMeson(int pdg);
161 // Setting MC label from outside
162 void SetMClabel(int mclab){fMClabel=mclab;}
164 /// TODO: want to have this function to be private again, currently
165 /// used with an external vector
166 /// check if pdg should be rejected, particle is not rejected
167 /// if it is in the list, returns always false if list is empty
168 bool RejectByPDG(int pdg, const vector<int> &list) const;
170 int GetNrMCParticles() const {return fNrMCParticles;}
171 int CheckMCParticle(AliVParticle* p);
173 /// mapping of pdg code to enum
174 int MapPDGLabel(int pdg) const;
175 /// mapping of pdg code to enum
176 int MapPDGMotherLabel(int pdg) const;
181 /// copy contructor prohibited
182 AliDxHFEToolsMC(const AliDxHFEToolsMC&);
183 /// assignment operator prohibited
184 AliDxHFEToolsMC& operator=(const AliDxHFEToolsMC&);
186 /// create control histogram
187 TH1* CreateControlHistogram(const char* name,
190 const char** binLabels) const;
192 static const char* fgkPDGBinLabels[];
193 static const char* fgkPDGMotherBinLabels[];
194 static const char* fgkStatisticsBinLabels[];
196 int fSequence; // sequence of checks
197 TObjArray* fMCParticles; //! pointer to external array of MC particles
198 vector<int> fPDGs; // PDGs to be selected
199 vector<int> fMotherPDGs; // mother PDGs to be selected
200 TH1* fHistPDG; // control histogram pdg of selected particle
201 TH1* fHistPDGMother; // control histogram pdg of selected particle
202 int fOriginMother; // Holds the origin motherquark (process)
203 int fMClabel; // MClabel passed from outside (default =-1)
204 int fNrMCParticles; // number of MC particles
205 bool fUseKine; // For looping over stack directly
207 ClassDef(AliDxHFEToolsMC, 3);