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 **************************************************************************/
16 //_________________________________________________________________________
17 // Class containing methods for the isolation cut.
18 // An AOD candidate (AliAODPWG4ParticleCorrelation type)
19 // is passed. Look in a cone around the candidate and study
20 // the hadronic activity inside to decide if the candidate is isolated
23 //*-- Author: Gustavo Conesa (LNF-INFN)
25 //-Yaxian Mao (add the possibility for different IC method with different pt range, 01/10/2010)
26 //-Yaxian Mao (check the candidate particle is the leading particle or not at the same hemishere)
28 //////////////////////////////////////////////////////////////////////////////
31 // --- ROOT system ---
32 #include <TObjArray.h>
34 // --- AliRoot system ---
35 #include "AliIsolationCut.h"
36 #include "AliAODPWG4ParticleCorrelation.h"
37 #include "AliEMCALGeometry.h"
38 #include "AliEMCALGeoParams.h"
39 #include "AliCalorimeterUtils.h"
40 #include "AliAODTrack.h"
41 #include "AliVCluster.h"
42 #include "AliCaloTrackReader.h"
43 #include "AliMixedEvent.h"
44 #include "AliCaloPID.h"
47 ClassImp(AliIsolationCut)
49 //____________________________________
50 AliIsolationCut::AliIsolationCut() :
54 fPtThresholdMax(10000.),
56 fSumPtThresholdMax(10000.),
67 //Initialize parameters
72 //_________________________________________________________________________________________________________________________________
73 void AliIsolationCut::CalculateUEBandClusterNormalization(AliCaloTrackReader * /*reader*/, Float_t etaC, Float_t /*phiC*/,
74 Float_t phiUEptsumCluster, Float_t etaUEptsumCluster,
75 Float_t & phiUEptsumClusterNorm, Float_t & etaUEptsumClusterNorm,
76 Float_t & excessFracEta, Float_t & excessFracPhi ) const
78 // Normalize cluster background band
80 Float_t coneA = fConeSize*fConeSize*TMath::Pi(); // A = pi R^2, isolation cone area
82 //Careful here if EMCal limits changed .. 2010 (4 SM) to 2011-12 (10 SM), for the moment consider 100 deg in phi
83 Float_t emcEtaSize = 0.7*2; // TO FIX
84 Float_t emcPhiSize = TMath::DegToRad()*100.; // TO FIX
87 if(((((2*fConeSize*emcPhiSize)-coneA))*phiBandBadCellsCoeff)!=0)phiUEptsumClusterNorm = phiUEptsumCluster*(coneA*coneBadCellsCoeff / (((2*fConeSize*emcPhiSize)-coneA))*phiBandBadCellsCoeff); // pi * R^2 / (2 R * 2 100 deg) - trigger cone
88 if(((((2*(fConeSize-excess)*emcPhiSize)-(coneA-excessFracEta))*etaBandBadCellsCoeff))!=0)phiUEptsumClusterNorm = phiUEptsumCluster*(coneA *coneBadCellsCoeff/ (((2*(fConeSize-excess)*emcPhiSize)-(coneA/excessFracEta))*etaBandBadCellsCoeff));
89 if(((2*(fConeSize-excess)*emcEtaSize)-(coneA-excessFracPhi))*phiBandBadCellsCoeff!=0) etaUEptsumClusterNorm = etaUEptsumCluster*(coneA*coneBadCellsCoeff / (((2*(fConeSize-excess)*emcEtaSize)-(coneA/excessFracPhi))*phiBandBadCellsCoeff));
92 if((2*fConeSize*emcPhiSize-coneA)!=0) phiUEptsumClusterNorm = phiUEptsumCluster*(coneA / (((2*fConeSize*emcPhiSize)-coneA))); // pi * R^2 / (2 R * 2 100 deg) - trigger cone
93 if((2*fConeSize*emcEtaSize-coneA)!=0) etaUEptsumClusterNorm = etaUEptsumCluster*(coneA / (((2*fConeSize*emcEtaSize)-coneA))); // pi * R^2 / (2 R * 2*0.7) - trigger cone
95 //out of eta acceptance
99 if(TMath::Abs(etaC)+fConeSize > emcEtaSize/2.)
101 Float_t excess = TMath::Abs(etaC) + fConeSize - emcEtaSize/2.;
102 excessFracEta = CalculateExcessAreaFraction(excess);
104 if ( excessFracEta != 0) coneA /= excessFracEta;
106 //UE band is also out of acceptance, need to estimate corrected area
107 if(((2*fConeSize-excess)*emcPhiSize-coneA) != 0 ) phiUEptsumClusterNorm = phiUEptsumCluster*(coneA / ((((2*fConeSize-excess)*emcPhiSize)-coneA)));
108 if(( 2*fConeSize *emcEtaSize-coneA) != 0 ) etaUEptsumClusterNorm = etaUEptsumCluster*(coneA / ((( 2*fConeSize *emcEtaSize)-coneA)));
113 //________________________________________________________________________________________________________________________________
114 void AliIsolationCut::CalculateUEBandTrackNormalization (AliCaloTrackReader * reader, Float_t etaC, Float_t /*phiC*/,
115 Float_t phiUEptsumTrack, Float_t etaUEptsumTrack,
116 Float_t & phiUEptsumTrackNorm, Float_t & etaUEptsumTrackNorm,
117 Float_t & excessFracEta, Float_t & excessFracPhi ) const
119 // Normalize track background band
121 Float_t coneA = fConeSize*fConeSize*TMath::Pi(); // A = pi R^2, isolation cone area
123 // Get the cut used for the TPC tracks in the reader, +-0.8, +-0.9 ...
124 // Only valid in simple fidutial cut case and if the cut is applied, careful!
125 Float_t tpcEtaSize = reader->GetFiducialCut()->GetCTSFidCutMaxEtaArray()->At(0) -
126 reader->GetFiducialCut()->GetCTSFidCutMinEtaArray()->At(0) ;
127 Float_t tpcPhiSize = TMath::TwoPi();
130 //phiUEptsumTrackNorm = phiUEptsumTrack*(coneA*coneBadCellsCoeff / (((2*fConeSize*tpcPhiSize)-coneA))*phiBandBadCellsCoeff); // pi * R^2 / (2 R * 2 pi) - trigger cone
131 //etaUEptsumTrackNorm = etaUEptsumTrack*(coneA*coneBadCellsCoeff / (((2*fConeSize*tpcEtaSize)-coneA))*etaBandBadCellsCoeff); // pi * R^2 / (2 R * 1.6) - trigger cone
132 if((2*fConeSize*tpcPhiSize-coneA)!=0)phiUEptsumTrackNorm = phiUEptsumTrack*(coneA / (((2*fConeSize*tpcPhiSize)-coneA))); // pi * R^2 / (2 R * 2 pi) - trigger cone
133 if((2*fConeSize*tpcEtaSize-coneA)!=0)etaUEptsumTrackNorm = etaUEptsumTrack*(coneA / (((2*fConeSize*tpcEtaSize)-coneA))); // pi * R^2 / (2 R * 1.6) - trigger cone
134 if((2*(fConeSize-excess)*tpcPhiSize)-(coneA-excessFracEta)!=0)phiUEptsumTrackNorm = phiUEptsumTrack*(coneA / (((2*(fConeSize-excess)*tpcPhiSize)-(coneA/excessFracEta))));
135 */ //end Catherine code
137 //correct out of eta acceptance
141 if((2*fConeSize*tpcPhiSize-coneA)!=0) phiUEptsumTrackNorm = phiUEptsumTrack*(coneA / (((2*fConeSize*tpcPhiSize)-coneA))); // pi * R^2 / (2 R * 2 pi) - trigger cone
142 if((2*fConeSize*tpcEtaSize-coneA)!=0) etaUEptsumTrackNorm = etaUEptsumTrack*(coneA / (((2*fConeSize*tpcEtaSize)-coneA))); // pi * R^2 / (2 R * 1.6) - trigger cone
144 if(TMath::Abs(etaC)+fConeSize > tpcEtaSize/2.)
146 Float_t excess = TMath::Abs(etaC) + fConeSize - tpcEtaSize/2.;
147 excessFracEta = CalculateExcessAreaFraction(excess);
148 if (excessFracEta != 0) coneA /= excessFracEta;
150 //UE band is also out of acceptance, need to estimate corrected area
151 if(((2*fConeSize-excess)*tpcPhiSize - coneA) !=0 ) phiUEptsumTrackNorm = phiUEptsumTrack*(coneA / ((((2*fConeSize-excess)*tpcPhiSize)-coneA)));
152 if(( 2*fConeSize *tpcEtaSize - coneA) !=0 ) etaUEptsumTrackNorm = etaUEptsumTrack*(coneA / ((( 2*fConeSize *tpcEtaSize)-coneA)));
157 //________________________________________________________________________
158 Float_t AliIsolationCut::CalculateExcessAreaFraction(Float_t excess) const
160 // Area of a circunference segment segment 1/2 R^2 (angle-sin(angle)), angle = 2*ACos((R-excess)/R)
163 Float_t angle = 2*TMath::ACos( (fConeSize-excess) / fConeSize );
165 Float_t coneA = fConeSize*fConeSize*TMath::Pi(); // A = pi R^2, isolation cone area
167 Float_t excessA = fConeSize*fConeSize / 2 * (angle-TMath::Sin(angle));
169 if(coneA > excessA) return coneA / (coneA-excessA);
172 AliWarning(Form("Please Check : Excess Track %2.3f, coneA %2.2f, excessA %2.2f, angle %2.2f,factor %2.2f",
173 excess,coneA, excessA, angle*TMath::RadToDeg(), coneA / (coneA-excessA)));
178 //_______________________________________________________________________________________
179 Float_t AliIsolationCut::GetCellDensity(AliAODPWG4ParticleCorrelation * pCandidate,
180 AliCaloTrackReader * reader) const
182 // Get good cell density (number of active cells over all cells in cone)
184 Double_t coneCells = 0.; //number of cells in cone with radius fConeSize
185 Double_t coneCellsBad = 0.; //number of bad cells in cone with radius fConeSize
186 Double_t cellDensity = 1.;
188 Float_t phiC = pCandidate->Phi() ;
189 if(phiC<0) phiC+=TMath::TwoPi();
190 Float_t etaC = pCandidate->Eta() ;
192 if(pCandidate->GetDetectorTag() == AliCaloTrackReader::kEMCAL)
194 AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
195 AliCalorimeterUtils *cu = reader->GetCaloUtils();
198 if (eGeom->GetAbsCellIdFromEtaPhi(etaC,phiC,absId))
200 //Get absolute (col,row) of candidate
201 Int_t iEta=-1, iPhi=-1, iRCU = -1;
202 Int_t nSupMod = cu->GetModuleNumberCellIndexes(absId, pCandidate->GetDetectorTag(), iEta, iPhi, iRCU);
205 if (nSupMod % 2) colC = AliEMCALGeoParams::fgkEMCALCols + iEta ;
206 Int_t rowC = iPhi + AliEMCALGeoParams::fgkEMCALRows*int(nSupMod/2);
208 Int_t sqrSize = int(fConeSize/0.0143) ; // Size of cell in radians
209 //loop on cells in a square of side fConeSize to check cells in cone
210 for(Int_t icol = colC-sqrSize; icol < colC+sqrSize;icol++)
212 for(Int_t irow = rowC-sqrSize; irow < rowC+sqrSize; irow++)
214 if (Radius(colC, rowC, icol, irow) < sqrSize)
219 Int_t cellEta = -999;
220 Int_t cellPhi = -999;
221 if(icol > AliEMCALGeoParams::fgkEMCALCols-1)
223 cellSM = 0+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
224 cellEta = icol-AliEMCALGeoParams::fgkEMCALCols;
225 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
227 if(icol < AliEMCALGeoParams::fgkEMCALCols)
229 cellSM = 1+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
231 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
234 //Count as bad "cells" out of EMCAL acceptance
235 if(icol < 0 || icol > AliEMCALGeoParams::fgkEMCALCols*2 ||
236 irow < 0 || irow > AliEMCALGeoParams::fgkEMCALRows*16./3) //5*nRows+1/3*nRows
240 //Count as bad "cells" marked as bad in the DataBase
241 else if (cu->GetEMCALChannelStatus(cellSM,cellEta,cellPhi)==1)
249 else AliWarning("Cluster with bad (eta,phi) in EMCal for energy density calculation");
253 cellDensity = (coneCells-coneCellsBad)/coneCells;
254 //printf("Energy density = %f\n", cellDensity);
262 //__________________________________________________________________________________
263 void AliIsolationCut::GetCoeffNormBadCell(AliAODPWG4ParticleCorrelation * pCandidate,
264 AliCaloTrackReader * reader,
265 Float_t & coneBadCellsCoeff,
266 Float_t & etaBandBadCellsCoeff,
267 Float_t & phiBandBadCellsCoeff)
269 // Get good cell density (number of active cells over all cells in cone)
271 Double_t coneCells = 0.; //number of cells in cone with radius fConeSize
272 Double_t phiBandCells = 0.; //number of cells in band phi
273 Double_t etaBandCells = 0.; //number of cells in band eta
275 Float_t phiC = pCandidate->Phi() ;
276 if(phiC<0) phiC+=TMath::TwoPi();
277 Float_t etaC = pCandidate->Eta() ;
279 if(pCandidate->GetDetectorTag() == AliCaloTrackReader::kEMCAL)
281 AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
282 AliCalorimeterUtils *cu = reader->GetCaloUtils();
285 if (eGeom->GetAbsCellIdFromEtaPhi(etaC,phiC,absId))
287 //Get absolute (col,row) of candidate
288 Int_t iEta=-1, iPhi=-1, iRCU = -1;
289 Int_t nSupMod = cu->GetModuleNumberCellIndexes(absId, pCandidate->GetDetectorTag(),
293 if (nSupMod % 2) colC = AliEMCALGeoParams::fgkEMCALCols + iEta ;
294 Int_t rowC = iPhi + AliEMCALGeoParams::fgkEMCALRows*int(nSupMod/2);
296 Int_t sqrSize = int(fConeSize/0.0143) ; // Size of cell in radians
297 for(Int_t icol = 0; icol < 2*AliEMCALGeoParams::fgkEMCALCols-1;icol++)
299 for(Int_t irow = 0; irow < 5*AliEMCALGeoParams::fgkEMCALRows -1; irow++)
301 //loop on cells in a square of side fConeSize to check cells in cone
302 if ( Radius(colC, rowC, icol, irow) < sqrSize ) { coneCells += 1.; }
303 else if( icol>colC-sqrSize && icol<colC+sqrSize ) { phiBandCells += 1 ; }
304 else if( irow>rowC-sqrSize && irow<rowC+sqrSize ) { etaBandCells += 1 ; }
307 Int_t cellEta = -999;
308 Int_t cellPhi = -999;
309 if(icol > AliEMCALGeoParams::fgkEMCALCols-1)
311 cellSM = 0+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
312 cellEta = icol-AliEMCALGeoParams::fgkEMCALCols;
313 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
315 if(icol < AliEMCALGeoParams::fgkEMCALCols)
317 cellSM = 1+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
319 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
322 if( (icol < 0 || icol > AliEMCALGeoParams::fgkEMCALCols*2-1 ||
323 irow < 0 || irow > AliEMCALGeoParams::fgkEMCALRows*5 - 1) //5*nRows+1/3*nRows //Count as bad "cells" out of EMCAL acceptance
324 || (cu->GetEMCALChannelStatus(cellSM,cellEta,cellPhi)==1)) //Count as bad "cells" marked as bad in the DataBase
326 if ( Radius(colC, rowC, icol, irow) < sqrSize ) coneBadCellsCoeff += 1.;
327 else if( icol>colC-sqrSize && icol<colC+sqrSize ) phiBandBadCellsCoeff += 1 ;
328 else if( irow>rowC-sqrSize && irow<rowC+sqrSize ) etaBandBadCellsCoeff += 1 ;
333 else AliWarning("Cluster with bad (eta,phi) in EMCal for energy density coeff calculation");
337 // printf("Energy density coneBadCellsCoeff= %.2f coneCells%.2f\n", coneBadCellsCoeff,coneCells);
338 coneBadCellsCoeff = (coneCells-coneBadCellsCoeff)/coneCells;
339 // printf("coneBadCellsCoeff= %.2f\n", coneBadCellsCoeff);
341 if (phiBandCells > 0.)
343 // printf("Energy density phiBandBadCellsCoeff = %.2f phiBandCells%.2f\n", phiBandBadCellsCoeff,phiBandCells);
344 phiBandBadCellsCoeff = (phiBandCells-phiBandBadCellsCoeff)/phiBandCells;
345 // printf("phiBandBadCellsCoeff = %.2f\n", phiBandBadCellsCoeff);
347 if (etaBandCells > 0.)
349 //printf("Energy density etaBandBadCellsCoeff = %.2f etaBandCells%.2f\n", etaBandBadCellsCoeff,etaBandCells);
350 etaBandBadCellsCoeff = (etaBandCells-etaBandBadCellsCoeff)/etaBandCells;
351 // printf("etaBandBadCellsCoeff = %.2f\n",etaBandBadCellsCoeff);
358 //____________________________________________
359 TString AliIsolationCut::GetICParametersList()
361 //Put data member values in string to keep in output container
363 TString parList ; //this will be list of parameters used for this analysis.
364 const Int_t buffersize = 255;
365 char onePar[buffersize] ;
367 snprintf(onePar,buffersize,"--- AliIsolationCut ---\n") ;
369 snprintf(onePar,buffersize,"fConeSize: (isolation cone size) %1.2f\n",fConeSize) ;
371 snprintf(onePar,buffersize,"fPtThreshold >%2.2f;<%2.2f (isolation pt threshold) \n",fPtThreshold,fPtThresholdMax) ;
373 snprintf(onePar,buffersize,"fSumPtThreshold >%2.2f;<%2.2f (isolation sum pt threshold) \n",fSumPtThreshold,fSumPtThresholdMax) ;
375 snprintf(onePar,buffersize,"fPtFraction=%2.2f (isolation pt threshold fraction) \n",fPtFraction) ;
377 snprintf(onePar,buffersize,"fICMethod=%d (isolation cut case) \n",fICMethod) ;
379 snprintf(onePar,buffersize,"fPartInCone=%d \n",fPartInCone) ;
381 snprintf(onePar,buffersize,"fFracIsThresh=%i \n",fFracIsThresh) ;
387 //____________________________________
388 void AliIsolationCut::InitParameters()
390 //Initialize the parameters of the analysis.
394 fPtThresholdMax = 10000. ;
395 fSumPtThreshold = 1.0 ;
396 fSumPtThresholdMax = 10000. ;
398 fPartInCone = kNeutralAndCharged;
399 fICMethod = kSumPtIC; // 0 pt threshol method, 1 cone pt sum method
403 //________________________________________________________________________________
404 void AliIsolationCut::MakeIsolationCut(TObjArray * plCTS,
406 AliCaloTrackReader * reader,
409 AliAODPWG4ParticleCorrelation *pCandidate,
410 TString aodArrayRefName,
413 Float_t & coneptsum, Float_t & ptLead,
416 //Search in cone around a candidate particle if it is isolated
417 Float_t ptC = pCandidate->Pt() ;
418 Float_t phiC = pCandidate->Phi() ;
419 if(phiC<0) phiC+=TMath::TwoPi();
420 Float_t etaC = pCandidate->Eta() ;
423 Float_t eta = -100. ;
424 Float_t phi = -100. ;
425 Float_t rad = -100. ;
427 Float_t coneptsumCluster = 0;
428 Float_t coneptsumTrack = 0;
430 Float_t etaBandPtSumTrack = 0;
431 Float_t phiBandPtSumTrack = 0;
432 Float_t etaBandPtSumCluster = 0;
433 Float_t phiBandPtSumCluster = 0;
439 AliDebug(1,Form("Candidate pT %2.2f, eta %2.2f, phi %2.2f, cone %1.2f, thres %2.2f, Fill AOD? %d",
440 pCandidate->Pt(), pCandidate->Eta(), pCandidate->Phi()*TMath::RadToDeg(), fConeSize,fPtThreshold,bFillAOD));
442 //Initialize the array with refrences
443 TObjArray * refclusters = 0x0;
444 TObjArray * reftracks = 0x0;
445 Int_t ntrackrefs = 0;
446 Int_t nclusterrefs = 0;
448 //Check charged particles in cone.
450 (fPartInCone==kOnlyCharged || fPartInCone==kNeutralAndCharged))
452 for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ )
454 AliVTrack* track = dynamic_cast<AliVTrack*>(plCTS->At(ipr)) ;
458 //Do not count the candidate (pion, conversion photon) or the daughters of the candidate
459 if(track->GetID() == pCandidate->GetTrackLabel(0) || track->GetID() == pCandidate->GetTrackLabel(1) ||
460 track->GetID() == pCandidate->GetTrackLabel(2) || track->GetID() == pCandidate->GetTrackLabel(3) ) continue ;
462 fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
463 pt = fTrackVector.Pt();
464 eta = fTrackVector.Eta();
465 phi = fTrackVector.Phi() ;
468 {// Mixed event stored in AliAODPWG4Particles
469 AliAODPWG4Particle * trackmix = dynamic_cast<AliAODPWG4Particle*>(plCTS->At(ipr)) ;
472 AliWarning("Wrong track data type, continue");
477 eta = trackmix->Eta();
478 phi = trackmix->Phi() ;
481 if( phi < 0 ) phi+=TMath::TwoPi();
483 rad = Radius(etaC, phiC, eta, phi);
485 // ** For the background out of cone **
489 if(eta > (etaC-fConeSize) && eta < (etaC+fConeSize)) phiBandPtSumTrack += pt;
490 if(phi > (phiC-fConeSize) && phi < (phiC+fConeSize)) etaBandPtSumTrack += pt;
493 // ** For the isolated particle **
495 // Only loop the particle at the same side of candidate
496 if(TMath::Abs(phi-phiC) > TMath::PiOver2()) continue ;
498 // // If at the same side has particle larger than candidate,
499 // // then candidate can not be the leading, skip such events
504 // coneptsumTrack = -1;
505 // isolated = kFALSE;
507 // pCandidate->SetLeadingParticle(kFALSE);
509 // if(bFillAOD && reftracks)
511 // reftracks->Clear();
518 // // Check if there is any particle inside cone with pt larger than fPtThreshold
519 // Check if the leading particule inside the cone has a ptLead larger than fPtThreshold
521 AliDebug(2,Form("\t Track %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad));
525 AliDebug(2,"Inside candidate cone");
532 reftracks = new TObjArray(0);
533 //reftracks->SetName(Form("Tracks%s",aodArrayRefName.Data()));
534 TString tempo(aodArrayRefName) ;
536 reftracks->SetName(tempo);
537 reftracks->SetOwner(kFALSE);
539 reftracks->Add(track);
544 if( ptLead < pt ) ptLead = pt;
546 // // *Before*, count particles in cone
547 // if(pt > fPtThreshold && pt < fPtThresholdMax) n++;
549 // //if fPtFraction*ptC<fPtThreshold then consider the fPtThreshold directly
552 // if( fPtFraction*ptC < fPtThreshold )
554 // if( pt > fPtThreshold ) nfrac++ ;
558 // if( pt > fPtFraction*ptC ) nfrac++;
563 // if( pt > fPtFraction*ptC ) nfrac++;
568 }// charged particle loop
573 //Check neutral particles in cone.
575 (fPartInCone==kOnlyNeutral || fPartInCone==kNeutralAndCharged))
578 for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ )
580 AliVCluster * calo = dynamic_cast<AliVCluster *>(plNe->At(ipr)) ;
584 //Get the index where the cluster comes, to retrieve the corresponding vertex
586 if (reader->GetMixedEvent())
587 evtIndex=reader->GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
590 //Do not count the candidate (photon or pi0) or the daughters of the candidate
591 if(calo->GetID() == pCandidate->GetCaloLabel(0) ||
592 calo->GetID() == pCandidate->GetCaloLabel(1) ) continue ;
594 //Skip matched clusters with tracks in case of neutral+charged analysis
595 if( fPartInCone == kNeutralAndCharged &&
596 pid->IsTrackMatched(calo,reader->GetCaloUtils(),reader->GetInputEvent()) ) continue ;
598 //Assume that come from vertex in straight line
599 calo->GetMomentum(fMomentum,reader->GetVertex(evtIndex)) ;
601 pt = fMomentum.Pt() ;
602 eta = fMomentum.Eta() ;
603 phi = fMomentum.Phi() ;
606 {// Mixed event stored in AliAODPWG4Particles
607 AliAODPWG4Particle * calomix = dynamic_cast<AliAODPWG4Particle*>(plNe->At(ipr)) ;
610 AliWarning("Wrong calo data type, continue");
615 eta = calomix->Eta();
616 phi = calomix->Phi() ;
619 if( phi < 0 ) phi+=TMath::TwoPi();
621 rad = Radius(etaC, phiC, eta, phi);
623 // ** For the background out of cone **
627 if(eta > (etaC-fConeSize) && eta < (etaC+fConeSize)) phiBandPtSumCluster += pt;
628 if(phi > (phiC-fConeSize) && phi < (phiC+fConeSize)) etaBandPtSumCluster += pt;
631 // ** For the isolated particle **
633 // Only loop the particle at the same side of candidate
634 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
636 // // If at the same side has particle larger than candidate,
637 // // then candidate can not be the leading, skip such events
642 // coneptsumCluster = -1;
643 // isolated = kFALSE;
645 // pCandidate->SetLeadingParticle(kFALSE);
651 // reftracks ->Clear();
657 // refclusters->Clear();
658 // delete refclusters;
664 //Check if there is any particle inside cone with pt larger than fPtThreshold
666 AliDebug(2,Form("\t Cluster %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad));
670 AliDebug(2,"Inside candidate cone");
677 refclusters = new TObjArray(0);
678 //refclusters->SetName(Form("Clusters%s",aodArrayRefName.Data()));
679 TString tempo(aodArrayRefName) ;
680 tempo += "Clusters" ;
681 refclusters->SetName(tempo);
682 refclusters->SetOwner(kFALSE);
684 refclusters->Add(calo);
687 coneptsumCluster+=pt;
689 if( ptLead < pt ) ptLead = pt;
691 // // *Before*, count particles in cone
692 // if(pt > fPtThreshold && pt < fPtThresholdMax) n++;
694 // //if fPtFraction*ptC<fPtThreshold then consider the fPtThreshold directly
697 // if( fPtFraction*ptC < fPtThreshold )
699 // if( pt > fPtThreshold ) nfrac++ ;
703 // if( pt > fPtFraction*ptC ) nfrac++;
708 // if( pt > fPtFraction*ptC ) nfrac++;
713 }// neutral particle loop
717 //Add reference arrays to AOD when filling AODs only
720 if(refclusters) pCandidate->AddObjArray(refclusters);
721 if(reftracks) pCandidate->AddObjArray(reftracks);
724 coneptsum = coneptsumCluster + coneptsumTrack;
726 // *Now*, just check the leading particle in the cone if the threshold is passed
727 if(ptLead > fPtThreshold && ptLead < fPtThresholdMax) n = 1;
729 //if fPtFraction*ptC<fPtThreshold then consider the fPtThreshold directly
732 if( fPtFraction*ptC < fPtThreshold )
734 if( ptLead > fPtThreshold ) nfrac = 1 ;
738 if( ptLead > fPtFraction*ptC ) nfrac = 1;
743 if( ptLead > fPtFraction*ptC ) nfrac = 1;
746 //-------------------------------------------------------------------
747 //Check isolation, depending on selected isolation criteria requested
749 if( fICMethod == kPtThresIC)
751 if( n == 0 ) isolated = kTRUE ;
753 AliDebug(1,Form("pT Cand %2.2f, pT Lead %2.2f, %2.2f<pT Lead< %2.2f, isolated %d",
754 ptC,ptLead,fPtThreshold,fPtThresholdMax,isolated));
756 else if( fICMethod == kSumPtIC )
758 if( coneptsum > fSumPtThreshold &&
759 coneptsum < fSumPtThresholdMax )
764 AliDebug(1,Form("pT Cand %2.2f, SumPt %2.2f, %2.2f<Sum pT< %2.2f, isolated %d",
765 ptC,ptLead,fSumPtThreshold,fSumPtThresholdMax,isolated));
767 else if( fICMethod == kPtFracIC )
769 if(nfrac == 0 ) isolated = kTRUE ;
771 else if( fICMethod == kSumPtFracIC )
773 //when the fPtFraction*ptC < fSumPtThreshold then consider the later case
774 // printf("photon analysis IsDataMC() ?%i\n",IsDataMC());
777 if( fPtFraction*ptC < fSumPtThreshold && coneptsum < fSumPtThreshold ) isolated = kTRUE ;
778 if( fPtFraction*ptC > fSumPtThreshold && coneptsum < fPtFraction*ptC ) isolated = kTRUE ;
782 if( coneptsum < fPtFraction*ptC ) isolated = kTRUE ;
785 else if( fICMethod == kSumDensityIC )
787 // Get good cell density (number of active cells over all cells in cone)
788 // and correct energy in cone
790 Float_t cellDensity = GetCellDensity(pCandidate,reader);
792 if( coneptsum < fSumPtThreshold*cellDensity )
795 else if( fICMethod == kSumBkgSubIC )
797 Double_t coneptsumBkg = 0.;
798 Float_t etaBandPtSumTrackNorm = 0;
799 Float_t phiBandPtSumTrackNorm = 0;
800 Float_t etaBandPtSumClusterNorm = 0;
801 Float_t phiBandPtSumClusterNorm = 0;
803 Float_t excessFracEtaTrack = 1;
804 Float_t excessFracPhiTrack = 1;
805 Float_t excessFracEtaCluster = 1;
806 Float_t excessFracPhiCluster = 1;
808 // Normalize background to cone area
809 if (fPartInCone != kOnlyCharged )
810 CalculateUEBandClusterNormalization(reader, etaC, phiC,
811 phiBandPtSumCluster , etaBandPtSumCluster,
812 phiBandPtSumClusterNorm, etaBandPtSumClusterNorm,
813 excessFracEtaCluster , excessFracPhiCluster );
814 if (fPartInCone != kOnlyNeutral )
815 CalculateUEBandTrackNormalization(reader, etaC, phiC,
816 phiBandPtSumTrack , etaBandPtSumTrack ,
817 phiBandPtSumTrackNorm, etaBandPtSumTrackNorm,
818 excessFracEtaTrack , excessFracPhiTrack );
820 if (fPartInCone == kOnlyCharged ) coneptsumBkg = etaBandPtSumTrackNorm;
821 else if(fPartInCone == kOnlyNeutral ) coneptsumBkg = etaBandPtSumClusterNorm;
822 else if(fPartInCone == kNeutralAndCharged ) coneptsumBkg = etaBandPtSumClusterNorm + etaBandPtSumTrackNorm;
824 //coneptsumCluster*=(coneBadCellsCoeff*excessFracEtaCluster*excessFracPhiCluster) ; // apply this correction earlier???
825 // line commented out in last modif!!!
827 coneptsum = coneptsumCluster+coneptsumTrack;
829 coneptsum -= coneptsumBkg;
831 if( coneptsum > fSumPtThreshold && coneptsum < fSumPtThresholdMax )
840 //_____________________________________________________
841 void AliIsolationCut::Print(const Option_t * opt) const
844 //Print some relevant parameters set for the analysis
848 printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ;
850 printf("IC method = %d\n", fICMethod ) ;
851 printf("Cone Size = %1.2f\n", fConeSize ) ;
852 printf("pT threshold = >%2.1f;<%2.1f\n", fPtThreshold , fPtThresholdMax) ;
853 printf("Sum pT threshold = >%2.1f;<%2.1f\n", fSumPtThreshold,fSumPtThresholdMax) ;
854 printf("pT fraction = %3.1f\n", fPtFraction ) ;
855 printf("particle type in cone = %d\n", fPartInCone ) ;
856 printf("using fraction for high pt leading instead of frac ? %i\n",fFracIsThresh);
861 //___________________________________________________________________________
862 Float_t AliIsolationCut::Radius(Float_t etaC, Float_t phiC,
863 Float_t eta , Float_t phi) const
865 // Calculate the distance to trigger from any particle
867 Float_t dEta = etaC-eta;
868 Float_t dPhi = phiC-phi;
870 if(TMath::Abs(dPhi) >= TMath::Pi())
871 dPhi = TMath::TwoPi()-TMath::Abs(dPhi);
873 return TMath::Sqrt( dEta*dEta + dPhi*dPhi );