1 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include <TClonesArray.h>
9 #include <TLorentzVector.h>
13 #include "AliESDEvent.h"
14 #include "AliESDMuonTrack.h"
15 #include "AliCDBManager.h"
39 void DIMUONFakes(Bool_t useLabel = kFALSE, Int_t FirstEvent = 0, Int_t LastEvent = -1,
40 const TString esdFileName =
"AliESDs.root",
const TString SimDir =
"./generated/",
41 const TString ocdbPath =
"local://$ALICE_ROOT/OCDB")
47 AliLog::SetClassDebugLevel(
"AliMCEvent",-1);
50 TFile *histoFile =
new TFile(
"DiFakes.root",
"RECREATE");
52 TH1F *hMass =
new TH1F(
"hMass",
"Dimuon mass distribution (GeV/c^{2})", 100, 0., 12.);
53 TH1F *hMassM =
new TH1F(
"hMassM",
"matched track mass distribution (GeV/c^{2})", 100, 0., 12.);
54 TH1F *hMassF =
new TH1F(
"hMassF",
"fake track mass distribution (GeV/c^{2})", 100, 0., 12.);
55 TH1F *hP =
new TH1F(
"hP",
"Dimuon P distribution (GeV/c)", 100, 0., 200.);
56 TH1F *hPM =
new TH1F(
"hPM",
"matched track P distribution (GeV/c)", 100, 0., 200.);
57 TH1F *hPF =
new TH1F(
"hPF",
"fake track P distribution (GeV/c)", 100, 0., 200.);
58 TH1F *hPt =
new TH1F(
"hPt",
"Dimuon Pt distribution (GeV/c)", 100, 0., 20.);
59 TH1F *hPtM =
new TH1F(
"hPtM",
"matched track Pt distribution (GeV/c)", 100, 0., 20.);
60 TH1F *hPtF =
new TH1F(
"hPtF",
"fake track Pt distribution (GeV/c)", 100, 0., 20.);
61 TH1F *hY =
new TH1F(
"hY",
" Dimuon rapidity distribution",100,-10,0);
62 TH1F *hYM =
new TH1F(
"hYM",
" matched track rapidity distribution",100,-10,0);
63 TH1F *hYF =
new TH1F(
"hYF",
" fake track rapidity distribution",100,-10,0);
64 TH1F *hEta =
new TH1F(
"hEta",
" Dimuon pseudo-rapidity distribution",100,-10,0);
65 TH1F *hEtaM =
new TH1F(
"hEtaM",
" matched track pseudo-rapidity distribution",100,-10,0);
66 TH1F *hEtaF =
new TH1F(
"hEtaF",
" fake track pseudo-rapidity distribution",100,-10,0);
67 TH1F *hPhi =
new TH1F(
"hPhi",
" Dimuon phi distribution",100,-1.,9.);
68 TH1F *hPhiM =
new TH1F(
"hPhiM",
" matched track phi distribution",100,-1.,9.);
69 TH1F *hPhiF =
new TH1F(
"hPhiF",
" fake track phi distribution",100,-1.,9.);
75 AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
76 AliCDBManager::Instance()->SetSpecificStorage(
"GRP/GRP/Data",
"local://.");
79 if (!recoParam)
return;
85 for (Int_t i = 0; i < 5; i++)
if (recoParam->
RequestStation(i)) requestedStationMask |= ( 1 << i );
89 TLorentzVector vMu1, vMu2, vDiMu;
90 Int_t nReconstructiblePairs = 0;
91 Int_t nReconstructedPairs = 0;
92 Int_t nMatchedPairs = 0;
95 FirstEvent = TMath::Max(0, FirstEvent);
97 for (Int_t iEvent = FirstEvent; iEvent <= LastEvent; iEvent++) {
102 if (!muonTrackStore || !trackRefStore)
continue;
105 Int_t nMuPlus = 0, nMuMinus = 0;
108 while ( ( trackRef = static_cast<AliMUONTrack*>(next()) ) ) {
109 if (trackRef->IsValid(requestedStationMask, request2ChInSameSt45)) {
110 if (trackRef->GetTrackParamAtVertex()->GetCharge() > 0) nMuPlus++;
114 nReconstructiblePairs += nMuPlus*nMuMinus;
118 Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ;
119 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
121 AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
124 if (!esdTrack->ContainTrackerData())
continue;
130 Int_t nMatchClusters = 0;
134 if (matchedTrackRef) {
137 esdTrack->SetLabel(matchedTrackRef->GetUniqueID());
140 trackRefStore->
Remove(*matchedTrackRef);
145 esdTrack->SetLabel(-1);
152 for (Int_t iTrack1 = 0; iTrack1 < nTracks; iTrack1++) {
153 AliESDMuonTrack* muonTrack1 = esd->GetMuonTrack(iTrack1);
156 if (!muonTrack1->ContainTrackerData())
continue;
159 Short_t charge1 = muonTrack1->Charge();
160 Int_t label1 = muonTrack1->GetLabel();
161 muonTrack1->LorentzP(vMu1);
163 for (Int_t iTrack2 = iTrack1+1; iTrack2 < nTracks; iTrack2++) {
164 AliESDMuonTrack* muonTrack2 = esd->GetMuonTrack(iTrack2);
167 if (!muonTrack2->ContainTrackerData())
continue;
170 Short_t charge2 = muonTrack2->Charge();
171 if (charge1*charge2 > 0)
continue;
173 nReconstructedPairs++;
176 Int_t label2 = muonTrack2->GetLabel();
177 muonTrack2->LorentzP(vMu2);
181 Float_t mass = vDiMu.M();
182 Float_t p = vDiMu.P();
183 Float_t pt = vDiMu.Pt();
184 Float_t y = vDiMu.Rapidity();
185 Float_t eta = vDiMu.Eta();
186 Float_t phi = vDiMu.Phi();
187 if (phi < 0) phi += 2.*TMath::Pi();
198 if (label1 >= 0 && label2 >= 0) {
227 TCanvas cDiFakesSummary(
"cDiFakesSummary",
"cDiFakesSummary",900,600);
228 cDiFakesSummary.Divide(3,2);
229 cDiFakesSummary.cd(1);
230 cDiFakesSummary.GetPad(1)->SetLogy();
232 hMass->SetMinimum(0.5);
233 hMassM->Draw(
"same");
234 hMassM->SetLineColor(4);
235 hMassF->Draw(
"same");
236 hMassF->SetLineColor(2);
237 hMassF->SetFillColor(2);
238 hMassF->SetFillStyle(3017);
239 cDiFakesSummary.cd(2);
240 cDiFakesSummary.GetPad(3)->SetLogy();
244 hPM->SetLineColor(4);
246 hPF->SetLineColor(2);
247 hPF->SetFillColor(2);
248 hPF->SetFillStyle(3017);
249 cDiFakesSummary.cd(3);
250 cDiFakesSummary.GetPad(4)->SetLogy();
252 hPt->SetMinimum(0.5);
254 hPtM->SetLineColor(4);
256 hPtF->SetLineColor(2);
257 hPtF->SetFillColor(2);
258 hPtF->SetFillStyle(3017);
259 cDiFakesSummary.cd(4);
260 cDiFakesSummary.GetPad(2)->SetLogy();
264 hYM->SetLineColor(4);
266 hYF->SetLineColor(2);
267 hYF->SetFillColor(2);
268 hYF->SetFillStyle(3017);
269 cDiFakesSummary.cd(5);
270 cDiFakesSummary.GetPad(5)->SetLogy();
272 hEta->SetMinimum(0.5);
274 hEtaM->SetLineColor(4);
276 hEtaF->SetLineColor(2);
277 hEtaF->SetFillColor(2);
278 hEtaF->SetFillStyle(3017);
279 cDiFakesSummary.cd(6);
280 cDiFakesSummary.GetPad(6)->SetLogy();
282 hPhi->SetMinimum(0.5);
284 hPhiM->SetLineColor(4);
286 hPhiF->SetLineColor(2);
287 hPhiF->SetFillColor(2);
288 hPhiF->SetFillStyle(3017);
293 cDiFakesSummary.Write();
298 printf(
"nb of reconstructible OS pairs: %d \n", nReconstructiblePairs);
299 printf(
"nb of reconstructed OS pairs: %d \n", nReconstructedPairs);
300 printf(
"nb of reconstructed OS pairs matched with trackRefs: %d \n", nMatchedPairs);
Base class of a track container.
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
void ImproveTracks(Bool_t flag)
switch on/off the track improvement and keep the default cut in sigma to apply on cluster (local chi2...
void MakeMoreTrackCandidates(Bool_t flag)
switch on/off the building of track candidates starting from 1 cluster in each of the stations 4 and ...
Double_t GetSigmaCutForTracking() const
return the cut in sigma to apply on cluster (local chi2) and track (global chi2) during tracking ...
Int_t NumberOfEvents() const
Return the total number of events.
virtual TIterator * CreateIterator() const =0
Create an iterator to loop over tracks.
Int_t GetRunNumber()
Return the run number of the current ESD event.
virtual AliMUONTrack * Remove(AliMUONTrack &track)=0
Remove a track from the store.
Class with MUON reconstruction parameters.
Bool_t request2ChInSameSt45
Utility class to check reconstruction.
AliMUONVTrackStore * TrackRefs(Int_t event)
Return reference muon tracks.
static AliMUONTrack * FindCompatibleTrack(AliMUONTrack &track, AliMUONVTrackStore &trackStore, Int_t &nMatchClusters, Bool_t useLabel=kFALSE, Double_t sigmaCut=10.)
Return the track from the store matched with the given track (or 0x0) and the fraction of matched clu...
AliMUONVTrackStore * ReconstructedTracks(Int_t event, Bool_t refit=kTRUE)
Return the list of reconstructed tracks.
UInt_t requestedStationMask
void RequestStation(Int_t iSt, Bool_t flag)
request or not at least one cluster in the station to validate the track
Reconstructed track in ALICE dimuon spectrometer.
Double_t GetSigmaCutForImprovement() const
return the cut in sigma to apply on cluster (local chi2) during track improvement ...
void DIMUONFakes(Bool_t useLabel=kFALSE, Int_t FirstEvent=0, Int_t LastEvent=-1, const TString esdFileName="AliESDs.root", const TString SimDir="./generated/", const TString ocdbPath="local://$ALICE_ROOT/OCDB")
virtual TObject * FindObject(const char *name) const
Find an object by name.
const AliESDEvent * GetESDEvent() const
Return the reconstructed data of current event.
AliMUONRecoParam * LoadRecoParam()