1 #if !defined(__CINT__) || defined(__MAKECINT__)
13 #include "AliESDEvent.h"
14 #include "AliESDMuonTrack.h"
15 #include "AliCDBManager.h"
42 Bool_t useLabel, TH1F &hFractionOfConnectedClusters);
45 void MUONFakes(Bool_t useLabel = kFALSE, Int_t FirstEvent = 0, Int_t LastEvent = -1,
46 const TString esdFileName =
"AliESDs.root",
const TString SimDir =
"./generated/",
47 const TString ocdbPath =
"local://$ALICE_ROOT/OCDB")
51 AliLog::SetClassDebugLevel(
"AliMCEvent",-1);
57 TFile *histoFile =
new TFile(
"Fakes.root",
"RECREATE");
59 TH1F *hNumberOfTracks =
new TH1F(
"hNumberOfTracks",
"nb of tracks /evt",20,0.,20.);
60 TH1F *hNumberOfAdditionalTracks =
new TH1F(
"hNumberOfAdditionalTracks",
"nb of fake - nb of missing track",20,0.,20.);
62 TH1F *hNumberOfClusters =
new TH1F(
"hNumberOfClusters",
"nb of clusters /track",20,0.,20.);
63 TH1F *hNumberOfClustersM =
new TH1F(
"hNumberOfClustersM",
"nb of clusters /matched track",20,0.,20.);
64 TH1F *hNumberOfClustersF =
new TH1F(
"hNumberOfClustersF",
"nb of clusters /fake track",20,0.,20.);
65 TH1F *hNumberOfClustersMC =
new TH1F(
"hNumberOfClustersMC",
"nb of clusters /MC track",20,0.,20.);
66 TH1F *hFractionOfMatchedClusters =
new TH1F(
"hFractionOfMatchedClusters",
"nb of matched clusters / nb of clusters",110,0.,1.1);
67 TH1F *hFractionOfConnectedClusters =
new TH1F(
"hFractionOfConnectedClusters",
"nb of connected clusters / nb of clusters in fake tracks",110,0.,1.1);
69 TH1F *hChi2PerDof =
new TH1F(
"hChi2PerDof",
"track chi2/d.o.f.", 100, 0., 20.);
70 TH1F *hChi2PerDofM =
new TH1F(
"hChi2PerDofM",
"matched track chi2/d.o.f.", 100, 0., 20.);
71 TH1F *hChi2PerDofF =
new TH1F(
"hChi2PerDofF",
"fake track chi2/d.o.f.", 100, 0., 20.);
72 TH1F *hP =
new TH1F(
"hP",
"Muon P distribution (GeV/c)", 100, 0., 200.);
73 TH1F *hPM =
new TH1F(
"hPM",
"matched track P distribution (GeV/c)", 100, 0., 200.);
74 TH1F *hPF =
new TH1F(
"hPF",
"fake track P distribution (GeV/c)", 100, 0., 200.);
75 TH1F *hPt =
new TH1F(
"hPt",
"Muon Pt distribution (GeV/c)", 100, 0., 20.);
76 TH1F *hPtM =
new TH1F(
"hPtM",
"matched track Pt distribution (GeV/c)", 100, 0., 20.);
77 TH1F *hPtF =
new TH1F(
"hPtF",
"fake track Pt distribution (GeV/c)", 100, 0., 20.);
78 TH1F *hEta =
new TH1F(
"hEta",
" Muon pseudo-rapidity distribution",100,-10,0);
79 TH1F *hEtaM =
new TH1F(
"hEtaM",
" matched track pseudo-rapidity distribution",100,-10,0);
80 TH1F *hEtaF =
new TH1F(
"hEtaF",
" fake track pseudo-rapidity distribution",100,-10,0);
81 TH1F *hPhi =
new TH1F(
"hPhi",
" Muon phi distribution",100,-1.,9.);
82 TH1F *hPhiM =
new TH1F(
"hPhiM",
" matched track phi distribution",100,-1.,9.);
83 TH1F *hPhiF =
new TH1F(
"hPhiF",
" fake track phi distribution",100,-1.,9.);
84 TH1F *hNumberOfChamberHit =
new TH1F(
"hNumberOfChamberHit",
"nb of chambers hit /track",20,0.,20.);
85 TH1F *hNumberOfChamberHitM =
new TH1F(
"hNumberOfChamberHitM",
"nb of chambers hit /matched track",20,0.,20.);
86 TH1F *hNumberOfChamberHitF =
new TH1F(
"hNumberOfChamberHitF",
"nb of chambers hit /fake track",20,0.,20.);
92 AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
95 if (!recoParam)
return;
105 Int_t nReconstructibleTracks = 0;
106 Int_t nReconstructedTracks = 0;
107 Int_t nEventsWithTrackReconstructedYet = 0;
108 Int_t nEventsWithFake = 0;
109 Int_t nEventsWithAdditionalFake = 0;
110 Int_t nTotMatchedTracks = 0;
111 Int_t nTotTracksReconstructedYet = 0;
112 Int_t nTotFakeTracks = 0;
113 Int_t nTotConnectedTracks = 0;
114 Int_t nTotAdditionalTracks = 0;
115 Bool_t trackReconstructedYet;
116 TArrayI eventsWithTrackReconstructedYet(10);
117 TArrayI eventsWithFake(10);
118 TArrayI eventsWithAdditionalFake(10);
121 FirstEvent = TMath::Max(0, FirstEvent);
123 for (Int_t iEvent = FirstEvent; iEvent <= LastEvent; iEvent++) {
128 if (!muonTrackStore || !trackRefStore)
continue;
133 while ( ( trackRef = static_cast<AliMUONTrack*>(next()) ) ) {
138 Int_t nTrackerTracks = 0;
139 trackReconstructedYet = kFALSE;
142 Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ;
143 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
145 AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack);
148 if (!esdTrack->ContainTrackerData())
continue;
155 Int_t nClusters = esdTrack->GetNClusters();
156 Double_t normalizedChi2 = esdTrack->GetChi2() / (2. * esdTrack->GetNHit() - 5);
157 Double_t p = esdTrack->P();
158 Double_t pT = esdTrack->Pt();
159 Double_t eta = esdTrack->Eta();
160 Double_t phi = esdTrack->Phi();
161 Int_t nChamberHit = 0;
162 for (Int_t ich=0; ich<10; ich++)
if (esdTrack->IsInMuonClusterMap(ich)) nChamberHit++;
165 hNumberOfClusters->Fill(nClusters);
166 hChi2PerDof->Fill(normalizedChi2);
171 hNumberOfChamberHit->Fill(nChamberHit);
174 Int_t nMatchClusters = 0;
178 if (matchedTrackRef) {
183 trackReconstructedYet = kTRUE;
184 nTotTracksReconstructedYet++;
188 hFractionOfMatchedClusters->Fill(((Float_t) nMatchClusters) / ((Float_t) nClusters));
189 hNumberOfClustersMC->Fill(matchedTrackRef->
GetNClusters());
190 hNumberOfClustersM->Fill(nClusters);
191 hChi2PerDofM->Fill(normalizedChi2);
196 hNumberOfChamberHitM->Fill(nChamberHit);
199 trackRefStore->
Remove(*matchedTrackRef);
207 hNumberOfClustersF->Fill(nClusters);
208 hChi2PerDofF->Fill(normalizedChi2);
213 hNumberOfChamberHitF->Fill(nChamberHit);
216 fakeTrackStore->
Add(*muonTrack);
223 hNumberOfTracks->Fill(nTrackerTracks);
224 nReconstructedTracks += nTrackerTracks;
225 if (trackReconstructedYet) {
226 if (nEventsWithTrackReconstructedYet >= eventsWithTrackReconstructedYet.GetSize())
227 eventsWithTrackReconstructedYet.Set(10*eventsWithTrackReconstructedYet.GetSize());
228 eventsWithTrackReconstructedYet[nEventsWithTrackReconstructedYet++] = iEvent;
232 if (fakeTrackStore->
GetSize() > 0) {
235 Int_t nFreeMissingTracks =
RemoveConnectedFakes(*fakeTrackStore, *trackRefStore, useLabel, *hFractionOfConnectedClusters);
238 Int_t nAdditionalTracks = fakeTrackStore->
GetSize() - nFreeMissingTracks;
241 if (nEventsWithFake >= eventsWithFake.GetSize()) eventsWithFake.Set(10*eventsWithFake.GetSize());
242 eventsWithFake[nEventsWithFake++] = iEvent;
243 if (nAdditionalTracks > 0) {
244 if (nEventsWithAdditionalFake >= eventsWithAdditionalFake.GetSize()) eventsWithAdditionalFake.Set(10*eventsWithAdditionalFake.GetSize());
245 eventsWithAdditionalFake[nEventsWithAdditionalFake++] = iEvent;
246 nTotAdditionalTracks += nAdditionalTracks;
247 hNumberOfAdditionalTracks->Fill(nAdditionalTracks);
252 delete fakeTrackStore;
257 nTotConnectedTracks = hFractionOfConnectedClusters->GetEntries();
260 TCanvas cFakesSummary(
"cFakesSummary",
"cFakesSummary",900,600);
261 cFakesSummary.Divide(3,2);
263 TVirtualPad* pad1 = cFakesSummary.GetPad(1);
266 pad1->GetPad(1)->SetLogy();
267 hNumberOfClusters->Draw();
268 hNumberOfClusters->SetMinimum(0.5);
269 hNumberOfClustersM->Draw(
"same");
270 hNumberOfClustersM->SetLineColor(4);
271 hNumberOfClustersF->Draw(
"same");
272 hNumberOfClustersF->SetLineColor(2);
273 hNumberOfClustersF->SetFillColor(2);
274 hNumberOfClustersF->SetFillStyle(3017);
276 pad1->GetPad(2)->SetLogy();
277 hNumberOfChamberHit->Draw();
278 hNumberOfChamberHit->SetMinimum(0.5);
279 hNumberOfChamberHitM->Draw(
"same");
280 hNumberOfChamberHitM->SetLineColor(4);
281 hNumberOfChamberHitF->Draw(
"same");
282 hNumberOfChamberHitF->SetLineColor(2);
283 hNumberOfChamberHitF->SetFillColor(2);
284 hNumberOfChamberHitF->SetFillStyle(3017);
286 cFakesSummary.GetPad(2)->SetLogy();
288 hChi2PerDof->SetMinimum(0.5);
289 hChi2PerDofM->Draw(
"same");
290 hChi2PerDofM->SetLineColor(4);
291 hChi2PerDofF->Draw(
"same");
292 hChi2PerDofF->SetLineColor(2);
293 hChi2PerDofF->SetFillColor(2);
294 hChi2PerDofF->SetFillStyle(3017);
296 cFakesSummary.GetPad(3)->SetLogy();
300 hPM->SetLineColor(4);
302 hPF->SetLineColor(2);
303 hPF->SetFillColor(2);
304 hPF->SetFillStyle(3017);
306 cFakesSummary.GetPad(4)->SetLogy();
308 hPt->SetMinimum(0.5);
310 hPtM->SetLineColor(4);
312 hPtF->SetLineColor(2);
313 hPtF->SetFillColor(2);
314 hPtF->SetFillStyle(3017);
316 cFakesSummary.GetPad(5)->SetLogy();
318 hEta->SetMinimum(0.5);
320 hEtaM->SetLineColor(4);
322 hEtaF->SetLineColor(2);
323 hEtaF->SetFillColor(2);
324 hEtaF->SetFillStyle(3017);
326 cFakesSummary.GetPad(6)->SetLogy();
328 hPhi->SetMinimum(0.5);
330 hPhiM->SetLineColor(4);
332 hPhiF->SetLineColor(2);
333 hPhiF->SetFillColor(2);
334 hPhiF->SetFillStyle(3017);
339 cFakesSummary.Write();
344 cout <<
"- Number of reconstructible tracks: " << nReconstructibleTracks << endl;
345 cout <<
"- Number of reconstructed tracks: " << nReconstructedTracks << endl;
346 cout <<
"- Number of matched tracks: " << nTotMatchedTracks << endl;
347 cout <<
" (including " << nTotTracksReconstructedYet <<
" track(s) matched with a TrackRef that is not reconstructible";
348 if (nTotTracksReconstructedYet > 0) {
349 for(Int_t i=0; i<nEventsWithTrackReconstructedYet; i++){
350 if (i==0) cout <<
" (eventID = " << eventsWithTrackReconstructedYet[i];
351 else cout <<
", " << eventsWithTrackReconstructedYet[i];
353 cout <<
"))" << endl;
354 }
else cout <<
")" << endl;
355 cout <<
"- Number of fake tracks: " << nTotFakeTracks << endl;
356 cout <<
" (including " << nTotConnectedTracks <<
" track(s) still connected to a reconstructible one)" << endl;
357 cout <<
" (including " << nTotAdditionalTracks <<
" additional track(s) (compared to the number of expected ones))" << endl;
358 cout <<
"- Number of events with fake track(s): " << nEventsWithFake;
359 if (nEventsWithFake > 0) {
360 for(Int_t i=0; i<nEventsWithFake; i++){
361 if (i==0) cout <<
" (eventID = " << eventsWithFake[i];
362 else cout <<
", " << eventsWithFake[i];
366 cout <<
" (including " << nEventsWithAdditionalFake <<
" events with additional track(s)";
367 if (nEventsWithAdditionalFake > 0) {
368 for(Int_t i=0; i<nEventsWithAdditionalFake; i++){
369 if (i==0) cout <<
" (eventID = " << eventsWithAdditionalFake[i];
370 else cout <<
", " << eventsWithAdditionalFake[i];
372 cout <<
"))" << endl;
373 }
else cout <<
")" << endl;
375 cout <<
"REMINDER: results are relevent provided that you use the same recoParams as for the reconstruction" << endl;
382 Bool_t useLabel, TH1F &hFractionOfConnectedClusters)
389 Int_t nFreeMissingTracks = 0;
394 while ( ( trackRef = static_cast<AliMUONTrack*>(next()) ) ) {
399 Int_t label = trackRef->GetUniqueID();
403 Double_t fractionOfConnectedClusters = 0.;
406 while ( ( fakeTrack = static_cast<AliMUONTrack*>(next2()) ) ) {
409 Int_t nConnectedClusters = 0;
411 for (Int_t iCl = 0; iCl < fakeTrack->GetNClusters(); iCl++)
412 if (((
AliMUONTrackParam*) fakeTrack->GetTrackParamAtCluster()->UncheckedAt(iCl))->GetClusterPtr()->GetMCLabel() == label)
413 nConnectedClusters++;
415 Bool_t compTrack[10];
420 if (nConnectedClusters == 0)
continue;
423 Double_t
f = ((Double_t)nConnectedClusters) / ((Double_t)fakeTrack->GetNClusters());
424 if (f > fractionOfConnectedClusters) {
425 connectedFake = fakeTrack;
426 fractionOfConnectedClusters =
f;
433 hFractionOfConnectedClusters.Fill(fractionOfConnectedClusters);
434 fakeTrackStore.
Remove(*connectedFake);
435 }
else nFreeMissingTracks++;
439 return nFreeMissingTracks;
Base class of a track container.
Int_t GetNClusters() const
return the number of clusters attached to the track
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.
void MUONFakes(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")
Int_t GetRunNumber()
Return the run number of the current ESD event.
TFile f("CalibObjects.root")
virtual AliMUONTrack * Remove(AliMUONTrack &track)=0
Remove a track from the store.
virtual Int_t GetSize() const =0
The number of objects stored.
Track parameters in ALICE dimuon spectrometer.
Class with MUON reconstruction parameters.
Bool_t request2ChInSameSt45
Bool_t IsValid(UInt_t requestedStationMask, Bool_t request2ChInSameSt45=kFALSE)
Utility class to check reconstruction.
AliMUONVTrackStore * TrackRefs(Int_t event)
Return reference muon tracks.
Int_t FindCompatibleClusters(const AliMUONTrack &track, Double_t sigma2Cut, Bool_t compatibleCluster[10]) const
static AliMUONVTrackStore * NewTrackStore()
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 ...
virtual Bool_t Add(TObject *object)
Add an object, if of the right type.
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()
Int_t RemoveConnectedFakes(AliMUONVTrackStore &fakeTrackStore, AliMUONVTrackStore &trackRefStore, Bool_t useLabel, TH1F &hFractionOfConnectedClusters)