3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
6 //_________________________________________________________________________
7 // Class for PID selection with calorimeters
8 // The Output of the main method GetIdentifiedParticleType is a PDG number identifying the cluster,
9 // being kPhoton, kElectron, kPi0 ... as defined in the header file
10 // - GetIdentifiedParticleType(const AliVCluster * cluster)
11 // Assignes a PID tag to the cluster, right now there is the possibility to : use bayesian weights from reco,
12 // recalculate them (EMCAL) or use other procedures not used in reco.
13 // In order to recalculate Bayesian, it is necessary to load the EMCALUtils library
14 // and do SwitchOnBayesianRecalculation().
15 // To change the PID parameters from Low to High like the ones by default, use the constructor
17 // where flux is AliCaloPID::kLow or AliCaloPID::kHigh
18 // If it is necessary to change the parameters use the constructor
19 // AliCaloPID(AliEMCALPIDUtils *utils) and set the parameters before.
21 // - GetGetIdentifiedParticleTypeFromBayesian(const Double_t * pid, const Float_t energy)
22 // Reads the PID weights array of the ESDs and depending on its magnitude identifies the particle,
23 // executed when bayesian is ON by GetIdentifiedParticleType(const AliVCluster * cluster)
24 // - SetPIDBits: Simple PID, depending on the thresholds fLOCut fTOFCut and even the
25 // result of the PID bayesian a different PID bit is set.
28 //*-- Author: Gustavo Conesa (INFN-LNF)
30 // --- ROOT system ---
33 class TLorentzVector ;
38 //--- AliRoot system ---
41 class AliAODPWG4Particle;
42 class AliEMCALPIDUtils;
43 class AliCalorimeterUtils;
46 class AliCaloPID : public TObject {
50 AliCaloPID() ; // ctor
51 AliCaloPID(const Int_t particleFlux) ; // ctor, to be used when recalculating bayesian PID
52 AliCaloPID(const TNamed * emcalpid) ; // ctor, to be used when recalculating bayesian PID and need different parameters
53 virtual ~AliCaloPID() ;//virtual dtor
62 kNeutralHadron = 2112,
64 kNeutralUnknown = 130,
68 enum TagType {kPi0Decay, kEtaDecay, kOtherDecay, kConversion, kNoTag = -1};
72 TList * GetCreateOutputObjects();
74 void InitParameters();
76 Bool_t IsInPi0SplitAsymmetryRange(const Float_t energy, const Float_t asy, const Int_t nlm);
78 Bool_t IsInPi0SplitMassRange (const Float_t energy, const Float_t mass, const Int_t nlm);
80 Bool_t IsInPi0M02Range (const Float_t energy, const Float_t m02, const Int_t nlm);
81 Bool_t IsInEtaM02Range (const Float_t energy, const Float_t m02, const Int_t nlm);
82 Bool_t IsInConM02Range (const Float_t energy, const Float_t m02, const Int_t nlm);
85 Int_t GetIdentifiedParticleTypeFromBayesWeights(const Bool_t isEMCAL, const Double_t * pid, const Float_t energy) ;
87 Int_t GetIdentifiedParticleTypeFromClusterSplitting(AliVCluster * cluster, AliVCaloCells* cells,
88 AliCalorimeterUtils * caloutils,
90 Int_t & nLocMax, Double_t & mass, Double_t & angle,
91 Double_t & e1 , Double_t & e2 ) ;
93 Int_t GetIdentifiedParticleType(const AliVCluster * cluster) ;
95 TString GetPIDParametersList();
97 Bool_t IsTrackMatched(AliVCluster * cluster, AliCalorimeterUtils* cu, AliVEvent* event) const ;
99 void SetPIDBits(AliVCluster * cluster, AliAODPWG4Particle *aodph,
100 AliCalorimeterUtils* cu, AliVEvent* event);
102 void Print(const Option_t * opt)const;
104 void PrintClusterPIDWeights(const Double_t * pid) const;
106 //Check if cluster photon-like. Uses photon cluster parameterization in real pp data
107 //Returns distance in sigmas. Recommended cut 2.5
108 Float_t TestPHOSDispersion(const Double_t pt, const Double_t m20, const Double_t m02) const ;
109 //Checks distance to the closest track. Takes into account
110 //non-perpendicular incidence of tracks.
111 Float_t TestPHOSChargedVeto(const Double_t dx, const Double_t dz, const Double_t ptTrack,
112 const Int_t chargeTrack, const Double_t mf) const ;
116 void SetDebug(Int_t deb) { fDebug = deb ; }
117 Int_t GetDebug() const { return fDebug ; }
119 enum eventType{kLow,kHigh};
120 void SetLowParticleFlux() { fParticleFlux = kLow ; }
121 void SetHighParticleFlux() { fParticleFlux = kHigh ; }
122 // not really used, only for bayesian recalculation in EMCAL, but could be useful in future
126 void SwitchOnBayesian() { fUseBayesianWeights = kTRUE ; }
127 void SwitchOffBayesian() { fUseBayesianWeights = kFALSE; }
128 void SwitchOnBayesianRecalculation() { fRecalculateBayesian = kTRUE ; fUseBayesianWeights = kTRUE ;} // EMCAL
129 void SwitchOffBayesianRecalculation() { fRecalculateBayesian = kFALSE; } // EMCAL
131 AliEMCALPIDUtils * GetEMCALPIDUtils() ;
134 Float_t GetEMCALPhotonWeight() const { return fEMCALPhotonWeight ; }
135 Float_t GetEMCALPi0Weight() const { return fEMCALPi0Weight ; }
136 Float_t GetEMCALElectronWeight() const { return fEMCALElectronWeight ; }
137 Float_t GetEMCALChargeWeight() const { return fEMCALChargeWeight ; }
138 Float_t GetEMCALNeutralWeight() const { return fEMCALNeutralWeight ; }
139 Float_t GetPHOSPhotonWeight() const { return fPHOSPhotonWeight ; }
140 Float_t GetPHOSPi0Weight() const { return fPHOSPi0Weight ; }
141 Float_t GetPHOSElectronWeight() const { return fPHOSElectronWeight ; }
142 Float_t GetPHOSChargeWeight() const { return fPHOSChargeWeight ; }
143 Float_t GetPHOSNeutralWeight() const { return fPHOSNeutralWeight ; }
145 Bool_t IsPHOSPIDWeightFormulaOn() const { return fPHOSWeightFormula ; }
147 TFormula * GetPHOSPhotonWeightFormula() {
148 if(!fPHOSPhotonWeightFormula)
149 fPHOSPhotonWeightFormula = new TFormula("phos_photon_weight",
150 fPHOSPhotonWeightFormulaExpression);
151 return fPHOSPhotonWeightFormula ; }
153 TFormula * GetPHOSPi0WeightFormula() {
154 if(!fPHOSPi0WeightFormula)
155 fPHOSPi0WeightFormula = new TFormula("phos_pi0_weight",
156 fPHOSPi0WeightFormulaExpression);
157 return fPHOSPi0WeightFormula ; }
159 TString GetPHOSPhotonWeightFormulaExpression() const { return fPHOSPhotonWeightFormulaExpression ; }
160 TString GetPHOSPi0WeightFormulaExpression() const { return fPHOSPi0WeightFormulaExpression ; }
163 void SetEMCALPhotonWeight (Float_t w) { fEMCALPhotonWeight = w ; }
164 void SetEMCALPi0Weight (Float_t w) { fEMCALPi0Weight = w ; }
165 void SetEMCALElectronWeight(Float_t w) { fEMCALElectronWeight = w ; }
166 void SetEMCALChargeWeight (Float_t w) { fEMCALChargeWeight = w ; }
167 void SetEMCALNeutralWeight (Float_t w) { fEMCALNeutralWeight = w ; }
168 void SetPHOSPhotonWeight (Float_t w) { fPHOSPhotonWeight = w ; }
169 void SetPHOSPi0Weight (Float_t w) { fPHOSPi0Weight = w ; }
170 void SetPHOSElectronWeight (Float_t w) { fPHOSElectronWeight = w ; }
171 void SetPHOSChargeWeight (Float_t w) { fPHOSChargeWeight = w ; }
172 void SetPHOSNeutralWeight (Float_t w) { fPHOSNeutralWeight = w ; }
174 void UsePHOSPIDWeightFormula (Bool_t ok ) { fPHOSWeightFormula = ok ; }
175 void SetPHOSPhotonWeightFormulaExpression(TString ph) { fPHOSPhotonWeightFormulaExpression = ph ; }
176 void SetPHOSPi0WeightFormulaExpression (TString pi) { fPHOSPi0WeightFormulaExpression = pi ; }
180 void SetEMCALLambda0CutMax(Float_t lcut ) { fEMCALL0CutMax = lcut ; }
181 Float_t GetEMCALLambda0CutMax() const { return fEMCALL0CutMax ; }
183 void SetEMCALLambda0CutMin(Float_t lcut ) { fEMCALL0CutMin = lcut ; }
184 Float_t GetEMCALLambda0CutMin() const { return fEMCALL0CutMin ; }
186 void SetEMCALDEtaCut(Float_t dcut ) { fEMCALDEtaCut = dcut ; }
187 Float_t GetEMCALDEtaCut() const { return fEMCALDEtaCut ; }
189 void SetEMCALDPhiCut(Float_t dcut ) { fEMCALDPhiCut = dcut ; }
190 Float_t GetEMCALDPhiCut() const { return fEMCALDPhiCut ; }
192 void SetTOFCut(Float_t tcut ) { fTOFCut = tcut ; }
193 Float_t GetTOFCut() const { return fTOFCut ; }
195 void SetPHOSRCut(Float_t rcut ) { fPHOSRCut = rcut ; }
196 Float_t GetPHOSRCut() const { return fPHOSRCut ; }
198 void SetPHOSDispersionCut(Float_t dcut ) { fPHOSDispersionCut = dcut ; }
199 Float_t GetPHOSDispersionCut() const { return fPHOSDispersionCut ; }
201 // Cluster splitting analysis
203 void SwitchOnClusterSplittingPID() { fDoClusterSplitting = kTRUE ; }
204 void SwitchOffClusterplittingPID() { fDoClusterSplitting = kFALSE ; }
206 void SwitchOnSimpleSplitMassCut() { fUseSimpleMassCut = kTRUE ; }
207 void SwitchOffSimpleSplitMassCut() { fUseSimpleMassCut = kFALSE ; }
209 void SwitchOnSimpleSplitM02Cut() { fUseSimpleM02Cut = kTRUE ; }
210 void SwitchOffSimpleSplitM02Cut() { fUseSimpleM02Cut = kFALSE ; }
212 void SwitchOnSplitAsymmetryCut() { fUseSplitAsyCut = kTRUE ; }
213 void SwitchOffSplitAsymmetryCut() { fUseSplitAsyCut = kFALSE ; }
215 void SetClusterSplittingM02Cut(Float_t min=0, Float_t max=100)
216 { fSplitM02MinCut = min ; fSplitM02MaxCut = max ; }
218 void SetClusterSplittingMinNCells(Int_t cut) { fSplitMinNCells = cut ; }
220 void SetSplitEnergyFractionMinimum(Int_t i, Float_t min){ if (i < 3 && i >=0 ) fSplitEFracMin[i] = min ; }
221 Float_t GetSplitEnergyFractionMinimum(Int_t i) const { if( i < 3 && i >=0 ) return fSplitEFracMin[i] ; else return 0 ; }
223 Float_t GetPi0MinMass() const { return fMassPi0Min ; } // Simple cut case
224 Float_t GetEtaMinMass() const { return fMassEtaMin ; } // Simple cut case
225 Float_t GetPhotonMinMass() const { return fMassPhoMin ; }
226 Float_t GetPi0MaxMass() const { return fMassPi0Max ; }
227 Float_t GetEtaMaxMass() const { return fMassEtaMax ; }
228 Float_t GetPhotonMaxMass() const { return fMassPhoMax ; }
230 void SetSplitWidthSigma(Float_t s) { fSplitWidthSigma = s ; }
231 void SetPi0MassWidthSelectionParameters (Int_t iparam, Float_t param) { if(iparam < 7 ) fMassWidthPi0Param[iparam] = param ; }
232 void SetM02MaximumSelectionParameters (Int_t inlm, Int_t iparam, Float_t param)
233 { if(iparam < 6 && inlm < 2) fM02MaxParam[inlm][iparam] = param ; }
234 void SetM02MinimumSelectionParameters (Int_t inlm, Int_t iparam, Float_t param)
235 { if(iparam < 6 && inlm < 2) fM02MinParam[inlm][iparam] = param ; }
236 void SetAsymmetryMinimumSelectionParameters(Int_t inlm, Int_t iparam, Float_t param)
237 { if(iparam < 6 && inlm < 2) fAsyMinParam[inlm][iparam] = param ; }
239 void SetPi0MassRange(Float_t min, Float_t max) { fMassPi0Min = min ; fMassPi0Max = max ; } // Simple case
240 void SetEtaMassRange(Float_t min, Float_t max) { fMassEtaMin = min ; fMassEtaMax = max ; }
241 void SetPhotonMassRange(Float_t min, Float_t max) { fMassPhoMin = min ; fMassPhoMax = max ; }
245 Int_t fDebug; // Debug level
246 Int_t fParticleFlux; // Particle flux for setting PID parameters
249 AliEMCALPIDUtils * fEMCALPIDUtils; // Pointer to EMCALPID to redo the PID Bayesian calculation
250 Bool_t fUseBayesianWeights; // Select clusters based on weights calculated in reconstruction
251 Bool_t fRecalculateBayesian; // Recalculate PID bayesian or use simple PID?
253 Float_t fEMCALPhotonWeight; // Bayesian PID weight for photons in EMCAL
254 Float_t fEMCALPi0Weight; // Bayesian PID weight for pi0 in EMCAL
255 Float_t fEMCALElectronWeight; // Bayesian PID weight for electrons in EMCAL
256 Float_t fEMCALChargeWeight; // Bayesian PID weight for charged hadrons in EMCAL
257 Float_t fEMCALNeutralWeight; // Bayesian PID weight for neutral hadrons in EMCAL
258 Float_t fPHOSPhotonWeight; // Bayesian PID weight for photons in PHOS
259 Float_t fPHOSPi0Weight; // Bayesian PID weight for pi0 in PHOS
260 Float_t fPHOSElectronWeight; // Bayesian PID weight for electrons in PHOS
261 Float_t fPHOSChargeWeight; // Bayesian PID weight for charged hadrons in PHOS
262 Float_t fPHOSNeutralWeight; // Bayesian PID weight for neutral hadrons in PHOS
264 Bool_t fPHOSWeightFormula ; // Use parametrized weight threshold, function of energy
265 TFormula *fPHOSPhotonWeightFormula ; // Formula for photon weight
266 TFormula *fPHOSPi0WeightFormula ; // Formula for pi0 weight
267 TString fPHOSPhotonWeightFormulaExpression; // Photon weight formula in string
268 TString fPHOSPi0WeightFormulaExpression; // Pi0 weight formula in string
271 Float_t fEMCALL0CutMax; // Max Cut on shower shape lambda0, used in PID evaluation, only EMCAL
272 Float_t fEMCALL0CutMin; // Min Cut on shower shape lambda0, used in PID evaluation, only EMCAL
273 Float_t fEMCALDEtaCut; // Track matching cut on Dz
274 Float_t fEMCALDPhiCut; // Track matching cut on Dx
276 Float_t fTOFCut; // Cut on TOF, used in PID evaluation
278 Float_t fPHOSDispersionCut; // Shower shape elipse radious cut
279 Float_t fPHOSRCut; // Track-Cluster distance cut for track matching in PHOS
281 // Cluster splitting mass ranges
282 Bool_t fDoClusterSplitting; // Cluster splitting analysis
283 Bool_t fUseSimpleMassCut; // Use simple min-max pi0 mass cut
284 Bool_t fUseSimpleM02Cut; // Use simple min-max M02 cut
285 Bool_t fUseSplitAsyCut ; // Remove splitted clusters with too large asymmetry, range defined in AliCaloPID
286 Float_t fSplitM02MaxCut ; // Study clusters with l0 smaller than cut
287 Float_t fSplitM02MinCut ; // Study clusters with l0 larger than cut // simple case
288 Int_t fSplitMinNCells ; // Study clusters with ncells larger than cut
289 Float_t fMassEtaMin ; // Min Eta mass
290 Float_t fMassEtaMax ; // Max Eta mass
291 Float_t fMassPi0Min ; // Min Pi0 mass // simple cut case
292 Float_t fMassPi0Max ; // Min Pi0 mass // simple cut case
293 Float_t fMassPhoMin ; // Min Photon mass
294 Float_t fMassPhoMax ; // Min Photon mass
295 Float_t fMassWidthPi0Param[7] ; // 3 param for pol2 fit on width, 2 param for mass position NLM=1 and NLM>1 for pi0 selection
296 Float_t fM02MinParam[2][6] ; // 4 param for pol3 fit on M02 minimum for pi0 selection (maximum for conversions)
297 Float_t fM02MaxParam[2][6] ; // 4 param for pol3 fit on M02 maximum for pi0 selection
298 Float_t fAsyMinParam[2][6] ; // 4 param for pol3 fit on asymmetry minimum, for 2 cases, NLM=1 and NLM>=2
299 Float_t fSplitEFracMin[3] ; // Do not use clusters with too large energy in cluster compared
300 // to energy in splitted clusters, depeding on NLM
301 Float_t fSplitWidthSigma; // Cut on mass+-width*fSplitWidthSigma
305 AliCaloPID & operator = (const AliCaloPID & cpid) ; // cpy assignment
306 AliCaloPID( const AliCaloPID & cpid) ; // cpy ctor
308 ClassDef(AliCaloPID,17)
313 #endif //ALICALOPID_H