17 #include <TObjArray.h>
20 #include "AliAODPWG4ParticleCorrelation.h"
21 #include "AliEMCALGeometry.h"
22 #include "AliEMCALGeoParams.h"
23 #include "AliAODTrack.h"
24 #include "AliVCluster.h"
25 #include "AliMixedEvent.h"
46 fPtThresholdMax(10000.),
48 fSumPtThresholdMax(10000.),
54 fIsTMClusterInConeRejected(1),
55 fDistMinToTrigger(-1.),
74 Float_t emcPhiSize = TMath::DegToRad()*100.;
82 if((2*
fConeSize*emcPhiSize-coneA)!=0) phiUEptsumClusterNorm = phiUEptsumCluster*(coneA / (((2*
fConeSize*emcPhiSize)-coneA)));
83 if((2*
fConeSize*emcEtaSize-coneA)!=0) etaUEptsumClusterNorm = etaUEptsumCluster*(coneA / (((2*
fConeSize*emcEtaSize)-coneA)));
89 if(TMath::Abs(etaC)+
fConeSize > emcEtaSize/2.)
94 if ( excessFracEta != 0) coneA /= excessFracEta;
97 if(((2*
fConeSize-excess)*emcPhiSize-coneA) != 0 ) phiUEptsumClusterNorm = phiUEptsumCluster*(coneA / ((((2*
fConeSize-excess)*emcPhiSize)-coneA)));
98 if(( 2*
fConeSize *emcEtaSize-coneA) != 0 ) etaUEptsumClusterNorm = etaUEptsumCluster*(coneA / ((( 2*
fConeSize *emcEtaSize)-coneA)));
116 Float_t tpcPhiSize = TMath::TwoPi();
130 if((2*
fConeSize*tpcPhiSize-coneA)!=0) phiUEptsumTrackNorm = phiUEptsumTrack*(coneA / (((2*
fConeSize*tpcPhiSize)-coneA)));
131 if((2*
fConeSize*tpcEtaSize-coneA)!=0) etaUEptsumTrackNorm = etaUEptsumTrack*(coneA / (((2*
fConeSize*tpcEtaSize)-coneA)));
133 if(TMath::Abs(etaC)+
fConeSize > tpcEtaSize/2.)
137 if (excessFracEta != 0) coneA /= excessFracEta;
140 if(((2*
fConeSize-excess)*tpcPhiSize - coneA) !=0 ) phiUEptsumTrackNorm = phiUEptsumTrack*(coneA / ((((2*
fConeSize-excess)*tpcPhiSize)-coneA)));
141 if(( 2*
fConeSize *tpcEtaSize - coneA) !=0 ) etaUEptsumTrackNorm = etaUEptsumTrack*(coneA / ((( 2*
fConeSize *tpcEtaSize)-coneA)));
158 if(coneA > excessA)
return coneA / (coneA-excessA);
161 AliWarning(Form(
"Please Check : Excess Track %2.3f, coneA %2.2f, excessA %2.2f, angle %2.2f,factor %2.2f",
162 excess,coneA, excessA, angle*TMath::RadToDeg(), coneA / (coneA-excessA)));
177 Float_t phiC = pCandidate->Phi() ;
178 if(phiC<0) phiC+=TMath::TwoPi();
179 Float_t etaC = pCandidate->Eta() ;
183 AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
187 if (eGeom->GetAbsCellIdFromEtaPhi(etaC,phiC,absId))
190 Int_t iEta=-1, iPhi=-1, iRCU = -1;
194 if (nSupMod % 2) colC = AliEMCALGeoParams::fgkEMCALCols + iEta ;
195 Int_t rowC = iPhi + AliEMCALGeoParams::fgkEMCALRows*int(nSupMod/2);
199 for(
Int_t icol = colC-sqrSize; icol < colC+sqrSize;icol++)
201 for(
Int_t irow = rowC-sqrSize; irow < rowC+sqrSize; irow++)
203 if (
Radius(colC, rowC, icol, irow) < sqrSize)
208 Int_t cellEta = -999;
209 Int_t cellPhi = -999;
210 if(icol > AliEMCALGeoParams::fgkEMCALCols-1)
212 cellSM = 0+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
213 cellEta = icol-AliEMCALGeoParams::fgkEMCALCols;
214 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
216 if(icol < AliEMCALGeoParams::fgkEMCALCols)
218 cellSM = 1+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
220 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
224 if(icol < 0 || icol > AliEMCALGeoParams::fgkEMCALCols*2 ||
225 irow < 0 || irow > AliEMCALGeoParams::fgkEMCALRows*16./3)
238 else AliWarning(
"Cluster with bad (eta,phi) in EMCal for energy density calculation");
242 cellDensity = (coneCells-coneCellsBad)/coneCells;
256 Float_t & etaBandBadCellsCoeff,
257 Float_t & phiBandBadCellsCoeff)
263 Float_t phiC = pCandidate->Phi() ;
264 if ( phiC < 0 ) phiC+=TMath::TwoPi();
265 Float_t etaC = pCandidate->Eta() ;
269 AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
273 if (eGeom->GetAbsCellIdFromEtaPhi(etaC,phiC,absId))
276 Int_t iEta=-1, iPhi=-1, iRCU = -1;
281 if (nSupMod % 2) colC = AliEMCALGeoParams::fgkEMCALCols + iEta ;
282 Int_t rowC = iPhi + AliEMCALGeoParams::fgkEMCALRows*int(nSupMod/2);
285 for(
Int_t icol = 0; icol < 2*AliEMCALGeoParams::fgkEMCALCols-1;icol++)
287 for(
Int_t irow = 0; irow < 5*AliEMCALGeoParams::fgkEMCALRows -1; irow++)
290 if (
Radius(colC, rowC, icol, irow) < sqrSize ) { coneCells += 1.; }
291 else if( icol>colC-sqrSize && icol<colC+sqrSize ) { phiBandCells += 1 ; }
292 else if( irow>rowC-sqrSize && irow<rowC+sqrSize ) { etaBandCells += 1 ; }
295 Int_t cellEta = -999;
296 Int_t cellPhi = -999;
297 if(icol > AliEMCALGeoParams::fgkEMCALCols-1)
299 cellSM = 0+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
300 cellEta = icol-AliEMCALGeoParams::fgkEMCALCols;
301 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
303 if(icol < AliEMCALGeoParams::fgkEMCALCols)
305 cellSM = 1+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
307 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
310 if( (icol < 0 || icol > AliEMCALGeoParams::fgkEMCALCols*2-1 ||
311 irow < 0 || irow > AliEMCALGeoParams::fgkEMCALRows*5 - 1)
314 if (
Radius(colC, rowC, icol, irow) < sqrSize ) coneBadCellsCoeff += 1.;
315 else if( icol>colC-sqrSize && icol<colC+sqrSize ) phiBandBadCellsCoeff += 1 ;
316 else if( irow>rowC-sqrSize && irow<rowC+sqrSize ) etaBandBadCellsCoeff += 1 ;
321 else AliWarning(
"Cluster with bad (eta,phi) in EMCal for energy density coeff calculation");
326 coneBadCellsCoeff = (coneCells-coneBadCellsCoeff)/coneCells;
330 if (phiBandCells > 0.)
333 phiBandBadCellsCoeff = (phiBandCells-phiBandBadCellsCoeff)/phiBandCells;
337 if (etaBandCells > 0.)
340 etaBandBadCellsCoeff = (etaBandCells-etaBandBadCellsCoeff)/etaBandCells;
353 const Int_t buffersize = 255;
354 char onePar[buffersize] ;
356 snprintf(onePar,buffersize,
"--- AliIsolationCut ---\n") ;
358 snprintf(onePar,buffersize,
"fConeSize: (isolation cone size) %1.2f\n",
fConeSize) ;
364 snprintf(onePar,buffersize,
"fPtFraction=%2.2f (isolation pt threshold fraction) \n",
fPtFraction) ;
366 snprintf(onePar,buffersize,
"fICMethod=%d (isolation cut case) \n",
fICMethod) ;
368 snprintf(onePar,buffersize,
"fPartInCone=%d \n",
fPartInCone) ;
370 snprintf(onePar,buffersize,
"fFracIsThresh=%i \n",
fFracIsThresh) ;
418 AliAODPWG4ParticleCorrelation *pCandidate,
425 Float_t ptC = pCandidate->Pt() ;
426 Float_t phiC = pCandidate->Phi() ;
427 if ( phiC < 0 ) phiC+=TMath::TwoPi();
428 Float_t etaC = pCandidate->Eta() ;
440 Float_t etaBandPtSumCluster = 0;
441 Float_t phiBandPtSumCluster = 0;
447 AliDebug(1,Form(
"Candidate pT %2.2f, eta %2.2f, phi %2.2f, cone %1.2f, thres %2.2f, Fill AOD? %d",
448 pCandidate->Pt(), pCandidate->Eta(), pCandidate->Phi()*TMath::RadToDeg(),
fConeSize,
fPtThreshold,bFillAOD));
453 Int_t ntrackrefs = 0;
454 Int_t nclusterrefs = 0;
463 for(
Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ )
465 AliVTrack* track =
dynamic_cast<AliVTrack*
>(plCTS->At(ipr)) ;
475 Bool_t contained = kFALSE;
477 for(
Int_t i = 0; i < 4; i++)
479 if( trackID == pCandidate->GetTrackLabel(i) ) contained = kTRUE;
482 if ( contained ) continue ;
485 fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
492 AliAODPWG4Particle * trackmix =
dynamic_cast<AliAODPWG4Particle*
>(plCTS->At(ipr)) ;
495 AliWarning(
"Wrong track data type, continue");
500 eta = trackmix->Eta();
501 phi = trackmix->Phi() ;
506 if ( phi < 0 ) phi+=TMath::TwoPi();
508 rad =
Radius(etaC, phiC, eta, phi);
525 if(TMath::Abs(phi-phiC) > TMath::PiOver2()) continue ;
547 AliDebug(2,Form(
"\t Track %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad));
554 AliDebug(2,
"Inside candidate cone");
563 TString tempo(aodArrayRefName) ;
565 reftracks->SetName(tempo);
566 reftracks->SetOwner(kFALSE);
568 reftracks->Add(track);
573 if( ptLead < pt ) ptLead = pt;
609 for(
Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ )
611 AliVCluster * calo =
dynamic_cast<AliVCluster *
>(plNe->At(ipr)) ;
618 evtIndex=reader->
GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
622 if(calo->GetID() == pCandidate->GetCaloLabel(0) ||
623 calo->GetID() == pCandidate->GetCaloLabel(1) )
continue ;
641 AliAODPWG4Particle * calomix =
dynamic_cast<AliAODPWG4Particle*
>(plNe->At(ipr)) ;
644 AliWarning(
"Wrong calo data type, continue");
649 eta = calomix->Eta();
650 phi = calomix->Phi() ;
655 if( phi < 0 ) phi+=TMath::TwoPi();
657 rad =
Radius(etaC, phiC, eta, phi);
674 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
704 AliDebug(2,Form(
"\t Cluster %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad));
711 AliDebug(2,
"Inside candidate cone");
720 TString tempo(aodArrayRefName) ;
721 tempo +=
"Clusters" ;
722 refclusters->SetName(tempo);
723 refclusters->SetOwner(kFALSE);
725 refclusters->Add(calo);
728 coneptsumCluster+=pt;
730 if( ptLead < pt ) ptLead = pt;
761 if(refclusters) pCandidate->AddObjArray(refclusters);
762 if(reftracks) pCandidate->AddObjArray(reftracks);
765 coneptsum = coneptsumCluster + coneptsumTrack;
775 if( ptLead > fPtThreshold ) nfrac = 1 ;
792 if( n == 0 ) isolated = kTRUE ;
794 AliDebug(1,Form(
"pT Cand %2.2f, pT Lead %2.2f, %2.2f<pT Lead< %2.2f, isolated %d",
805 AliDebug(1,Form(
"pT Cand %2.2f, SumPt %2.2f, %2.2f<Sum pT< %2.2f, isolated %d",
810 if(nfrac == 0 ) isolated = kTRUE ;
823 if( coneptsum <
fPtFraction*ptC ) isolated = kTRUE ;
839 Float_t etaBandPtSumTrackNorm = 0;
840 Float_t phiBandPtSumTrackNorm = 0;
841 Float_t etaBandPtSumClusterNorm = 0;
842 Float_t phiBandPtSumClusterNorm = 0;
844 Float_t excessFracEtaTrack = 1;
845 Float_t excessFracPhiTrack = 1;
846 Float_t excessFracEtaCluster = 1;
847 Float_t excessFracPhiCluster = 1;
852 phiBandPtSumCluster , etaBandPtSumCluster,
853 phiBandPtSumClusterNorm, etaBandPtSumClusterNorm,
854 excessFracEtaCluster , excessFracPhiCluster );
858 phiBandPtSumTrack , etaBandPtSumTrack ,
859 phiBandPtSumTrackNorm, etaBandPtSumTrackNorm,
860 excessFracEtaTrack , excessFracPhiTrack );
869 coneptsum = coneptsumCluster+coneptsumTrack;
871 coneptsum -= coneptsumBkg;
889 printf(
"**** Print %s %s **** \n", GetName(), GetTitle() ) ;
892 printf(
"Cone Size = %1.2f\n",
fConeSize ) ;
896 printf(
"particle type in cone = %d\n",
fPartInCone ) ;
897 printf(
"using fraction for high pt leading instead of frac ? %i\n",
fFracIsThresh);
915 if(TMath::Abs(dPhi) >= TMath::Pi())
916 dPhi = TMath::TwoPi()-TMath::Abs(dPhi);
918 return TMath::Sqrt( dEta*dEta + dPhi*dPhi );
void MakeIsolationCut(TObjArray *plCTS, TObjArray *plNe, AliCaloTrackReader *reader, AliCaloPID *pid, Bool_t bFillAOD, AliAODPWG4ParticleCorrelation *pCandidate, TString aodObjArrayName, Int_t &n, Int_t &nfrac, Float_t &ptSum, Float_t &ptLead, Bool_t &isolated)
AliCalorimeterUtils * GetCaloUtils() const
TArrayF * GetCTSFidCutMaxEtaArray() const
Bool_t fFracIsThresh
Use threshold instead of fraction when pt leading is small.
TLorentzVector fMomentum
! Momentum of cluster, temporal object.
Class with utils to perform Isolation Cuts.
virtual AliVEvent * GetInputEvent() const
Int_t fICMethod
Isolation cut method to be used: kPtIC, kSumPtIC, kPtFracIC, kSumPtFracIC.
Float_t fPtThreshold
Minimum pt of the particles in the cone or sum in cone (UE pt mean in the forward region cone) ...
virtual AliMixedEvent * GetMixedEvent() const
virtual void GetVertex(Double_t v[3]) const
Int_t fPartInCone
Type of particles inside cone: kNeutralAndCharged, kOnlyNeutral, kOnlyCharged.
TString GetICParametersList()
TVector3 fTrackVector
! Track moment, temporal object.
Float_t fSumPtThresholdMax
Maximum of sum pt of the particles in the cone (UE sum in the forward region cone) ...
virtual AliFiducialCut * GetFiducialCut()
Float_t GetCellDensity(AliAODPWG4ParticleCorrelation *pCandidate, AliCaloTrackReader *reader) const
Get good cell density (number of active cells over all cells in cone).
Float_t fConeSize
Size of the isolation cone.
void CalculateUEBandClusterNormalization(AliCaloTrackReader *reader, Float_t etaC, Float_t phiC, Float_t phiUEptsumCluster, Float_t etaUEptsumCluster, Float_t &phiUEptsumClusterNorm, Float_t &etaUEptsumClusterNorm, Float_t &excessFracEta, Float_t &excessFracPhi) const
Get normalization of cluster background band.
Base class for event, clusters and tracks filtering and preparation for the analysis.
virtual Int_t GetTrackID(AliVTrack *track)
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
void CalculateUEBandTrackNormalization(AliCaloTrackReader *reader, Float_t etaC, Float_t phiC, Float_t phiUEptsumTrack, Float_t etaUEptsumTrack, Float_t &phiUEptsumTrackNorm, Float_t &etaUEptsumTrackNorm, Float_t &excessFracEta, Float_t &excessFracPhi) const
Get normalization of track background band.
Float_t fDistMinToTrigger
Minimal distance between isolation candidate particle and particles in cone to count them for this is...
Float_t fPtThresholdMax
Maximum pt of the particles outside the cone (needed to fit shower distribution isolated/non-isolated...
Bool_t fIsTMClusterInConeRejected
Enable to remove the Track matching removal of clusters in cone sum pt calculation in case of kNeutra...
Float_t fSumPtThreshold
Minimum of sum pt of the particles in the cone (UE sum in the forward region cone) ...
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Float_t fPtFraction
Fraction of the momentum of particles in cone or sum in cone.
Int_t GetEMCALChannelStatus(Int_t iSM, Int_t iCol, Int_t iRow) const
Class for PID selection with calorimeters.
Class with utils specific to calorimeter clusters/cells.
AliIsolationCut()
Default constructor. Initialize parameters.
Float_t Radius(Float_t etaCandidate, Float_t phiCandidate, Float_t eta, Float_t phi) const
Float_t CalculateExcessAreaFraction(Float_t excess) const
TArrayF * GetCTSFidCutMinEtaArray() const
void GetCoeffNormBadCell(AliAODPWG4ParticleCorrelation *pCandidate, AliCaloTrackReader *reader, Float_t &coneBadCellsCoeff, Float_t &etaBandBadCellsCoeff, Float_t &phiBandBadCellsCoeff)
Get good cell density (number of active cells over all cells in cone).
Bool_t IsTrackMatched(AliVCluster *cluster, AliCalorimeterUtils *cu, AliVEvent *event) const
Int_t GetModuleNumberCellIndexes(Int_t absId, Int_t calo, Int_t &icol, Int_t &irow, Int_t &iRCU) const
Get the EMCAL/PHOS module, columns, row and RCU/DDL number that corresponds to this absId...