]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALPID.cxx
1) New library EMCALUtils with geometry and PID utils for the analysis: New classes...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALPID.cxx
CommitLineData
dc293ae9 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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
16/* $Id$ */
1e7c9b89 17
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
dc293ae9 20//
1e7c9b89 21// and do:
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();
26//
27// then in cluster loop do
28// pid->ComputePID(energy, lambda0);
29//
30// Compute PID Weight for all clusters in AliESDs.root file
dc293ae9 31// keep this function for the moment for a simple verification, could be removed
32//
1e7c9b89 33// pid->GetPIDFinal(idx) gives the probabilities
dc293ae9 34//
1e7c9b89 35// Double_t PIDFinal[AliPID::kSPECIESN] is the standard PID for :
dc293ae9 36//
dc293ae9 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]
48//
49//
50// PID[3] is a simple PID for
51// Electron & Photon PID[0]
52// Pi0 PID[1]
53// Hadron PID[2]
54//
0c5b726e 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
1e7c9b89 58// --- standard c ---
dc293ae9 59
60// standard C++ includes
1e7c9b89 61//#include <Riostream.h>
dc293ae9 62
63// ROOT includes
dc293ae9 64
46363b15 65// STEER includes
1e7c9b89 66#include "AliESDEvent.h"
dc293ae9 67#include "AliEMCALPID.h"
89ffc0b0 68#include "AliESDCaloCluster.h"
8ba062b1 69#include "AliEMCALReconstructor.h"
70
dc293ae9 71
72ClassImp(AliEMCALPID)
1e7c9b89 73
4cfd8ef9 74//______________________________________________
0c5b726e 75 AliEMCALPID::AliEMCALPID()
76 : AliEMCALPIDUtils(), fReconstructor(kTRUE)
dc293ae9 77{
4cfd8ef9 78 //
79 // Constructor.
80 // Initialize all constant values which have to be used
81 // during PID algorithm execution
82 //
1e7c9b89 83
84 InitParameters();
85
86
87}
46363b15 88
1e7c9b89 89//______________________________________________
0c5b726e 90AliEMCALPID::AliEMCALPID(Bool_t reconstructor)
91: AliEMCALPIDUtils(), fReconstructor(reconstructor)
1e7c9b89 92{
93 //
94 // Constructor.
95 // Initialize all constant values which have to be used
96 // during PID algorithm execution called when used in standalone mode
97 //
98
99 InitParameters();
46363b15 100
dc293ae9 101}
4cfd8ef9 102
103//______________________________________________
af885e0f 104void AliEMCALPID::RunPID(AliESDEvent *esd)
dc293ae9 105{
1e7c9b89 106 //
107 // Make the PID for all the EMCAL clusters containedin the ESDs File
108 // but just gamma/PiO/Hadron
109 //
110 // trivial check against NULL object passed
111
dc293ae9 112 if (esd == 0x0) {
4ce73a00 113 AliInfo("NULL ESD object passed !!" );
dc293ae9 114 return ;
115 }
1e7c9b89 116
3a2a23e1 117 Int_t nClusters = esd->GetNumberOfCaloClusters();
118 Int_t firstCluster = 0;
dc293ae9 119 Double_t energy, lambda0;
120 for (Int_t iCluster = firstCluster; iCluster < (nClusters + firstCluster); iCluster++) {
1e7c9b89 121
dc293ae9 122 AliESDCaloCluster *clust = esd->GetCaloCluster(iCluster);
1e7c9b89 123 if (!clust->IsEMCAL()) continue ;
124
7592dfc4 125 energy = clust->E();
dc293ae9 126 lambda0 = clust->GetM02();
127 // verify cluster type
128 Int_t clusterType= clust->GetClusterType();
8ada0ffe 129 if (clusterType == AliESDCaloCluster::kEMCALClusterv1 && lambda0 != 0 && energy < 1000) {
1e7c9b89 130
dc293ae9 131 // reject clusters with lambda0 = 0
1e7c9b89 132
133
dc293ae9 134 ComputePID(energy, lambda0);
1e7c9b89 135
136
dc293ae9 137 if (fPrintInfo) {
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("___________________________________________________");
158 }
1e7c9b89 159
160 if(fReconstructor){ // In case it is called during reconstruction.
da1ceeb8 161 // cout << "############# Fill ESDs with PIDWeight ##########" << endl;
1e7c9b89 162 clust->SetPid(fPIDFinal);}
dc293ae9 163 } // end if (clusterType...)
164 } // end for (iCluster...)
165}
4cfd8ef9 166
1e7c9b89 167
168//_______________________________________________________
169void AliEMCALPID::InitParameters()
170{
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.;
176
177 fPIDWeight[0] = -1;
178 fPIDWeight[1] = -1;
179 fPIDWeight[2] = -1;
180
181 for(Int_t i=0; i<AliPID::kSPECIESN+1; i++)
182 fPIDFinal[i]= 0;
183
184 const AliEMCALRecParam* recParam = AliEMCALReconstructor::GetRecParam();
185
186 if(fReconstructor){
187
188 if(!recParam) {
189 AliFatal("Reconstruction parameters for EMCAL not set!");
190 }
191 else {
192
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);
200
201
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;
205
206 } // end loop j
207 fHadronEnergyProb[i] = recParam->GetHadronEnergyProb(i);
208 fPiZeroEnergyProb[i] = recParam->GetPiZeroEnergyProb(i);
209 fGammaEnergyProb[i] = recParam->GetGammaEnergyProb(i);
210 } //end loop i
211
212
213 } // end if !recparam
214
215 }
216
217 else{
218 // init the parameters here instead of from loading from recparam
219 // default parameters are PbPb parameters.
220 SetHighFluxParam();
221
222 }
223
224}
225