]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/muon/AliAnalysisTaskMuonCollisionMultiplicity.cxx
Transition PWG3 --> PWGHF
[u/mrichter/AliRoot.git] / PWG / muon / AliAnalysisTaskMuonCollisionMultiplicity.cxx
CommitLineData
0a65e325 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
16/// Compute the number of Muons tracks as a function of the SPD tracklets multiplicity
17/// Compare with Monte Carlo tracks
18/// Author Matthieu LENHARDT - SUBATECH, Nantes
19
20
21//PWG3/muon includes
22#include "AliAnalysisTaskMuonCollisionMultiplicity.h"
23
24//STEER includes
25#include "AliAODEvent.h"
26#include "AliAODVertex.h"
27#include "AliESDEvent.h"
28#include "AliESDVertex.h"
29#include "AliAODTrack.h"
30#include "AliESDMuonTrack.h"
31#include "AliAODTracklets.h"
32#include "AliAODInputHandler.h"
33#include "AliAnalysisManager.h"
34#include "AliAODDimuon.h"
35#include "AliMCEvent.h"
36#include "AliMCParticle.h"
37#include "AliMultiplicity.h"
38
39//ROOT includes
40#include <TH2D.h>
41#include <THnSparse.h>
42#include <TChain.h>
43#include <TList.h>
44#include <TArrayD.h>
45#include <Riostream.h>
46#include <TParticle.h>
47#include <TLorentzVector.h>
48
49//___________________________________________________
50AliAnalysisTaskMuonCollisionMultiplicity::AliAnalysisTaskMuonCollisionMultiplicity()
51 :
52 AliAnalysisTaskSE(),
53 fIsInit(kFALSE),
54 fAOD(0x0),
55 fESD(0x0),
0a65e325 56 fEtaCut(0),
57 fTrackletMultiplicity(0),
58 fTriggerList(0),
59 fSingleMuonList(0),
60 fDimuonList(0),
61 fMonteCarloList(0)
62{
63 ///Default Constructor
64}
65
66
67//___________________________________________________
68AliAnalysisTaskMuonCollisionMultiplicity::AliAnalysisTaskMuonCollisionMultiplicity(const AliAnalysisTaskMuonCollisionMultiplicity& src)
69 :
70 AliAnalysisTaskSE(),
71 fIsInit(kFALSE),
72 fAOD(0x0),
73 fESD(0x0),
0a65e325 74 fEtaCut(0),
75 fTrackletMultiplicity(0),
76 fTriggerList(0),
77 fSingleMuonList(0),
78 fDimuonList(0),
79 fMonteCarloList(0)
80{
81 /// copy ctor
82 src.Copy(*this);
83
84}
85
86//___________________________________________________
87AliAnalysisTaskMuonCollisionMultiplicity& AliAnalysisTaskMuonCollisionMultiplicity::operator=(const AliAnalysisTaskMuonCollisionMultiplicity& src)
88{
89 /// assignement operator
90 if ( this != &src )
91 {
92 src.Copy(*this);
93 }
94 return *this;
95}
96
97
98
99
100//___________________________________________________
101AliAnalysisTaskMuonCollisionMultiplicity::AliAnalysisTaskMuonCollisionMultiplicity(const Char_t *name)
102 :
103 AliAnalysisTaskSE(name),
104 fIsInit(kFALSE),
105 fAOD(0x0),
106 fESD(0x0),
0a65e325 107 fEtaCut(0),
108 fTrackletMultiplicity(0),
109 fTriggerList(0),
110 fSingleMuonList(0),
111 fDimuonList(0),
112 fMonteCarloList(0)
113{
114 // Define Inputs and outputs
115 //DefineInput(0, TChain::Class());
116 //DefineInput(1, TChain::Class());
117 DefineOutput(0, TList::Class());
118 DefineOutput(1, TList::Class());
119 DefineOutput(2, TList::Class());
120 DefineOutput(3, TList::Class());
121 DefineOutput(4, TList::Class());
122}
123
124
125//______________________________________________________________________________
126AliAnalysisTaskMuonCollisionMultiplicity::~AliAnalysisTaskMuonCollisionMultiplicity()
127{
128// Destructor.
129 delete fAOD;
130 delete fESD;
131 delete fTriggerList;
132 delete fSingleMuonList;
133 delete fDimuonList;
134 delete fMonteCarloList;
135}
136
137
138
139//________________________________________________________________________
140void AliAnalysisTaskMuonCollisionMultiplicity::UserCreateOutputObjects()
141{
a7aef91d 142 // Initialise the object, and open the file.
0a65e325 143 if (!fIsInit)
144 Init();
145 OpenFile(0);
146}
147
148
149
150
151//________________________________________________________________________
152void AliAnalysisTaskMuonCollisionMultiplicity::UserExec(Option_t */*option*/)
153{
a7aef91d 154 // Execute the analysis task
0a65e325 155 fAOD = 0x0;
156 fESD = 0x0;
157
158 if (!fIsInit)
159 Init();
160
161 fAOD = dynamic_cast<AliAODEvent *> (InputEvent());
162 if (!fAOD)
163 fESD = dynamic_cast<AliESDEvent *> (InputEvent());
164
165
166 if (fAOD)
167 CheckEventAOD();
168
169 if (fESD)
170 CheckEventESD();
171
172 PostData(1, fTriggerList);
173 PostData(2, fSingleMuonList);
174 PostData(3, fDimuonList);
175 PostData(4, fMonteCarloList);
176}
177
178
179
180//________________________________________________________________________
181void AliAnalysisTaskMuonCollisionMultiplicity::NotifyRun()
182{
a7aef91d 183 // Notify run
0a65e325 184}
185
186
187//________________________________________________________________________
188void AliAnalysisTaskMuonCollisionMultiplicity::FinishTaskOutput()
189{
a7aef91d 190 // Finish the task
0a65e325 191}
192
193
194//__________________________________________________________________________
195Bool_t AliAnalysisTaskMuonCollisionMultiplicity::CheckEventAOD()
196{
a7aef91d 197 // Check if the AOD event pass the cuts
0a65e325 198 AliAODVertex *vertex = fAOD->GetPrimaryVertex();
199
200 if (!vertex)
201 return kFALSE;
202
203 if (vertex->GetNContributors() < 1)
204 return kFALSE;
205
206 ComputeMultiplicity();
0a65e325 207
208 // Variables use to determine the type of trigger :
209 // 0 for minimum bias : CINT1B, CINT1-B or MB1
210 // 1 for muon events : CMUS1B, CMUS1-B or MULow
211 // -1 for everything else
212 TString trigger = fAOD->GetFiredTriggerClasses();
213 Int_t triggerClass = -1;
214
215 if (trigger.Contains("CINT1B") || trigger.Contains("CINT1-B") || trigger.Contains("MB1"))
216 triggerClass = 0;
217
218 if (trigger.Contains("CMUS1B") || trigger.Contains("CMUS1-B") || trigger.Contains("MULow"))
219 triggerClass = 1;
220
221 if (triggerClass >= 0)
222 FillHistosAOD(triggerClass);
223
224 return kTRUE;
225}
226
227
228
229//__________________________________________________________________________
230Bool_t AliAnalysisTaskMuonCollisionMultiplicity::CheckEventESD()
231{
a7aef91d 232 // Check if the ESD event pass the cuts
0a65e325 233 const AliESDVertex *vertex = fESD->GetPrimaryVertex();
234
235 if (!vertex)
236 return kFALSE;
237
238 if (vertex->GetNContributors() < 1)
239 return kFALSE;
240
241 ComputeMultiplicity();
a7aef91d 242
0a65e325 243 // Variables use to determine the type of trigger :
244 // 0 for minimum bias : CINT1B, CINT1-B or MB1
245 // 1 for muon events : CMUS1B, CMUS1-B or MULow
246 // -1 for everything else
247 TString trigger = fESD->GetFiredTriggerClasses();
248 Int_t triggerClass = -1;
249
250 if (trigger.Contains("CINT1B") || trigger.Contains("CINT1-B") || trigger.Contains("MB1") || trigger.Contains("CMBAC-B") || trigger.Contains("CMBACS2-B"))
251 triggerClass = 0;
252
253 if (trigger.Contains("CMUS1B") || trigger.Contains("CMUS1-B") || trigger.Contains("MULow"))
254 triggerClass = 1;
255
256 if (triggerClass >= 0)
257 FillHistosESD(triggerClass);
258
259 if (fMCEvent)
260 FillHistosMC();
261
262 return kTRUE;
263}
264
265
266
267
268//________________________________________________________________________
269void AliAnalysisTaskMuonCollisionMultiplicity::FillHistosAOD(Int_t triggerClass)
270{
271 // Fill histos for AOD events
272 Int_t nTracks = fAOD->GetNTracks();
273 Int_t nDimuons = fAOD->GetNDimuons();
274
275 // Fill histos
a7aef91d 276 Double_t vertexPosition = fAOD->GetPrimaryVertex()->GetZ();
0a65e325 277 Double_t pileUp = !(fAOD->IsPileupFromSPD());
278
a7aef91d 279 Double_t valuesTrigger[3] = {fTrackletMultiplicity, vertexPosition, pileUp};
0a65e325 280 ((THnSparseD *)fTriggerList->At(triggerClass))->Fill(valuesTrigger);
281
a7aef91d 282
0a65e325 283 // Loop on the muons tracks
284 for (Int_t ii = 0; ii < nTracks; ii++)
285 if (IsUsableMuon(fAOD->GetTrack(ii)))
286 {
287 Double_t matchTrigger = fAOD->GetTrack(ii)->GetMatchTrigger();
288 if (matchTrigger > 1.0)
a7aef91d 289 matchTrigger = 1.0; // We don't care what type of trigger it is (low or high pT)
0a65e325 290
291 Double_t thetaAbs = (180.0 / TMath::Pi()) * TMath::ATan(fAOD->GetTrack(ii)->GetRAtAbsorberEnd()/505.0);
292 Double_t eta = fAOD->GetTrack(ii)->Eta();
0a65e325 293 Double_t p = fAOD->GetTrack(ii)->P();
294 Double_t pT = fAOD->GetTrack(ii)->Pt();
a7aef91d 295 // For the p used in the pDCA, we want the mean between the p before the muon go through the absorber (p corrected) and after (p uncorrected)
296 // However p uncorrected is not saved in the AODs
297 // Instead we define p uncorrected as p corrected minus the mean p lost when a muon go through the absorber
298 // p lost for muons (it depends of theta_abs) :
299 // 2.0 < theta_abs < 3.0 ---> 2.98 GeV
300 // 3.0 < theta_abs < 10.0 ---> 2.4 GeV
301 // No correction applied otherwise
302 Double_t pDCA = p*fAOD->GetTrack(ii)->DCA();
b05b3bc9 303 if (2.0 < thetaAbs && thetaAbs < 3.0)
a7aef91d 304 pDCA = (p-2.98/2.0) * fAOD->GetTrack(ii)->DCA();
b05b3bc9 305 if (3.0 < thetaAbs && thetaAbs < 10.0)
a7aef91d 306 pDCA = (p-2.4/2.0) * fAOD->GetTrack(ii)->DCA();
0a65e325 307
a7aef91d 308 Double_t valuesMuon[9] = {fTrackletMultiplicity, vertexPosition, pileUp, matchTrigger, thetaAbs, eta, pDCA, p, pT};
0a65e325 309 ((THnSparseD *)fSingleMuonList->At(triggerClass))->Fill(valuesMuon);
310 }
311
312 // Loop on Dimuons
313 for (Int_t ii = 0; ii < nDimuons; ii++)
314 if (fAOD->GetDimuon(ii)->Charge() == 0.0)
315 if (IsUsableMuon(fAOD->GetDimuon(ii)->GetMu(0)))
316 if (IsUsableMuon(fAOD->GetDimuon(ii)->GetMu(1)))
317 {
318 Double_t matchTrigger1 = fAOD->GetDimuon(ii)->GetMu(0)->GetMatchTrigger();
319 if (matchTrigger1 > 0.0)
320 matchTrigger1 = 1.0;
321 Double_t matchTrigger2 = fAOD->GetDimuon(ii)->GetMu(1)->GetMatchTrigger();
322 if (matchTrigger2 > 0.0)
323 matchTrigger2 = 1.0;
324
325 Double_t nMatchTrigger = matchTrigger1 + matchTrigger2;
326
327 Double_t thetaAbs1 = (180.0 / TMath::Pi()) * TMath::ATan(fAOD->GetDimuon(ii)->GetMu(0)->GetRAtAbsorberEnd()/505.0);
328 Double_t thetaAbs2 = (180.0 / TMath::Pi()) * TMath::ATan(fAOD->GetDimuon(ii)->GetMu(1)->GetRAtAbsorberEnd()/505.0);
329 Double_t eta1 = fAOD->GetDimuon(ii)->GetMu(0)->Eta();
330 Double_t eta2 = fAOD->GetDimuon(ii)->GetMu(1)->Eta();
0a65e325 331
332 Double_t p1 = fAOD->GetDimuon(ii)->GetMu(0)->P();
333 Double_t p2 = fAOD->GetDimuon(ii)->GetMu(1)->P();
a7aef91d 334 // See the explanation on how the pDCA is computed in the single muon loop
335 Double_t pDCA1 = p1*fAOD->GetDimuon(ii)->GetMu(0)->DCA();
b05b3bc9 336 if (2.0 < thetaAbs1 && thetaAbs1 < 3.0)
a7aef91d 337 pDCA1 = (p1-2.98/2.0) * fAOD->GetDimuon(ii)->GetMu(0)->DCA();
b05b3bc9 338 if (3.0 < thetaAbs1 && thetaAbs1 < 10.0)
a7aef91d 339 pDCA1 = (p1-2.4/2.0) * fAOD->GetDimuon(ii)->GetMu(0)->DCA();
340 Double_t pDCA2 = p2*fAOD->GetDimuon(ii)->GetMu(1)->DCA();
b05b3bc9 341 if (2.0 < thetaAbs2 && thetaAbs2 < 3.0)
a7aef91d 342 pDCA2 = (p2-2.98/2.0) * fAOD->GetDimuon(ii)->GetMu(1)->DCA();
b05b3bc9 343 if (3.0 < thetaAbs2 && thetaAbs2 < 10.0)
a7aef91d 344 pDCA2 = (p2-2.4/2.0) * fAOD->GetDimuon(ii)->GetMu(1)->DCA();
0a65e325 345
a7aef91d 346 Double_t y = fAOD->GetDimuon(ii)->Y();
0a65e325 347 Double_t p = fAOD->GetDimuon(ii)->P();
348 Double_t pT = fAOD->GetDimuon(ii)->Pt();
349 Double_t M = fAOD->GetDimuon(ii)->M();
350
a7aef91d 351 Double_t valuesDimuon[18] = {fTrackletMultiplicity, vertexPosition, pileUp, matchTrigger1, matchTrigger2, nMatchTrigger, thetaAbs1, thetaAbs2,
352 eta1, eta2, pDCA1, pDCA2, p1, p2, y, p, pT, M};
0a65e325 353 ((THnSparseD *)fDimuonList->At(triggerClass))->Fill(valuesDimuon);
354 }
355}
356
357
358
359void AliAnalysisTaskMuonCollisionMultiplicity::FillHistosESD(Int_t triggerClass)
360{
361 // Fill the histos for ESD events
0a65e325 362 Int_t nTracks = fESD->GetNumberOfMuonTracks();
363
a7aef91d 364 Double_t vertexPosition = fESD->GetPrimaryVertex()->GetZ();
0a65e325 365 Double_t pileUp = !(fESD->IsPileupFromSPD());
366
a7aef91d 367 Double_t valuesTrigger[3] = {fTrackletMultiplicity, vertexPosition, pileUp};
0a65e325 368 ((THnSparseD *)fTriggerList->At(triggerClass))->Fill(valuesTrigger);
369
a7aef91d 370
0a65e325 371 // Loop on the muons tracks
372 for (Int_t ii = 0; ii < nTracks; ii++)
373 if (IsUsableMuon(fESD->GetMuonTrack(ii)))
374 {
375 Double_t matchTrigger1 = fESD->GetMuonTrack(ii)->GetMatchTrigger();
376 if (matchTrigger1 > 1.0)
a7aef91d 377 matchTrigger1 = 1.0; // We don't care what type of trigger it is (low or high pT)
0a65e325 378
379 Double_t thetaAbs1 = (180.0 / TMath::Pi()) * TMath::ATan(fESD->GetMuonTrack(ii)->GetRAtAbsorberEnd()/505.0);
380 Double_t eta1 = fESD->GetMuonTrack(ii)->Eta();
0a65e325 381 Double_t p1 = fESD->GetMuonTrack(ii)->P();
0a65e325 382 Double_t pT1 = fESD->GetMuonTrack(ii)->Pt();
383
a7aef91d 384 // For the p used in the pDCA, we want the mean between the p before the muon go through the absorber (p corrected) and after (p uncorrected)
385 // These are respectively AliESDMuonTrack::P() and AliESDMuonTrack::PUncorrected()
386 Double_t pUncor1 = fESD->GetMuonTrack(ii)->PUncorrected();
387 Double_t pDCA1 = (p1+pUncor1) * fESD->GetMuonTrack(ii)->GetDCA() / 2.0;
0a65e325 388
a7aef91d 389 Double_t valuesMuon[9] = {fTrackletMultiplicity, vertexPosition, pileUp, matchTrigger1, thetaAbs1, eta1, pDCA1, p1, pT1};
0a65e325 390 ((THnSparseD *)fSingleMuonList->At(triggerClass))->Fill(valuesMuon);
391
392 // Second loop on muons, to fill the dimuons histos
393 for (Int_t jj = ii+1; jj < nTracks; jj++)
394 if (IsUsableMuon(fESD->GetMuonTrack(jj)))
395 if (fESD->GetMuonTrack(ii)->Charge() + fESD->GetMuonTrack(jj)->Charge() == 0.0)
396 {
397 Double_t matchTrigger2 = fESD->GetMuonTrack(jj)->GetMatchTrigger();
398 if (matchTrigger2 > 0.0)
399 matchTrigger2 = 1.0;
400
401 Double_t nMatchTrigger = matchTrigger1 + matchTrigger2;
402
403 Double_t thetaAbs2 = (180.0 / TMath::Pi()) * TMath::ATan(fESD->GetMuonTrack(jj)->GetRAtAbsorberEnd()/505.0);
404 Double_t eta2 = fESD->GetMuonTrack(jj)->Eta();
0a65e325 405 Double_t p2 = fESD->GetMuonTrack(jj)->P();
0a65e325 406
a7aef91d 407 // For the p used in the pDCA, we want the mean between the p before the muon go through the absorber (p corrected) and after (p uncorrected)
408 // These are respectively AliESDMuonTrack::P() and AliESDMuonTrack::PUncorrected()
409 Double_t pUncor2 = fESD->GetMuonTrack(jj)->PUncorrected();
410 Double_t pDCA2 = (p2+pUncor2) * fESD->GetMuonTrack(jj)->GetDCA() / 2.0;
0a65e325 411
412 // To compute the p, pT and M of the dimuon, we need a TLorentz vector of the dimuon
413 Double_t E = fESD->GetMuonTrack(ii)->E() + fESD->GetMuonTrack(jj)->E();
414 Double_t pX = fESD->GetMuonTrack(ii)->Px() + fESD->GetMuonTrack(jj)->Px();
415 Double_t pY = fESD->GetMuonTrack(ii)->Py() + fESD->GetMuonTrack(jj)->Py();
416 Double_t pZ = fESD->GetMuonTrack(ii)->Pz() + fESD->GetMuonTrack(jj)->Pz();
417 TLorentzVector *dimuonVector = new TLorentzVector(pX, pY, pZ, E);
418 dimuonVector->SetPxPyPzE(pX, pY, pZ, E);
419
a7aef91d 420 Double_t y = dimuonVector->Rapidity();
0a65e325 421 Double_t p = dimuonVector->P();
422 Double_t pT = TMath::Sqrt(pX*pX + pY*pY);
423 Double_t M = dimuonVector->M();
424
a7aef91d 425 Double_t valuesDimuon[18] = {fTrackletMultiplicity, vertexPosition, pileUp, matchTrigger1, matchTrigger2, nMatchTrigger, thetaAbs1, thetaAbs2,
426 eta1, eta2, pDCA1, pDCA2, p1, p2, y, p, pT, M};
0a65e325 427 ((THnSparseD *)fDimuonList->At(triggerClass))->Fill(valuesDimuon);
428 delete dimuonVector;
429 }
430 }
431
a7aef91d 432
433 // Since this is the ESD, we are also going to fill a the V0amp vs multiplicity histos
434 if (triggerClass == 0)
435 {
436 AliESDVZERO *v0 = fESD->GetVZEROData();
437 Float_t multV0 = 0;
438 Float_t multV0A = 0;
439 Float_t multV0C = 0;
440
441 for (Int_t ii = 0; ii < 64; ii++)
442 {
443 multV0 += v0->GetMultiplicity(ii);
444 if (ii < 32)
445 {
446 multV0C += v0->GetMultiplicityV0C(ii);
447 multV0A += v0->GetMultiplicityV0A(ii);
448 }
449 }
450
451 ((TH2D *)fTriggerList->At(2))->Fill(fTrackletMultiplicity, multV0);
452 ((TH2D *)fTriggerList->At(3))->Fill(fTrackletMultiplicity, multV0A);
453 ((TH2D *)fTriggerList->At(4))->Fill(fTrackletMultiplicity, multV0C);
454 }
455
456
0a65e325 457}
458
459
460//________________________________________________________________________
461void AliAnalysisTaskMuonCollisionMultiplicity::FillHistosMC()
462{
463 // Fill the histo of the correlation between MC tracks and ESD tracks
464
465 Int_t multiplicityGenerated = 0;
466 const AliESDVertex *vertex = fESD->GetPrimaryVertexTracks();
467
468 for (Int_t nn = 0; nn < fMCEvent->GetNumberOfTracks(); nn++)
469 {
470 AliMCParticle *particle = (AliMCParticle *) fMCEvent->GetTrack(nn);
471 Bool_t isGoodMult = kTRUE;
472
473 if (particle->Particle()->GetStatusCode() != 1)
474 isGoodMult = kFALSE;
475
476 if (particle->Charge() == 0)
477 isGoodMult = kFALSE;
478
a7aef91d 479 if (TMath::Abs(particle->Eta()) > 1.6)
0a65e325 480 isGoodMult = kFALSE;
481
482 // Check if the particle is a pion, kaon, proton, electron or muon
483 if (TMath::Abs(particle->PdgCode()) != 211 && TMath::Abs(particle->PdgCode()) != 321 && TMath::Abs(particle->PdgCode()) != 2212 &&
484 TMath::Abs(particle->PdgCode()) != 11 && TMath::Abs(particle->PdgCode()) != 13)
485 isGoodMult = kFALSE;
486
487 // Check if the distance to vertex is inferior to 1 cm
488 Double_t distanceToVertex = TMath::Sqrt((particle->Xv() - vertex->GetXv())*(particle->Xv() - vertex->GetXv()) +
489 (particle->Yv() - vertex->GetYv())*(particle->Yv() - vertex->GetYv()) +
490 (particle->Zv() - vertex->GetZv())*(particle->Zv() - vertex->GetZv()));
491 if (distanceToVertex > 1.0)
492 isGoodMult = kFALSE;
493
494 if (isGoodMult)
495 multiplicityGenerated += 1;
496 }
497
498 ((TH2D *)fMonteCarloList->At(0))->Fill(multiplicityGenerated, fTrackletMultiplicity);
499}
500
501
502
503//________________________________________________________________________
504void AliAnalysisTaskMuonCollisionMultiplicity::ComputeMultiplicity()
505{
506 // Compute the collision multiplicity based on AOD or ESD tracklets
507
508 Int_t multiplicity = 0;
509
510 if (fAOD)
511 {
512 AliAODTracklets *tracklets = fAOD->GetTracklets();
513 Int_t nTracklets = tracklets->GetNumberOfTracklets();
514 for (Int_t nn = 0; nn < nTracklets; nn++)
515 {
516 Double_t theta = tracklets->GetTheta(nn);
517 Double_t eta = -TMath::Log(TMath::Tan(theta/2.0));
518
519 if (TMath::Abs(eta) < fEtaCut)
520 multiplicity += 1;
521 }
522 }
523
524
a7aef91d 525 if (fESD)
526 {
527 // In ESDs, we use the EstimateMultiplicity function
528 Int_t multTracklets = 0;
529 Int_t multTPC = 0;
530 Int_t multITSSA = 0;
531 fESD->EstimateMultiplicity(multTracklets, multTPC, multITSSA, fEtaCut);
532 multiplicity = multTracklets;
533 }
0a65e325 534
535 fTrackletMultiplicity = multiplicity;
536}
537
538
539
540//________________________________________________________________________
541Bool_t AliAnalysisTaskMuonCollisionMultiplicity::IsUsableMuon(AliAODTrack *track)
542{
543 // Check if the track is a usable muon track
544 // Cuts applied :
545 // - is it a muon track?
546 // - does it have a pT > 0.0?
547
548 Bool_t isGood = kFALSE;
549
550 if (!track->IsMuonTrack())
551 return isGood;
552
553 if (!(track->Pt() > 0.0))
554 return isGood;
555
556 isGood = kTRUE;
557 return isGood;
558}
559
560
561
562//________________________________________________________________________
563Bool_t AliAnalysisTaskMuonCollisionMultiplicity::IsUsableMuon(AliESDMuonTrack *track)
564{
565 // Check if the track is a usable muon track
566 // Cuts applied :
567 // - is it a muon track?
568 // - does it have a pT > 0.0?
569
570 Bool_t isGood = kFALSE;
571
572 if (!track->ContainTrackerData())
573 return isGood;
574
575 if (!(track->Pt() > 0.0))
576 return isGood;
577
578 isGood = kTRUE;
579 return isGood;
580}
581
582
583
584//________________________________________________________________________
585void AliAnalysisTaskMuonCollisionMultiplicity::Init()
586{
587 // Initialize the object
588
589 fTriggerList = new TList();
590 fSingleMuonList = new TList();
591 fDimuonList = new TList();
592 fMonteCarloList = new TList();
593
594 fTriggerList->SetOwner();
595 fSingleMuonList->SetOwner();
596 fDimuonList->SetOwner();
597 fMonteCarloList->SetOwner();
598
599
600
0a65e325 601 // Trigger histos
602 // dimension 0 : multiplicity of the event
a7aef91d 603 // dimension 1 : z vertex of the event
0a65e325 604 // dimension 2 : is it an event without pile up (0 for no, 1 for yes)?
a7aef91d 605 Int_t nBinsTrigger[3] = { 150, 60, 2};
606 Double_t minRangeTrigger[3] = { 0.0, -30.0, 0.0};
607 Double_t maxRangeTrigger[3] = {150.0, 30.0, 2.0};
0a65e325 608 THnSparseD *CINT1B = new THnSparseD ("CINT1B", "CINT1B", 3, nBinsTrigger, minRangeTrigger, maxRangeTrigger);
609 THnSparseD *CMUS1B = new THnSparseD ("CMUS1B", "CMUS1B", 3, nBinsTrigger, minRangeTrigger, maxRangeTrigger);
610 CINT1B->Sumw2();
611 CMUS1B->Sumw2();
612
a7aef91d 613 TH2D *CompSPDV0 = new TH2D ("CompSPDV0", "CompSPDV0", 150, 0.0, 150.0, 2000, 0.0, 2000.0);
614 CompSPDV0->Sumw2();
615 TH2D *CompSPDV0A = new TH2D ("CompSPDV0A", "CompSPDV0A", 150, 0.0, 150.0, 1000, 0.0, 1000.0);
616 CompSPDV0A->Sumw2();
617 TH2D *CompSPDV0C = new TH2D ("CompSPDV0C", "CompSPDV0C", 150, 0.0, 150.0, 1000, 0.0, 1000.0);
618 CompSPDV0C->Sumw2();
619
0a65e325 620 fTriggerList->AddAt(CINT1B, 0);
621 fTriggerList->AddAt(CMUS1B, 1);
a7aef91d 622 fTriggerList->AddAt(CompSPDV0, 2);
623 fTriggerList->AddAt(CompSPDV0A, 3);
624 fTriggerList->AddAt(CompSPDV0C, 4);
0a65e325 625
626
627
628
629 // Muons histos
a7aef91d 630 // dimension 0 : multiplicity of the event
631 // dimension 1 : z vertex of the event
632 // dimension 2 : is it an event without pile up (0 for no, 1 for yes)?
633 // dimension 3 : does the muon match the trigger (0 for no, 1 for yes)?
634 // dimension 4 : theta_abs of the muon
635 // dimension 5 : eta of the muon
636 // dimension 6 : p DCA of the muon
637 // dimension 7 : p of the muon
638 // dimension 8 : pT of the muon
639
640 Int_t nBinsMuon[9] = { 150, 60, 2, 2, 110, 35, 300, 300, 300};
641 Double_t minRangeMuon[9] = { 0.0, -30.0, 0.0, 0.0, 0.0, -5.0, 0.0, 0.0, 0.0};
642 Double_t maxRangeMuon[9] = {150.0, 30.0, 2.0, 2.0, 11.0, -1.5, 300.0, 150.0, 30.0};
643
644 THnSparseD *muonCINT1B = new THnSparseD("muonCINT1B", "muonCINT1B", 9, nBinsMuon, minRangeMuon, maxRangeMuon);
645 THnSparseD *muonCMUS1B = new THnSparseD("muonCMUS1B", "muonCMUS1B", 9, nBinsMuon, minRangeMuon, maxRangeMuon);
0a65e325 646 muonCINT1B->Sumw2();
647 muonCMUS1B->Sumw2();
648
649 fSingleMuonList->AddAt(muonCINT1B, 0);
650 fSingleMuonList->AddAt(muonCMUS1B, 1);
651
652
653 // Dimuons histos
654 // dimension 0 : multiplicity of the event
a7aef91d 655 // dimension 1 : z range (0 for no, 1 for yes)?
0a65e325 656 // dimension 2 : is it an event without pile up (0 for no, 1 for yes)?
657 // dimension 3 : does the first muon match the trigger (0 for no, 1 for yes)?
658 // dimension 4 : does the second muon match the trigger (0 for no, 1 for yes)?
659 // dimension 5 : number of muons matching the trigger in the dimuon
660 // dimension 6 : theta_abs of the first muon
661 // dimension 7 : theta_abs of the second muon
662 // dimension 8 : eta of the first muon
663 // dimension 9 : eta of the second muon
a7aef91d 664 // dimension 10 : p DCA of the first muon
665 // dimension 11 : p DCA of the second muon
666 // dimension 12 : p of the first muon
667 // dimension 13 : p of the second muon
668 // dimension 14 : y of the dimuon
669 // dimension 15 : p of the dimuon
670 // dimension 16 : pT of the dimuon
671 // dimension 17 : invariant mass of the dimuon
672
673 Int_t nBinsDimuon[18] = { 150, 60, 2, 2, 2, 3, 110, 110, 35, 35, 200, 200, 300, 300, 35, 300, 300, 375};
674 Double_t minRangeDimuon[18] = { 0.0, -30.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -5.0, -5.0, 0.0, 0.0, 0.0, 0.0, -5.0, 0.0, 0.0, 0.0};
675 Double_t maxRangeDimuon[18] = {150.0, 30.0, 2.0, 2.0, 2.0, 3.0, 11.0, 11.0, -1.5, -1.5, 600.0, 600.0, 150.0, 150.0, -1.5, 300.0, 30.0, 15.0};
676
677 THnSparseD *dimuonCINT1B = new THnSparseD("dimuonCINT1B", "dimuonCINT1B", 18, nBinsDimuon, minRangeDimuon, maxRangeDimuon);
678 THnSparseD *dimuonCMUS1B = new THnSparseD("dimuonCMUS1B", "dimuonCMUS1B", 18, nBinsDimuon, minRangeDimuon, maxRangeDimuon);
0a65e325 679
680 dimuonCINT1B->Sumw2();
681 dimuonCMUS1B->Sumw2();
682
683 fDimuonList->AddAt(dimuonCINT1B, 0);
684 fDimuonList->AddAt(dimuonCMUS1B, 1);
685
686 // MonteCarlo Histo
687 TH2D *correlGenerReco = new TH2D("correlGenerReco", "correlGenerReco", 250, 0.0, 250.0, 250, 0.0, 250.0);
688 correlGenerReco->GetXaxis()->SetTitle("N ch gener");
689 correlGenerReco->GetYaxis()->SetTitle("N reco tracklets");
690
691 correlGenerReco->Sumw2();
692
693 fMonteCarloList->AddAt(correlGenerReco, 0);
694
695 fIsInit = kTRUE;
696}
697
698
699
700
701
702//________________________________________________________________________
703void AliAnalysisTaskMuonCollisionMultiplicity::Terminate(Option_t */*option*/)
704{
705//Terminate analysis
706
707 fTriggerList = (TList *) GetOutputData(0);
708 fSingleMuonList = (TList *) GetOutputData(1);
709 fDimuonList = (TList *) GetOutputData(2);
710}