1 /**************************************************************************
2 * Copyright(c) 1998-2014, 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 **************************************************************************/
16 // Comment describing what this class does needed!
18 // $Id: AliJPhoton.cxx,v 1.4 2008/05/08 13:44:45 djkim Exp $
20 ////////////////////////////////////////////////////
24 \author J. Rak, D.J.Kim, R.Diaz (University of Jyvaskyla)
26 \version $Revision: 1.4 $
27 \date $Date: 2008/05/08 13:44:45 $
29 ////////////////////////////////////////////////////
31 #include "AliJBaseTrack.h"
32 #include "AliJPhoton.h"
36 //______________________________________________________________________________
37 AliJPhoton::AliJPhoton() :
48 fDistToBadChannel(-999),
54 fNTracksMatched(-999),
57 fCellsAmpFraction(0x0),
68 // default constructor
69 for(Int_t i=0;i<kUnknownAli+1;i++) fCaloPID[i]=-1;
71 SetPID((Double_t*)NULL);
74 //_____________________________________________________________________________
75 AliJPhoton::AliJPhoton(const AliJPhoton& a) :
82 fProbPhot(a.fProbPhot),
85 fCaloType(a.fCaloType),
86 fDistToBadChannel(a.fDistToBadChannel),
87 fDispersion(a.fDispersion),
90 fEmcCpvDist(a.fEmcCpvDist),
92 fNTracksMatched(a.fNTracksMatched),
93 fSuperModuleId(a.fSuperModuleId),
95 fCellsAmpFraction(NULL),
96 fNEMCLabel(a.fNEMCLabel),
107 for(Int_t i=0;i<kUnknownAli+1;i++) fCaloPID[i] = a.fCaloPID[i];
108 SetCellsAbsId( a.fCellsAbsId );
109 SetCellsAmplitudeFraction( a.fCellsAmpFraction );
110 SetCellsIndex( a.fCellsIndex );
111 SetEMCLabel( a.fEMCLabel );
112 // SetCellsAmplitude( a.fCellsAmp );
116 //_____________________________________________________________________________
117 AliJPhoton::~AliJPhoton(){
122 //_____________________________________________________________________________
123 void AliJPhoton::Clear( Option_t * /* option */ ){
125 if(fCellsAbsId) delete [] fCellsAbsId;
126 if(fCellsAmpFraction) delete [] fCellsAmpFraction;
127 if( fEMCLabel ) delete [] fEMCLabel;
128 if( fCellsIndex ) delete [] fCellsIndex;
130 fCellsAmpFraction = 0;
133 // if(fCellsAmp) delete [] fCellsAmp;
136 //_____________________________________________________________________________
137 AliJPhoton& AliJPhoton::operator=(const AliJPhoton& photon){
140 AliJBaseTrack::operator=(photon);
141 fChi2 = photon.fChi2;
146 fProbPhot = photon.fProbPhot;
147 fTrackDx = photon.fTrackDx;
148 fTrackDz = photon.fTrackDz;
149 fCaloType = photon.fCaloType;
150 for(Int_t i=0; i<kUnknownAli+1; i++){
151 fCaloPID[i] = photon.fCaloPID[i];
153 fDistToBadChannel = photon.fDistToBadChannel;
154 fDispersion = photon.fDispersion;
157 fEmcCpvDist = photon.fEmcCpvDist;
158 fNCells = photon.fNCells;
159 fNTracksMatched = photon.fNTracksMatched;
160 fSuperModuleId = photon.fSuperModuleId;
161 SetCellsAbsId( photon.fCellsAbsId );
162 SetCellsAmplitudeFraction( photon.fCellsAmpFraction );
163 SetEMCLabel( photon.fEMCLabel );
164 // SetCellsAmplitude( photon.fCellsAmp );
165 fEMax = photon.fEMax;
166 fECross = photon.fECross;
167 fECore = photon.fECore;
169 SetCellsIndex( photon.fCellsIndex );
175 //______________________________________________________________________________
176 void AliJPhoton::SetCellsAbsId(const UShort_t *array)
178 // Set the array of cell absId numbers
180 if(fCellsAbsId){ delete [] fCellsAbsId; fCellsAbsId = NULL; }
181 fCellsAbsId = new UShort_t[fNCells];
182 for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i];
186 //_______________________________________________________________________
187 void AliJPhoton::SetCellsAmplitudeFraction(const Double32_t *array)
189 // Set the array of cell amplitude fraction
191 if(fCellsAmpFraction){ delete [] fCellsAmpFraction; fCellsAmpFraction = NULL;}
192 fCellsAmpFraction = new Double32_t[fNCells];
193 for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i];
197 //______________________________________________________________________________
198 void AliJPhoton::SetEMCLabel(const Int_t *array)
200 // Set the array of cell absId numbers
202 if(fEMCLabel){ delete [] fEMCLabel; fEMCLabel = NULL; }
203 fEMCLabel = new Int_t[fNEMCLabel];
204 for (Int_t i = 0; i < fNEMCLabel; i++) fEMCLabel[i] = array[i];
208 //______________________________________________________________________________
209 void AliJPhoton::SetCellsIndex(const Int_t *array)
211 // Set the array of cell absId numbers
214 delete [] fCellsIndex;
220 delete [] fCellsIndex;
224 fCellsIndex = new Int_t[fNCells];
225 for (Int_t i = 0; i < fNCells; i++)
226 fCellsIndex[i] = array[i];
230 //______________________________________________________________________________
231 void AliJPhoton::SetCellIndex(const Int_t pos, const Int_t ind)
233 // Set the array of cell absId numbers
238 fCellsIndex = new Int_t[fNCells];
239 for( i = 0; i < fNCells; i++ )
244 fCellsIndex[pos] = ind;
247 //______________________________________________________________________________
248 void AliJPhoton::ClearCellsIndex()
250 // Clears the array of cell absId numbers
252 delete [] fCellsIndex;
257 // //_______________________________________________________________________
258 // void AliJPhoton::SetCellsAmplitude(const Double32_t *array)
260 // // Set the array of cell amplitude fraction
262 // if(fCellsAmp){ delete [] fCellsAmp; fCellsAmp = NULL;}
263 // fCellsAmp = new Double_t[fNCells];
264 // for (Int_t i = 0; i < fNCells; i++) fCellsAmp[i] = array[i];
268 //______________________________________________________________________________
269 void AliJPhoton::SetPID(const Double32_t *pid) {
272 for(Int_t i=0; i<kUnknownAli; ++i) fCaloPID[i]=pid[i];
273 SetProbPhot(fCaloPID[kPhotonAli]);
275 for(Int_t i=0; i<kUnknownAli; fCaloPID[i++]=0.){}
276 fCaloPID[kUnknownAli]=1.;
281 //______________________________________________________________________________
282 particleType AliJPhoton::GetParticleType() {
284 // return the most problable particle type
285 // Note: following the AliCaloPID implementation
287 //Init default weights
288 Float_t wPhoton = 0.75 ;
290 Float_t wElectron = 0.5 ;
291 Float_t wCharged = 0.5 ;
292 Float_t wNeutral = 0.5 ;
294 Bool_t usePHOSweightFormula = kTRUE;
295 //Formula to set the PID weight threshold for photon or pizero
296 // ALICE-INT-2005-016 (2007)
297 TFormula* wPhotonPHOSFormula =
298 new TFormula("photonWeight","0.75*(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))");
299 TFormula* wPi0PHOSFormula =
300 new TFormula("pi0Weight","0.80*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))");
302 if(fCaloType == kPHOSCalo && usePHOSweightFormula){
303 wPhoton = wPhotonPHOSFormula->Eval(E()) ;
304 wPi0 = wPi0PHOSFormula->Eval(E());
305 // cout << "wPhotonF " << wPhoton << " wphoton " << fCaloPID[kPhotonAli] << " wPi0F " << wPi0 << " wpi0 " << fCaloPID[kPi0Ali] << endl;
308 if(fCaloType == kEMCALCalo){
317 particleType pdg = kJHadron;
319 //Select most probable ID
320 if(fCaloType == kPHOSCalo){
321 if(fCaloPID[kPhotonAli] > wPhoton) pdg = kJPhoton ;
322 else if(fCaloPID[kPi0Ali] > wPi0) pdg = kJPizero ;
323 //else if(fCaloPID[kElectronAli] > wElectron) pdg = electron ;
324 //else if(fCaloPID[kEleConAli] > wElectron) pdg = electronCon ;
325 //else if(chargedHadronWeight > wCharged) pdg = chargedHadron ;
326 //else if(neutralHadronWeight > wNeutral) pdg = neutralHadron ;
327 //else if(allChargedWeight > allNeutralWeight)
328 // pdg = chargedUnknown ;
330 // pdg = neutralUnknown ;
333 //Temporal solution, electrons and photons not differenciated
334 if(fCaloPID[kPhotonAli] + fCaloPID[kElectronAli] > wPhoton) pdg = kJPhoton ;
335 else if(fCaloPID[kPi0Ali] > wPi0) pdg = kJPizero ;
336 //else if(chargedHadronWeight + neutralHadronWeight > wCharged) pdg = chargedHadron ;
337 //else if(neutralHadronWeight + chargedHadronWeight > wNeutral) pdg = neutralHadron ;
338 //else pdg = neutralUnknown ;
342 delete wPhotonPHOSFormula;
343 delete wPi0PHOSFormula;
345 //if(fCaloType == kPHOSCalo) cout << "pdg " << pdg << endl;