]>
Commit | Line | Data |
---|---|---|
a5fb4114 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | /* $Id: $ */ | |
16 | ||
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 | |
22 | // | |
23 | // | |
24 | //*-- Author: Gustavo Conesa (LNF-INFN) | |
25 | ||
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) | |
28 | ||
29 | ////////////////////////////////////////////////////////////////////////////// | |
30 | ||
31 | ||
32 | // --- ROOT system --- | |
a5fb4114 | 33 | #include <TLorentzVector.h> |
34 | #include <TObjArray.h> | |
35 | ||
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" | |
ac5111f9 | 43 | #include "AliCaloPID.h" |
a5fb4114 | 44 | |
45 | ClassImp(AliIsolationCut) | |
46 | ||
c5693f62 | 47 | //____________________________________ |
48 | AliIsolationCut::AliIsolationCut() : | |
49 | TObject(), | |
50 | fConeSize(0.), | |
51 | fPtThreshold(0.), | |
52 | fSumPtThreshold(0.), | |
53 | fPtFraction(0.), | |
54 | fICMethod(0), | |
55 | fPartInCone(0) | |
56 | ||
a5fb4114 | 57 | { |
58 | //default ctor | |
59 | ||
60 | //Initialize parameters | |
61 | InitParameters(); | |
c5693f62 | 62 | |
a5fb4114 | 63 | } |
64 | ||
c5693f62 | 65 | //____________________________________________ |
a5fb4114 | 66 | TString AliIsolationCut::GetICParametersList() |
67 | { | |
68 | //Put data member values in string to keep in output container | |
69 | ||
70 | TString parList ; //this will be list of parameters used for this analysis. | |
71 | const Int_t buffersize = 255; | |
72 | char onePar[buffersize] ; | |
73 | ||
74 | snprintf(onePar,buffersize,"--- AliIsolationCut ---\n") ; | |
75 | parList+=onePar ; | |
76 | snprintf(onePar,buffersize,"fConeSize: (isolation cone size) %1.2f\n",fConeSize) ; | |
77 | parList+=onePar ; | |
78 | snprintf(onePar,buffersize,"fPtThreshold =%1.2f (isolation pt threshold) \n",fPtThreshold) ; | |
79 | parList+=onePar ; | |
80 | snprintf(onePar,buffersize,"fPtFraction=%1.2f (isolation pt threshold fraction ) \n",fPtFraction) ; | |
81 | parList+=onePar ; | |
82 | snprintf(onePar,buffersize,"fICMethod=%d (isolation cut case) \n",fICMethod) ; | |
83 | parList+=onePar ; | |
84 | snprintf(onePar,buffersize,"fPartInCone=%d \n",fPartInCone) ; | |
85 | parList+=onePar ; | |
1a31a9ab | 86 | |
a5fb4114 | 87 | return parList; |
88 | } | |
89 | ||
90 | //____________________________________________________________________________ | |
91 | void AliIsolationCut::InitParameters() | |
92 | { | |
93 | //Initialize the parameters of the analysis. | |
94 | ||
95 | fConeSize = 0.4 ; | |
96 | fPtThreshold = 1. ; | |
97 | fSumPtThreshold = 0.5 ; | |
98 | fPtFraction = 0.1 ; | |
99 | fPartInCone = kOnlyCharged; | |
100 | fICMethod = kSumPtFracIC; // 0 pt threshol method, 1 cone pt sum method | |
101 | ||
102 | } | |
103 | ||
c5693f62 | 104 | //________________________________________________________________________________ |
105 | void AliIsolationCut::MakeIsolationCut(const TObjArray * plCTS, | |
106 | const TObjArray * plNe, | |
107 | const AliCaloTrackReader * reader, | |
ac5111f9 | 108 | const AliCaloPID * pid, |
c5693f62 | 109 | const Bool_t bFillAOD, |
110 | AliAODPWG4ParticleCorrelation *pCandidate, | |
111 | const TString & aodArrayRefName, | |
112 | Int_t & n, | |
113 | Int_t & nfrac, | |
114 | Float_t &coneptsum, | |
115 | Bool_t &isolated) const | |
a5fb4114 | 116 | { |
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() ; | |
122 | Float_t pt = -100. ; | |
123 | Float_t eta = -100. ; | |
124 | Float_t phi = -100. ; | |
125 | Float_t rad = -100. ; | |
126 | ||
127 | n = 0 ; | |
128 | nfrac = 0 ; | |
129 | coneptsum = 0.; | |
130 | isolated = kFALSE; | |
1a31a9ab | 131 | |
a5fb4114 | 132 | //Initialize the array with refrences |
133 | TObjArray * refclusters = 0x0; | |
134 | TObjArray * reftracks = 0x0; | |
135 | Int_t ntrackrefs = 0; | |
136 | Int_t nclusterrefs = 0; | |
ac5111f9 | 137 | |
a5fb4114 | 138 | //Check charged particles in cone. |
139 | if(plCTS && (fPartInCone==kOnlyCharged || fPartInCone==kNeutralAndCharged)){ | |
140 | TVector3 p3; | |
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) | |
1a31a9ab | 145 | || track->GetID() == pCandidate->GetTrackLabel(2) || track->GetID() == pCandidate->GetTrackLabel(3) |
146 | ) continue ; | |
a5fb4114 | 147 | p3.SetXYZ(track->Px(),track->Py(),track->Pz()); |
148 | pt = p3.Pt(); | |
149 | eta = p3.Eta(); | |
150 | phi = p3.Phi() ; | |
151 | if(phi<0) phi+=TMath::TwoPi(); | |
152 | ||
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 | |
156 | if(pt > ptC){ | |
157 | n = -1; | |
158 | nfrac = -1; | |
159 | coneptsum = -1; | |
160 | isolated = kFALSE; | |
a5fb4114 | 161 | if(bFillAOD && reftracks) { |
162 | reftracks->Clear(); | |
163 | delete reftracks; | |
164 | } | |
165 | return ; | |
166 | } | |
167 | //Check if there is any particle inside cone with pt larger than fPtThreshold | |
168 | rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC)); | |
169 | ||
170 | if(rad < fConeSize){ | |
171 | if(bFillAOD) { | |
172 | ntrackrefs++; | |
173 | if(ntrackrefs == 1){ | |
174 | reftracks = new TObjArray(0); | |
175 | //reftracks->SetName(Form("Tracks%s",aodArrayRefName.Data())); | |
176 | TString tempo(aodArrayRefName) ; | |
177 | tempo += "Tracks" ; | |
178 | reftracks->SetName(tempo); | |
179 | reftracks->SetOwner(kFALSE); | |
180 | } | |
181 | reftracks->Add(track); | |
182 | } | |
183 | //printf("charged in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad); | |
184 | coneptsum+=pt; | |
185 | if(pt > fPtThreshold ) n++; | |
186 | if(pt > fPtFraction*ptC ) nfrac++; | |
187 | } // Inside cone | |
188 | }// charged particle loop | |
189 | }//Tracks | |
190 | ||
191 | //Check neutral particles in cone. | |
192 | if(plNe && (fPartInCone==kOnlyNeutral || fPartInCone==kNeutralAndCharged)){ | |
193 | ||
1a31a9ab | 194 | |
a5fb4114 | 195 | TLorentzVector mom ; |
196 | for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ ){ | |
197 | AliVCluster * calo = (AliVCluster *)(plNe->At(ipr)) ; | |
198 | ||
199 | //Get the index where the cluster comes, to retrieve the corresponding vertex | |
200 | Int_t evtIndex = 0 ; | |
201 | if (reader->GetMixedEvent()) { | |
202 | evtIndex=reader->GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ; | |
203 | } | |
204 | ||
205 | //Do not count the candidate (photon or pi0) or the daughters of the candidate | |
ac5111f9 | 206 | if(calo->GetID() == pCandidate->GetCaloLabel(0) || |
207 | calo->GetID() == pCandidate->GetCaloLabel(1)) continue ; | |
a5fb4114 | 208 | |
ac5111f9 | 209 | //Skip matched clusters with tracks |
210 | if( pid->IsTrackMatched(calo,reader->GetCaloUtils(),reader->GetInputEvent()) ) continue ; | |
211 | ||
212 | //Assume that come from vertex in straight line | |
213 | calo->GetMomentum(mom,reader->GetVertex(evtIndex)) ; | |
a5fb4114 | 214 | |
215 | pt = mom.Pt(); | |
216 | eta = mom.Eta(); | |
217 | phi = mom.Phi() ; | |
218 | if(phi<0) phi+=TMath::TwoPi(); | |
219 | //only loop the particle at the same side of candidate | |
220 | ||
a5fb4114 | 221 | //if at the same side has particle larger than candidate, then candidate can not be the leading, skip such events |
ac5111f9 | 222 | if(TMath::Abs(phi-phiC)>TMath::PiOver2()) continue ; |
223 | ||
a5fb4114 | 224 | if(pt > ptC){ |
225 | n = -1; | |
226 | nfrac = -1; | |
227 | coneptsum = -1; | |
228 | isolated = kFALSE; | |
a5fb4114 | 229 | if(bFillAOD){ |
230 | if(reftracks){ | |
231 | reftracks ->Clear(); | |
232 | delete reftracks; | |
233 | } | |
234 | if(refclusters){ | |
235 | refclusters->Clear(); | |
236 | delete refclusters; | |
237 | } | |
238 | } | |
239 | return ; | |
240 | } | |
241 | ||
242 | //Check if there is any particle inside cone with pt larger than fPtThreshold | |
243 | rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC)); | |
244 | if(rad < fConeSize){ | |
245 | if(bFillAOD) { | |
246 | nclusterrefs++; | |
247 | if(nclusterrefs==1){ | |
248 | refclusters = new TObjArray(0); | |
249 | //refclusters->SetName(Form("Clusters%s",aodArrayRefName.Data())); | |
250 | TString tempo(aodArrayRefName) ; | |
251 | tempo += "Clusters" ; | |
252 | refclusters->SetName(tempo); | |
253 | refclusters->SetOwner(kFALSE); | |
254 | } | |
255 | refclusters->Add(calo); | |
256 | } | |
257 | //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad); | |
258 | coneptsum+=pt; | |
259 | if(pt > fPtThreshold ) n++; | |
260 | //if fPtFraction*ptC<fPtThreshold then consider the fPtThreshold directly | |
261 | if(fPtFraction*ptC<fPtThreshold) { | |
1a31a9ab | 262 | if(pt>fPtThreshold) nfrac++ ; |
a5fb4114 | 263 | } |
264 | else { | |
1a31a9ab | 265 | if(pt>fPtFraction*ptC) nfrac++; |
a5fb4114 | 266 | } |
267 | }//in cone | |
268 | }// neutral particle loop | |
269 | }//neutrals | |
1a31a9ab | 270 | |
a5fb4114 | 271 | //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac); |
272 | ||
273 | //Add reference arrays to AOD when filling AODs only | |
274 | if(bFillAOD) { | |
275 | if(refclusters) pCandidate->AddObjArray(refclusters); | |
276 | if(reftracks) pCandidate->AddObjArray(reftracks); | |
277 | } | |
278 | //Check isolation, depending on method. | |
279 | if( fICMethod == kPtThresIC){ | |
280 | if(n==0) isolated = kTRUE ; | |
281 | } | |
282 | else if( fICMethod == kSumPtIC){ | |
283 | if(coneptsum < fSumPtThreshold) | |
284 | isolated = kTRUE ; | |
285 | } | |
286 | else if( fICMethod == kPtFracIC){ | |
287 | if(nfrac==0) isolated = kTRUE ; | |
288 | } | |
289 | else if( fICMethod == kSumPtFracIC){ | |
290 | //when the fPtFraction*ptC < fSumPtThreshold then consider the later case | |
291 | if(fPtFraction*ptC < fSumPtThreshold && coneptsum < fSumPtThreshold) isolated = kTRUE ; | |
292 | if(fPtFraction*ptC > fSumPtThreshold && coneptsum < fPtFraction*ptC) isolated = kTRUE ; | |
293 | } | |
294 | ||
295 | } | |
296 | ||
c5693f62 | 297 | //_____________________________________________________ |
a5fb4114 | 298 | void AliIsolationCut::Print(const Option_t * opt) const |
299 | { | |
300 | ||
301 | //Print some relevant parameters set for the analysis | |
302 | if(! opt) | |
303 | return; | |
304 | ||
305 | printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ; | |
306 | ||
c5693f62 | 307 | printf("IC method = %d\n", fICMethod ) ; |
308 | printf("Cone Size = %1.2f\n", fConeSize ) ; | |
a5fb4114 | 309 | printf("pT threshold = %2.1f\n", fPtThreshold) ; |
c5693f62 | 310 | printf("pT fraction = %3.1f\n", fPtFraction ) ; |
311 | printf("particle type in cone = %d\n", fPartInCone ) ; | |
a5fb4114 | 312 | printf(" \n") ; |
313 | ||
314 | } |