1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 /* $Id: AliCaloPID.cxx 21839 2007-10-29 13:49:42Z gustavo $ */
17 /* History of cvs commits:
24 //_________________________________________________________________________
25 // Class for track/cluster acceptance selection
26 // Selection in Central barrel, EMCAL and PHOS
28 //*-- Author: Gustavo Conesa (LNF-INFN)
29 //////////////////////////////////////////////////////////////////////////////
32 // --- ROOT system ---
34 #include <TLorentzVector.h>
38 //---- ANALYSIS system ----
40 #include "AliCaloPID.h"
41 #include "AliAODCluster.h"
46 //________________________________________________
47 AliCaloPID::AliCaloPID() :
48 TObject(), fEMCALPhotonWeight(0.), fEMCALPi0Weight(0.),
49 fEMCALElectronWeight(0.), fEMCALChargeWeight(0.),
50 fEMCALNeutralWeight(0.),
51 fPHOSPhotonWeight(0.), fPHOSPi0Weight(0.),
52 fPHOSElectronWeight(0.), fPHOSChargeWeight(0.) ,
53 fPHOSNeutralWeight(0.), fPHOSWeightFormula(0),
54 fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0)
58 //Initialize parameters
62 //____________________________________________________________________________
63 AliCaloPID::AliCaloPID(const AliCaloPID & pid) :
64 TObject(pid), fEMCALPhotonWeight(pid.fEMCALPhotonWeight),
65 fEMCALPi0Weight(pid.fEMCALPi0Weight),
66 fEMCALElectronWeight(pid.fEMCALElectronWeight),
67 fEMCALChargeWeight(pid.fEMCALChargeWeight),
68 fEMCALNeutralWeight(pid.fEMCALNeutralWeight),
69 fPHOSPhotonWeight(pid.fPHOSPhotonWeight),
70 fPHOSPi0Weight(pid.fPHOSPi0Weight),
71 fPHOSElectronWeight(pid.fPHOSElectronWeight),
72 fPHOSChargeWeight(pid.fPHOSChargeWeight),
73 fPHOSNeutralWeight(pid.fPHOSNeutralWeight),
74 fPHOSWeightFormula(pid.fPHOSWeightFormula),
75 fPHOSPhotonWeightFormula(pid.fPHOSPhotonWeightFormula),
76 fPHOSPi0WeightFormula(pid.fPHOSPi0WeightFormula)
84 //_________________________________________________________________________
85 AliCaloPID & AliCaloPID::operator = (const AliCaloPID & pid)
87 // assignment operator
89 if(&pid == this) return *this;
91 fEMCALPhotonWeight = pid. fEMCALPhotonWeight ;
92 fEMCALPi0Weight = pid.fEMCALPi0Weight ;
93 fEMCALElectronWeight = pid.fEMCALElectronWeight;
94 fEMCALChargeWeight = pid.fEMCALChargeWeight;
95 fEMCALNeutralWeight = pid.fEMCALNeutralWeight;
97 fPHOSPhotonWeight = pid.fPHOSPhotonWeight ;
98 fPHOSPi0Weight = pid.fPHOSPi0Weight ;
99 fPHOSElectronWeight = pid.fPHOSElectronWeight;
100 fPHOSChargeWeight = pid.fPHOSChargeWeight;
101 fPHOSNeutralWeight = pid.fPHOSNeutralWeight;
103 fPHOSWeightFormula = pid.fPHOSWeightFormula;
104 fPHOSPhotonWeightFormula = pid.fPHOSPhotonWeightFormula;
105 fPHOSPi0WeightFormula = pid.fPHOSPi0WeightFormula;
111 //_________________________________
112 AliCaloPID::~AliCaloPID() {
115 if(fPHOSPhotonWeightFormula) delete fPHOSPhotonWeightFormula ;
116 if(fPHOSPi0WeightFormula) delete fPHOSPi0WeightFormula ;
121 //_______________________________________________________________
122 void AliCaloPID::InitParameters()
124 //Initialize the parameters of the PID.
126 fEMCALPhotonWeight = 0.8 ;
127 fEMCALPi0Weight = 0.5 ;
128 fEMCALElectronWeight = 0.8 ;
129 fEMCALChargeWeight = 0.5 ;
130 fEMCALNeutralWeight = 0.5 ;
132 fPHOSPhotonWeight = 0.75 ;
133 fPHOSPi0Weight = 0.8 ;
134 fPHOSElectronWeight = 0.5 ;
135 fPHOSChargeWeight = 0.5 ;
136 fPHOSNeutralWeight = 0.5 ;
138 //Formula to set the PID weight threshold for photon or pi0
139 fPHOSWeightFormula = kTRUE;
140 fPHOSPhotonWeightFormula =
141 new TFormula("photonWeight","0.98*(x<40)+ 0.68*(x>=100)+(x>=40 && x<100)*(0.98+x*(6e-3)-x*x*(2e-04)+x*x*x*(1.1e-06))");
142 fPHOSPi0WeightFormula =
143 new TFormula("pi0Weight","0.98*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))");
147 //________________________________________________________________
148 void AliCaloPID::Print(const Option_t * opt) const
151 //Print some relevant parameters set for the analysis
155 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
157 printf("PHOS PID weight , photon %0.2f, pi0 %0.2f, e %0.2f, charge %0.2f, neutral %0.2f \n",
158 fPHOSPhotonWeight, fPHOSPi0Weight,
159 fPHOSElectronWeight, fPHOSChargeWeight, fPHOSNeutralWeight) ;
160 printf("EMCAL PID weight, photon %0.2f, pi0 %0.2f, e %0.2f, charge %0.2f, neutral %0.2f\n",
161 fEMCALPhotonWeight, fEMCALPi0Weight,
162 fEMCALElectronWeight, fEMCALChargeWeight, fEMCALNeutralWeight) ;
164 printf("PHOS Parametrized weight on? = %d\n", fPHOSWeightFormula) ;
165 // if(fPHOSWeightFormula){
166 // printf(">>>>>>>>>>> Photon weight formula<<<<<<<<<<<<\n");
167 // fPHOSPhotonWeightFormula->Print();
168 // printf(">>>>>>>>>>> Pi0 weight formula<<<<<<<<<<<<\n");
169 // fPHOSPhotonWeightFormula->Print();
175 //_______________________________________________________________
176 Int_t AliCaloPID::GetPdg(const TString calo, const Double_t * pid, const Float_t energy) const {
177 //Return most probable identity of the particle.
179 if(!pid) AliFatal("pid pointer not initialized!!!");
181 Float_t wPh = fPHOSPhotonWeight ;
182 Float_t wPi0 = fPHOSPi0Weight ;
183 Float_t wE = fPHOSElectronWeight ;
184 Float_t wCh = fPHOSChargeWeight ;
185 Float_t wNe = fPHOSNeutralWeight ;
188 if(calo == "PHOS" && fPHOSWeightFormula){
189 wPh = fPHOSPhotonWeightFormula->Eval(energy) ;
190 wPi0 = fPHOSPi0WeightFormula->Eval(energy);
195 wPh = fEMCALPhotonWeight ;
196 wPi0 = fEMCALPi0Weight ;
197 wE = fEMCALElectronWeight ;
198 wCh = fEMCALChargeWeight ;
199 wNe = fEMCALNeutralWeight ;
203 // printf("PID: calo %s, ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n",
204 // calo.Data(),pid[AliAODCluster::kPhoton], pid[AliAODCluster::kPi0],
205 // pid[AliAODCluster::kElectron], pid[AliAODCluster::kEleCon],
206 // pid[AliAODCluster::kPion], pid[AliAODCluster::kKaon], pid[AliAODCluster::kProton],
207 // pid[AliAODCluster::kNeutron], pid[AliAODCluster::kKaon0]);
209 Int_t pdg = kNeutralUnknown ;
210 Float_t chargedHadronWeight = pid[AliAODCluster::kProton]+pid[AliAODCluster::kKaon]+
211 pid[AliAODCluster::kPion]+pid[AliAODCluster::kMuon];
212 Float_t neutralHadronWeight = pid[AliAODCluster::kNeutron]+pid[AliAODCluster::kKaon0];
213 Float_t allChargedWeight = pid[AliAODCluster::kElectron]+pid[AliAODCluster::kEleCon]+ chargedHadronWeight;
214 Float_t allNeutralWeight = pid[AliAODCluster::kPhoton]+pid[AliAODCluster::kPi0]+ neutralHadronWeight;
216 //Select most probable ID
218 if(pid[AliAODCluster::kPhoton] > wPh) pdg = kPhoton ;
219 else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ;
220 else if(pid[AliAODCluster::kElectron] > wE) pdg = kElectron ;
221 else if(pid[AliAODCluster::kEleCon] > wE) pdg = kEleCon ;
222 else if(chargedHadronWeight > wCh) pdg = kChargedHadron ;
223 else if(neutralHadronWeight > wNe) pdg = kNeutralHadron ;
224 else if(allChargedWeight > allNeutralWeight)
225 pdg = kChargedUnknown ;
227 pdg = kNeutralUnknown ;
230 //Temporal solution, electrons and photons not differenciated
231 if(pid[AliAODCluster::kPhoton] + pid[AliAODCluster::kElectron] > wPh) pdg = kPhoton ;
232 else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ;
233 else if(chargedHadronWeight + neutralHadronWeight > wCh) pdg = kChargedHadron ;
234 else if(neutralHadronWeight + chargedHadronWeight > wNe) pdg = kNeutralHadron ;
235 else pdg = kNeutralUnknown ;
240 //printf("Final Pdg: %d \n", pdg);
248 //_______________________________________________________________
249 Int_t AliCaloPID::GetPdg(const TString calo, const TLorentzVector mom, const Double_t l0,
250 const Double_t l1, const Double_t disp, const Double_t tof,
251 const Double_t distCPV) const {
252 //Recalculated PID with all parameters
253 AliDebug(2,Form("Calorimeter %s, E %3.2f, l0 %3.2f, l1 %3.2f, disp %3.2f, tof %3.2f, distCPV %3.2f",
254 calo.Data(),mom.E(),l0,l1,disp,tof,distCPV));
256 if(calo == "EMCAL") {
257 if(l0 < 0.25) return kPhoton ;
258 else return kNeutralHadron ;
261 return kNeutralHadron ;