17 #include <TObjArray.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.),
75 Float_t emcPhiSize = TMath::DegToRad()*100.;
83 if((2*
fConeSize*emcPhiSize-coneA)!=0) phiUEptsumClusterNorm = phiUEptsumCluster*(coneA / (((2*
fConeSize*emcPhiSize)-coneA)));
84 if((2*
fConeSize*emcEtaSize-coneA)!=0) etaUEptsumClusterNorm = etaUEptsumCluster*(coneA / (((2*
fConeSize*emcEtaSize)-coneA)));
90 if(TMath::Abs(etaC)+
fConeSize > emcEtaSize/2.)
95 if ( excessFracEta != 0) coneA /= excessFracEta;
98 if(((2*
fConeSize-excess)*emcPhiSize-coneA) != 0 ) phiUEptsumClusterNorm = phiUEptsumCluster*(coneA / ((((2*
fConeSize-excess)*emcPhiSize)-coneA)));
99 if(( 2*
fConeSize *emcEtaSize-coneA) != 0 ) etaUEptsumClusterNorm = etaUEptsumCluster*(coneA / ((( 2*
fConeSize *emcEtaSize)-coneA)));
118 Float_t tpcPhiSize = TMath::TwoPi();
132 if((2*
fConeSize*tpcPhiSize-coneA)!=0) phiUEptsumTrackNorm = phiUEptsumTrack*(coneA / (((2*
fConeSize*tpcPhiSize)-coneA)));
133 if((2*
fConeSize*tpcEtaSize-coneA)!=0) etaUEptsumTrackNorm = etaUEptsumTrack*(coneA / (((2*
fConeSize*tpcEtaSize)-coneA)));
135 if(TMath::Abs(etaC)+
fConeSize > tpcEtaSize/2.)
139 if (excessFracEta != 0) coneA /= excessFracEta;
142 if(((2*
fConeSize-excess)*tpcPhiSize - coneA) !=0 ) phiUEptsumTrackNorm = phiUEptsumTrack*(coneA / ((((2*
fConeSize-excess)*tpcPhiSize)-coneA)));
143 if(( 2*
fConeSize *tpcEtaSize - coneA) !=0 ) etaUEptsumTrackNorm = etaUEptsumTrack*(coneA / ((( 2*
fConeSize *tpcEtaSize)-coneA)));
160 if(coneA > excessA)
return coneA / (coneA-excessA);
163 AliWarning(Form(
"Please Check : Excess Track %2.3f, coneA %2.2f, excessA %2.2f, angle %2.2f,factor %2.2f",
164 excess,coneA, excessA, angle*TMath::RadToDeg(), coneA / (coneA-excessA)));
180 if(phiC<0) phiC+=TMath::TwoPi();
185 AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
189 if (eGeom->GetAbsCellIdFromEtaPhi(etaC,phiC,absId))
192 Int_t iEta=-1, iPhi=-1, iRCU = -1;
196 if (nSupMod % 2) colC = AliEMCALGeoParams::fgkEMCALCols + iEta ;
197 Int_t rowC = iPhi + AliEMCALGeoParams::fgkEMCALRows*int(nSupMod/2);
201 for(
Int_t icol = colC-sqrSize; icol < colC+sqrSize;icol++)
203 for(
Int_t irow = rowC-sqrSize; irow < rowC+sqrSize; irow++)
205 if (
Radius(colC, rowC, icol, irow) < sqrSize)
210 Int_t cellEta = -999;
211 Int_t cellPhi = -999;
212 if(icol > AliEMCALGeoParams::fgkEMCALCols-1)
214 cellSM = 0+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
215 cellEta = icol-AliEMCALGeoParams::fgkEMCALCols;
216 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
218 if(icol < AliEMCALGeoParams::fgkEMCALCols)
220 cellSM = 1+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
222 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
226 if(icol < 0 || icol > AliEMCALGeoParams::fgkEMCALCols*2 ||
227 irow < 0 || irow > AliEMCALGeoParams::fgkEMCALRows*16./3)
240 else AliWarning(
"Cluster with bad (eta,phi) in EMCal for energy density calculation");
244 cellDensity = (coneCells-coneCellsBad)/coneCells;
258 Float_t & etaBandBadCellsCoeff,
259 Float_t & phiBandBadCellsCoeff)
266 if ( phiC < 0 ) phiC+=TMath::TwoPi();
271 AliEMCALGeometry* eGeom = AliEMCALGeometry::GetInstance();
275 if (eGeom->GetAbsCellIdFromEtaPhi(etaC,phiC,absId))
278 Int_t iEta=-1, iPhi=-1, iRCU = -1;
283 if (nSupMod % 2) colC = AliEMCALGeoParams::fgkEMCALCols + iEta ;
284 Int_t rowC = iPhi + AliEMCALGeoParams::fgkEMCALRows*int(nSupMod/2);
287 for(
Int_t icol = 0; icol < 2*AliEMCALGeoParams::fgkEMCALCols-1;icol++)
289 for(
Int_t irow = 0; irow < 5*AliEMCALGeoParams::fgkEMCALRows -1; irow++)
292 if (
Radius(colC, rowC, icol, irow) < sqrSize ) { coneCells += 1.; }
293 else if( icol>colC-sqrSize && icol<colC+sqrSize ) { phiBandCells += 1 ; }
294 else if( irow>rowC-sqrSize && irow<rowC+sqrSize ) { etaBandCells += 1 ; }
297 Int_t cellEta = -999;
298 Int_t cellPhi = -999;
299 if(icol > AliEMCALGeoParams::fgkEMCALCols-1)
301 cellSM = 0+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
302 cellEta = icol-AliEMCALGeoParams::fgkEMCALCols;
303 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
305 if(icol < AliEMCALGeoParams::fgkEMCALCols)
307 cellSM = 1+int(irow/AliEMCALGeoParams::fgkEMCALRows)*2;
309 cellPhi = irow-AliEMCALGeoParams::fgkEMCALRows*int(cellSM/2);
312 if( (icol < 0 || icol > AliEMCALGeoParams::fgkEMCALCols*2-1 ||
313 irow < 0 || irow > AliEMCALGeoParams::fgkEMCALRows*5 - 1)
316 if (
Radius(colC, rowC, icol, irow) < sqrSize ) coneBadCellsCoeff += 1.;
317 else if( icol>colC-sqrSize && icol<colC+sqrSize ) phiBandBadCellsCoeff += 1 ;
318 else if( irow>rowC-sqrSize && irow<rowC+sqrSize ) etaBandBadCellsCoeff += 1 ;
323 else AliWarning(
"Cluster with bad (eta,phi) in EMCal for energy density coeff calculation");
328 coneBadCellsCoeff = (coneCells-coneBadCellsCoeff)/coneCells;
332 if (phiBandCells > 0.)
335 phiBandBadCellsCoeff = (phiBandCells-phiBandBadCellsCoeff)/phiBandCells;
339 if (etaBandCells > 0.)
342 etaBandBadCellsCoeff = (etaBandCells-etaBandBadCellsCoeff)/etaBandCells;
355 const Int_t buffersize = 255;
356 char onePar[buffersize] ;
358 snprintf(onePar,buffersize,
"--- AliIsolationCut ---\n") ;
360 snprintf(onePar,buffersize,
"fConeSize: (isolation cone size) %1.2f\n",
fConeSize) ;
366 snprintf(onePar,buffersize,
"fPtFraction=%2.2f (isolation pt threshold fraction) \n",
fPtFraction) ;
368 snprintf(onePar,buffersize,
"fICMethod=%d (isolation cut case) \n",
fICMethod) ;
370 snprintf(onePar,buffersize,
"fPartInCone=%d \n",
fPartInCone) ;
372 snprintf(onePar,buffersize,
"fFracIsThresh=%i \n",
fFracIsThresh) ;
429 if ( phiC < 0 ) phiC+=TMath::TwoPi();
442 Float_t etaBandPtSumCluster = 0;
443 Float_t phiBandPtSumCluster = 0;
449 AliDebug(1,Form(
"Candidate pT %2.2f, eta %2.2f, phi %2.2f, cone %1.2f, thres %2.2f, Fill AOD? %d",
455 Int_t ntrackrefs = 0;
456 Int_t nclusterrefs = 0;
465 for(
Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ )
467 AliVTrack* track =
dynamic_cast<AliVTrack*
>(plCTS->At(ipr)) ;
477 Bool_t contained = kFALSE;
479 for(
Int_t i = 0; i < 4; i++)
481 if( trackID == pCandidate->
GetTrackLabel(i) ) contained = kTRUE;
484 if ( contained ) continue ;
487 fTrackVector.SetXYZ(track->Px(),track->Py(),track->Pz());
497 AliWarning(
"Wrong track data type, continue");
502 eta = trackmix->
Eta();
503 phi = trackmix->
Phi() ;
508 if ( phi < 0 ) phi+=TMath::TwoPi();
510 rad =
Radius(etaC, phiC, eta, phi);
527 if(TMath::Abs(phi-phiC) > TMath::PiOver2()) continue ;
549 AliDebug(2,Form(
"\t Track %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad));
556 AliDebug(2,
"Inside candidate cone");
565 TString tempo(aodArrayRefName) ;
567 reftracks->SetName(tempo);
568 reftracks->SetOwner(kFALSE);
570 reftracks->Add(track);
575 if( ptLead < pt ) ptLead = pt;
611 for(
Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ )
613 AliVCluster * calo =
dynamic_cast<AliVCluster *
>(plNe->At(ipr)) ;
620 evtIndex=reader->
GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
625 calo->GetID() == pCandidate->
GetCaloLabel(1) )
continue ;
646 AliWarning(
"Wrong calo data type, continue");
651 eta = calomix->
Eta();
652 phi = calomix->
Phi() ;
657 if( phi < 0 ) phi+=TMath::TwoPi();
659 rad =
Radius(etaC, phiC, eta, phi);
676 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
706 AliDebug(2,Form(
"\t Cluster %d, pT %2.2f, eta %1.2f, phi %2.2f, R candidate %2.2f", ipr,pt,eta,phi,rad));
713 AliDebug(2,
"Inside candidate cone");
722 TString tempo(aodArrayRefName) ;
723 tempo +=
"Clusters" ;
724 refclusters->SetName(tempo);
725 refclusters->SetOwner(kFALSE);
727 refclusters->Add(calo);
730 coneptsumCluster+=pt;
732 if( ptLead < pt ) ptLead = pt;
763 if(refclusters) pCandidate->
AddObjArray(refclusters);
767 coneptsum = coneptsumCluster + coneptsumTrack;
777 if( ptLead > fPtThreshold ) nfrac = 1 ;
794 if( n == 0 ) isolated = kTRUE ;
796 AliDebug(1,Form(
"pT Cand %2.2f, pT Lead %2.2f, %2.2f<pT Lead< %2.2f, isolated %d",
807 AliDebug(1,Form(
"pT Cand %2.2f, SumPt %2.2f, %2.2f<Sum pT< %2.2f, isolated %d",
812 if(nfrac == 0 ) isolated = kTRUE ;
825 if( coneptsum <
fPtFraction*ptC ) isolated = kTRUE ;
841 Float_t etaBandPtSumTrackNorm = 0;
842 Float_t phiBandPtSumTrackNorm = 0;
843 Float_t etaBandPtSumClusterNorm = 0;
844 Float_t phiBandPtSumClusterNorm = 0;
846 Float_t excessFracEtaTrack = 1;
847 Float_t excessFracPhiTrack = 1;
848 Float_t excessFracEtaCluster = 1;
849 Float_t excessFracPhiCluster = 1;
854 phiBandPtSumCluster , etaBandPtSumCluster,
855 phiBandPtSumClusterNorm, etaBandPtSumClusterNorm,
856 excessFracEtaCluster , excessFracPhiCluster );
860 phiBandPtSumTrack , etaBandPtSumTrack ,
861 phiBandPtSumTrackNorm, etaBandPtSumTrackNorm,
862 excessFracEtaTrack , excessFracPhiTrack );
871 coneptsum = coneptsumCluster+coneptsumTrack;
873 coneptsum -= coneptsumBkg;
891 printf(
"**** Print %s %s **** \n", GetName(), GetTitle() ) ;
894 printf(
"Cone Size = %1.2f\n",
fConeSize ) ;
898 printf(
"particle type in cone = %d\n",
fPartInCone ) ;
899 printf(
"using fraction for high pt leading instead of frac ? %i\n",
fFracIsThresh);
917 if(TMath::Abs(dPhi) >= TMath::Pi())
918 dPhi = TMath::TwoPi()-TMath::Abs(dPhi);
920 return TMath::Sqrt( dEta*dEta + dPhi*dPhi );
virtual Double_t Eta() const
virtual Double_t Pt() const
void MakeIsolationCut(TObjArray *plCTS, TObjArray *plNe, AliCaloTrackReader *reader, AliCaloPID *pid, Bool_t bFillAOD, AliCaloTrackParticleCorrelation *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
virtual void AddObjArray(TObjArray *refarray)
virtual Int_t GetTrackLabel(Int_t i) const
Bool_t IsTrackMatched(AliVCluster *cluster, AliCalorimeterUtils *cu, AliVEvent *event)
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
Float_t GetCellDensity(AliCaloTrackParticleCorrelation *pCandidate, AliCaloTrackReader *reader) const
Get good cell density (number of active cells over all cells in cone).
virtual void GetVertex(Double_t v[3]) const
virtual UInt_t GetDetectorTag() const
Int_t fPartInCone
Type of particles inside cone: kNeutralAndCharged, kOnlyNeutral, kOnlyCharged.
TString GetICParametersList()
Daughter of AliCaloTrackParticle that includes correlation part.
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()
Container for input particle information on CaloTrackCorr package.
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) ...
Float_t fPtFraction
Fraction of the momentum of particles in cone or sum in cone.
virtual Double_t Phi() const
void GetCoeffNormBadCell(AliCaloTrackParticleCorrelation *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).
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
virtual Int_t GetCaloLabel(Int_t i) 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...