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 = kOnlyCharged;
95 fICMethod = kSumPtFracIC; // 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, Bool_t &leading) const
105 //Search in cone around a candidate particle if it is isolated
106 Float_t phiC = pCandidate->Phi() ;
107 if(phiC<0) phiC+=TMath::TwoPi();
108 Float_t etaC = pCandidate->Eta() ;
109 Float_t ptC = pCandidate->Pt() ;
111 Float_t eta = -100. ;
112 Float_t phi = -100. ;
113 Float_t rad = -100. ;
121 //Initialize the array with refrences
122 TObjArray * refclusters = 0x0;
123 TObjArray * reftracks = 0x0;
124 Int_t ntrackrefs = 0;
125 Int_t nclusterrefs = 0;
126 //Check charged particles in cone.
127 if(plCTS && (fPartInCone==kOnlyCharged || fPartInCone==kNeutralAndCharged)){
129 for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ ){
130 AliAODTrack* track = (AliAODTrack *)(plCTS->At(ipr)) ;
131 //Do not count the candidate (pion, conversion photon) or the daughters of the candidate
132 if(track->GetID() == pCandidate->GetTrackLabel(0) || track->GetID() == pCandidate->GetTrackLabel(1)
133 || track->GetID() == pCandidate->GetTrackLabel(2) || track->GetID() == pCandidate->GetTrackLabel(3)
135 p3.SetXYZ(track->Px(),track->Py(),track->Pz());
139 if(phi<0) phi+=TMath::TwoPi();
141 //only loop the particle at the same side of candidate
142 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
143 //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
150 if(bFillAOD && reftracks) {
156 //Check if there is any particle inside cone with pt larger than fPtThreshold
157 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
163 reftracks = new TObjArray(0);
164 //reftracks->SetName(Form("Tracks%s",aodArrayRefName.Data()));
165 TString tempo(aodArrayRefName) ;
167 reftracks->SetName(tempo);
168 reftracks->SetOwner(kFALSE);
170 reftracks->Add(track);
172 //printf("charged in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
174 if(pt > fPtThreshold ) n++;
175 if(pt > fPtFraction*ptC ) nfrac++;
177 }// charged particle loop
180 //Check neutral particles in cone.
181 if(plNe && (fPartInCone==kOnlyNeutral || fPartInCone==kNeutralAndCharged)){
183 //Get vertex for photon momentum calculation
184 //Double_t vertex2[] = {0,0,0} ; //vertex second AOD input ;
185 //if(reader->GetDataType()!= AliCaloTrackReader::kMC)
187 //if(reader->GetSecondInputAODTree()) reader->GetSecondInputAODVertex(vertex2);
190 for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ ){
191 AliVCluster * calo = (AliVCluster *)(plNe->At(ipr)) ;
193 //Get the index where the cluster comes, to retrieve the corresponding vertex
195 if (reader->GetMixedEvent()) {
196 evtIndex=reader->GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
199 //Do not count the candidate (photon or pi0) or the daughters of the candidate
200 if(calo->GetID() == pCandidate->GetCaloLabel(0) || calo->GetID() == pCandidate->GetCaloLabel(1)) continue ; //Skip matched clusters with tracks
202 if(calo->GetNTracksMatched() > 0) continue ;
204 //Input from second AOD?
206 // if (pCandidate->GetDetector() == "EMCAL" && reader->GetAODEMCALNormalInputEntries() <= ipr) input = 1 ;
207 // else if(pCandidate->GetDetector() == "PHOS" && reader->GetAODPHOSNormalInputEntries() <= ipr) input = 1;
209 //Get Momentum vector,
211 calo->GetMomentum(mom,reader->GetVertex(evtIndex)) ;//Assume that come from vertex in straight line
212 //else if(input == 1) calo->GetMomentum(mom,vertex2);//Assume that come from vertex in straight line
217 if(phi<0) phi+=TMath::TwoPi();
218 //only loop the particle at the same side of candidate
220 if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ;
221 //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events
234 refclusters->Clear();
241 //Check if there is any particle inside cone with pt larger than fPtThreshold
242 rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC));
247 refclusters = new TObjArray(0);
248 //refclusters->SetName(Form("Clusters%s",aodArrayRefName.Data()));
249 TString tempo(aodArrayRefName) ;
250 tempo += "Clusters" ;
251 refclusters->SetName(tempo);
252 refclusters->SetOwner(kFALSE);
254 refclusters->Add(calo);
256 //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad);
258 if(pt > fPtThreshold ) n++;
259 //if fPtFraction*ptC<fPtThreshold then consider the fPtThreshold directly
260 if(fPtFraction*ptC<fPtThreshold) {
261 if(pt>fPtThreshold) nfrac++ ;
264 if(pt>fPtFraction*ptC) nfrac++;
267 }// neutral particle loop
270 //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac);
272 //Add reference arrays to AOD when filling AODs only
274 if(refclusters) pCandidate->AddObjArray(refclusters);
275 if(reftracks) pCandidate->AddObjArray(reftracks);
277 //Check isolation, depending on method.
278 if( fICMethod == kPtThresIC){
279 if(n==0) isolated = kTRUE ;
281 else if( fICMethod == kSumPtIC){
282 if(coneptsum < fSumPtThreshold)
285 else if( fICMethod == kPtFracIC){
286 if(nfrac==0) isolated = kTRUE ;
288 else if( fICMethod == kSumPtFracIC){
289 //when the fPtFraction*ptC < fSumPtThreshold then consider the later case
290 if(fPtFraction*ptC < fSumPtThreshold && coneptsum < fSumPtThreshold) isolated = kTRUE ;
291 if(fPtFraction*ptC > fSumPtThreshold && coneptsum < fPtFraction*ptC) isolated = kTRUE ;
296 //__________________________________________________________________
297 void AliIsolationCut::Print(const Option_t * opt) const
300 //Print some relevant parameters set for the analysis
304 printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ;
306 printf("IC method = %d\n", fICMethod) ;
307 printf("Cone Size = %1.2f\n", fConeSize) ;
308 printf("pT threshold = %2.1f\n", fPtThreshold) ;
309 printf("pT fraction = %3.1f\n", fPtFraction) ;
310 printf("particle type in cone = %d\n",fPartInCone);