19 #include <TObjArray.h> 20 #include <TClonesArray.h> 28 #include "AliESDEvent.h" 29 #include "AliESDMuonTrack.h" 30 #include "AliESDInputHandler.h" 31 #include "AliMCEventHandler.h" 32 #include "AliCDBManager.h" 33 #include "AliCentrality.h" 34 #include "AliMCParticle.h" 35 #include "AliMCEvent.h" 36 #include "AliCounterCollection.h" 39 #include "AliAnalysisDataSlot.h" 40 #include "AliAnalysisDataContainer.h" 41 #include "AliAnalysisManager.h" 44 #include "AliMUONCDB.h" 45 #include "AliMUONRecoParam.h" 46 #include "AliMUONRecoCheck.h" 47 #include "AliMUONVCluster.h" 48 #include "AliMUONVTrackStore.h" 49 #include "AliMUONVTriggerTrackStore.h" 50 #include "AliMUONTrack.h" 51 #include "AliMUONTrackParam.h" 52 #include "AliMUONESDInterface.h" 53 #include "AliMUONTriggerTrack.h" 71 fFakeTrackCounters(0x0),
72 fMatchedTrackCounters(0x0),
76 fRequestedStationMask(0),
77 fRequest2ChInSameSt45(kFALSE),
80 fShowProgressBar(kFALSE),
83 fExternalSigmaCut(-1.),
88 fRecoParamLocation(""),
90 fPrintDecayChain(kFALSE),
91 fDisableDetailedCounters(kFALSE),
104 fFakeTrackCounters(0x0),
105 fMatchedTrackCounters(0x0),
108 fCurrentFileName(
""),
109 fRequestedStationMask(0),
110 fRequest2ChInSameSt45(kFALSE),
113 fShowProgressBar(kFALSE),
115 fCombineMCId(kFALSE),
116 fExternalSigmaCut(-1.),
118 fApplyAccCut(kFALSE),
121 fRecoParamLocation(
"raw://"),
122 fDecayAsFake(kFALSE),
123 fPrintDecayChain(kFALSE),
124 fDisableDetailedCounters(kFALSE),
129 DefineOutput(1,TObjArray::Class());
131 DefineOutput(2,AliCounterCollection::Class());
133 DefineOutput(3,AliCounterCollection::Class());
135 DefineOutput(4,AliCounterCollection::Class());
137 DefineOutput(5,AliCounterCollection::Class());
139 DefineOutput(6,TObjArray::Class());
141 DefineOutput(7,AliCounterCollection::Class());
148 if (!AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
172 TString nameSuffix0[2] = {
"",
"S"};
173 TString nameSuffixT[6] = {
"",
"M",
"MY",
"D",
"DY",
"F"};
174 TString titlePrefix0[2] = {
"",
"selected "};
175 TString titlePrefixT[6] = {
"",
"matched ",
"not reconstructible matched ",
"decay ",
"not reconstructible decay ",
"fake "};
176 for (
Int_t i = 0; i < 2; i++) {
178 for (
Int_t j = 0; j < 6; j++) {
181 h =
new TH1F(Form(
"hNumberOfClusters%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
182 Form(
"nb of clusters /%s%strack",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 21, -0.5, 20.5);
186 h =
new TH1F(Form(
"hNumberOfChamberHit%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
187 Form(
"nb of chambers hit /%s%strack",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 16, -0.5, 15.5);
191 h =
new TH1F(Form(
"hChi2PerDof%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
192 Form(
"%s%strack chi2/d.o.f.",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 200, 0., 20.);
196 h2 =
new TH2F(Form(
"hChi2PerDofVsNClusters%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
197 Form(
"%s%strack chi2/d.o.f. versus nb of clusters",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 21, -0.5, 20.5, 100, 0., 20.);
201 h2 =
new TH2F(Form(
"hChi2PerDofVsNChamberHit%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
202 Form(
"%s%strack chi2/d.o.f. versus nb of fired chambers",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 16, -0.5, 15.5, 100, 0., 20.);
206 h =
new TH1F(Form(
"hP%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
207 Form(
"%s%strack P distribution (GeV/c)",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 100, 0., 200.);
209 h =
new TH1F(Form(
"hPt%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
210 Form(
"%s%strack Pt distribution (GeV/c)",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 100, 0., 20.);
212 h =
new TH1F(Form(
"hEta%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
213 Form(
"%s%strack pseudo-rapidity distribution",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 200, -10., 0.);
215 h =
new TH1F(Form(
"hPhi%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
216 Form(
"%s%strack phi distribution",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 100, -1., 9.);
218 h =
new TH1F(Form(
"hDCA%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
219 Form(
"%s%strack DCA distribution",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 250, 0., 500.);
221 h =
new TH1F(Form(
"hPDCA23%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
222 Form(
"%s%strack P*DCA distribution in 2-3 deg",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 250, 0., 5000.);
224 h =
new TH1F(Form(
"hPDCA310%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
225 Form(
"%s%strack P*DCA distribution in 3-10 deg",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 250, 0., 5000.);
227 h =
new TH1F(Form(
"hRAbs%s%s",nameSuffix0[i].
Data(),nameSuffixT[j].
Data()),
228 Form(
"%s%strack R_{Abs} distribution",titlePrefix0[i].
Data(),titlePrefixT[j].
Data()), 200, 0., 100.);
236 TH1F *hNumberOfTracks =
new TH1F(
"hNumberOfTracks",
"nb of tracks /evt", 21, -0.5, 20.5);
238 TH1F *hNumberOfAdditionalTracks =
new TH1F(
"hNumberOfAdditionalTracks",
"nb of fake - nb of missing track", 21, -0.5, 20.5);
242 TH1F *hNumberOfClustersMC =
new TH1F(
"hNumberOfClustersMC",
"nb of clusters /MC track", 21, -0.5, 20.5);
244 TH1F *hFractionOfMatchedClusters =
new TH1F(
"hFractionOfMatchedClusters",
"nb of matched clusters / nb of clusters", 110, 0., 1.1);
246 TH1F *hFractionOfConnectedClusters =
new TH1F(
"hFractionOfConnectedClusters",
"nb of connected clusters / nb of clusters in fake tracks", 110, 0., 1.1);
254 TString nameSuffix[4] = {
"",
"M",
"F1",
"F2"};
255 TString titlePrefix[4] = {
"dimuon ",
"matched-matched pair ",
"matched-fake pair ",
"fake-fake pair "};
256 for (
Int_t i = 0; i < 2; i++) {
257 for (
Int_t j = 0; j < 4; j++) {
258 h =
new TH1F(Form(
"h2Mass%s%s",nameSuffix0[i].
Data(),nameSuffix[j].
Data()),
259 Form(
"%s%smass distribution (GeV/c^{2})",titlePrefix0[i].
Data(),titlePrefix[j].
Data()), 300, 0., 15.);
261 h =
new TH1F(Form(
"h2P%s%s",nameSuffix0[i].
Data(),nameSuffix[j].
Data()),
262 Form(
"%s%sP distribution (GeV/c)",titlePrefix0[i].
Data(),titlePrefix[j].
Data()), 100, 0., 200.);
264 h =
new TH1F(Form(
"h2Pt%s%s",nameSuffix0[i].
Data(),nameSuffix[j].
Data()),
265 Form(
"%s%sPt distribution (GeV/c)",titlePrefix0[i].
Data(),titlePrefix[j].
Data()), 100, 0., 20.);
267 h =
new TH1F(Form(
"h2Y%s%s",nameSuffix0[i].
Data(),nameSuffix[j].
Data()),
268 Form(
"%s%srapidity distribution",titlePrefix0[i].
Data(),titlePrefix[j].
Data()), 200, -10., 0.);
270 h =
new TH1F(Form(
"h2Eta%s%s",nameSuffix0[i].
Data(),nameSuffix[j].
Data()),
271 Form(
"%s%spseudo-rapidity distribution",titlePrefix0[i].
Data(),titlePrefix[j].
Data()), 200, -10., 0.);
273 h =
new TH1F(Form(
"h2Phi%s%s",nameSuffix0[i].
Data(),nameSuffix[j].
Data()),
274 Form(
"%s%sphi distribution",titlePrefix0[i].
Data(),titlePrefix[j].
Data()), 100, -1., 9.);
289 fTrackCounters =
new AliCounterCollection(GetOutputSlot(2)->GetContainer()->GetName());
290 fTrackCounters->AddRubric(
"track",
"reconstructible/reconstructed/matched/matchedyet/decay/decayyet/fake/connected/additional");
295 TString centralityClasses =
"5/10/15/20/25/30/35/40/45/50/55/60/65/70/75/80/85/90/95/100";
300 fFakeTrackCounters =
new AliCounterCollection(GetOutputSlot(3)->GetContainer()->GetName());
301 fFakeTrackCounters->AddRubric(
"position",
"matched/decay/decayyet/matchedyet/fake/connected/additional");
302 fFakeTrackCounters->AddRubric(
"label",
"matched/decay/decayyet/matchedyet/fake/connected/additional");
330 fEventCounters =
new AliCounterCollection(GetOutputSlot(5)->GetContainer()->GetName());
331 fEventCounters->AddRubric(
"event",
"any/fake/notconnected/additional/matchedyet");
344 fPairCounters =
new AliCounterCollection(GetOutputSlot(7)->GetContainer()->GetName());
345 fPairCounters->AddRubric(
"pair",
"reconstructible/reconstructed/matched/1fake/2fakes");
354 AliLog::SetClassDebugLevel(
"AliMCEvent",-1);
377 TString selected = (fInputHandler && fInputHandler->IsEventSelected() != 0) ?
"selected:yes" :
"selected:no";
391 AliError(
"Cannot get input event");
400 Double_t centralityValue = esd->GetCentrality()->GetCentralityPercentile(
"V0M");
402 TObjString* limit = 0x0;
403 TIter nextLimit(centralylimits);
404 while ((limit = static_cast<TObjString*>(nextLimit()))) {
405 if (centralityValue < limit->String().Atoi()) {
406 centrality += limit->GetName();
410 if (!limit) centrality +=
static_cast<TObjString*
>(centralylimits->Last())->GetName();
411 delete centralylimits;
414 AliMCEventHandler *mcH = 0;
415 if(MCEvent()) mcH = static_cast<AliMCEventHandler*>((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
418 AliMUONRecoCheck rc(esd,mcH);
419 AliMUONVTrackStore* muonTrackStore = rc.ReconstructedTracks(-1, kFALSE);
420 AliMUONVTrackStore* trackRefStore = rc.TrackRefs(-1);
421 AliMUONVTriggerTrackStore* triggerTrackRefStore = rc.TriggerableTracks(-1);
422 if (!muonTrackStore || !trackRefStore)
return;
425 Int_t nMuPlus[2] = {0, 0};
426 Int_t nMuMinus[2] = {0, 0};
427 TIter next(trackRefStore->CreateIterator());
428 AliMUONTrack* trackRef;
429 while ( ( trackRef = static_cast<AliMUONTrack*>(next()) ) ) {
435 AliMUONTriggerTrack *trigRef =
static_cast<AliMUONTriggerTrack*
>(triggerTrackRefStore->FindObject(trackRef->GetUniqueID()));
436 Bool_t trigger = (trigRef && trigRef->GetPtCutLevel() > 0);
437 Int_t iTrig = trigger ? 1 : 0;
438 TString trig = trigger ?
"trig:yes" :
"trig:no";
441 if (trackRef->GetTrackParamAtVertex()->GetCharge() > 0) nMuPlus[iTrig]++;
442 else nMuMinus[iTrig]++;
445 fTrackCounters->Count(Form(
"track:reconstructible/run:%d/%s/%s/acc:unknown/%s", fCurrentRunNumber, trig.Data(), selected.Data(), centrality.Data()));
450 fPairCounters->Count(Form(
"pair:reconstructible/run:%d/trig:0/%s/acc:unknown/%s", fCurrentRunNumber, selected.Data(), centrality.Data()), nMuPlus[0]*nMuMinus[0]);
451 fPairCounters->Count(Form(
"pair:reconstructible/run:%d/trig:1/%s/acc:unknown/%s", fCurrentRunNumber, selected.Data(), centrality.Data()), nMuPlus[1]*nMuMinus[0]+nMuPlus[0]*nMuMinus[1]);
452 fPairCounters->Count(Form(
"pair:reconstructible/run:%d/trig:2/%s/acc:unknown/%s", fCurrentRunNumber, selected.Data(), centrality.Data()), nMuPlus[1]*nMuMinus[1]);
455 Int_t nTrackerTracks = 0;
456 Bool_t containTrack[2] = {kFALSE, kFALSE};
457 Bool_t containFakeTrack[2] = {kFALSE, kFALSE};
458 Bool_t containMatchedYetTrack[2] = {kFALSE, kFALSE};
459 AliMUONVTrackStore *usedTrackRefStore = AliMUONESDInterface::NewTrackStore();
460 AliMUONVTrackStore *fakeTrackStore = AliMUONESDInterface::NewTrackStore();
461 Int_t nTracks = (
Int_t)esd->GetNumberOfMuonTracks();
463 for (
Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
465 AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
469 containTrack[0] = kTRUE;
472 Bool_t trigger = esdTrack->ContainTriggerData();
473 TString trig = trigger ?
"trig:yes" :
"trig:no";
474 if (trigger) containTrack[1] = kTRUE;
477 Double_t rAbs = esdTrack->GetRAtAbsorberEnd();
478 Double_t thetaTrackAbsEnd = TMath::ATan(rAbs/505.) * TMath::RadToDeg();
480 Bool_t inAcc = (thetaTrackAbsEnd >= 2. && thetaTrackAbsEnd <= 10. && eta >= -4. && eta <= -2.5);
481 TString acc = inAcc ?
"acc:in" :
"acc:out";
485 fTrackCounters->Count(Form(
"track:reconstructed/run:%d/%s/%s/%s/%s", fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
488 AliMUONTrack* muonTrack =
static_cast<AliMUONTrack*
>(muonTrackStore->FindObject(esdTrack->GetUniqueID()));
491 Int_t nClusters = esdTrack->GetNClusters();
492 Int_t nChamberHit = 0;
493 for (
Int_t ich=0; ich<10; ich++)
if (esdTrack->IsInMuonClusterMap(ich)) nChamberHit++;
494 Double_t normalizedChi2 = esdTrack->GetChi2() / (2. * esdTrack->GetNHit() - 5);
499 Double_t pU = esdTrack->PUncorrected();
503 FillHistoTrack(0, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
505 FillHistoTrack(
kNhistTrack, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
508 Int_t nMatchClustersByPosition = 0;
509 AliMUONTrack* matchedTrackRefByPosition = rc.FindCompatibleTrack(*muonTrack, *trackRefStore, nMatchClustersByPosition, kFALSE,
fSigmaCut);
510 Bool_t isMatchedYetByPosition = kFALSE;
511 Bool_t isRecoDecayByPosition = kFALSE;
512 Int_t decayLabelByPosition = -1, lastChDecayByPosition = 0;
514 decayLabelByPosition =
IsDecayByPosition(*muonTrack, *trackRefStore, *usedTrackRefStore, isRecoDecayByPosition, lastChDecayByPosition);
515 if (decayLabelByPosition >= 0) matchedTrackRefByPosition = 0x0;
516 else if (matchedTrackRefByPosition) isMatchedYetByPosition = kTRUE;
518 Bool_t isFakeByPosition = (!matchedTrackRefByPosition && decayLabelByPosition < 0);
521 Int_t nMatchClustersByLabel = 0;
522 AliMUONTrack* matchedTrackRefByLabel = rc.FindCompatibleTrack(*muonTrack, *trackRefStore, nMatchClustersByLabel, kTRUE,
fSigmaCut);
523 Bool_t isMatchedYetByLabel = kFALSE;
524 Bool_t isRecoDecayByLabel = kFALSE;
525 Int_t decayLabelByLabel = -1, lastChDecayByLabel = 0;
527 decayLabelByLabel =
IsDecayByLabel(*muonTrack, isRecoDecayByLabel, lastChDecayByLabel);
528 if (decayLabelByLabel >= 0) matchedTrackRefByLabel = 0x0;
529 else if (matchedTrackRefByLabel) isMatchedYetByLabel = kTRUE;
531 Bool_t isFakeByLabel = (!matchedTrackRefByLabel && decayLabelByLabel < 0);
534 TString positionCase =
"position:";
535 if (isMatchedYetByPosition) positionCase +=
"matchedyet";
536 else if (isRecoDecayByPosition) positionCase +=
"decay";
537 else if (decayLabelByPosition >= 0) positionCase +=
"decayyet";
538 else if (isFakeByPosition) positionCase +=
"fake";
539 else positionCase +=
"matched";
541 if (isMatchedYetByLabel) labelCase +=
"matchedyet";
542 else if (isRecoDecayByLabel) labelCase +=
"decay";
543 else if (decayLabelByLabel >= 0) labelCase +=
"decayyet";
544 else if (isFakeByLabel) labelCase +=
"fake";
545 else labelCase +=
"matched";
546 if (!matchedTrackRefByPosition || isMatchedYetByPosition || !matchedTrackRefByLabel || isMatchedYetByLabel)
547 fFakeTrackCounters->Count(Form(
"%s/%s/run:%d/file:%s/%s/%s/%s/%s/%s", positionCase.Data(), labelCase.Data(), fCurrentRunNumber,
548 fCurrentFileName.Data(), eventNumberInFile.Data(), trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
549 if (matchedTrackRefByLabel && matchedTrackRefByPosition &&
550 matchedTrackRefByLabel->GetUniqueID() != matchedTrackRefByPosition->GetUniqueID()) labelCase =
"label:matchedother";
552 fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
555 Int_t nMatchClusters = 0;
556 AliMUONTrack* matchedTrackRef = 0x0;
557 Bool_t isFake = kFALSE, isMatchedYet = kFALSE, isRecoDecay = kFALSE;
558 Int_t decayLabel = -1;
562 if (matchedTrackRefByPosition && matchedTrackRefByLabel && ((!isMatchedYetByPosition && !isMatchedYetByLabel) ||
563 (isMatchedYetByPosition && isMatchedYetByLabel))) {
565 nMatchClusters = TMath::Max(nMatchClustersByPosition, nMatchClustersByLabel);
566 matchedTrackRef = (nMatchClusters == nMatchClustersByPosition) ? matchedTrackRefByPosition : matchedTrackRefByLabel;
567 isMatchedYet = isMatchedYetByPosition;
569 }
else if (matchedTrackRefByPosition && (!isMatchedYetByPosition || isFakeByLabel)) {
571 nMatchClusters = nMatchClustersByPosition;
572 matchedTrackRef = matchedTrackRefByPosition;
573 isMatchedYet = isMatchedYetByPosition;
575 }
else if (matchedTrackRefByLabel && (!isMatchedYetByLabel || isFakeByPosition)) {
577 nMatchClusters = nMatchClustersByLabel;
578 matchedTrackRef = matchedTrackRefByLabel;
579 isMatchedYet = isMatchedYetByLabel;
582 }
else if (decayLabelByPosition >= 0 && decayLabelByLabel >= 0 && ((isRecoDecayByPosition && isRecoDecayByLabel) ||
583 (!isRecoDecayByPosition && !isRecoDecayByLabel))) {
585 decayLabel = (lastChDecayByLabel > lastChDecayByPosition) ? decayLabelByLabel : decayLabelByPosition;
586 isRecoDecay = isRecoDecayByPosition;
588 }
else if (decayLabelByPosition >= 0 && (isRecoDecayByPosition || decayLabelByLabel < 0)) {
590 decayLabel = decayLabelByPosition;
591 isRecoDecay = isRecoDecayByPosition;
593 }
else if (decayLabelByLabel >= 0) {
595 decayLabel = decayLabelByLabel;
596 isRecoDecay = isRecoDecayByLabel;
599 }
else isFake = kTRUE;
604 nMatchClusters = nMatchClustersByLabel;
605 matchedTrackRef = matchedTrackRefByLabel;
606 isMatchedYet = isMatchedYetByLabel;
607 decayLabel = decayLabelByLabel;
608 isRecoDecay = isRecoDecayByLabel;
609 isFake = isFakeByLabel;
614 nMatchClusters = nMatchClustersByPosition;
615 matchedTrackRef = matchedTrackRefByPosition;
616 isMatchedYet = isMatchedYetByPosition;
617 decayLabel = decayLabelByPosition;
618 isRecoDecay = isRecoDecayByPosition;
619 isFake = isFakeByPosition;
623 if (matchedTrackRef) {
626 fTrackCounters->Count(Form(
"track:matched/run:%d/%s/%s/%s/%s", fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
631 containMatchedYetTrack[0] = kTRUE;
632 if (trigger) containMatchedYetTrack[1] = kTRUE;
635 fTrackCounters->Count(Form(
"track:matchedyet/run:%d/%s/%s/%s/%s", fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
638 FillHistoTrack(2, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
640 FillHistoTrack(2+
kNhistTrack, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
647 FillHistoTrack(1, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
649 FillHistoTrack(1+
kNhistTrack, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
652 mcLabels[iTrack] = matchedTrackRef->GetUniqueID();
655 usedTrackRefStore->Add(*matchedTrackRef);
656 trackRefStore->Remove(*matchedTrackRef);
660 if (decayLabel >= 0) {
663 fTrackCounters->Count(Form(
"track:decay/run:%d/%s/%s/%s/%s", fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
669 fTrackCounters->Count(Form(
"track:decayyet/run:%d/%s/%s/%s/%s", fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
672 FillHistoTrack(4, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
674 FillHistoTrack(4+
kNhistTrack, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
679 FillHistoTrack(3, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
681 FillHistoTrack(3+
kNhistTrack, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
684 mcLabels[iTrack] = decayLabel;
690 containFakeTrack[0] = kTRUE;
691 if (trigger) containFakeTrack[1] = kTRUE;
694 fTrackCounters->Count(Form(
"track:fake/run:%d/%s/%s/%s/%s", fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
697 FillHistoTrack(5, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
699 FillHistoTrack(5+
kNhistTrack, nClusters, nChamberHit, normalizedChi2, p, pT, eta, phi, dca, thetaTrackAbsEnd, pdca, rAbs);
702 mcLabels[iTrack] = -1;
705 fakeTrackStore->Add(*muonTrack);
715 if (containTrack[0])
fEventCounters->Count(Form(
"event:any/run:%d/trig:any/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
716 if (containTrack[1])
fEventCounters->Count(Form(
"event:any/run:%d/trig:yes/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
717 if (containFakeTrack[0])
fEventCounters->Count(Form(
"event:fake/run:%d/trig:any/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
718 if (containFakeTrack[1])
fEventCounters->Count(Form(
"event:fake/run:%d/trig:yes/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
719 if (containMatchedYetTrack[0])
fEventCounters->Count(Form(
"event:matchedyet/run:%d/trig:any/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
720 if (containMatchedYetTrack[1])
fEventCounters->Count(Form(
"event:matchedyet/run:%d/trig:yes/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
723 if (fakeTrackStore->GetSize() > 0) {
728 if (fakeTrackStore->GetSize() > 0) {
731 fEventCounters->Count(Form(
"event:notconnected/run:%d/trig:any/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
734 Bool_t containMatchedFake = kFALSE;
735 Bool_t containUnmatchedFake = kFALSE;
736 AliMUONTrack* fakeTrack = 0x0;
737 TIter next3(fakeTrackStore->CreateIterator());
738 while ( ( fakeTrack = static_cast<AliMUONTrack*>(next3()) ) ) {
739 if (fakeTrack->GetMatchTrigger() > 0) containMatchedFake = kTRUE;
740 else containUnmatchedFake = kTRUE;
744 if (containMatchedFake)
fEventCounters->Count(Form(
"event:notconnected/run:%d/trig:yes/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
747 Int_t nAdditionalTracks = fakeTrackStore->GetSize() - nFreeMissingTracks;
749 if (nAdditionalTracks > 0) {
753 fEventCounters->Count(Form(
"event:additional/run:%d/trig:any/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
754 if (!containUnmatchedFake) {
755 fEventCounters->Count(Form(
"event:additional/run:%d/trig:yes/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
756 fTrackCounters->Count(Form(
"track:additional/run:%d/trig:yes/%s/acc:unknown/%s", fCurrentRunNumber, selected.Data(), centrality.Data()), nAdditionalTracks);
757 fFakeTrackCounters->Count(Form(
"position:additional/label:additional/run:%d/file:%s/%s/trig:yes/%s/acc:unknown/%s", fCurrentRunNumber,
758 fCurrentFileName.Data(), eventNumberInFile.Data(), selected.Data(), centrality.Data()), nAdditionalTracks);
759 }
else if (!containMatchedFake) {
760 fTrackCounters->Count(Form(
"track:additional/run:%d/trig:no/%s/acc:unknown/%s", fCurrentRunNumber, selected.Data(), centrality.Data()), nAdditionalTracks);
761 fFakeTrackCounters->Count(Form(
"position:additional/label:additional/run:%d/file:%s/%s/trig:no/%s/acc:unknown/%s", fCurrentRunNumber,
762 fCurrentFileName.Data(), eventNumberInFile.Data(), selected.Data(), centrality.Data()), nAdditionalTracks);
764 fEventCounters->Count(Form(
"event:additional/run:%d/trig:yes/%s/%s", fCurrentRunNumber, selected.Data(), centrality.Data()));
765 fTrackCounters->Count(Form(
"track:additional/run:%d/trig:unknown/%s/acc:unknown/%s", fCurrentRunNumber, selected.Data(), centrality.Data()), nAdditionalTracks);
766 fFakeTrackCounters->Count(Form(
"position:additional/label:additional/run:%d/file:%s/%s/trig:unknown/%s/acc:unknown/%s", fCurrentRunNumber,
767 fCurrentFileName.Data(), eventNumberInFile.Data(), selected.Data(), centrality.Data()), nAdditionalTracks);
777 delete usedTrackRefStore;
778 delete fakeTrackStore;
781 TLorentzVector vMu1, vMu2, vDiMu;
782 for (
Int_t iTrack1 = 0; iTrack1 < nTracks; iTrack1++) {
783 AliESDMuonTrack* muonTrack1 = esd->GetMuonTrack(iTrack1);
789 Bool_t trigger1 = muonTrack1->ContainTriggerData();
790 Double_t thetaAbs1 = TMath::ATan(muonTrack1->GetRAtAbsorberEnd()/505.) * TMath::RadToDeg();
792 Bool_t acc1 = (thetaAbs1 >= 2. && thetaAbs1 <= 10. && eta1 >= -4. && eta1 <= -2.5);
793 Short_t charge1 = muonTrack1->Charge();
794 Int_t label1 = mcLabels[iTrack1];
795 muonTrack1->LorentzP(vMu1);
797 for (
Int_t iTrack2 = iTrack1+1; iTrack2 < nTracks; iTrack2++) {
798 AliESDMuonTrack* muonTrack2 = esd->GetMuonTrack(iTrack2);
804 Short_t charge2 = muonTrack2->Charge();
805 if (charge1*charge2 > 0)
continue;
808 Bool_t trigger2 = muonTrack2->ContainTriggerData();
809 Double_t thetaAbs2 = TMath::ATan(muonTrack2->GetRAtAbsorberEnd()/505.) * TMath::RadToDeg();
811 Bool_t acc2 = (thetaAbs2 >= 2. && thetaAbs2 <= 10. && eta2 >= -4. && eta2 <= -2.5);
812 Int_t label2 = mcLabels[iTrack2];
813 muonTrack2->LorentzP(vMu2);
823 if (phi < 0) phi += 2.*TMath::Pi();
827 if (trigger1 && trigger2) trig +=
"2";
828 else if (trigger1 || trigger2) trig +=
"1";
832 Bool_t inAcc = (acc1 && acc2 && y >= -4. && y <= -2.5);
833 TString acc = inAcc ?
"acc:in" :
"acc:out";
843 if (label1 >= 0 && label2 >= 0) {
851 }
else if (label1 >= 0 || label2 >= 0) {
870 fPairCounters->Count(Form(
"pair:reconstructed/run:%d/%s/%s/%s/%s", fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
871 fPairCounters->Count(Form(
"%s/run:%d/%s/%s/%s/%s", pair.Data(), fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
896 AliCDBManager* cdbm = AliCDBManager::Instance();
897 if (cdbm->IsDefaultStorageSet()) printf(
"FakeTask: CDB default storage already set!\n");
899 if (cdbm->GetRun() > -1) printf(
"FakeTask: run number already set!\n");
900 else cdbm->SetRun(fCurrentRunNumber);
903 AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam();
908 AliError(
"--> skip this run");
921 else if (recoParam->ImproveTracks())
fSigmaCut = recoParam->GetSigmaCutForImprovement();
922 else fSigmaCut = recoParam->GetSigmaCutForTracking();
937 fTrackCounters =
static_cast<AliCounterCollection*
> (GetOutputData(2));
940 fEventCounters =
static_cast<AliCounterCollection*
> (GetOutputData(5));
941 fPairCounters =
static_cast<AliCounterCollection*
> (GetOutputData(7));
944 extention.ReplaceAll(
"MUONFakes",
"");
950 TString nameSuffix[2] = {
"",
"S"};
951 TString titleSuffix[2] = {
"",
"selected "};
952 for (
Int_t j = 0; j < 2; j++) {
954 TCanvas *cFakesSummary11 =
new TCanvas(Form(
"cTracks11%s_%s",nameSuffix[j].
Data(),extention.Data()),
955 Form(
"distributions of %stracks (%s)",titleSuffix[j].
Data(),extention.Data()),900,900);
956 fCanvases->AddAtAndExpand(cFakesSummary11, 0+7*j);
957 TCanvas *cFakesSummary12 =
new TCanvas(Form(
"cTracks12%s_%s",nameSuffix[j].
Data(),extention.Data()),
958 Form(
"detailled distributions of %stracks (%s)",titleSuffix[j].
Data(),extention.Data()),900,900);
959 fCanvases->AddAtAndExpand(cFakesSummary12, 1+7*j);
960 TCanvas *cFakesSummary13 =
new TCanvas(Form(
"cTracks13%s_%s",nameSuffix[j].
Data(),extention.Data()),
961 Form(
"p*DCA distributions of %stracks (%s)",titleSuffix[j].
Data(),extention.Data()),600,300);
962 fCanvases->AddAtAndExpand(cFakesSummary13, 2+7*j);
963 TCanvas *cFakesSummary14 =
new TCanvas(Form(
"cTracks14%s_%s",nameSuffix[j].
Data(),extention.Data()),
964 Form(
"detailled p*DCA distributions of %stracks (%s)",titleSuffix[j].
Data(),extention.Data()),600,300);
965 fCanvases->AddAtAndExpand(cFakesSummary14, 3+7*j);
966 TCanvas *cFakesSummary21 =
new TCanvas(Form(
"cTracks21%s_%s",nameSuffix[j].
Data(),extention.Data()),
967 Form(
"correlations at the %strack level (%s)",titleSuffix[j].
Data(),extention.Data()),1200,600);
968 fCanvases->AddAtAndExpand(cFakesSummary21, 4+7*j);
969 TCanvas *cFakesSummary22 =
new TCanvas(Form(
"cTracks22%s_%s",nameSuffix[j].
Data(),extention.Data()),
970 Form(
"detailled correlations at the %strack level (%s)",titleSuffix[j].
Data(),extention.Data()),1200,600);
971 fCanvases->AddAtAndExpand(cFakesSummary22, 5+7*j);
972 TCanvas *cFakesSummary3 =
new TCanvas(Form(
"cPairs%s_%s",nameSuffix[j].
Data(),extention.Data()),
973 Form(
"distributions of %spairs (%s)",titleSuffix[j].
Data(),extention.Data()),900,600);
974 fCanvases->AddAtAndExpand(cFakesSummary3, 6+7*j);
978 cFakesSummary11->Divide(3,3);
979 for (
Int_t i=0; i<9; i++) {
980 cFakesSummary11->cd(i+1);
981 cFakesSummary11->GetPad(i+1)->SetLogy();
983 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack))->DrawCopy();
984 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+1))->SetLineColor(4);
985 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+1))->DrawCopy(
"sames");
986 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+3))->SetLineColor(kViolet-3);
987 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+3))->SetFillColor(kViolet-3);
988 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+3))->SetFillStyle(3018);
989 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+3))->DrawCopy(
"sames");
990 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+5))->SetLineColor(2);
991 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+5))->SetFillColor(2);
992 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+5))->SetFillStyle(3017);
993 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+5))->DrawCopy(
"sames");
996 cFakesSummary12->Divide(3,3);
997 for (
Int_t i=0; i<9; i++) {
998 cFakesSummary12->cd(i+1);
999 cFakesSummary12->GetPad(i+1)->SetLogy();
1001 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack))->DrawCopy();
1002 TH1F *hClone = (TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+1)->Clone();
1003 hClone->Add(((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+2)), -1);
1004 hClone->SetLineColor(4);
1005 hClone->DrawCopy(
"sames");
1006 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+2))->SetLineColor(7);
1007 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+2))->DrawCopy(
"sames");
1008 hClone = (TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+3)->Clone();
1009 hClone->Add(((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+4)), -1);
1010 hClone->SetLineColor(3);
1011 hClone->SetFillStyle(0);
1012 hClone->DrawCopy(
"sames");
1013 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+4))->SetLineColor(32);
1014 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+4))->DrawCopy(
"sames");
1015 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+5))->SetLineColor(2);
1016 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+5))->SetFillStyle(0);
1017 ((TH1F*)
fList->UncheckedAt(iHist1[i]+j*kNhistTrack+5))->DrawCopy(
"sames");
1021 cFakesSummary13->Divide(2,1);
1022 for (
Int_t i=0; i<2; i++) {
1023 cFakesSummary13->cd(i+1);
1024 cFakesSummary13->GetPad(i+1)->SetLogy();
1026 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack))->DrawCopy();
1027 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+1))->SetLineColor(4);
1028 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+1))->DrawCopy(
"sames");
1029 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+3))->SetLineColor(kViolet-3);
1030 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+3))->SetFillColor(kViolet-3);
1031 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+3))->SetFillStyle(3018);
1032 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+3))->DrawCopy(
"sames");
1033 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+5))->SetLineColor(2);
1034 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+5))->SetFillColor(2);
1035 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+5))->SetFillStyle(3017);
1036 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+5))->DrawCopy(
"sames");
1039 cFakesSummary14->Divide(2,1);
1040 for (
Int_t i=0; i<2; i++) {
1041 cFakesSummary14->cd(i+1);
1042 cFakesSummary14->GetPad(i+1)->SetLogy();
1044 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack))->DrawCopy();
1045 TH1F *hClone = (TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+1)->Clone();
1046 hClone->Add(((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+2)), -1);
1047 hClone->SetLineColor(4);
1048 hClone->DrawCopy(
"sames");
1049 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+2))->SetLineColor(7);
1050 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+2))->DrawCopy(
"sames");
1051 hClone = (TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+3)->Clone();
1052 hClone->Add(((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+4)), -1);
1053 hClone->SetLineColor(3);
1054 hClone->SetFillStyle(0);
1055 hClone->DrawCopy(
"sames");
1056 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+4))->SetLineColor(32);
1057 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+4))->DrawCopy(
"sames");
1058 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+5))->SetLineColor(2);
1059 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+5))->SetFillStyle(0);
1060 ((TH1F*)
fList->UncheckedAt(iHist2[i]+j*kNhistTrack+5))->DrawCopy(
"sames");
1064 cFakesSummary21->Divide(2);
1065 for (
Int_t i=0; i<2; i++) {
1066 cFakesSummary21->cd(i+1);
1077 cFakesSummary22->Divide(2);
1078 for (
Int_t i=0; i<2; i++) {
1079 cFakesSummary22->cd(i+1);
1082 hClone->SetMarkerColor(4);
1089 hClone->SetMarkerColor(kViolet-3);
1090 hClone->SetMarkerStyle(6);
1091 hClone->DrawCopy(
"sames");
1101 cFakesSummary3->Divide(3,2);
1102 for (
Int_t i=0; i<6; i++) {
1103 cFakesSummary3->cd(i+1);
1104 cFakesSummary3->GetPad(i+1)->SetLogy();
1106 ((TH1F*)
fList2->UncheckedAt(iHist4[i]+j*kNhistPair))->DrawCopy();
1107 ((TH1F*)
fList2->UncheckedAt(iHist4[i]+j*kNhistPair+1))->SetLineColor(4);
1108 ((TH1F*)
fList2->UncheckedAt(iHist4[i]+j*kNhistPair+1))->DrawCopy(
"sames");
1109 TH1F* hClone = (TH1F*)
fList2->UncheckedAt(iHist4[i]+j*kNhistPair+2)->Clone();
1110 hClone->Add((TH1F*)
fList2->UncheckedAt(iHist4[i]+j*kNhistPair+3));
1111 hClone->SetLineColor(2);
1112 hClone->SetFillColor(2);
1113 hClone->SetFillStyle(3017);
1114 hClone->DrawCopy(
"sames");
1115 ((TH1F*)
fList2->UncheckedAt(iHist4[i]+j*kNhistPair+3))->SetLineColor(6);
1116 ((TH1F*)
fList2->UncheckedAt(iHist4[i]+j*kNhistPair+3))->SetFillColor(6);
1117 ((TH1F*)
fList2->UncheckedAt(iHist4[i]+j*kNhistPair+3))->SetFillStyle(3018);
1118 ((TH1F*)
fList2->UncheckedAt(iHist4[i]+j*kNhistPair+3))->DrawCopy(
"sames");
1125 printf(
"\nGlobal statistics of reconstructed tracks matched or not with the trigger:\n");
1127 printf(
"\nGlobal statistics of pathological tracks matched or not with the trigger:\n");
1129 printf(
"\nDetailled statistics of tracks matched per label vs position:\n");
1131 printf(
"\nGlobal statistics of events containing pathological tracks:\n");
1136 printf(
"\nGlobal statistics of reconstructed track pairs matched or not with the trigger:\n");
1140 printf(
"\nREMINDER: results are relevent provided that you use the same recoParams as for the reconstruction\n\n");
1150 if (!esdTrack.ContainTrackerData())
return kFALSE;
1156 if (
fChi2Cut > 0. && esdTrack.GetNormalizedChi2() >
fChi2Cut)
return kFALSE;
1159 if (
fPtCut > 0. && esdTrack.Pt() <
fPtCut)
return kFALSE;
1174 ((TH1F*)
fList->UncheckedAt(
kP+histShift))->Fill(p);
1175 ((TH1F*)
fList->UncheckedAt(
kPt+histShift))->Fill(pT);
1176 ((TH1F*)
fList->UncheckedAt(
kEta+histShift))->Fill(eta);
1177 ((TH1F*)
fList->UncheckedAt(
kPhi+histShift))->Fill(phi);
1178 ((TH1F*)
fList->UncheckedAt(
kDCA+histShift))->Fill(dca);
1179 if (thetaTrackAbsEnd > 2 && thetaTrackAbsEnd <= 3) ((TH1F*)
fList->UncheckedAt(
kPDCA23+histShift))->Fill(pdca);
1180 else if (thetaTrackAbsEnd > 3 && thetaTrackAbsEnd < 10) ((TH1F*)
fList->UncheckedAt(
kPDCA310+histShift))->Fill(pdca);
1181 ((TH1F*)
fList->UncheckedAt(
kRAbs+histShift))->Fill(rAbs);
1191 ((TH1F*)
fList2->UncheckedAt(
k2Mass+histShift))->Fill(mass);
1192 ((TH1F*)
fList2->UncheckedAt(
k2P+histShift))->Fill(p);
1193 ((TH1F*)
fList2->UncheckedAt(
k2Pt+histShift))->Fill(pt);
1194 ((TH1F*)
fList2->UncheckedAt(
k2Y+histShift))->Fill(y);
1195 ((TH1F*)
fList2->UncheckedAt(
k2Eta+histShift))->Fill(eta);
1196 ((TH1F*)
fList2->UncheckedAt(
k2Phi+histShift))->Fill(phi);
1208 Int_t nFreeMissingTracks = 0;
1211 TIter next(trackRefStore.CreateIterator());
1212 AliMUONTrack* trackRef;
1213 while ( ( trackRef = static_cast<AliMUONTrack*>(next()) ) ) {
1218 Int_t label = trackRef->GetUniqueID();
1221 AliMUONTrack *connectedFake = 0x0;
1222 Double_t fractionOfConnectedClusters = 0.;
1223 TIter next2(fakeTrackStore.CreateIterator());
1224 AliMUONTrack* fakeTrack;
1225 while ( ( fakeTrack = static_cast<AliMUONTrack*>(next2()) ) ) {
1228 Int_t nConnectedClusters = 0;
1230 for (
Int_t iCl = 0; iCl < fakeTrack->GetNClusters(); iCl++)
1231 if (((AliMUONTrackParam*) fakeTrack->GetTrackParamAtCluster()->UncheckedAt(iCl))->GetClusterPtr()->GetMCLabel() == label)
1232 nConnectedClusters++;
1236 nConnectedClusters = TMath::Max(nConnectedClusters, fakeTrack->FindCompatibleClusters(*trackRef,
fSigmaCut, compTrack));
1240 if (nConnectedClusters == 0)
continue;
1244 if (f > fractionOfConnectedClusters) {
1245 connectedFake = fakeTrack;
1246 fractionOfConnectedClusters = f;
1251 if (connectedFake) {
1256 AliError(
"Cannot get input event");
1257 return nFreeMissingTracks;
1259 TIter next3(static_cast<TClonesArray*>(esd->FindListObject(
"MuonTracks")));
1260 AliESDMuonTrack* esdTrack = 0x0;
1261 while ((esdTrack = static_cast<AliESDMuonTrack*>(next3())) && esdTrack->GetUniqueID() != connectedFake->GetUniqueID()) {}
1263 AliError(
"unable to find the corresponding ESD track???");
1268 TString trig = (esdTrack->ContainTriggerData()) ?
"trig:yes" :
"trig:no";
1271 Double_t thetaTrackAbsEnd = TMath::ATan(esdTrack->GetRAtAbsorberEnd()/505.) * TMath::RadToDeg();
1273 TString acc = (thetaTrackAbsEnd >= 2. && thetaTrackAbsEnd <= 10. && eta >= -4. && eta <= -2.5) ?
"acc:in" :
"acc:out";
1278 fTrackCounters->Count(Form(
"track:connected/run:%d/%s/%s/%s/%s", fCurrentRunNumber, trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
1280 eventNumberInFile.Data(), trig.Data(), selected.Data(), acc.Data(), centrality.Data()));
1283 fakeTrackStore.Remove(*connectedFake);
1285 }
else nFreeMissingTracks++;
1289 return nFreeMissingTracks;
1305 Int_t halfCluster = nClusters/2;
1308 Int_t firstLabel = -1, decayLabel = -1;
1309 isReconstructible = kFALSE;
1310 for (
Int_t iCluster1 = nClusters-1; iCluster1 >= halfCluster; iCluster1--) {
1313 if (chId[iCluster1] < 6)
break;
1316 if (labels[iCluster1] < 0 || labels[iCluster1] == firstLabel)
continue;
1319 Int_t stationId = chId[iCluster1]/2;
1320 Int_t stationMask = 1 << stationId;
1322 Bool_t isValid = ((1 & requestedStations) == requestedStations);
1325 if (!isValid && chId[iCluster1] <= lastCh)
break;
1328 Int_t nChHitInSt45[2] = {0, 0};
1329 nChHitInSt45[stationId-3] = 1;
1330 Int_t currentCh = chId[iCluster1];
1334 Int_t nParticles = 0;
1335 Int_t currentLabel = labels[iCluster1];
1337 chainLabels[nParticles++] = currentLabel;
1338 if (nParticles >= chainLabels.GetSize()) chainLabels.Set(2*chainLabels.GetSize());
1339 AliMCParticle* currentParticle =
static_cast<AliMCParticle*
>(fMCEvent->GetTrack(currentLabel));
1340 currentLabel = (currentParticle) ? currentParticle->GetMother() : -1;
1341 }
while (currentLabel >= 0);
1344 firstLabel = labels[iCluster1];
1345 Int_t nCompatibleLabel = 1;
1346 Int_t currentParticle = 0;
1347 for (
Int_t iCluster2 = iCluster1-1; iCluster2 >= 0; iCluster2--) {
1350 if (iCluster2 < halfCluster-nCompatibleLabel)
break;
1352 if (labels[iCluster2] < 0)
continue;
1355 Bool_t matchFound = kFALSE;
1356 for (
Int_t iParticle = currentParticle; iParticle < nParticles; iParticle++) {
1357 if (labels[iCluster2] == chainLabels[iParticle]) {
1358 currentParticle = iParticle;
1363 if (matchFound) nCompatibleLabel++;
1367 stationId = chId[iCluster2]/2;
1368 stationMask |= 1 << stationId;
1371 if (stationId > 2 && chId[iCluster2] < currentCh) {
1372 nChHitInSt45[stationId-3]++;
1373 currentCh = chId[iCluster2];
1377 if (nCompatibleLabel <= halfCluster || chId[iCluster2] > 3 || chainLabels[currentParticle] == firstLabel)
continue;
1380 if (chId[iCluster1] > lastCh) {
1381 decayLabel = firstLabel;
1382 lastCh = chId[iCluster1];
1387 : (nChHitInSt45[0]+nChHitInSt45[1] >= 2);
1391 isValid = (((stationMask >> stationId) & requestedStations) == requestedStations &&
1392 (chId[iCluster2] > 5 || isEnoughClOnSt45));
1395 if (!isValid)
break;
1399 lastCh = chId[iCluster1];
1400 isReconstructible = kTRUE;
1420 Int_t nCl1 = track.GetNClusters();
1421 for(
Int_t iCl1 = 0; iCl1 < nCl1; iCl1++) {
1422 AliMUONVCluster *cluster1 =
static_cast<AliMUONTrackParam*
>(track.GetTrackParamAtCluster()->UncheckedAt(iCl1))->GetClusterPtr();
1425 Int_t nCl2 = trackRef.GetNClusters();
1426 for(
Int_t iCl2 = 0; iCl2 < nCl2; iCl2++) {
1427 AliMUONVCluster *cluster2 =
static_cast<AliMUONTrackParam*
>(trackRef.GetTrackParamAtCluster()->UncheckedAt(iCl2))->GetClusterPtr();
1430 if (cluster1->GetDetElemId() != cluster2->GetDetElemId())
continue;
1433 Double_t dX = cluster1->GetX() - cluster2->GetX();
1434 Double_t dY = cluster1->GetY() - cluster2->GetY();
1435 Double_t chi2 = dX * dX / (cluster1->GetErrX2() + cluster2->GetErrX2()) + dY * dY / (cluster1->GetErrY2() + cluster2->GetErrY2());
1436 if (chi2 > chi2Max)
continue;
1439 if (nLabels[iCl1] >= labels[iCl1].GetSize()) labels[iCl1].Set(2*labels[iCl1].GetSize());
1442 labels[iCl1][nLabels[iCl1]] =
static_cast<Int_t>(trackRef.GetUniqueID());
1454 Int_t &lastCh)
const 1460 Int_t nClusters = track.GetNClusters();
1461 if (nClusters <= 0)
return -1;
1466 for (
Int_t iCluster = 0; iCluster < nClusters; iCluster++) {
1467 AliMUONVCluster* cluster =
static_cast<AliMUONTrackParam*
>(track.GetTrackParamAtCluster()->UncheckedAt(iCluster))->GetClusterPtr();
1468 chId[iCluster] = cluster->GetChamberId();
1469 labels[iCluster] = cluster->GetMCLabel();
1471 printf(
"ch%d: %d",chId[iCluster],labels[iCluster]);
1472 Int_t currentLabel = labels[iCluster];
1473 while (currentLabel >= 0) {
1474 AliMCParticle* currentParticle =
static_cast<AliMCParticle*
>(fMCEvent->GetTrack(currentLabel));
1475 printf(
"(%s)",(currentParticle) ? currentParticle->Particle()->GetName() :
"");
1476 if (currentLabel == labels[iCluster]) printf(
" (");
1477 currentLabel = (currentParticle) ? currentParticle->GetMother() : -1;
1478 if (currentLabel >= 0) printf(
" %d",currentLabel);
1486 Int_t decayLabel =
IsDecay(nClusters, chId, labels, isReconstructible, lastCh);
1487 if (
fPrintDecayChain) printf(
"---> decayLabel = %d (reco = %d / lastCh = %d)\n",decayLabel,isReconstructible,lastCh);
1497 const AliMUONVTrackStore &usedTrackRefStore,
Bool_t &isReconstructible,
1498 Int_t &lastCh)
const 1504 Int_t nClusters = track.GetNClusters();
1505 if (nClusters <= 0)
return -1;
1511 for (
Int_t iCluster = 0; iCluster < nClusters; iCluster++) {
1512 AliMUONVCluster* cluster =
static_cast<AliMUONTrackParam*
>(track.GetTrackParamAtCluster()->UncheckedAt(iCluster))->GetClusterPtr();
1513 chId[iCluster] = cluster->GetChamberId();
1514 nLabels[iCluster] = 0;
1515 labels[iCluster].Set(100);
1519 TIter next1(trackRefStore.CreateIterator());
1520 AliMUONTrack* trackRef;
1521 while ( ( trackRef = static_cast<AliMUONTrack*>(next1()) ) )
1525 TIter next2(usedTrackRefStore.CreateIterator());
1526 while ( ( trackRef = static_cast<AliMUONTrack*>(next2()) ) )
1530 for (
Int_t iCluster = 0; iCluster < nClusters; iCluster++) {
1531 if (nLabels[iCluster] == 0) {
1532 labels[iCluster][0] = -1;
1533 nLabels[iCluster]++;
1539 memset(iLabel,0,nClusters*
sizeof(
Int_t));
1540 iLabel[nClusters-1] = -1;
1542 Int_t decayLabel = -1;
1544 isReconstructible = kFALSE;
1548 Int_t iCl = nClusters-1;
1549 while (++iLabel[iCl] >= nLabels[iCl] && iCl > 0) iLabel[iCl--] = 0;
1550 if (iLabel[iCl] >= nLabels[iCl])
break;
1554 for (
Int_t iCluster = 0; iCluster < nClusters; iCluster++) {
1555 currentLabels[iCluster] = labels[iCluster][iLabel[iCluster]];
1557 printf(
"ch%d: %d",chId[iCluster],currentLabels[iCluster]);
1558 Int_t currentLabel = currentLabels[iCluster];
1559 while (currentLabel >= 0) {
1560 AliMCParticle* currentParticle =
static_cast<AliMCParticle*
>(fMCEvent->GetTrack(currentLabel));
1561 printf(
"(%s)",(currentParticle) ? currentParticle->Particle()->GetName() :
"");
1562 if (currentLabel == currentLabels[iCluster]) printf(
" (");
1563 currentLabel = (currentParticle) ? currentParticle->GetMother() : -1;
1564 if (currentLabel >= 0) printf(
" %d",currentLabel);
1571 Int_t currentDecayLabel =
IsDecay(nClusters, chId, currentLabels, isReconstructible, lastCh);
1572 if (
fPrintDecayChain) printf(
"---> decayLabel = %d (reco = %d / lastCh = %d)\n",currentDecayLabel,isReconstructible,lastCh);
1573 if (currentDecayLabel >= 0) {
1574 decayLabel = currentDecayLabel;
1575 if (isReconstructible)
break;
1580 if (
fPrintDecayChain) printf(
"------> decayLabel = %d (reco = %d / lastCh = %d)\n",decayLabel,isReconstructible,lastCh);
1586 delete[] currentLabels;
Bool_t fCombineMCId
combine reconstructed/simulated track matching by MC labels and by position
TString fCurrentFileName
current input file name
Double_t fPtCut
cut on minimum pt
number of clusters per track
number of clusters per MC track
virtual void Terminate(Option_t *)
Bool_t fPrintDecayChain
print labels of connected particles and ancestors when looking for decays
void AddCompatibleClusters(const AliMUONTrack &track, const AliMUONTrack &trackRef, TArrayI *labels, Int_t *nLabels) const
Int_t RemoveConnectedFakes(AliMUONVTrackStore &fakeTrackStore, AliMUONVTrackStore &trackRefStore, TString &selected, TString ¢rality)
number of additional tracks
Bool_t fDecayAsFake
considere decays as fake tracks or not
AliCounterCollection * fPairCounters
global counters of track pairs
Double_t fSigmaCut
sigma cut to associate clusters with TrackRefs
Bool_t fRequest2ChInSameSt45
2 fired chambers requested in the same station (4 or 5) or not
AliAnalysisTaskMuonFakes()
virtual void UserCreateOutputObjects()
Bool_t fShowProgressBar
show the progression bar
UInt_t fRequestedStationMask
mask of requested stations
Bool_t fApplyAccCut
fill histograms with tracks passing the acceptance cuts (Rabs, eta) only
Bool_t IsSelected(AliESDMuonTrack &esdTrack)
AliCounterCollection * fFakeTrackCounters
detailled counters of fake tracks
Double_t fChi2Cut
cut on normalized chi2
Int_t fNEvents
number of processed events
void FillHistoPair(Int_t histShift, Double_t mass, Double_t p, Double_t pt, Double_t y, Double_t eta, Double_t phi)
fill global histograms at pair level
number of histograms at pair level
fraction of matched clusters in matched tracks
AliCounterCollection * fMatchedTrackCounters
detailled counters of matched tracks
Bool_t fMatchTrig
fill histograms with tracks matched with trigger only
Int_t IsDecayByLabel(const AliMUONTrack &track, Bool_t &isReconstructible, Int_t &lastCh) const
TString fRecoParamLocation
ocdb path toward the reconstruction parameters
normalized chi2 versus number of fired chambers
Double_t fExternalSigmaCut
sigma cut to associate clusters with TrackRefs (instead of using recoParam)
virtual ~AliAnalysisTaskMuonFakes()
AliCounterCollection * fTrackCounters
global counters of tracks
Bool_t fDisableDetailedCounters
disable the recording of event/file of problematic tracks
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Bool_t fUseLabel
match reconstructed and simulated tracks by using the MC labels or by position
TObjArray * fList
list of output histograms about single tracks
AliMuonTrackCuts * fMuonTrackCuts
cuts to select tracks to be considered
virtual void UserExec(Option_t *)
number of histograms at track level
void FillHistoTrack(Int_t histShift, Int_t nClusters, Int_t nChamberHit, Double_t normalizedChi2, Double_t p, Double_t pT, Double_t eta, Double_t phi, Double_t dca, Double_t thetaTrackAbsEnd, Double_t pdca, Double_t rAbs)
fraction of connected clusters in fake tracks
Int_t IsDecay(Int_t nClusters, Int_t *chId, Int_t *labels, Bool_t &isReconstructible, Int_t &lastCh) const
TObjArray * fCanvases
List of canvases summarizing the results.
AliCounterCollection * fEventCounters
counters of events
Int_t IsDecayByPosition(const AliMUONTrack &track, const AliMUONVTrackStore &trackRefStore, const AliMUONVTrackStore &usedTrackRefStore, Bool_t &isReconstructible, Int_t &lastCh) const
Muon task to study fake tracks.
TObjArray * fList2
list of output histograms about track pairs
normalized chi2 versus number of clusters
R at the end of the absorber.
number of fired chambers per track