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 **************************************************************************/
18 // Compute PID weights for all the clusters that are in AliESDs.root file
19 // the AliESDs.root have to be in the same directory as the class
22 // AliEMCALPID *pid = new AliEMCALPID(kFALSE); // this calls the constructor which avoids the call to recparam
23 // pid->SetReconstructor(kFALSE);
24 // pid->SetPrintInfo(kTRUE);
25 // pid->SetHighFluxParam(); // pid->SetLowFluxParam();
27 // then in cluster loop do
28 // pid->ComputePID(energy, lambda0);
30 // Compute PID Weight for all clusters in AliESDs.root file
31 // keep this function for the moment for a simple verification, could be removed
33 // pid->GetPIDFinal(idx) gives the probabilities
35 // Double_t PIDFinal[AliPID::kSPECIESN] is the standard PID for :
37 // kElectron : fPIDFinal[0]
38 // kMuon : fPIDFinal[1]
39 // kPion : fPIDFinal[2]
40 // kKaon : fPIDFinal[3]
41 // kProton : fPIDFinal[4]
42 // kPhoton : fPIDFinal[5]
43 // kPi0 : fPIDFinal[6]
44 // kNeutron : fPIDFinal[7]
45 // kKaon0 : fPIDFinal[8]
46 // kEleCon : fPIDFinal[9]
47 // kUnknown : fPIDFinal[10]
50 // PID[3] is a simple PID for
51 // Electron & Photon PID[0]
55 // Author: Genole Bourdaud 2007 (SUBATECH)
56 // Marie Germain 07/2009 (SUBATECH), new parametrization for low and high flux environment
57 // Gustavo Conesa 08/2009 (LNF), divide class in AliEMCALPID and AliEMCALPIDUtils, PIDUtils belong to library EMCALUtils
60 // standard C++ includes
61 //#include <Riostream.h>
66 #include "AliESDEvent.h"
67 #include "AliEMCALPID.h"
68 #include "AliESDCaloCluster.h"
69 #include "AliEMCALReconstructor.h"
74 //______________________________________________
75 AliEMCALPID::AliEMCALPID()
76 : AliEMCALPIDUtils(), fReconstructor(kTRUE)
80 // Initialize all constant values which have to be used
81 // during PID algorithm execution
89 //______________________________________________
90 AliEMCALPID::AliEMCALPID(Bool_t reconstructor)
91 : AliEMCALPIDUtils(), fReconstructor(reconstructor)
95 // Initialize all constant values which have to be used
96 // during PID algorithm execution called when used in standalone mode
103 //______________________________________________
104 void AliEMCALPID::RunPID(AliESDEvent *esd)
107 // Make the PID for all the EMCAL clusters containedin the ESDs File
108 // but just gamma/PiO/Hadron
110 // trivial check against NULL object passed
113 AliInfo("NULL ESD object passed !!" );
117 Int_t nClusters = esd->GetNumberOfCaloClusters();
118 Int_t firstCluster = 0;
119 Double_t energy, lambda0;
120 for (Int_t iCluster = firstCluster; iCluster < (nClusters + firstCluster); iCluster++) {
122 AliESDCaloCluster *clust = esd->GetCaloCluster(iCluster);
123 if (!clust->IsEMCAL()) continue ;
126 lambda0 = clust->GetM02();
127 // verify cluster type
128 Int_t clusterType= clust->GetClusterType();
129 if (clusterType == AliESDCaloCluster::kEMCALClusterv1 && lambda0 != 0 && energy < 1000) {
131 // reject clusters with lambda0 = 0
134 ComputePID(energy, lambda0);
138 AliInfo("___________________________________________________");
139 AliInfo(Form( "Particle Energy = %f",energy));
140 AliInfo(Form( "Particle Lambda0 of the particle = %f", lambda0) );
141 AliInfo("PIDWeight of the particle :" );
142 AliInfo(Form( " GAMMA : %f",fPID[0] ));
143 AliInfo(Form( " PiZero : %f",fPID[1] ));
144 AliInfo(Form( " HADRON : %f", fPID[2] ));
145 AliInfo("_________________________________________");
146 AliInfo(Form( " kElectron : %f", fPIDFinal[0]) );
147 AliInfo(Form( " kMuon : %f", fPIDFinal[1] ));
148 AliInfo(Form( " kPion : %f", fPIDFinal[2] ));
149 AliInfo(Form( " kKaon : %f", fPIDFinal[3] ));
150 AliInfo(Form( " kProton : %f", fPIDFinal[4] ));
151 AliInfo(Form( " kPhoton : %f", fPIDFinal[5] ));
152 AliInfo(Form( " kPi0 : %f", fPIDFinal[6] ));
153 AliInfo(Form( " kNeutron : %f", fPIDFinal[7] ));
154 AliInfo(Form( " kKaon0 : %f", fPIDFinal[8] ));
155 AliInfo(Form( " kEleCon : %f", fPIDFinal[9] ));
156 AliInfo(Form( " kUnknown : %f", fPIDFinal[10] ));
157 AliInfo("___________________________________________________");
160 if(fReconstructor){ // In case it is called during reconstruction.
161 // cout << "############# Fill ESDs with PIDWeight ##########" << endl;
162 clust->SetPid(fPIDFinal);}
163 } // end if (clusterType...)
164 } // end for (iCluster...)
168 //_______________________________________________________
169 void AliEMCALPID::InitParameters()
171 // Initialize PID parameters, depending on the use or not of the reconstructor
172 // and the kind of event type if the reconstructor is not used.
173 // fWeightHadronEnergy=0.;
174 // fWeightPiZeroEnergy=0.;
175 // fWeightGammaEnergy=0.;
181 for(Int_t i=0; i<AliPID::kSPECIESN+1; i++)
184 const AliEMCALRecParam* recParam = AliEMCALReconstructor::GetRecParam();
189 AliFatal("Reconstruction parameters for EMCAL not set!");
193 for(Int_t i=0; i<6; i++){
194 for(Int_t j=0; j<6; j++){
195 fGamma[i][j] = recParam->GetGamma(i,j);
196 fGamma1to10[i][j] = recParam->GetGamma1to10(i,j);
197 fHadron[i][j] = recParam->GetHadron(i,j);
198 fHadron1to10[i][j] = recParam->GetHadron1to10(i,j);
199 fPiZero[i][j] = recParam->GetPiZero(i,j);
202 // AliDebug(1,Form("PID parameters (%d, %d): fGamma=%.3f, fPi=%.3f, fHadron=%.3f",
203 // i,j, fGamma[i][j],fPiZero[i][j],fHadron[i][j] ));
204 // cout << "PID parameters (" << i << " ,"<<j<<") fGamma= "<< fGamma[i][j]<<" fPi0 ="<< fPiZero[i][j]<< endl;
207 fHadronEnergyProb[i] = recParam->GetHadronEnergyProb(i);
208 fPiZeroEnergyProb[i] = recParam->GetPiZeroEnergyProb(i);
209 fGammaEnergyProb[i] = recParam->GetGammaEnergyProb(i);
213 } // end if !recparam
218 // init the parameters here instead of from loading from recparam
219 // default parameters are PbPb parameters.