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 **************************************************************************/
17 //_________________________________________________________________________
18 // Class containing methods for the isolation cut.
19 // An AOD candidate (AliAODPWG4ParticleCorrelation type)
20 // is passed. Look in a cone around the candidate and study
21 // the hadronic activity inside to decide if the candidate is isolated
24 //*-- Author: Gustavo Conesa (LNF-INFN)
26 //-Yaxian Mao (add the possibility for different IC method with different pt range, 01/10/2010)
27 //-Yaxian Mao (check the candidate particle is the leading particle or not at the same hemishere)
29 //////////////////////////////////////////////////////////////////////////////
32 // --- ROOT system ---
33 #include <TLorentzVector.h>
34 #include <TObjArray.h>
36 // --- AliRoot system ---
37 #include "AliIsolationCut.h"
38 #include "AliAODPWG4ParticleCorrelation.h"
39 #include "AliAODTrack.h"
40 #include "AliVCluster.h"
41 #include "AliCaloTrackReader.h"
42 #include "AliMixedEvent.h"
43 #include "AliCaloPID.h"
45 ClassImp(AliIsolationCut)
47 //____________________________________
48 AliIsolationCut::AliIsolationCut() :
60 //Initialize parameters
65 //____________________________________________
66 TString AliIsolationCut::GetICParametersList()
68 //Put data member values in string to keep in output container
70 TString parList ; //this will be list of parameters used for this analysis.
71 const Int_t buffersize = 255;
72 char onePar[buffersize] ;
74 snprintf(onePar,buffersize,"--- AliIsolationCut ---\n") ;
76 snprintf(onePar,buffersize,"fConeSize: (isolation cone size) %1.2f\n",fConeSize) ;
78 snprintf(onePar,buffersize,"fPtThreshold =%1.2f (isolation pt threshold) \n",fPtThreshold) ;
80 snprintf(onePar,buffersize,"fPtFraction=%1.2f (isolation pt threshold fraction ) \n",fPtFraction) ;
82 snprintf(onePar,buffersize,"fICMethod=%d (isolation cut case) \n",fICMethod) ;
84 snprintf(onePar,buffersize,"fPartInCone=%d \n",fPartInCone) ;
90 //____________________________________
91 void AliIsolationCut::InitParameters()
93 //Initialize the parameters of the analysis.
97 fSumPtThreshold = 0.5 ;
99 fPartInCone = kOnlyCharged;
100 fICMethod = kSumPtFracIC; // 0 pt threshol method, 1 cone pt sum method
104 //________________________________________________________________________________
105 void AliIsolationCut::MakeIsolationCut(const TObjArray * plCTS,
106 const TObjArray * plNe,
107 const AliCaloTrackReader * reader,
108 const AliCaloPID * pid,
109 const Bool_t bFillAOD,
110 AliAODPWG4ParticleCorrelation *pCandidate,
111 const TString & aodArrayRefName,
115 Bool_t &isolated) const
117 //Search in cone around a candidate particle if it is isolated
118 Float_t phiC = pCandidate->Phi() ;
119 if(phiC<0) phiC+=TMath::TwoPi();
120 Float_t etaC = pCandidate->Eta() ;
121 Float_t ptC = pCandidate->Pt() ;
123 Float_t eta = -100. ;
124 Float_t phi = -100. ;
125 Float_t rad = -100. ;
132 //Initialize the array with refrences
133 TObjArray * refclusters = 0x0;
134 TObjArray * reftracks = 0x0;
135 Int_t ntrackrefs = 0;
136 Int_t nclusterrefs = 0;
138 //Check charged particles in cone.
139 if(plCTS && (fPartInCone==kOnlyCharged || fPartInCone==kNeutralAndCharged)){
141 for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ ){
142 AliAODTrack* track = (AliAODTrack *)(plCTS->At(ipr)) ;
143 //Do not count the candidate (pion, conversion photon) or the daughters of the candidate
144 if(track->GetID() == pCandidate->GetTrackLabel(0) || track->GetID() == pCandidate->GetTrackLabel(1)
145 || track->GetID() == pCandidate->GetTrackLabel(2) || track->GetID() == pCandidate->GetTrackLabel(3)
147 p3.SetXYZ(track->Px(),track->Py(),track->Pz());
151 if(phi<0) phi+=TMath::TwoPi();
153 //only loop the particle at the same side of candidate
154 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
155 //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
161 if(bFillAOD && reftracks) {
168 //Check if there is any particle inside cone with pt larger than fPtThreshold
170 rad = Radius(etaC, phiC, eta, phi);
176 reftracks = new TObjArray(0);
177 //reftracks->SetName(Form("Tracks%s",aodArrayRefName.Data()));
178 TString tempo(aodArrayRefName) ;
180 reftracks->SetName(tempo);
181 reftracks->SetOwner(kFALSE);
183 reftracks->Add(track);
185 //printf("charged in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
187 if(pt > fPtThreshold ) n++;
188 if(pt > fPtFraction*ptC ) nfrac++;
190 }// charged particle loop
193 //Check neutral particles in cone.
194 if(plNe && (fPartInCone==kOnlyNeutral || fPartInCone==kNeutralAndCharged)){
198 for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ ){
199 AliVCluster * calo = (AliVCluster *)(plNe->At(ipr)) ;
201 //Get the index where the cluster comes, to retrieve the corresponding vertex
203 if (reader->GetMixedEvent()) {
204 evtIndex=reader->GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
207 //Do not count the candidate (photon or pi0) or the daughters of the candidate
208 if(calo->GetID() == pCandidate->GetCaloLabel(0) ||
209 calo->GetID() == pCandidate->GetCaloLabel(1)) continue ;
211 //Skip matched clusters with tracks
212 if( pid->IsTrackMatched(calo,reader->GetCaloUtils(),reader->GetInputEvent()) ) continue ;
214 //Assume that come from vertex in straight line
215 calo->GetMomentum(mom,reader->GetVertex(evtIndex)) ;
220 if(phi<0) phi+=TMath::TwoPi();
221 //only loop the particle at the same side of candidate
223 //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
224 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
237 refclusters->Clear();
244 //Check if there is any particle inside cone with pt larger than fPtThreshold
246 rad = Radius(etaC, phiC, eta, phi);
252 refclusters = new TObjArray(0);
253 //refclusters->SetName(Form("Clusters%s",aodArrayRefName.Data()));
254 TString tempo(aodArrayRefName) ;
255 tempo += "Clusters" ;
256 refclusters->SetName(tempo);
257 refclusters->SetOwner(kFALSE);
259 refclusters->Add(calo);
261 //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
263 if(pt > fPtThreshold ) n++;
264 //if fPtFraction*ptC<fPtThreshold then consider the fPtThreshold directly
265 if(fPtFraction*ptC<fPtThreshold) {
266 if(pt>fPtThreshold) nfrac++ ;
269 if(pt>fPtFraction*ptC) nfrac++;
272 }// neutral particle loop
275 //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac);
277 //Add reference arrays to AOD when filling AODs only
279 if(refclusters) pCandidate->AddObjArray(refclusters);
280 if(reftracks) pCandidate->AddObjArray(reftracks);
282 //Check isolation, depending on method.
283 if( fICMethod == kPtThresIC){
284 if(n==0) isolated = kTRUE ;
286 else if( fICMethod == kSumPtIC){
287 if(coneptsum < fSumPtThreshold)
290 else if( fICMethod == kPtFracIC){
291 if(nfrac==0) isolated = kTRUE ;
293 else if( fICMethod == kSumPtFracIC){
294 //when the fPtFraction*ptC < fSumPtThreshold then consider the later case
295 if(fPtFraction*ptC < fSumPtThreshold && coneptsum < fSumPtThreshold) isolated = kTRUE ;
296 if(fPtFraction*ptC > fSumPtThreshold && coneptsum < fPtFraction*ptC) isolated = kTRUE ;
301 //_____________________________________________________
302 void AliIsolationCut::Print(const Option_t * opt) const
305 //Print some relevant parameters set for the analysis
309 printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ;
311 printf("IC method = %d\n", fICMethod ) ;
312 printf("Cone Size = %1.2f\n", fConeSize ) ;
313 printf("pT threshold = %2.1f\n", fPtThreshold) ;
314 printf("pT fraction = %3.1f\n", fPtFraction ) ;
315 printf("particle type in cone = %d\n", fPartInCone ) ;
320 //___________________________________________________________________________
321 Float_t AliIsolationCut::Radius(const Float_t etaC, const Float_t phiC,
322 const Float_t eta , const Float_t phi) const
324 // Calculate the distance to trigger from any particle
326 Float_t dEta = etaC-eta;
327 Float_t dPhi = phiC-phi;
329 if(TMath::Abs(dPhi) >= TMath::Pi())
330 dPhi = TMath::TwoPi()-TMath::Abs(dPhi);
332 return TMath::Sqrt( dEta*dEta + dPhi*dPhi );