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 <Riostream.h>
34 #include <TLorentzVector.h>
35 #include <TObjArray.h>
37 // --- AliRoot system ---
38 #include "AliIsolationCut.h"
39 #include "AliAODPWG4ParticleCorrelation.h"
40 #include "AliAODTrack.h"
41 #include "AliVCluster.h"
42 #include "AliCaloTrackReader.h"
43 #include "AliMixedEvent.h"
45 ClassImp(AliIsolationCut)
47 //____________________________________________________________________________
48 AliIsolationCut::AliIsolationCut() :
50 fConeSize(0.),fPtThreshold(0.), fSumPtThreshold(0.), fPtFraction(0.), fICMethod(0),fPartInCone(0)
55 //Initialize parameters
60 //____________________________________________________________________________
61 AliIsolationCut::AliIsolationCut(const AliIsolationCut & g) :
63 fConeSize(g.fConeSize),
64 fPtThreshold(g.fPtThreshold),
65 fPtFraction(g.fPtFraction),
66 fICMethod(g.fICMethod)
72 //_________________________________________________________________________
73 AliIsolationCut & AliIsolationCut::operator = (const AliIsolationCut & source)
75 // assignment operator
77 if(&source == this) return *this;
79 fConeSize = source.fConeSize ;
80 fPtThreshold = source.fPtThreshold ;
81 fICMethod = source.fICMethod ;
82 fPtFraction = source.fPtFraction ;
88 //____________________________________________________________________________
89 TString AliIsolationCut::GetICParametersList()
91 //Put data member values in string to keep in output container
93 TString parList ; //this will be list of parameters used for this analysis.
94 const Int_t buffersize = 255;
95 char onePar[buffersize] ;
97 snprintf(onePar,buffersize,"--- AliIsolationCut ---\n") ;
99 snprintf(onePar,buffersize,"fConeSize: (isolation cone size) %1.2f\n",fConeSize) ;
101 snprintf(onePar,buffersize,"fPtThreshold =%1.2f (isolation pt threshold) \n",fPtThreshold) ;
103 snprintf(onePar,buffersize,"fPtFraction=%1.2f (isolation pt threshold fraction ) \n",fPtFraction) ;
105 snprintf(onePar,buffersize,"fICMethod=%d (isolation cut case) \n",fICMethod) ;
107 snprintf(onePar,buffersize,"fPartInCone=%d \n",fPartInCone) ;
113 //____________________________________________________________________________
114 void AliIsolationCut::InitParameters()
116 //Initialize the parameters of the analysis.
120 fSumPtThreshold = 0.5 ;
122 fPartInCone = kNeutralAndCharged;
123 fICMethod = kPtThresIC; // 0 pt threshol method, 1 cone pt sum method
127 //__________________________________________________________________
128 void AliIsolationCut::MakeIsolationCut(TObjArray * const plCTS, TObjArray * const plNe, AliCaloTrackReader * const reader,
129 const Bool_t bFillAOD, AliAODPWG4ParticleCorrelation *pCandidate,
130 const TString & aodArrayRefName,
131 Int_t & n, Int_t & nfrac, Float_t &coneptsum, Bool_t &isolated) const
133 //Search in cone around a candidate particle if it is isolated
134 Float_t phiC = pCandidate->Phi() ;
135 Float_t etaC = pCandidate->Eta() ;
136 Float_t ptC = pCandidate->Pt() ;
138 Float_t eta = -100. ;
139 Float_t phi = -100. ;
140 Float_t rad = -100. ;
147 //Initialize the array with refrences
148 TObjArray * refclusters = 0x0;
149 TObjArray * reftracks = 0x0;
150 Int_t ntrackrefs = 0;
151 Int_t nclusterrefs = 0;
152 //Check charged particles in cone.
153 if(plCTS && (fPartInCone==kOnlyCharged || fPartInCone==kNeutralAndCharged)){
155 for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ ){
156 AliAODTrack* track = (AliAODTrack *)(plCTS->At(ipr)) ;
157 //Do not count the candidate (pion, conversion photon) or the daughters of the candidate
158 if(track->GetID() == pCandidate->GetTrackLabel(0) || track->GetID() == pCandidate->GetTrackLabel(1)) continue ;
159 p3.SetXYZ(track->Px(),track->Py(),track->Pz());
163 if(phi<0) phi+=TMath::TwoPi();
165 //only loop the particle at the same side of candidate
166 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
167 //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
173 if(bFillAOD && reftracks) reftracks->Clear();
176 //Check if there is any particle inside cone with pt larger than fPtThreshold
177 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
183 reftracks = new TObjArray(0);
184 //reftracks->SetName(Form("Tracks%s",aodArrayRefName.Data()));
185 TString tempo(aodArrayRefName) ;
187 reftracks->SetName(tempo);
188 reftracks->SetOwner(kFALSE);
190 reftracks->Add(track);
192 //printf("charged in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
194 if(pt > fPtThreshold ) n++;
195 if(pt > fPtFraction*ptC ) nfrac++;
197 }// charged particle loop
200 //Check neutral particles in cone.
201 if(plNe && (fPartInCone==kOnlyNeutral || fPartInCone==kNeutralAndCharged)){
203 //Get vertex for photon momentum calculation
204 //Double_t vertex2[] = {0,0,0} ; //vertex second AOD input ;
205 //if(reader->GetDataType()!= AliCaloTrackReader::kMC)
207 //if(reader->GetSecondInputAODTree()) reader->GetSecondInputAODVertex(vertex2);
210 for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ ){
211 AliVCluster * calo = (AliVCluster *)(plNe->At(ipr)) ;
213 //Get the index where the cluster comes, to retrieve the corresponding vertex
215 if (reader->GetMixedEvent()) {
216 evtIndex=reader->GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
219 //Do not count the candidate (photon or pi0) or the daughters of the candidate
220 if(calo->GetID() == pCandidate->GetCaloLabel(0) || calo->GetID() == pCandidate->GetCaloLabel(1)) continue ; //Skip matched clusters with tracks
222 if(calo->GetNTracksMatched() > 0) continue ;
224 //Input from second AOD?
226 // if (pCandidate->GetDetector() == "EMCAL" && reader->GetAODEMCALNormalInputEntries() <= ipr) input = 1 ;
227 // else if(pCandidate->GetDetector() == "PHOS" && reader->GetAODPHOSNormalInputEntries() <= ipr) input = 1;
229 //Get Momentum vector,
231 calo->GetMomentum(mom,reader->GetVertex(evtIndex)) ;//Assume that come from vertex in straight line
232 //else if(input == 1) calo->GetMomentum(mom,vertex2);//Assume that come from vertex in straight line
237 if(phi<0) phi+=TMath::TwoPi();
238 //only loop the particle at the same side of candidate
240 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
241 //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
248 if(reftracks) reftracks ->Clear();
249 if(refclusters)refclusters->Clear();
254 //Check if there is any particle inside cone with pt larger than fPtThreshold
255 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
260 refclusters = new TObjArray(0);
261 //refclusters->SetName(Form("Clusters%s",aodArrayRefName.Data()));
262 TString tempo(aodArrayRefName) ;
263 tempo += "Clusters" ;
264 refclusters->SetName(tempo);
265 refclusters->SetOwner(kFALSE);
267 refclusters->Add(calo);
269 //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
271 if(pt > fPtThreshold ) n++;
272 //if fPtFraction*ptC<fPtThreshold then consider the fPtThreshold directly
273 if(fPtFraction*ptC<fPtThreshold) {
274 if(pt>fPtThreshold) nfrac++ ;
277 if(pt>fPtFraction*ptC) nfrac++;
280 }// neutral particle loop
283 //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac);
285 //Add reference arrays to AOD when filling AODs only
287 if(refclusters) pCandidate->AddObjArray(refclusters);
288 if(reftracks) pCandidate->AddObjArray(reftracks);
290 //Check isolation, depending on method.
291 if( fICMethod == kPtThresIC){
292 if(n==0) isolated = kTRUE ;
294 else if( fICMethod == kSumPtIC){
295 if(coneptsum < fSumPtThreshold)
298 else if( fICMethod == kPtFracIC){
299 if(nfrac==0) isolated = kTRUE ;
301 else if( fICMethod == kSumPtFracIC){
302 //when the fPtFraction*ptC < fSumPtThreshold then consider the later case
303 if(coneptsum < fPtFraction*ptC && coneptsum < fSumPtThreshold) isolated = kTRUE ;
308 //__________________________________________________________________
309 void AliIsolationCut::Print(const Option_t * opt) const
312 //Print some relevant parameters set for the analysis
316 printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ;
318 printf("IC method = %d\n", fICMethod) ;
319 printf("Cone Size = %1.2f\n", fConeSize) ;
320 printf("pT threshold = %2.1f\n", fPtThreshold) ;
321 printf("pT fraction = %3.1f\n", fPtFraction) ;
322 printf("particle type in cone = %d\n",fPartInCone);