]>
Commit | Line | Data |
---|---|---|
0aaa8b91 | 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 | **************************************************************************/ | |
f2dec884 | 15 | // |
16 | // static dNdPt helper functions | |
17 | // | |
18 | // basic functionality to select events and tracks | |
19 | // for dNdPt analysis | |
20 | // | |
21 | // Origin: Jan Fiete Grosse-Oetringhaus | |
22 | // Modified and Extended: Jacek Otwinowski 19/11/2009 | |
23 | // | |
24 | // | |
0aaa8b91 | 25 | |
26 | #include <TROOT.h> | |
f2dec884 | 27 | #include <TCanvas.h> |
28 | #include <TF1.h> | |
0aaa8b91 | 29 | #include <TH1.h> |
30 | #include <TH2.h> | |
31 | #include <TH3.h> | |
0aaa8b91 | 32 | |
33 | #include <AliHeader.h> | |
34 | #include <AliStack.h> | |
35 | #include <AliLog.h> | |
0aaa8b91 | 36 | #include <AliESD.h> |
37 | #include <AliESDEvent.h> | |
38 | #include <AliMCEvent.h> | |
39 | #include <AliESDVertex.h> | |
40 | #include <AliVertexerTracks.h> | |
0aaa8b91 | 41 | #include <AliMathBase.h> |
42 | #include <AliESDtrackCuts.h> | |
774986ef | 43 | #include <AliTracker.h> |
0aaa8b91 | 44 | #include "dNdPt/AlidNdPtEventCuts.h" |
45 | #include "dNdPt/AlidNdPtAcceptanceCuts.h" | |
46 | #include "dNdPt/AlidNdPtHelper.h" | |
47 | ||
48 | //____________________________________________________________________ | |
49 | ClassImp(AlidNdPtHelper) | |
50 | ||
0aaa8b91 | 51 | //____________________________________________________________________ |
e9f7cb15 | 52 | const AliESDVertex* AlidNdPtHelper::GetVertex(AliESDEvent* const aEsd, const AlidNdPtEventCuts *const evtCuts, const AlidNdPtAcceptanceCuts *const accCuts, const AliESDtrackCuts *const trackCuts, AnalysisMode analysisMode, Bool_t debug, Bool_t bRedoTPC, Bool_t bUseMeanVertex) |
0aaa8b91 | 53 | { |
54 | // Get the vertex from the ESD and returns it if the vertex is valid | |
55 | // | |
56 | // Second argument decides which vertex is used (this selects | |
57 | // also the quality criteria that are applied) | |
58 | ||
59 | if(!aEsd) | |
60 | { | |
61 | ::Error("AlidNdPtHelper::GetVertex()","esd event is NULL"); | |
62 | return NULL; | |
63 | } | |
64 | ||
65 | if(!evtCuts || !accCuts || !trackCuts) | |
66 | { | |
67 | ::Error("AlidNdPtHelper::GetVertex()","cuts not available"); | |
68 | return NULL; | |
69 | } | |
70 | ||
71 | const AliESDVertex* vertex = 0; | |
72 | AliESDVertex *initVertex = 0; | |
774986ef | 73 | if (analysisMode == kSPD || analysisMode == kTPCITS || |
74 | analysisMode == kTPCSPDvtx || analysisMode == kTPCSPDvtxUpdate || analysisMode == kTPCITSHybrid) | |
0aaa8b91 | 75 | { |
76 | vertex = aEsd->GetPrimaryVertexSPD(); | |
77 | if (debug) | |
78 | Printf("AlidNdPtHelper::GetVertex: Returning SPD vertex"); | |
79 | } | |
695facdf | 80 | else if (analysisMode == kTPCTrackSPDvtx || analysisMode == kTPCTrackSPDvtxUpdate || |
81 | analysisMode == kTPCITSHybridTrackSPDvtx || analysisMode == kTPCITSHybridTrackSPDvtxDCArPt || | |
82 | analysisMode == kITSStandAloneTrackSPDvtx || analysisMode == kITSStandAloneTPCTrackSPDvtx) | |
791aaf54 | 83 | { |
84 | vertex = aEsd->GetPrimaryVertexTracks(); | |
85 | if(!vertex) return NULL; | |
86 | if(vertex->GetNContributors()<1) { | |
87 | // SPD vertex | |
88 | vertex = aEsd->GetPrimaryVertexSPD(); | |
89 | } | |
90 | } | |
847e74b2 | 91 | else if (analysisMode == kTPC) |
0aaa8b91 | 92 | { |
93 | if(bRedoTPC) { | |
94 | ||
95 | Double_t kBz = aEsd->GetMagneticField(); | |
96 | AliVertexerTracks vertexer(kBz); | |
97 | ||
98 | if(bUseMeanVertex) { | |
99 | Double_t pos[3]={evtCuts->GetMeanXv(),evtCuts->GetMeanYv(),evtCuts->GetMeanZv()}; | |
100 | Double_t err[3]={evtCuts->GetSigmaMeanXv(),evtCuts->GetSigmaMeanYv(),evtCuts->GetSigmaMeanZv()}; | |
0aaa8b91 | 101 | initVertex = new AliESDVertex(pos,err); |
102 | vertexer.SetVtxStart(initVertex); | |
103 | vertexer.SetConstraintOn(); | |
104 | } | |
105 | ||
0aaa8b91 | 106 | Double_t maxDCAr = accCuts->GetMaxDCAr(); |
107 | Double_t maxDCAz = accCuts->GetMaxDCAz(); | |
108 | Int_t minTPCClust = trackCuts->GetMinNClusterTPC(); | |
109 | ||
bad4ba69 | 110 | //vertexer.SetTPCMode(Double_t dcacut=0.1, Double_t dcacutIter0=1.0, Double_t maxd0z0=5.0, Int_t minCls=10, Int_t mintrks=1, Double_t nsigma=3., Double_t mindetfitter=0.1, Double_t maxtgl=1.5, Double_t fidR=3., Double_t fidZ=30., Int_t finderAlgo=1, Int_t finderAlgoIter0=4); |
0aaa8b91 | 111 | vertexer.SetTPCMode(0.1,1.0,5.0,minTPCClust,1,3.,0.1,2.0,maxDCAr,maxDCAz,1,4); |
112 | ||
113 | // TPC track preselection | |
114 | Int_t ntracks = aEsd->GetNumberOfTracks(); | |
115 | TObjArray array(ntracks); | |
116 | UShort_t *id = new UShort_t[ntracks]; | |
117 | ||
118 | Int_t count=0; | |
119 | for (Int_t i=0;i <ntracks; i++) { | |
120 | AliESDtrack *t = aEsd->GetTrack(i); | |
121 | if (!t) continue; | |
122 | if (t->Charge() == 0) continue; | |
123 | if (!t->GetTPCInnerParam()) continue; | |
124 | if (t->GetTPCNcls()<vertexer.GetMinClusters()) continue; | |
125 | AliExternalTrackParam *tpcTrack = new AliExternalTrackParam(*(t->GetTPCInnerParam())); | |
126 | if(tpcTrack) { | |
127 | array.AddLast(tpcTrack); | |
128 | id[count] = (UShort_t)t->GetID(); | |
129 | count++; | |
130 | } | |
131 | } | |
132 | AliESDVertex *vTPC = vertexer.VertexForSelectedTracks(&array,id, kTRUE, kTRUE, bUseMeanVertex); | |
bad4ba69 | 133 | |
134 | // set recreated TPC vertex | |
0aaa8b91 | 135 | aEsd->SetPrimaryVertexTPC(vTPC); |
136 | ||
137 | for (Int_t i=0; i<aEsd->GetNumberOfTracks(); i++) { | |
138 | AliESDtrack *t = aEsd->GetTrack(i); | |
774986ef | 139 | if(!t) continue; |
140 | ||
141 | Double_t x[3]; t->GetXYZ(x); | |
142 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
143 | t->RelateToVertexTPCBxByBz(vTPC, b, kVeryBig); | |
0aaa8b91 | 144 | } |
145 | ||
146 | delete vTPC; | |
147 | array.Delete(); | |
148 | delete [] id; id=NULL; | |
149 | ||
150 | } | |
151 | vertex = aEsd->GetPrimaryVertexTPC(); | |
152 | if (debug) | |
774986ef | 153 | Printf("AlidNdPtHelper::GetVertex: Returning vertex from tracks"); |
154 | } | |
155 | else | |
156 | Printf("AlidNdPtHelper::GetVertex: ERROR: Invalid second argument %d", analysisMode); | |
0aaa8b91 | 157 | |
158 | if (!vertex) { | |
159 | if (debug) | |
160 | Printf("AlidNdPtHelper::GetVertex: No vertex found in ESD"); | |
161 | return 0; | |
162 | } | |
163 | ||
164 | if (debug) | |
165 | { | |
166 | Printf("AlidNdPtHelper::GetVertex: Returning valid vertex: %s", vertex->GetTitle()); | |
167 | vertex->Print(); | |
168 | } | |
169 | ||
170 | if(initVertex) delete initVertex; initVertex=NULL; | |
171 | return vertex; | |
172 | } | |
173 | ||
bad4ba69 | 174 | //____________________________________________________________________ |
791aaf54 | 175 | Bool_t AlidNdPtHelper::TestRecVertex(const AliESDVertex* vertex, const AliESDVertex* vertexSPD, AnalysisMode analysisMode, Bool_t debug) |
bad4ba69 | 176 | { |
177 | // Checks if a vertex meets the needed quality criteria | |
178 | if(!vertex) return kFALSE; | |
774986ef | 179 | if(!vertex->GetStatus()) return kFALSE; |
bad4ba69 | 180 | |
181 | Float_t requiredZResolution = -1; | |
774986ef | 182 | if (analysisMode == kSPD || analysisMode == kTPCITS || |
791aaf54 | 183 | analysisMode == kTPCSPDvtx || analysisMode == kTPCSPDvtxUpdate || analysisMode == kTPCITSHybrid || |
184 | analysisMode == kTPCTrackSPDvtx || analysisMode == kTPCTrackSPDvtxUpdate || analysisMode == kTPCITSHybridTrackSPDvtx || analysisMode == kTPCITSHybridTrackSPDvtxDCArPt | |
695facdf | 185 | || analysisMode == kITSStandAloneTrackSPDvtx || analysisMode == kITSStandAloneTPCTrackSPDvtx) |
bad4ba69 | 186 | { |
774986ef | 187 | requiredZResolution = 1000; |
bad4ba69 | 188 | } |
847e74b2 | 189 | else if (analysisMode == kTPC) |
bad4ba69 | 190 | requiredZResolution = 10.; |
191 | ||
774986ef | 192 | // check resolution |
193 | Double_t zRes = vertex->GetZRes(); | |
194 | ||
195 | if (zRes > requiredZResolution) { | |
196 | if (debug) | |
197 | Printf("AlidNdPtHelper::TestVertex: Resolution too poor %f (required: %f", zRes, requiredZResolution); | |
198 | return kFALSE; | |
199 | } | |
791aaf54 | 200 | |
201 | // always check for SPD vertex | |
202 | if(!vertexSPD) return kFALSE; | |
203 | if(!vertexSPD->GetStatus()) return kFALSE; | |
204 | if (vertexSPD->IsFromVertexerZ()) | |
774986ef | 205 | { |
791aaf54 | 206 | if (vertexSPD->GetDispersion() > 0.02) |
774986ef | 207 | { |
208 | if (debug) | |
209 | Printf("AliPWG0Helper::TestVertex: Delta Phi too large in Vertexer Z: %f (required: %f", vertex->GetDispersion(), 0.02); | |
210 | return kFALSE; | |
211 | } | |
212 | } | |
213 | ||
214 | /* | |
bad4ba69 | 215 | // check Ncontributors |
216 | if (vertex->GetNContributors() <= 0) { | |
217 | if (debug){ | |
218 | Printf("AlidNdPtHelper::GetVertex: NContributors() <= 0: %d",vertex->GetNContributors()); | |
219 | Printf("AlidNdPtHelper::GetVertex: NIndices(): %d",vertex->GetNIndices()); | |
220 | vertex->Print(); | |
221 | } | |
222 | return kFALSE; | |
223 | } | |
774986ef | 224 | */ |
bad4ba69 | 225 | |
226 | return kTRUE; | |
227 | } | |
228 | ||
791aaf54 | 229 | //____________________________________________________________________ |
e9f7cb15 | 230 | Bool_t AlidNdPtHelper::IsGoodImpPar(const AliESDtrack *const track) |
791aaf54 | 231 | { |
232 | // | |
233 | // check whether particle has good DCAr(Pt) impact | |
234 | // parameter. Only for TPC+ITS tracks (7*sigma cut) | |
235 | // Origin: Andrea Dainese | |
236 | // | |
237 | ||
238 | Float_t d0z0[2],covd0z0[3]; | |
239 | track->GetImpactParameters(d0z0,covd0z0); | |
240 | Float_t sigma= 0.0050+0.0060/TMath::Power(track->Pt(),0.9); | |
241 | Float_t d0max = 7.*sigma; | |
242 | if(TMath::Abs(d0z0[0]) < d0max) return kTRUE; | |
243 | ||
244 | return kFALSE; | |
245 | } | |
246 | ||
0aaa8b91 | 247 | //____________________________________________________________________ |
f2dec884 | 248 | Bool_t AlidNdPtHelper::IsPrimaryParticle(AliStack* const stack, Int_t idx, ParticleMode particleMode) |
0aaa8b91 | 249 | { |
774986ef | 250 | // |
0aaa8b91 | 251 | // check primary particles |
847e74b2 | 252 | // depending on the particle mode |
0aaa8b91 | 253 | // |
254 | if(!stack) return kFALSE; | |
255 | ||
256 | TParticle* particle = stack->Particle(idx); | |
257 | if (!particle) return kFALSE; | |
258 | ||
259 | // only charged particles | |
260 | Double_t charge = particle->GetPDG()->Charge()/3.; | |
f2dec884 | 261 | if (TMath::Abs(charge) < 0.001) return kFALSE; |
0aaa8b91 | 262 | |
263 | Int_t pdg = TMath::Abs(particle->GetPdgCode()); | |
264 | ||
265 | // physical primary | |
266 | Bool_t prim = stack->IsPhysicalPrimary(idx); | |
267 | ||
847e74b2 | 268 | if(particleMode==kMCPion) { |
0aaa8b91 | 269 | if(prim && pdg==kPiPlus) return kTRUE; |
270 | else return kFALSE; | |
271 | } | |
272 | ||
847e74b2 | 273 | if (particleMode==kMCKaon) { |
0aaa8b91 | 274 | if(prim && pdg==kKPlus) return kTRUE; |
275 | else return kFALSE; | |
276 | } | |
277 | ||
847e74b2 | 278 | if (particleMode==kMCProton) { |
0aaa8b91 | 279 | if(prim && pdg==kProton) return kTRUE; |
280 | else return kFALSE; | |
281 | } | |
282 | ||
17e8c701 | 283 | if(particleMode==kMCRest) { |
284 | if(prim && pdg!=kPiPlus && pdg!=kKPlus && pdg!=kProton) return kTRUE; | |
285 | else return kFALSE; | |
286 | } | |
287 | ||
0aaa8b91 | 288 | return prim; |
289 | } | |
290 | ||
d269b0e6 | 291 | //____________________________________________________________________ |
f2dec884 | 292 | Bool_t AlidNdPtHelper::IsCosmicTrack(AliESDtrack *const track1, AliESDtrack *const track2) |
d269b0e6 | 293 | { |
294 | // | |
295 | // check cosmic tracks | |
296 | // | |
297 | if(!track1) return kFALSE; | |
298 | if(!track2) return kFALSE; | |
d269b0e6 | 299 | |
774986ef | 300 | // |
301 | // cosmic tracks in TPC | |
302 | // | |
303 | //if( TMath::Abs( track1->Theta() - track2->Theta() ) < 0.004 && | |
304 | // ((TMath::Abs(track1->Phi()-track2->Phi()) - TMath::Pi() )<0.004) && | |
305 | //if( track1->Pt() > 4.0 && (TMath::Abs(track1->Phi()-track2->Phi())-TMath::Pi())<0.1 | |
306 | // && (TMath::Abs(track1->Eta()+track2->Eta())-0.1) < 0.0 && (track1->Charge()+track2->Charge()) == 0) | |
307 | ||
308 | //Float_t scaleF= 6.0; | |
309 | if ( track1->Pt() > 4 && track2->Pt() > 4 && | |
310 | //(TMath::Abs(track1->GetSnp()-track2->GetSnp())-2.) < scaleF * TMath::Sqrt(track1->GetSigmaSnp2()+track2->GetSigmaSnp2()) && | |
311 | //TMath::Abs(track1->GetTgl()-track2->GetTgl()) < scaleF * TMath::Sqrt(track1->GetSigmaTgl2()+track2->GetSigmaTgl2()) && | |
312 | //TMath::Abs(track1->OneOverPt()-track2->OneOverPt()) < scaleF * TMath::Sqrt(track1->GetSigma1Pt2()+track2->GetSigma1Pt2()) && | |
313 | (track1->Charge()+track2->Charge()) == 0 && | |
314 | track1->Eta()*track2->Eta()<0.0 && TMath::Abs(track1->Eta()+track2->Eta())<0.03 && | |
315 | TMath::Abs(TMath::Abs(track1->Phi()-track2->Phi())-TMath::Pi())<0.1 | |
316 | ) | |
d269b0e6 | 317 | { |
774986ef | 318 | printf("COSMIC candidate \n"); |
d269b0e6 | 319 | |
774986ef | 320 | printf("track1->Pt() %f, track1->Theta() %f, track1->Eta() %f, track1->Phi() %f, track1->Charge() %d \n", track1->Pt(), track1->Theta(), track1->Eta(), track1->Phi(), track1->Charge()); |
321 | printf("track2->Pt() %f, track2->Theta() %f, track2->Eta() %f, track2->Phi() %f, track2->Charge() %d \n", track2->Pt(), track2->Theta(), track2->Eta(), track2->Phi(), track2->Charge()); | |
322 | printf("dtheta %f, deta %f, dphi %f, dq %d \n", track1->Theta()-track2->Theta(), track1->Eta()-track2->Eta(), track1->Phi()-track2->Phi(), track1->Charge()+track2->Charge()); | |
323 | printf("dsphi %f, errsphi %f, dtanl %f, errtanl %f \n", TMath::Abs(track1->GetSnp()-track2->GetSnp()), TMath::Sqrt(track1->GetSigmaSnp2()+track2->GetSigmaSnp2()), TMath::Abs(track1->GetTgl()-track2->GetTgl()), TMath::Sqrt(track1->GetSigmaTgl2()+track2->GetSigmaTgl2())); | |
324 | return kTRUE; | |
325 | } | |
847e74b2 | 326 | |
327 | return kFALSE; | |
328 | } | |
329 | ||
0aaa8b91 | 330 | //____________________________________________________________________ |
70fdd197 | 331 | void AlidNdPtHelper::PrintConf(AnalysisMode analysisMode, AliTriggerAnalysis::Trigger trigger) |
0aaa8b91 | 332 | { |
333 | // | |
334 | // Prints the given configuration | |
335 | // | |
336 | ||
337 | TString str(">>>> Running with "); | |
338 | ||
339 | switch (analysisMode) | |
340 | { | |
341 | case kInvalid: str += "invalid setting"; break; | |
342 | case kSPD : str += "SPD-only"; break; | |
343 | case kTPC : str += "TPC-only"; break; | |
344 | case kTPCITS : str += "Global tracking"; break; | |
345 | case kTPCSPDvtx : str += "TPC tracking + SPD event vertex"; break; | |
847e74b2 | 346 | case kTPCSPDvtxUpdate : str += "TPC tracks updated with SPD event vertex point"; break; |
791aaf54 | 347 | case kTPCTrackSPDvtx : str += "TPC tracking + Tracks event vertex or SPD event vertex"; break; |
348 | case kTPCTrackSPDvtxUpdate : str += "TPC tracks updated with Track or SPD event vertex point"; break; | |
774986ef | 349 | case kTPCITSHybrid : str += "TPC tracking + ITS refit + >1 SPD cluster"; break; |
791aaf54 | 350 | case kTPCITSHybridTrackSPDvtx : str += "TPC tracking + ITS refit + >1 SPD cluster + Tracks event vertex or SPD event vertex"; break; |
351 | case kTPCITSHybridTrackSPDvtxDCArPt : str += "TPC tracking + ITS refit + >1 SPD cluster + Tracks event vertex or SPD event vertex + DCAr(pt)"; break; | |
695facdf | 352 | case kITSStandAloneTrackSPDvtx : str += "ITS standalone + Tracks event vertex or SPD event vertex + DCAr(pt)"; break; |
353 | case kITSStandAloneTPCTrackSPDvtx : str += "kITSStandAloneTPCTrackSPDvtx + TPC stand alone track + Tracks event vertex or SPD event vertex + DCAr(pt)"; break; | |
0aaa8b91 | 354 | case kMCRec : str += "TPC tracking + Replace rec. with MC values"; break; |
0aaa8b91 | 355 | } |
356 | str += " and trigger "; | |
357 | ||
70fdd197 | 358 | str += AliTriggerAnalysis::GetTriggerName(trigger); |
0aaa8b91 | 359 | |
360 | str += " <<<<"; | |
361 | ||
362 | Printf("%s", str.Data()); | |
363 | } | |
364 | ||
365 | //____________________________________________________________________ | |
e9f7cb15 | 366 | Int_t AlidNdPtHelper::ConvertPdgToPid(const TParticle *const particle) { |
0aaa8b91 | 367 | // |
368 | // Convert Abs(pdg) to pid | |
369 | // (0 - e, 1 - muons, 2 - pions, 3 - kaons, 4 - protons, 5 -all rest) | |
370 | // | |
371 | Int_t pid=-1; | |
372 | ||
373 | if (TMath::Abs(particle->GetPdgCode()) == kElectron) { pid = 0; } | |
374 | else if (TMath::Abs(particle->GetPdgCode()) == kMuonMinus) { pid = 1; } | |
375 | else if (TMath::Abs(particle->GetPdgCode()) == kPiPlus) { pid = 2; } | |
376 | else if (TMath::Abs(particle->GetPdgCode()) == kKPlus) { pid = 3; } | |
377 | else if (TMath::Abs(particle->GetPdgCode()) == kProton) { pid = 4; } | |
378 | else { pid = 5; } | |
379 | ||
380 | return pid; | |
381 | } | |
382 | ||
383 | //_____________________________________________________________________________ | |
f2dec884 | 384 | TH1F* AlidNdPtHelper::CreateResHisto(TH2F* const hRes2, TH1F **phMean, Int_t integ, Bool_t drawBinFits, Int_t minHistEntries) |
0aaa8b91 | 385 | { |
bad4ba69 | 386 | // |
387 | // Create mean and resolution | |
388 | // histograms | |
389 | // | |
0aaa8b91 | 390 | TVirtualPad* currentPad = gPad; |
391 | TAxis* axis = hRes2->GetXaxis(); | |
392 | Int_t nBins = axis->GetNbins(); | |
393 | Bool_t overflowBinFits = kFALSE; | |
394 | TH1F* hRes, *hMean; | |
395 | if (axis->GetXbins()->GetSize()){ | |
396 | hRes = new TH1F("hRes", "", nBins, axis->GetXbins()->GetArray()); | |
397 | hMean = new TH1F("hMean", "", nBins, axis->GetXbins()->GetArray()); | |
398 | } | |
399 | else{ | |
400 | hRes = new TH1F("hRes", "", nBins, axis->GetXmin(), axis->GetXmax()); | |
401 | hMean = new TH1F("hMean", "", nBins, axis->GetXmin(), axis->GetXmax()); | |
402 | ||
403 | } | |
404 | hRes->SetStats(false); | |
405 | hRes->SetOption("E"); | |
406 | hRes->SetMinimum(0.); | |
407 | // | |
408 | hMean->SetStats(false); | |
409 | hMean->SetOption("E"); | |
410 | ||
411 | // create the fit function | |
412 | TF1 * fitFunc = new TF1("G","[0]*exp(-(x-[1])*(x-[1])/(2.*[2]*[2]))",-3,3); | |
413 | ||
414 | fitFunc->SetLineWidth(2); | |
415 | fitFunc->SetFillStyle(0); | |
416 | // create canvas for fits | |
417 | TCanvas* canBinFits = NULL; | |
418 | Int_t nPads = (overflowBinFits) ? nBins+2 : nBins; | |
419 | Int_t nx = Int_t(sqrt(nPads-1.));// + 1; | |
420 | Int_t ny = (nPads-1) / nx + 1; | |
421 | if (drawBinFits) { | |
422 | canBinFits = (TCanvas*)gROOT->FindObject("canBinFits"); | |
423 | if (canBinFits) delete canBinFits; | |
424 | canBinFits = new TCanvas("canBinFits", "fits of bins", 200, 100, 500, 700); | |
425 | canBinFits->Divide(nx, ny); | |
426 | } | |
427 | ||
428 | // loop over x bins and fit projection | |
429 | Int_t dBin = ((overflowBinFits) ? 1 : 0); | |
430 | for (Int_t bin = 1-dBin; bin <= nBins+dBin; bin++) { | |
431 | if (drawBinFits) canBinFits->cd(bin + dBin); | |
432 | Int_t bin0=TMath::Max(bin-integ,0); | |
433 | Int_t bin1=TMath::Min(bin+integ,nBins); | |
434 | TH1D* hBin = hRes2->ProjectionY("hBin", bin0, bin1); | |
435 | // | |
436 | if (hBin->GetEntries() > minHistEntries) { | |
437 | fitFunc->SetParameters(hBin->GetMaximum(),hBin->GetMean(),hBin->GetRMS()); | |
438 | hBin->Fit(fitFunc,"s"); | |
439 | Double_t sigma = TMath::Abs(fitFunc->GetParameter(2)); | |
440 | ||
441 | if (sigma > 0.){ | |
442 | hRes->SetBinContent(bin, TMath::Abs(fitFunc->GetParameter(2))); | |
443 | hMean->SetBinContent(bin, fitFunc->GetParameter(1)); | |
444 | } | |
445 | else{ | |
446 | hRes->SetBinContent(bin, 0.); | |
447 | hMean->SetBinContent(bin,0); | |
448 | } | |
449 | hRes->SetBinError(bin, fitFunc->GetParError(2)); | |
450 | hMean->SetBinError(bin, fitFunc->GetParError(1)); | |
451 | ||
452 | // | |
453 | // | |
454 | ||
455 | } else { | |
456 | hRes->SetBinContent(bin, 0.); | |
457 | hRes->SetBinError(bin, 0.); | |
458 | hMean->SetBinContent(bin, 0.); | |
459 | hMean->SetBinError(bin, 0.); | |
460 | } | |
461 | ||
462 | ||
463 | if (drawBinFits) { | |
464 | char name[256]; | |
465 | if (bin == 0) { | |
466 | sprintf(name, "%s < %.4g", axis->GetTitle(), axis->GetBinUpEdge(bin)); | |
467 | } else if (bin == nBins+1) { | |
468 | sprintf(name, "%.4g < %s", axis->GetBinLowEdge(bin), axis->GetTitle()); | |
469 | } else { | |
470 | sprintf(name, "%.4g < %s < %.4g", axis->GetBinLowEdge(bin), | |
471 | axis->GetTitle(), axis->GetBinUpEdge(bin)); | |
472 | } | |
473 | canBinFits->cd(bin + dBin); | |
474 | hBin->SetTitle(name); | |
475 | hBin->SetStats(kTRUE); | |
476 | hBin->DrawCopy("E"); | |
477 | canBinFits->Update(); | |
478 | canBinFits->Modified(); | |
479 | canBinFits->Update(); | |
480 | } | |
481 | ||
482 | delete hBin; | |
483 | } | |
484 | ||
485 | delete fitFunc; | |
486 | currentPad->cd(); | |
487 | *phMean = hMean; | |
488 | return hRes; | |
489 | } | |
490 | ||
491 | //_____________________________________________________________________________ | |
492 | TH1F* AlidNdPtHelper::MakeResol(TH2F * his, Int_t integ, Bool_t type, Bool_t drawBins, Int_t minHistEntries){ | |
493 | // Create resolution histograms | |
494 | ||
495 | TH1F *hisr=0, *hism=0; | |
496 | if (!gPad) new TCanvas; | |
0aaa8b91 | 497 | hisr = CreateResHisto(his,&hism,integ,drawBins,minHistEntries); |
498 | if (type) return hism; | |
499 | else return hisr; | |
500 | ||
501 | return hisr; | |
502 | } | |
503 | ||
504 | //_____________________________________________________________________________ | |
bad4ba69 | 505 | TObjArray* AlidNdPtHelper::GetAllChargedTracks(AliESDEvent *esdEvent, AnalysisMode analysisMode) |
0aaa8b91 | 506 | { |
507 | // | |
508 | // all charged TPC particles | |
509 | // | |
510 | TObjArray *allTracks = new TObjArray(); | |
511 | if(!allTracks) return allTracks; | |
512 | ||
513 | AliESDtrack *track=0; | |
514 | for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++) | |
515 | { | |
847e74b2 | 516 | if(analysisMode == AlidNdPtHelper::kTPC) { |
774986ef | 517 | // |
847e74b2 | 518 | // track must be deleted by user |
774986ef | 519 | // esd track parameters are replaced by TPCinner |
520 | // | |
bad4ba69 | 521 | track = AliESDtrackCuts::GetTPCOnlyTrack(esdEvent,iTrack); |
847e74b2 | 522 | if(!track) continue; |
523 | } | |
774986ef | 524 | else if (analysisMode == AlidNdPtHelper::kTPCSPDvtx || analysisMode == AlidNdPtHelper::kTPCSPDvtxUpdate) |
847e74b2 | 525 | { |
774986ef | 526 | // |
847e74b2 | 527 | // track must be deleted by the user |
774986ef | 528 | // esd track parameters are replaced by TPCinner |
529 | // | |
847e74b2 | 530 | track = AlidNdPtHelper::GetTPCOnlyTrackSPDvtx(esdEvent,iTrack,kFALSE); |
531 | if(!track) continue; | |
532 | } | |
791aaf54 | 533 | else if (analysisMode == AlidNdPtHelper::kTPCTrackSPDvtx || analysisMode == AlidNdPtHelper::kTPCTrackSPDvtxUpdate) |
534 | { | |
535 | // | |
536 | // track must be deleted by the user | |
537 | // esd track parameters are replaced by TPCinner | |
538 | // | |
539 | track = AlidNdPtHelper::GetTPCOnlyTrackTrackSPDvtx(esdEvent,iTrack,kFALSE); | |
540 | if(!track) continue; | |
541 | } | |
695facdf | 542 | else if(analysisMode == AlidNdPtHelper::kTPCITSHybrid ) |
774986ef | 543 | { |
544 | track = AlidNdPtHelper::GetTrackSPDvtx(esdEvent,iTrack,kFALSE); | |
545 | } | |
695facdf | 546 | else if(analysisMode == AlidNdPtHelper::kTPCITSHybridTrackSPDvtx || analysisMode == AlidNdPtHelper::kTPCITSHybridTrackSPDvtxDCArPt || kITSStandAloneTrackSPDvtx || kITSStandAloneTPCTrackSPDvtx) |
791aaf54 | 547 | { |
548 | track = AlidNdPtHelper::GetTrackTrackSPDvtx(esdEvent,iTrack,kFALSE); | |
549 | } | |
774986ef | 550 | else |
551 | { | |
552 | track = esdEvent->GetTrack(iTrack); | |
0aaa8b91 | 553 | } |
774986ef | 554 | |
0aaa8b91 | 555 | if(!track) continue; |
556 | ||
557 | if(track->Charge()==0) { | |
791aaf54 | 558 | if(analysisMode == AlidNdPtHelper::kTPC || |
559 | analysisMode == AlidNdPtHelper::kTPCSPDvtx || analysisMode == AlidNdPtHelper::kTPCTrackSPDvtx || | |
560 | analysisMode == AlidNdPtHelper::kTPCSPDvtxUpdate || analysisMode == AlidNdPtHelper::kTPCTrackSPDvtxUpdate) | |
847e74b2 | 561 | { |
0aaa8b91 | 562 | delete track; continue; |
563 | } else { | |
564 | continue; | |
565 | } | |
566 | } | |
567 | ||
568 | allTracks->Add(track); | |
569 | } | |
bad4ba69 | 570 | |
791aaf54 | 571 | if(analysisMode == AlidNdPtHelper::kTPC || |
572 | analysisMode == AlidNdPtHelper::kTPCSPDvtx || analysisMode == AlidNdPtHelper::kTPCTrackSPDvtx || | |
573 | analysisMode == AlidNdPtHelper::kTPCSPDvtxUpdate || analysisMode == AlidNdPtHelper::kTPCTrackSPDvtxUpdate) { | |
bad4ba69 | 574 | |
575 | allTracks->SetOwner(kTRUE); | |
576 | } | |
0aaa8b91 | 577 | |
578 | return allTracks; | |
579 | } | |
580 | ||
847e74b2 | 581 | //_____________________________________________________________________________ |
e9f7cb15 | 582 | AliESDtrack *AlidNdPtHelper::GetTPCOnlyTrackSPDvtx(const AliESDEvent* esdEvent, Int_t iTrack, Bool_t bUpdate) |
847e74b2 | 583 | { |
584 | // | |
585 | // Create ESD tracks from TPCinner parameters. | |
586 | // Propagte to DCA to SPD vertex. | |
587 | // Update using SPD vertex point (parameter) | |
588 | // | |
589 | // It is user responsibility to delete these tracks | |
590 | // | |
591 | ||
592 | if (!esdEvent) return NULL; | |
593 | if (!esdEvent->GetPrimaryVertexSPD() ) { return NULL; } | |
594 | if (!esdEvent->GetPrimaryVertexSPD()->GetStatus() ) { return NULL; } | |
595 | ||
596 | // | |
597 | AliESDtrack* track = esdEvent->GetTrack(iTrack); | |
598 | if (!track) | |
599 | return NULL; | |
600 | ||
774986ef | 601 | Bool_t isOK = kFALSE; |
602 | Double_t x[3]; track->GetXYZ(x); | |
603 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
604 | ||
847e74b2 | 605 | // create new ESD track |
606 | AliESDtrack *tpcTrack = new AliESDtrack(); | |
607 | ||
608 | // relate TPC-only tracks (TPCinner) to SPD vertex | |
609 | AliExternalTrackParam cParam; | |
610 | if(bUpdate) { | |
774986ef | 611 | isOK = track->RelateToVertexTPCBxByBz(esdEvent->GetPrimaryVertexSPD(),b,kVeryBig,&cParam); |
847e74b2 | 612 | track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance()); |
613 | ||
614 | // reject fake tracks | |
615 | if(track->Pt() > 10000.) { | |
616 | ::Error("Exclude no physical tracks","pt>10000. GeV"); | |
617 | delete tpcTrack; | |
618 | return NULL; | |
619 | } | |
620 | } | |
621 | else { | |
774986ef | 622 | isOK = track->RelateToVertexTPCBxByBz(esdEvent->GetPrimaryVertexSPD(), b, kVeryBig); |
847e74b2 | 623 | } |
624 | ||
625 | // only true if we have a tpc track | |
626 | if (!track->FillTPCOnlyTrack(*tpcTrack)) | |
627 | { | |
628 | delete tpcTrack; | |
629 | return NULL; | |
630 | } | |
774986ef | 631 | |
632 | if(!isOK) return NULL; | |
847e74b2 | 633 | |
634 | return tpcTrack; | |
635 | } | |
636 | ||
791aaf54 | 637 | //_____________________________________________________________________________ |
e9f7cb15 | 638 | AliESDtrack *AlidNdPtHelper::GetTPCOnlyTrackTrackSPDvtx(const AliESDEvent* esdEvent, Int_t iTrack, Bool_t bUpdate) |
791aaf54 | 639 | { |
640 | // | |
641 | // Create ESD tracks from TPCinner parameters. | |
642 | // Propagte to DCA to Track or SPD vertex. | |
643 | // Update using SPD vertex point (parameter) | |
644 | // | |
645 | // It is user responsibility to delete these tracks | |
646 | // | |
647 | if (!esdEvent) return NULL; | |
648 | const AliESDVertex *vertex = esdEvent->GetPrimaryVertexTracks(); | |
649 | if(vertex->GetNContributors()<1) { | |
650 | // SPD vertex | |
651 | vertex = esdEvent->GetPrimaryVertexSPD(); | |
652 | } | |
653 | if(!vertex) return NULL; | |
654 | ||
655 | // | |
656 | AliESDtrack* track = esdEvent->GetTrack(iTrack); | |
657 | if (!track) | |
658 | return NULL; | |
659 | ||
660 | Bool_t isOK = kFALSE; | |
661 | Double_t x[3]; track->GetXYZ(x); | |
662 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
663 | ||
664 | // create new ESD track | |
665 | AliESDtrack *tpcTrack = new AliESDtrack(); | |
666 | ||
667 | // relate TPC-only tracks (TPCinner) to SPD vertex | |
668 | AliExternalTrackParam cParam; | |
669 | if(bUpdate) { | |
670 | isOK = track->RelateToVertexTPCBxByBz(vertex,b,kVeryBig,&cParam); | |
671 | track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance()); | |
672 | ||
673 | // reject fake tracks | |
674 | if(track->Pt() > 10000.) { | |
675 | ::Error("Exclude no physical tracks","pt>10000. GeV"); | |
676 | delete tpcTrack; | |
677 | return NULL; | |
678 | } | |
679 | } | |
680 | else { | |
681 | isOK = track->RelateToVertexTPCBxByBz(vertex, b, kVeryBig); | |
682 | } | |
683 | ||
684 | // only true if we have a tpc track | |
685 | if (!track->FillTPCOnlyTrack(*tpcTrack)) | |
686 | { | |
687 | delete tpcTrack; | |
688 | return NULL; | |
689 | } | |
690 | ||
691 | if(!isOK) return NULL; | |
692 | ||
693 | return tpcTrack; | |
694 | } | |
695 | ||
774986ef | 696 | //_____________________________________________________________________________ |
e9f7cb15 | 697 | AliESDtrack *AlidNdPtHelper::GetTrackSPDvtx(const AliESDEvent* esdEvent, Int_t iTrack, Bool_t bUpdate) |
774986ef | 698 | { |
699 | // | |
700 | // Propagte track to DCA to SPD vertex. | |
701 | // Update using SPD vertex point (parameter) | |
702 | // | |
703 | if (!esdEvent) return NULL; | |
704 | if (!esdEvent->GetPrimaryVertexSPD() ) { return NULL; } | |
705 | if (!esdEvent->GetPrimaryVertexSPD()->GetStatus() ) { return NULL; } | |
706 | ||
707 | // | |
708 | AliESDtrack* track = esdEvent->GetTrack(iTrack); | |
709 | if (!track) | |
710 | return NULL; | |
711 | ||
712 | Bool_t isOK = kFALSE; | |
713 | Double_t x[3]; track->GetXYZ(x); | |
714 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
715 | ||
716 | // relate tracks to SPD vertex | |
717 | AliExternalTrackParam cParam; | |
718 | if(bUpdate) { | |
719 | isOK = track->RelateToVertexBxByBz(esdEvent->GetPrimaryVertexSPD(),b,kVeryBig,&cParam); | |
720 | track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance()); | |
721 | ||
722 | // reject fake tracks | |
723 | if(track->Pt() > 10000.) { | |
724 | ::Error("Exclude no physical tracks","pt>10000. GeV"); | |
725 | return NULL; | |
726 | } | |
727 | } | |
728 | else { | |
729 | isOK = track->RelateToVertexBxByBz(esdEvent->GetPrimaryVertexSPD(), b, kVeryBig); | |
730 | } | |
731 | ||
732 | if(!isOK) return NULL; | |
733 | ||
734 | return track; | |
735 | } | |
736 | ||
791aaf54 | 737 | //_____________________________________________________________________________ |
e9f7cb15 | 738 | AliESDtrack *AlidNdPtHelper::GetTrackTrackSPDvtx(const AliESDEvent* esdEvent, Int_t iTrack, Bool_t bUpdate) |
791aaf54 | 739 | { |
740 | // | |
741 | // Propagte track to DCA to Track or SPD vertex. | |
742 | // Update using SPD vertex point (parameter) | |
743 | // | |
744 | if (!esdEvent) return NULL; | |
745 | ||
746 | const AliESDVertex *vertex = esdEvent->GetPrimaryVertexTracks(); | |
747 | if(vertex->GetNContributors()<1) { | |
748 | // SPD vertex | |
749 | vertex = esdEvent->GetPrimaryVertexSPD(); | |
750 | } | |
751 | if(!vertex) return NULL; | |
752 | ||
753 | // | |
754 | AliESDtrack* track = esdEvent->GetTrack(iTrack); | |
755 | if (!track) | |
756 | return NULL; | |
757 | ||
758 | Bool_t isOK = kFALSE; | |
759 | Double_t x[3]; track->GetXYZ(x); | |
760 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
761 | ||
762 | // relate tracks to SPD vertex | |
763 | AliExternalTrackParam cParam; | |
764 | if(bUpdate) { | |
765 | isOK = track->RelateToVertexBxByBz(vertex,b,kVeryBig,&cParam); | |
766 | track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance()); | |
767 | ||
768 | // reject fake tracks | |
769 | if(track->Pt() > 10000.) { | |
770 | ::Error("Exclude no physical tracks","pt>10000. GeV"); | |
771 | return NULL; | |
772 | } | |
773 | } | |
774 | else { | |
775 | isOK = track->RelateToVertexBxByBz(vertex, b, kVeryBig); | |
776 | } | |
777 | ||
778 | if(!isOK) return NULL; | |
779 | ||
780 | return track; | |
781 | } | |
782 | ||
0aaa8b91 | 783 | //_____________________________________________________________________________ |
e9f7cb15 | 784 | Int_t AlidNdPtHelper::GetTPCMBTrackMult(const AliESDEvent *const esdEvent,const AlidNdPtEventCuts *const evtCuts, const AlidNdPtAcceptanceCuts *const accCuts,const AliESDtrackCuts *const trackCuts) |
0aaa8b91 | 785 | { |
786 | // | |
787 | // get MB event track multiplicity | |
788 | // | |
789 | if(!esdEvent) | |
790 | { | |
791 | ::Error("AlidNdPtHelper::GetTPCMBTrackMult()","esd event is NULL"); | |
792 | return 0; | |
793 | } | |
794 | ||
795 | if(!evtCuts || !accCuts || !trackCuts) | |
796 | { | |
797 | ::Error("AlidNdPtHelper::GetTPCMBTrackMult()","cuts not available"); | |
798 | return 0; | |
799 | } | |
800 | ||
801 | // | |
802 | Double_t pos[3]={evtCuts->GetMeanXv(),evtCuts->GetMeanYv(),evtCuts->GetMeanZv()}; | |
803 | Double_t err[3]={evtCuts->GetSigmaMeanXv(),evtCuts->GetSigmaMeanYv(),evtCuts->GetSigmaMeanZv()}; | |
804 | AliESDVertex vtx0(pos,err); | |
805 | ||
806 | // | |
807 | Float_t maxDCAr = accCuts->GetMaxDCAr(); | |
808 | Float_t maxDCAz = accCuts->GetMaxDCAz(); | |
809 | Float_t minTPCClust = trackCuts->GetMinNClusterTPC(); | |
810 | // | |
811 | Int_t ntracks = esdEvent->GetNumberOfTracks(); | |
812 | Double_t dca[2],cov[3]; | |
813 | Int_t mult=0; | |
814 | for (Int_t i=0;i <ntracks; i++){ | |
815 | AliESDtrack *t = esdEvent->GetTrack(i); | |
816 | if (!t) continue; | |
817 | if (t->Charge() == 0) continue; | |
818 | if (!t->GetTPCInnerParam()) continue; | |
819 | if (t->GetTPCNcls()<minTPCClust) continue; | |
820 | // | |
774986ef | 821 | Double_t x[3]; t->GetXYZ(x); |
822 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
823 | const Double_t kMaxStep = 1; //max step over the material | |
824 | ||
0aaa8b91 | 825 | AliExternalTrackParam *tpcTrack = new AliExternalTrackParam(*(t->GetTPCInnerParam())); |
774986ef | 826 | if (!tpcTrack->PropagateToDCABxByBz(&vtx0,b,kMaxStep,dca,cov)) |
0aaa8b91 | 827 | { |
828 | if(tpcTrack) delete tpcTrack; | |
829 | continue; | |
830 | } | |
831 | // | |
832 | if (TMath::Abs(dca[0])>maxDCAr || TMath::Abs(dca[1])>maxDCAz) { | |
833 | if(tpcTrack) delete tpcTrack; | |
834 | continue; | |
835 | } | |
836 | ||
837 | mult++; | |
838 | ||
839 | if(tpcTrack) delete tpcTrack; | |
840 | } | |
841 | ||
842 | return mult; | |
843 | } | |
844 | ||
845 | //_____________________________________________________________________________ | |
e9f7cb15 | 846 | Int_t AlidNdPtHelper::GetTPCMBPrimTrackMult(const AliESDEvent *const esdEvent, AliStack *const stack, const AlidNdPtEventCuts *const evtCuts, const AlidNdPtAcceptanceCuts *const accCuts, const AliESDtrackCuts *const trackCuts) |
0aaa8b91 | 847 | { |
848 | // | |
849 | // get MB primary event track multiplicity | |
850 | // | |
851 | if(!esdEvent) | |
852 | { | |
853 | ::Error("AlidNdPtHelper::GetTPCMBPrimTrackMult()","esd event is NULL"); | |
854 | return 0; | |
855 | } | |
856 | ||
857 | if(!stack) | |
858 | { | |
859 | ::Error("AlidNdPtHelper::GetTPCMBPrimTrackMult()","esd event is NULL"); | |
860 | return 0; | |
861 | } | |
862 | ||
863 | if(!evtCuts || !accCuts || !trackCuts) | |
864 | { | |
865 | ::Error("AlidNdPtHelper::GetTPCMBPrimTrackMult()","cuts not available"); | |
866 | return 0; | |
867 | } | |
868 | ||
869 | // | |
870 | Double_t pos[3]={evtCuts->GetMeanXv(),evtCuts->GetMeanYv(),evtCuts->GetMeanZv()}; | |
871 | Double_t err[3]={evtCuts->GetSigmaMeanXv(),evtCuts->GetSigmaMeanYv(),evtCuts->GetSigmaMeanZv()}; | |
872 | AliESDVertex vtx0(pos,err); | |
873 | ||
874 | // | |
875 | Float_t maxDCAr = accCuts->GetMaxDCAr(); | |
876 | Float_t maxDCAz = accCuts->GetMaxDCAz(); | |
877 | Float_t minTPCClust = trackCuts->GetMinNClusterTPC(); | |
878 | ||
879 | // | |
880 | Int_t ntracks = esdEvent->GetNumberOfTracks(); | |
881 | Double_t dca[2],cov[3]; | |
882 | Int_t mult=0; | |
883 | for (Int_t i=0;i <ntracks; i++){ | |
884 | AliESDtrack *t = esdEvent->GetTrack(i); | |
885 | if (!t) continue; | |
886 | if (t->Charge() == 0) continue; | |
887 | if (!t->GetTPCInnerParam()) continue; | |
888 | if (t->GetTPCNcls()<minTPCClust) continue; | |
889 | // | |
774986ef | 890 | Double_t x[3]; t->GetXYZ(x); |
891 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
892 | const Double_t kMaxStep = 1; //max step over the material | |
893 | ||
0aaa8b91 | 894 | AliExternalTrackParam *tpcTrack = new AliExternalTrackParam(*(t->GetTPCInnerParam())); |
774986ef | 895 | if (!tpcTrack->PropagateToDCABxByBz(&vtx0,b,kMaxStep,dca,cov)) |
0aaa8b91 | 896 | { |
897 | if(tpcTrack) delete tpcTrack; | |
898 | continue; | |
899 | } | |
900 | // | |
901 | if (TMath::Abs(dca[0])>maxDCAr || TMath::Abs(dca[1])>maxDCAz) { | |
902 | if(tpcTrack) delete tpcTrack; | |
903 | continue; | |
904 | } | |
905 | ||
906 | Int_t label = TMath::Abs(t->GetLabel()); | |
907 | TParticle *part = stack->Particle(label); | |
908 | if(!part) { | |
909 | if(tpcTrack) delete tpcTrack; | |
910 | continue; | |
911 | } | |
912 | if(!stack->IsPhysicalPrimary(label)) | |
913 | { | |
914 | if(tpcTrack) delete tpcTrack; | |
915 | continue; | |
916 | } | |
917 | ||
918 | mult++; | |
919 | ||
920 | if(tpcTrack) delete tpcTrack; | |
921 | } | |
922 | ||
923 | return mult; | |
924 | } | |
925 | ||
926 | ||
791aaf54 | 927 | //_____________________________________________________________________________ |
928 | Double_t AlidNdPtHelper::GetStrangenessCorrFactor(const Double_t pt) | |
929 | { | |
930 | // data driven correction factor for secondaries | |
931 | // underestimated secondaries with strangeness in Pythia (A. Dainese) | |
0aaa8b91 | 932 | |
791aaf54 | 933 | // |
934 | // pt=0.17; fact=1 | |
935 | // pt=0.4; fact=1.07 | |
936 | // pt=0.6; fact=1.25 | |
937 | // pt>=1.2; fact=1.5 | |
938 | // | |
0aaa8b91 | 939 | |
791aaf54 | 940 | if (pt <= 0.17) return 1.0; |
941 | if (pt <= 0.4) return GetLinearInterpolationValue(0.17,1.0,0.4,1.07, pt); | |
942 | if (pt <= 0.6) return GetLinearInterpolationValue(0.4,1.07,0.6,1.25, pt); | |
943 | if (pt <= 1.2) return GetLinearInterpolationValue(0.6,1.25,1.2,1.5, pt); | |
944 | return 1.5; | |
945 | ||
946 | } | |
947 | ||
d4640855 | 948 | //_____________________________________________________________________________ |
949 | Double_t AlidNdPtHelper::GetStrangenessCorrFactorPbPb(const Double_t pt) | |
950 | { | |
951 | // data driven correction factor for secondaries (PbPb) | |
952 | ||
953 | if (pt <= 0.25) return 1.0; | |
954 | if (pt <= 0.5) return GetLinearInterpolationValue(0.25,1.0,0.5,1.4, pt); | |
955 | if (pt <= 1.0) return GetLinearInterpolationValue(0.5,1.4,1.0,1.47, pt); | |
956 | if (pt <= 2.0) return GetLinearInterpolationValue(1.0,1.47,2.0,1.56, pt); | |
957 | if (pt <= 5.0) return GetLinearInterpolationValue(2.0,1.56,5.0,1.67, pt); | |
958 | return 1.67; | |
959 | ||
960 | } | |
961 | ||
791aaf54 | 962 | //___________________________________________________________________________ |
e9f7cb15 | 963 | Double_t AlidNdPtHelper::GetLinearInterpolationValue(const Double_t x1,const Double_t y1,const Double_t x2,const Double_t y2, const Double_t pt) |
791aaf54 | 964 | { |
965 | // | |
966 | // linear interpolation | |
967 | // | |
968 | return ((y2-y1)/(x2-x1))*pt+(y2-(((y2-y1)/(x2-x1))*x2)); | |
969 | } | |
0aaa8b91 | 970 | |
971 | //_____________________________________________________________________________ | |
f2dec884 | 972 | Int_t AlidNdPtHelper::GetMCTrueTrackMult(AliMCEvent *const mcEvent, AlidNdPtEventCuts *const evtCuts, AlidNdPtAcceptanceCuts *const accCuts) |
0aaa8b91 | 973 | { |
974 | // | |
975 | // calculate mc event true track multiplicity | |
976 | // | |
977 | if(!mcEvent) return 0; | |
978 | ||
979 | AliStack* stack = 0; | |
980 | Int_t mult = 0; | |
981 | ||
982 | // MC particle stack | |
983 | stack = mcEvent->Stack(); | |
984 | if (!stack) return 0; | |
985 | ||
695facdf | 986 | // |
987 | //printf("minZv %f, maxZv %f \n", evtCuts->GetMinZv(), evtCuts->GetMaxZv()); | |
988 | // | |
989 | ||
0aaa8b91 | 990 | Bool_t isEventOK = evtCuts->AcceptMCEvent(mcEvent); |
991 | if(!isEventOK) return 0; | |
992 | ||
993 | Int_t nPart = stack->GetNtrack(); | |
994 | for (Int_t iMc = 0; iMc < nPart; ++iMc) | |
995 | { | |
996 | TParticle* particle = stack->Particle(iMc); | |
997 | if (!particle) | |
998 | continue; | |
999 | ||
1000 | // only charged particles | |
09abaebb | 1001 | if(!particle->GetPDG()) continue; |
0aaa8b91 | 1002 | Double_t charge = particle->GetPDG()->Charge()/3.; |
f2dec884 | 1003 | if (TMath::Abs(charge) < 0.001) |
0aaa8b91 | 1004 | continue; |
1005 | ||
1006 | // physical primary | |
1007 | Bool_t prim = stack->IsPhysicalPrimary(iMc); | |
1008 | if(!prim) continue; | |
1009 | ||
774986ef | 1010 | // checked accepted without pt cut |
1011 | //if(accCuts->AcceptTrack(particle)) | |
1012 | if( particle->Eta() > accCuts->GetMinEta() && particle->Eta() < accCuts->GetMaxEta() ) | |
0aaa8b91 | 1013 | { |
1014 | mult++; | |
1015 | } | |
1016 | } | |
1017 | ||
1018 | return mult; | |
1019 | } | |
1020 | ||
1021 | //_______________________________________________________________________ | |
f2dec884 | 1022 | void AlidNdPtHelper::PrintMCInfo(AliStack *const pStack,Int_t label) |
0aaa8b91 | 1023 | { |
1024 | // print information about particles in the stack | |
1025 | ||
1026 | if(!pStack)return; | |
1027 | label = TMath::Abs(label); | |
1028 | TParticle *part = pStack->Particle(label); | |
1029 | Printf("########################"); | |
1030 | Printf("%s:%d %d UniqueID %d PDG %d P %3.3f",(char*)__FILE__,__LINE__,label,part->GetUniqueID(),part->GetPdgCode(),part->P()); | |
1031 | part->Print(); | |
1032 | TParticle* mother = part; | |
1033 | Int_t imo = part->GetFirstMother(); | |
1034 | Int_t nprim = pStack->GetNprimary(); | |
1035 | ||
1036 | while((imo >= nprim)) { | |
1037 | mother = pStack->Particle(imo); | |
1038 | Printf("Mother %s:%d Label %d UniqueID %d PDG %d P %3.3f",(char*)__FILE__,__LINE__,imo,mother->GetUniqueID(),mother->GetPdgCode(),mother->P()); | |
1039 | mother->Print(); | |
1040 | imo = mother->GetFirstMother(); | |
1041 | } | |
1042 | ||
1043 | Printf("########################"); | |
1044 | } | |
1045 | ||
1046 | ||
1047 | //_____________________________________________________________________________ | |
f2dec884 | 1048 | TH1* AlidNdPtHelper::GetContCorrHisto(TH1 *const hist) |
0aaa8b91 | 1049 | { |
1050 | // | |
1051 | // get contamination histogram | |
1052 | // | |
1053 | if(!hist) return 0; | |
1054 | ||
1055 | Int_t nbins = hist->GetNbinsX(); | |
f2dec884 | 1056 | TH1 *hCont = (TH1D *)hist->Clone(); |
0aaa8b91 | 1057 | |
1058 | for(Int_t i=0; i<=nbins+1; i++) { | |
1059 | Double_t binContent = hist->GetBinContent(i); | |
1060 | Double_t binError = hist->GetBinError(i); | |
1061 | ||
f2dec884 | 1062 | hCont->SetBinContent(i,1.-binContent); |
1063 | hCont->SetBinError(i,binError); | |
0aaa8b91 | 1064 | } |
1065 | ||
f2dec884 | 1066 | return hCont; |
0aaa8b91 | 1067 | } |
1068 | ||
1069 | ||
1070 | //_____________________________________________________________________________ | |
f2dec884 | 1071 | TH1* AlidNdPtHelper::ScaleByBinWidth(TH1 *const hist) |
0aaa8b91 | 1072 | { |
1073 | // | |
1074 | // scale by bin width | |
1075 | // | |
1076 | if(!hist) return 0; | |
1077 | ||
f2dec884 | 1078 | TH1 *hScale = (TH1D *)hist->Clone(); |
1079 | hScale->Scale(1.,"width"); | |
0aaa8b91 | 1080 | |
f2dec884 | 1081 | return hScale; |
0aaa8b91 | 1082 | } |
1083 | ||
1084 | //_____________________________________________________________________________ | |
e9f7cb15 | 1085 | TH1* AlidNdPtHelper::CalcRelativeDifference(const TH1 *const hist1, const TH1 *const hist2) |
0aaa8b91 | 1086 | { |
1087 | // | |
1088 | // calculate rel. difference | |
1089 | // | |
1090 | ||
1091 | if(!hist1) return 0; | |
1092 | if(!hist2) return 0; | |
1093 | ||
f2dec884 | 1094 | TH1 *h1Clone = (TH1D *)hist1->Clone(); |
1095 | h1Clone->Sumw2(); | |
0aaa8b91 | 1096 | |
1097 | // (rec-mc)/mc | |
f2dec884 | 1098 | h1Clone->Add(hist2,-1); |
1099 | h1Clone->Divide(hist2); | |
0aaa8b91 | 1100 | |
f2dec884 | 1101 | return h1Clone; |
0aaa8b91 | 1102 | } |
1103 | ||
1104 | //_____________________________________________________________________________ | |
e9f7cb15 | 1105 | TH1* AlidNdPtHelper::CalcRelativeDifferenceFun(const TH1 *const hist1, TF1 *const fun) |
0aaa8b91 | 1106 | { |
1107 | // | |
08a80bfe | 1108 | // calculate rel. difference |
0aaa8b91 | 1109 | // between histogram and function |
1110 | // | |
1111 | if(!hist1) return 0; | |
1112 | if(!fun) return 0; | |
1113 | ||
f2dec884 | 1114 | TH1 *h1Clone = (TH1D *)hist1->Clone(); |
1115 | h1Clone->Sumw2(); | |
0aaa8b91 | 1116 | |
1117 | // | |
f2dec884 | 1118 | h1Clone->Add(fun,-1); |
1119 | h1Clone->Divide(hist1); | |
0aaa8b91 | 1120 | |
f2dec884 | 1121 | return h1Clone; |
0aaa8b91 | 1122 | } |
1123 | ||
1124 | //_____________________________________________________________________________ | |
e9f7cb15 | 1125 | TH1* AlidNdPtHelper::NormalizeToEvent(const TH2 *const hist1, const TH1 *const hist2) |
0aaa8b91 | 1126 | { |
1127 | // normalise to event for a given multiplicity bin | |
1128 | // return pt histogram | |
1129 | ||
1130 | if(!hist1) return 0; | |
1131 | if(!hist2) return 0; | |
1132 | char name[256]; | |
1133 | ||
1134 | Int_t nbinsX = hist1->GetNbinsX(); | |
1135 | //Int_t nbinsY = hist1->GetNbinsY(); | |
1136 | ||
f2dec884 | 1137 | TH1D *histNorm = 0; |
0aaa8b91 | 1138 | for(Int_t i=0; i<=nbinsX+1; i++) { |
1139 | sprintf(name,"mom_%d",i); | |
1140 | TH1D *hist = (TH1D*)hist1->ProjectionY(name,i+1,i+1); | |
1141 | ||
1142 | sprintf(name,"mom_norm"); | |
1143 | if(i==0) { | |
f2dec884 | 1144 | histNorm = (TH1D *)hist->Clone(name); |
1145 | histNorm->Reset(); | |
0aaa8b91 | 1146 | } |
1147 | ||
1148 | Double_t nbEvents = hist2->GetBinContent(i); | |
1149 | if(!nbEvents) { nbEvents = 1.; }; | |
1150 | ||
1151 | hist->Scale(1./nbEvents); | |
f2dec884 | 1152 | histNorm->Add(hist); |
0aaa8b91 | 1153 | } |
1154 | ||
f2dec884 | 1155 | return histNorm; |
0aaa8b91 | 1156 | } |
1157 | ||
1158 | //_____________________________________________________________________________ | |
e9f7cb15 | 1159 | //THnSparse* AlidNdPtHelper::GenerateCorrMatrix(THnSparse *const hist1, const THnSparse *const hist2, char *const name) { |
1160 | THnSparse* AlidNdPtHelper::GenerateCorrMatrix(THnSparse *const hist1, const THnSparse *const hist2, const char *name) { | |
0aaa8b91 | 1161 | // generate correction matrix |
1162 | if(!hist1 || !hist2) return 0; | |
1163 | ||
1164 | THnSparse *h =(THnSparse*)hist1->Clone(name);; | |
1165 | h->Divide(hist1,hist2,1,1,"B"); | |
1166 | ||
1167 | return h; | |
1168 | } | |
1169 | ||
1170 | //_____________________________________________________________________________ | |
a9b12ce1 | 1171 | //TH2* AlidNdPtHelper::GenerateCorrMatrix(TH2 *const hist1, TH2 *const hist2, char *const name) { |
1172 | TH2* AlidNdPtHelper::GenerateCorrMatrix(TH2 *const hist1, TH2 *const hist2, const char *name) { | |
0aaa8b91 | 1173 | // generate correction matrix |
1174 | if(!hist1 || !hist2) return 0; | |
1175 | ||
1176 | TH2D *h =(TH2D*)hist1->Clone(name);; | |
1177 | h->Divide(hist1,hist2,1,1,"B"); | |
1178 | ||
1179 | return h; | |
1180 | } | |
1181 | ||
1182 | //_____________________________________________________________________________ | |
a9b12ce1 | 1183 | //TH1* AlidNdPtHelper::GenerateCorrMatrix(TH1 *const hist1, TH1 *const hist2, char *const name) { |
1184 | TH1* AlidNdPtHelper::GenerateCorrMatrix(TH1 *const hist1, TH1 *const hist2, const char* name) { | |
0aaa8b91 | 1185 | // generate correction matrix |
1186 | if(!hist1 || !hist2) return 0; | |
1187 | ||
1188 | TH1D *h =(TH1D*)hist1->Clone(name);; | |
1189 | h->Divide(hist1,hist2,1,1,"B"); | |
1190 | ||
1191 | return h; | |
1192 | } | |
1193 | ||
1194 | //_____________________________________________________________________________ | |
a9b12ce1 | 1195 | //THnSparse* AlidNdPtHelper::GenerateContCorrMatrix(THnSparse *const hist1, THnSparse *const hist2, char *const name) { |
e9f7cb15 | 1196 | THnSparse* AlidNdPtHelper::GenerateContCorrMatrix(THnSparse *const hist1, const THnSparse *const hist2, const char* name) { |
0aaa8b91 | 1197 | // generate contamination correction matrix |
1198 | if(!hist1 || !hist2) return 0; | |
1199 | ||
1200 | THnSparse *hist = GenerateCorrMatrix(hist1, hist2, name); | |
1201 | if(!hist) return 0; | |
1202 | ||
1203 | // only for non ZERO bins!!!! | |
1204 | ||
1205 | Int_t* coord = new Int_t[hist->GetNdimensions()]; | |
1206 | memset(coord, 0, sizeof(Int_t) * hist->GetNdimensions()); | |
1207 | ||
1208 | for (Long64_t i = 0; i < hist->GetNbins(); ++i) { | |
1209 | Double_t v = hist->GetBinContent(i, coord); | |
1210 | hist->SetBinContent(coord, 1.0-v); | |
1211 | //printf("v %f, hist->GetBinContent(i, coord) %f \n",v,hist->GetBinContent(i, coord)); | |
1212 | Double_t err = hist->GetBinError(coord); | |
1213 | hist->SetBinError(coord, err); | |
1214 | } | |
1215 | ||
1216 | delete [] coord; | |
1217 | ||
1218 | return hist; | |
1219 | } | |
1220 | ||
1221 | //_____________________________________________________________________________ | |
a9b12ce1 | 1222 | //TH2* AlidNdPtHelper::GenerateContCorrMatrix(TH2 *const hist1, TH2 *const hist2, char *const name) { |
1223 | TH2* AlidNdPtHelper::GenerateContCorrMatrix(TH2 *const hist1, TH2 *const hist2, const char* name) { | |
0aaa8b91 | 1224 | // generate contamination correction matrix |
1225 | if(!hist1 || !hist2) return 0; | |
1226 | ||
1227 | TH2 *hist = GenerateCorrMatrix(hist1, hist2, name); | |
1228 | if(!hist) return 0; | |
1229 | ||
1230 | Int_t nBinsX = hist->GetNbinsX(); | |
1231 | Int_t nBinsY = hist->GetNbinsY(); | |
1232 | ||
1233 | for (Int_t i = 0; i < nBinsX+1; i++) { | |
1234 | for (Int_t j = 0; j < nBinsY+1; j++) { | |
1235 | Double_t cont = hist->GetBinContent(i,j); | |
1236 | hist->SetBinContent(i,j,1.-cont); | |
1237 | Double_t err = hist->GetBinError(i,j); | |
1238 | hist->SetBinError(i,j,err); | |
1239 | } | |
1240 | } | |
1241 | ||
1242 | return hist; | |
1243 | } | |
1244 | ||
1245 | //_____________________________________________________________________________ | |
a9b12ce1 | 1246 | //TH1* AlidNdPtHelper::GenerateContCorrMatrix(TH1 *const hist1, TH1 *const hist2, char *const name) { |
1247 | TH1* AlidNdPtHelper::GenerateContCorrMatrix(TH1 *const hist1, TH1 *const hist2, const char* name) { | |
0aaa8b91 | 1248 | // generate contamination correction matrix |
1249 | if(!hist1 || !hist2) return 0; | |
1250 | ||
1251 | TH1 *hist = GenerateCorrMatrix(hist1, hist2, name); | |
1252 | if(!hist) return 0; | |
1253 | ||
1254 | Int_t nBinsX = hist->GetNbinsX(); | |
1255 | ||
1256 | for (Int_t i = 0; i < nBinsX+1; i++) { | |
1257 | Double_t cont = hist->GetBinContent(i); | |
1258 | hist->SetBinContent(i,1.-cont); | |
1259 | Double_t err = hist->GetBinError(i); | |
1260 | hist->SetBinError(i,err); | |
1261 | } | |
1262 | ||
1263 | return hist; | |
1264 | } | |
1265 | ||
1266 | //_____________________________________________________________________________ | |
e9f7cb15 | 1267 | const AliESDVertex* AlidNdPtHelper::GetTPCVertexZ(const AliESDEvent* const esdEvent, const AlidNdPtEventCuts *const evtCuts, const AlidNdPtAcceptanceCuts *const accCuts, const AliESDtrackCuts *const trackCuts, Float_t fraction, Int_t ntracksMin){ |
0aaa8b91 | 1268 | // |
1269 | // TPC Z vertexer | |
1270 | // | |
bad4ba69 | 1271 | if(!esdEvent) |
1272 | { | |
1273 | ::Error("AlidNdPtHelper::GetTPCVertexZ()","cuts not available"); | |
1274 | return NULL; | |
1275 | } | |
1276 | ||
1277 | if(!evtCuts || !accCuts || !trackCuts) | |
1278 | { | |
1279 | ::Error("AlidNdPtHelper::GetTPCVertexZ()","cuts not available"); | |
1280 | return NULL; | |
1281 | } | |
1282 | ||
1283 | Double_t vtxpos[3]={evtCuts->GetMeanXv(),evtCuts->GetMeanYv(),evtCuts->GetMeanZv()}; | |
1284 | Double_t vtxsigma[3]={evtCuts->GetSigmaMeanXv(),evtCuts->GetSigmaMeanYv(),evtCuts->GetSigmaMeanZv()}; | |
0aaa8b91 | 1285 | AliESDVertex vtx0(vtxpos,vtxsigma); |
bad4ba69 | 1286 | |
1287 | Double_t maxDCAr = accCuts->GetMaxDCAr(); | |
1288 | Double_t maxDCAz = accCuts->GetMaxDCAz(); | |
1289 | Int_t minTPCClust = trackCuts->GetMinNClusterTPC(); | |
1290 | ||
0aaa8b91 | 1291 | // |
1292 | Int_t ntracks = esdEvent->GetNumberOfTracks(); | |
1293 | TVectorD ztrack(ntracks); | |
0aaa8b91 | 1294 | Double_t dca[2],cov[3]; |
1295 | Int_t counter=0; | |
1296 | for (Int_t i=0;i <ntracks; i++){ | |
1297 | AliESDtrack *t = esdEvent->GetTrack(i); | |
1298 | if (!t) continue; | |
1299 | if (!t->GetTPCInnerParam()) continue; | |
bad4ba69 | 1300 | if (t->GetTPCNcls()<minTPCClust) continue; |
0aaa8b91 | 1301 | // |
774986ef | 1302 | |
1303 | Double_t x[3]; t->GetXYZ(x); | |
1304 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
1305 | const Double_t kMaxStep = 1; //max step over the material | |
1306 | ||
0aaa8b91 | 1307 | AliExternalTrackParam *tpcTrack = new AliExternalTrackParam(*(t->GetTPCInnerParam())); |
774986ef | 1308 | if (!tpcTrack->PropagateToDCABxByBz(&vtx0,b,kMaxStep,dca,cov)) continue; |
0aaa8b91 | 1309 | |
1310 | // | |
bad4ba69 | 1311 | if (TMath::Abs(dca[0])>maxDCAr) continue; |
1312 | //if (TMath::Sqrt(cov[0])>sigmaXYcut) continue; | |
1313 | if (TMath::Abs(tpcTrack->GetZ())>maxDCAz) continue; | |
0aaa8b91 | 1314 | |
0aaa8b91 | 1315 | ztrack[counter]=tpcTrack->GetZ(); |
1316 | counter++; | |
1317 | ||
1318 | if(tpcTrack) delete tpcTrack; | |
1319 | } | |
bad4ba69 | 1320 | |
0aaa8b91 | 1321 | // |
1322 | // Find LTM z position | |
1323 | // | |
1324 | Double_t mean=0, sigma=0; | |
1325 | if (counter<ntracksMin) return 0; | |
1326 | // | |
1327 | Int_t nused = TMath::Nint(counter*fraction); | |
1328 | if (nused==counter) nused=counter-1; | |
1329 | if (nused>1){ | |
1330 | AliMathBase::EvaluateUni(counter, ztrack.GetMatrixArray(), mean,sigma, TMath::Nint(counter*fraction)); | |
1331 | sigma/=TMath::Sqrt(nused); | |
1332 | }else{ | |
1333 | mean = TMath::Mean(counter, ztrack.GetMatrixArray()); | |
1334 | sigma = TMath::RMS(counter, ztrack.GetMatrixArray()); | |
1335 | sigma/=TMath::Sqrt(counter-1); | |
1336 | } | |
1337 | vtxpos[2]=mean; | |
1338 | vtxsigma[2]=sigma; | |
1339 | const AliESDVertex* vertex = new AliESDVertex(vtxpos, vtxsigma); | |
1340 | return vertex; | |
1341 | } | |
1342 | ||
1343 | //_____________________________________________________________________________ | |
e9f7cb15 | 1344 | Int_t AlidNdPtHelper::GetSPDMBTrackMult(const AliESDEvent* const esdEvent, Float_t deltaThetaCut, Float_t deltaPhiCut) |
0aaa8b91 | 1345 | { |
1346 | // | |
1347 | // SPD track multiplicity | |
1348 | // | |
1349 | ||
1350 | // get tracklets | |
1351 | const AliMultiplicity* mult = esdEvent->GetMultiplicity(); | |
1352 | if (!mult) | |
1353 | return 0; | |
1354 | ||
1355 | // get multiplicity from SPD tracklets | |
1356 | Int_t inputCount = 0; | |
1357 | for (Int_t i=0; i<mult->GetNumberOfTracklets(); ++i) | |
1358 | { | |
1359 | //printf("%d %f %f %f\n", i, mult->GetTheta(i), mult->GetPhi(i), mult->GetDeltaPhi(i)); | |
1360 | ||
1361 | Float_t phi = mult->GetPhi(i); | |
1362 | if (phi < 0) | |
1363 | phi += TMath::Pi() * 2; | |
1364 | Float_t deltaPhi = mult->GetDeltaPhi(i); | |
1365 | Float_t deltaTheta = mult->GetDeltaTheta(i); | |
1366 | ||
1367 | if (TMath::Abs(deltaPhi) > 1) | |
1368 | printf("WARNING: Very high Delta Phi: %d %f %f %f\n", i, mult->GetTheta(i), mult->GetPhi(i), deltaPhi); | |
1369 | ||
1370 | if (deltaThetaCut > 0. && TMath::Abs(deltaTheta) > deltaThetaCut) | |
1371 | continue; | |
1372 | ||
1373 | if (deltaPhiCut > 0. && TMath::Abs(deltaPhi) > deltaPhiCut) | |
1374 | continue; | |
1375 | ||
1376 | ++inputCount; | |
1377 | } | |
1378 | ||
1379 | return inputCount; | |
1380 | } | |
1381 | ||
1382 | //_____________________________________________________________________________ | |
e9f7cb15 | 1383 | Int_t AlidNdPtHelper::GetSPDMBPrimTrackMult(const AliESDEvent* const esdEvent, AliStack* const stack, Float_t deltaThetaCut, Float_t deltaPhiCut) |
0aaa8b91 | 1384 | { |
1385 | // | |
1386 | // SPD track multiplicity | |
1387 | // | |
1388 | ||
1389 | // get tracklets | |
1390 | const AliMultiplicity* mult = esdEvent->GetMultiplicity(); | |
1391 | if (!mult) | |
1392 | return 0; | |
1393 | ||
1394 | // get multiplicity from SPD tracklets | |
1395 | Int_t inputCount = 0; | |
1396 | for (Int_t i=0; i<mult->GetNumberOfTracklets(); ++i) | |
1397 | { | |
1398 | //printf("%d %f %f %f\n", i, mult->GetTheta(i), mult->GetPhi(i), mult->GetDeltaPhi(i)); | |
1399 | ||
1400 | Float_t phi = mult->GetPhi(i); | |
1401 | if (phi < 0) | |
1402 | phi += TMath::Pi() * 2; | |
1403 | Float_t deltaPhi = mult->GetDeltaPhi(i); | |
1404 | Float_t deltaTheta = mult->GetDeltaTheta(i); | |
1405 | ||
1406 | if (TMath::Abs(deltaPhi) > 1) | |
1407 | printf("WARNING: Very high Delta Phi: %d %f %f %f\n", i, mult->GetTheta(i), mult->GetPhi(i), deltaPhi); | |
1408 | ||
1409 | if (deltaThetaCut > 0. && TMath::Abs(deltaTheta) > deltaThetaCut) | |
1410 | continue; | |
1411 | ||
1412 | if (deltaPhiCut > 0. && TMath::Abs(deltaPhi) > deltaPhiCut) | |
1413 | continue; | |
1414 | ||
1415 | ||
1416 | if (mult->GetLabel(i, 0) < 0 || mult->GetLabel(i, 0) != mult->GetLabel(i, 1) || | |
1417 | !stack->IsPhysicalPrimary(mult->GetLabel(i, 0))) | |
1418 | continue; | |
1419 | ||
1420 | ||
1421 | ++inputCount; | |
1422 | } | |
1423 | ||
1424 | return inputCount; | |
1425 | } | |
1426 | ||
1427 |