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 TString AliIsolationCut::GetICParametersList()
63 //Put data member values in string to keep in output container
65 TString parList ; //this will be list of parameters used for this analysis.
66 const Int_t buffersize = 255;
67 char onePar[buffersize] ;
69 snprintf(onePar,buffersize,"--- AliIsolationCut ---\n") ;
71 snprintf(onePar,buffersize,"fConeSize: (isolation cone size) %1.2f\n",fConeSize) ;
73 snprintf(onePar,buffersize,"fPtThreshold =%1.2f (isolation pt threshold) \n",fPtThreshold) ;
75 snprintf(onePar,buffersize,"fPtFraction=%1.2f (isolation pt threshold fraction ) \n",fPtFraction) ;
77 snprintf(onePar,buffersize,"fICMethod=%d (isolation cut case) \n",fICMethod) ;
79 snprintf(onePar,buffersize,"fPartInCone=%d \n",fPartInCone) ;
85 //____________________________________________________________________________
86 void AliIsolationCut::InitParameters()
88 //Initialize the parameters of the analysis.
92 fSumPtThreshold = 0.5 ;
94 fPartInCone = kNeutralAndCharged;
95 fICMethod = kPtThresIC; // 0 pt threshol method, 1 cone pt sum method
99 //__________________________________________________________________
100 void AliIsolationCut::MakeIsolationCut(TObjArray * const plCTS, TObjArray * const plNe, AliCaloTrackReader * const reader,
101 const Bool_t bFillAOD, AliAODPWG4ParticleCorrelation *pCandidate,
102 const TString & aodArrayRefName,
103 Int_t & n, Int_t & nfrac, Float_t &coneptsum, Bool_t &isolated) const
105 //Search in cone around a candidate particle if it is isolated
106 Float_t phiC = pCandidate->Phi() ;
107 Float_t etaC = pCandidate->Eta() ;
108 Float_t ptC = pCandidate->Pt() ;
110 Float_t eta = -100. ;
111 Float_t phi = -100. ;
112 Float_t rad = -100. ;
119 //Initialize the array with refrences
120 TObjArray * refclusters = 0x0;
121 TObjArray * reftracks = 0x0;
122 Int_t ntrackrefs = 0;
123 Int_t nclusterrefs = 0;
124 //Check charged particles in cone.
125 if(plCTS && (fPartInCone==kOnlyCharged || fPartInCone==kNeutralAndCharged)){
127 for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ ){
128 AliAODTrack* track = (AliAODTrack *)(plCTS->At(ipr)) ;
129 //Do not count the candidate (pion, conversion photon) or the daughters of the candidate
130 if(track->GetID() == pCandidate->GetTrackLabel(0) || track->GetID() == pCandidate->GetTrackLabel(1)) continue ;
131 p3.SetXYZ(track->Px(),track->Py(),track->Pz());
135 if(phi<0) phi+=TMath::TwoPi();
137 //only loop the particle at the same side of candidate
138 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
139 //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
145 if(bFillAOD && reftracks) {
151 //Check if there is any particle inside cone with pt larger than fPtThreshold
152 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
158 reftracks = new TObjArray(0);
159 //reftracks->SetName(Form("Tracks%s",aodArrayRefName.Data()));
160 TString tempo(aodArrayRefName) ;
162 reftracks->SetName(tempo);
163 reftracks->SetOwner(kFALSE);
165 reftracks->Add(track);
167 //printf("charged in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
169 if(pt > fPtThreshold ) n++;
170 if(pt > fPtFraction*ptC ) nfrac++;
172 }// charged particle loop
175 //Check neutral particles in cone.
176 if(plNe && (fPartInCone==kOnlyNeutral || fPartInCone==kNeutralAndCharged)){
178 //Get vertex for photon momentum calculation
179 //Double_t vertex2[] = {0,0,0} ; //vertex second AOD input ;
180 //if(reader->GetDataType()!= AliCaloTrackReader::kMC)
182 //if(reader->GetSecondInputAODTree()) reader->GetSecondInputAODVertex(vertex2);
185 for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ ){
186 AliVCluster * calo = (AliVCluster *)(plNe->At(ipr)) ;
188 //Get the index where the cluster comes, to retrieve the corresponding vertex
190 if (reader->GetMixedEvent()) {
191 evtIndex=reader->GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
194 //Do not count the candidate (photon or pi0) or the daughters of the candidate
195 if(calo->GetID() == pCandidate->GetCaloLabel(0) || calo->GetID() == pCandidate->GetCaloLabel(1)) continue ; //Skip matched clusters with tracks
197 if(calo->GetNTracksMatched() > 0) continue ;
199 //Input from second AOD?
201 // if (pCandidate->GetDetector() == "EMCAL" && reader->GetAODEMCALNormalInputEntries() <= ipr) input = 1 ;
202 // else if(pCandidate->GetDetector() == "PHOS" && reader->GetAODPHOSNormalInputEntries() <= ipr) input = 1;
204 //Get Momentum vector,
206 calo->GetMomentum(mom,reader->GetVertex(evtIndex)) ;//Assume that come from vertex in straight line
207 //else if(input == 1) calo->GetMomentum(mom,vertex2);//Assume that come from vertex in straight line
212 if(phi<0) phi+=TMath::TwoPi();
213 //only loop the particle at the same side of candidate
215 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
216 //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
228 refclusters->Clear();
235 //Check if there is any particle inside cone with pt larger than fPtThreshold
236 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
241 refclusters = new TObjArray(0);
242 //refclusters->SetName(Form("Clusters%s",aodArrayRefName.Data()));
243 TString tempo(aodArrayRefName) ;
244 tempo += "Clusters" ;
245 refclusters->SetName(tempo);
246 refclusters->SetOwner(kFALSE);
248 refclusters->Add(calo);
250 //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
252 if(pt > fPtThreshold ) n++;
253 //if fPtFraction*ptC<fPtThreshold then consider the fPtThreshold directly
254 if(fPtFraction*ptC<fPtThreshold) {
255 if(pt>fPtThreshold) nfrac++ ;
258 if(pt>fPtFraction*ptC) nfrac++;
261 }// neutral particle loop
264 //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac);
266 //Add reference arrays to AOD when filling AODs only
268 if(refclusters) pCandidate->AddObjArray(refclusters);
269 if(reftracks) pCandidate->AddObjArray(reftracks);
271 //Check isolation, depending on method.
272 if( fICMethod == kPtThresIC){
273 if(n==0) isolated = kTRUE ;
275 else if( fICMethod == kSumPtIC){
276 if(coneptsum < fSumPtThreshold)
279 else if( fICMethod == kPtFracIC){
280 if(nfrac==0) isolated = kTRUE ;
282 else if( fICMethod == kSumPtFracIC){
283 //when the fPtFraction*ptC < fSumPtThreshold then consider the later case
284 if(coneptsum < fPtFraction*ptC && coneptsum < fSumPtThreshold) isolated = kTRUE ;
289 //__________________________________________________________________
290 void AliIsolationCut::Print(const Option_t * opt) const
293 //Print some relevant parameters set for the analysis
297 printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ;
299 printf("IC method = %d\n", fICMethod) ;
300 printf("Cone Size = %1.2f\n", fConeSize) ;
301 printf("pT threshold = %2.1f\n", fPtThreshold) ;
302 printf("pT fraction = %3.1f\n", fPtFraction) ;
303 printf("particle type in cone = %d\n",fPartInCone);