CbmRoot
CbmMatchRecoToMC.cxx
Go to the documentation of this file.
1 /*
2  * CbmMatchRecoToMC.cxx
3  *
4  * Created on: Oct 17, 2013
5  * Author: andrey
6  */
7 #include "CbmMatchRecoToMC.h"
8 
9 #include "CbmCluster.h" // for CbmCluster
10 #include "CbmDigiManager.h" // for CbmDigiManager
11 #include "CbmHit.h" // for CbmHit, kMUCHPIXELHIT
12 #include "CbmLink.h" // for CbmLink
13 #include "CbmMCDataArray.h" // for CbmMCDataArray
14 #include "CbmMCDataManager.h" // for CbmMCDataManager
15 #include "CbmMCTrack.h" // for CbmMCTrack
16 #include "CbmMatch.h" // for CbmMatch
17 #include "CbmPixelHit.h" // for CbmPixelHit
18 #include "CbmRichDigi.h" // for CbmRichDigi
19 #include "CbmRichHit.h" // for CbmRichHit
20 #include "CbmRichPoint.h" // for CbmRichPoint
21 #include "CbmRichRing.h" // for CbmRichRing
22 #include "CbmStsAddress.h" // for GetSystemId
23 #include "CbmStsHit.h" // for CbmStsHit
24 #include "CbmStsTrack.h" // for CbmStsTrack
25 #include "CbmTofDigi.h" // for CbmTofDigi
26 #include "CbmTrack.h" // for CbmTrack
27 #include "CbmTrackMatchNew.h" // for CbmTrackMatchNew
28 
29 #include <FairLogger.h> // for LOG, Logger
30 #include <FairMCPoint.h> // for FairMCPoint
31 #include <FairRootManager.h> // for FairRootManager
32 #include <FairTask.h> // for FairTask, InitStatus
33 
34 #include <TClonesArray.h> // for TClonesArray
35 
36 #include <algorithm> // for find
37 #include <boost/exception/exception.hpp> // for clone_impl
38 #include <boost/type_index/type_index_facade.hpp> // for operator==
39 
40 using std::pair;
41 using std::vector;
42 
44 
45 CbmMatchRecoToMC::CbmMatchRecoToMC() : FairTask("MatchRecoToMC") {}
46 
48  if (fStsClusterMatches != nullptr) {
49  fStsClusterMatches->Delete();
50  delete fStsClusterMatches;
51  }
52  if (fStsHitMatches != nullptr) {
53  fStsHitMatches->Delete();
54  delete fStsHitMatches;
55  }
56  if (fStsTrackMatches) {
57  fStsTrackMatches->Delete();
58  delete fStsTrackMatches;
59  }
60 
61  if (fRichTrackMatches) {
62  fRichTrackMatches->Delete();
63  delete fRichTrackMatches;
64  }
65 
66  if (fTrdClusterMatches != nullptr) {
67  fTrdClusterMatches->Delete();
68  delete fTrdClusterMatches;
69  }
70  if (fTrdHitMatches != nullptr) {
71  fTrdHitMatches->Delete();
72  delete fTrdHitMatches;
73  }
74  if (fTrdTrackMatches) {
75  fTrdTrackMatches->Delete();
76  delete fTrdTrackMatches;
77  }
78 
79  if (fMuchClusterMatches != nullptr) {
80  fMuchClusterMatches->Delete();
81  delete fMuchClusterMatches;
82  }
83  if (fMuchPixelHitMatches != nullptr) {
84  fMuchPixelHitMatches->Delete();
85  delete fMuchPixelHitMatches;
86  }
87  if (fMuchTrackMatches) {
88  fMuchTrackMatches->Delete();
89  delete fMuchTrackMatches;
90  }
91 
92  if (fMvdClusterMatches != nullptr) {
93  fMvdClusterMatches->Delete();
94  delete fMvdClusterMatches;
95  }
96  if (fMvdHitMatches != nullptr) {
97  fMvdHitMatches->Delete();
98  delete fMvdHitMatches;
99  }
100 
101  if (fTofHitMatches != nullptr) {
102  fTofHitMatches->Delete();
103  delete fTofHitMatches;
104  }
105 }
106 
108  Bool_t includeMvdHitsInStsTrack) {
109  fIncludeMvdHitsInStsTrack = includeMvdHitsInStsTrack;
110 }
111 
114 
115  return kSUCCESS;
116 }
117 
118 void CbmMatchRecoToMC::Exec(Option_t* /*opt*/) {
119  if (fStsClusterMatches != nullptr) fStsClusterMatches->Delete();
120  if (fStsHitMatches != nullptr) fStsHitMatches->Delete();
121  if (fStsTrackMatches != nullptr) fStsTrackMatches->Delete();
122  if (fRichTrackMatches != nullptr) fRichTrackMatches->Delete();
123  if (fTrdClusterMatches != nullptr) fTrdClusterMatches->Delete();
124  if (fTrdHitMatches != nullptr) fTrdHitMatches->Delete();
125  if (fTrdTrackMatches != nullptr) fTrdTrackMatches->Delete();
126  if (fMuchClusterMatches != nullptr) fMuchClusterMatches->Delete();
127  if (fMuchPixelHitMatches != nullptr) fMuchPixelHitMatches->Delete();
128  if (fMuchTrackMatches != nullptr) fMuchTrackMatches->Delete();
129  if (fMvdHitMatches != nullptr) fMvdHitMatches->Delete();
130  if (fMvdClusterMatches != nullptr) fMvdClusterMatches->Delete();
131  if (fTofHitMatches != nullptr) fTofHitMatches->Delete();
132 
133 
134  // ----- MVD -----
135  // MVD: digi->hit
136  if (fMvdHits && fMvdHitMatches && !fMvdCluster) {
138  } else {
139  // MVD: digi->cluster
141  // MVD: cluster->hit
143  }
144 
145  // ----- STS -----
146  // STS: digi->cluster
148  // STS: cluster->hit
150  // STS: hit->track
153  fMvdPoints,
154  fStsPoints,
155  fStsTracks,
157 
158  // ----- MUCH -----
159  // MUCH: digi->cluster
161  // MUCH: cluster->hit
163  // MUCH: hit->track
164  MatchTracks(
166 
167 
168  //RICH
172  }
173 
174  // TRD
175  if (fTrdClusters && fTrdHits) { // MC->digi->cluster->hit->track
179  } else if (fTrdHits) { // MC->hit->track
182  }
183 
184  // TOF: (Digi->MC)+(Hit->Digi)=>(Hit->MC)
186 
187  //static Int_t eventNo = 0;
188  LOG(info) << "CbmMatchRecoToMC::Exec eventNo=" << fEventNumber++;
189 }
190 
192 
194  FairRootManager* ioman = FairRootManager::Instance();
195  if (nullptr == ioman) {
196  LOG(fatal)
197  << "CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL FairRootManager.";
198  }
199 
200  CbmMCDataManager* mcManager =
201  (CbmMCDataManager*) ioman->GetObject("MCDataManager");
202 
203  if (nullptr == mcManager)
204  LOG(fatal)
205  << "CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL MCDataManager.";
206 
207  fMCTracks = mcManager->InitBranch("MCTrack");
208 
209  //fMCTracksArray= (TClonesArray*) ioman->GetObject("MCTrack");
210 
211  // --- Digi Manager
213  fDigiManager->Init();
214 
215 
216  // Register output branches only if they don't exist
217  // This should solve the problem with BranchName_1, BranchName_2
218  // when having two instances of CbmMatchRecoToMC in the same macro
219 
220  // STS
221  fStsPoints = mcManager->InitBranch("StsPoint");
222 
223  fStsClusters = static_cast<TClonesArray*>(ioman->GetObject("StsCluster"));
224  if (nullptr != fStsClusters) {
226  static_cast<TClonesArray*>(ioman->GetObject("StsClusterMatch"));
227  if (nullptr == fStsClusterMatches) {
228  fStsClusterMatches = new TClonesArray("CbmMatch", 100);
229  ioman->Register("StsClusterMatch",
230  "STS",
232  IsOutputBranchPersistent("StsClusterMatch"));
233  }
234  }
235 
236  fStsHits = static_cast<TClonesArray*>(ioman->GetObject("StsHit"));
237  if (nullptr != fStsHits) {
239  static_cast<TClonesArray*>(ioman->GetObject("StsHitMatch"));
240  if (nullptr == fStsHitMatches) {
241  fStsHitMatches = new TClonesArray("CbmMatch", 100);
242  ioman->Register("StsHitMatch",
243  "STS",
245  IsOutputBranchPersistent("StsHitMatch"));
246  }
247  }
248 
249  fStsTracks = static_cast<TClonesArray*>(ioman->GetObject("StsTrack"));
250  if (nullptr != fStsTracks) {
252  static_cast<TClonesArray*>(ioman->GetObject("StsTrackMatch"));
253  if (nullptr == fStsTrackMatches) {
254  fStsTrackMatches = new TClonesArray("CbmTrackMatchNew", 100);
255  ioman->Register("StsTrackMatch",
256  "STS",
258  IsOutputBranchPersistent("StsTrackMatch"));
259  }
260  }
261 
262  //RICH
263  fRichMcPoints = mcManager->InitBranch("RichPoint");
264  fRichHits = static_cast<TClonesArray*>(ioman->GetObject("RichHit"));
265 
266  fRichRings = static_cast<TClonesArray*>(ioman->GetObject("RichRing"));
267  if (nullptr != fRichRings) {
269  static_cast<TClonesArray*>(ioman->GetObject("RichRingMatch"));
270  if (nullptr == fRichTrackMatches) {
271  fRichTrackMatches = new TClonesArray("CbmTrackMatchNew", 100);
272  ioman->Register("RichRingMatch",
273  "RICH",
275  IsOutputBranchPersistent("RichRingMatch"));
276  }
277  }
278 
279  // TRD
280  fTrdPoints = mcManager->InitBranch("TrdPoint");
281  fTrdClusters = static_cast<TClonesArray*>(ioman->GetObject("TrdCluster"));
282  if (nullptr != fTrdClusters) {
284  static_cast<TClonesArray*>(ioman->GetObject("TrdClusterMatch"));
285  if (nullptr == fTrdClusterMatches) {
286  fTrdClusterMatches = new TClonesArray("CbmMatch", 100);
287  ioman->Register("TrdClusterMatch",
288  "TRD",
290  IsOutputBranchPersistent("TrdClusterMatch"));
291  }
292  }
293 
294  fTrdHits = static_cast<TClonesArray*>(ioman->GetObject("TrdHit"));
295  if (nullptr != fTrdHits) {
297  static_cast<TClonesArray*>(ioman->GetObject("TrdHitMatch"));
298  if (nullptr == fTrdHitMatches) {
299  fTrdHitMatches = new TClonesArray("CbmMatch", 100);
300  ioman->Register("TrdHitMatch",
301  "TRD",
303  IsOutputBranchPersistent("TrdHitMatch"));
304  }
305  }
306 
307 
308  fTrdTracks = static_cast<TClonesArray*>(ioman->GetObject("TrdTrack"));
309  if (nullptr != fTrdTracks) {
311  static_cast<TClonesArray*>(ioman->GetObject("TrdTrackMatch"));
312  if (nullptr == fTrdTrackMatches) {
313  fTrdTrackMatches = new TClonesArray("CbmTrackMatchNew", 100);
314  ioman->Register("TrdTrackMatch",
315  "TRD",
317  IsOutputBranchPersistent("TrdTrackMatch"));
318  }
319  }
320 
321  // MUCH
322  fMuchPoints = mcManager->InitBranch("MuchPoint");
323 
324  fMuchTracks = (TClonesArray*) ioman->GetObject("MuchTrack");
325  fMuchClusters = static_cast<TClonesArray*>(ioman->GetObject("MuchCluster"));
326  if (nullptr != fMuchClusters) {
328  static_cast<TClonesArray*>(ioman->GetObject("MuchClusterMatch"));
329  if (nullptr == fMuchClusterMatches) {
330  fMuchClusterMatches = new TClonesArray("CbmMatch", 100);
331  ioman->Register("MuchClusterMatch",
332  "MUCH",
334  IsOutputBranchPersistent("MuchClusterMatch"));
335  }
336  }
337 
338  fMuchPixelHits = static_cast<TClonesArray*>(ioman->GetObject("MuchPixelHit"));
339  if (nullptr != fMuchPixelHits) {
341  static_cast<TClonesArray*>(ioman->GetObject("MuchPixelHitMatch"));
342  if (nullptr == fMuchPixelHitMatches) {
343  fMuchPixelHitMatches = new TClonesArray("CbmMatch", 100);
344  ioman->Register("MuchPixelHitMatch",
345  "MUCH",
347  IsOutputBranchPersistent("MuchPixelHitMatch"));
348  }
349  }
350 
351  fMuchTracks = static_cast<TClonesArray*>(ioman->GetObject("MuchTrack"));
352  if (nullptr != fMuchTracks) {
354  static_cast<TClonesArray*>(ioman->GetObject("MuchTrackMatch"));
355  if (nullptr == fMuchTrackMatches) {
356  fMuchTrackMatches = new TClonesArray("CbmTrackMatchNew", 100);
357  ioman->Register("MuchTrackMatch",
358  "MUCH",
360  IsOutputBranchPersistent("MuchTrackMatch"));
361  }
362  }
363 
364  // MVD
365  fMvdPoints = mcManager->InitBranch("MvdPoint");
366 
367  fMvdCluster = static_cast<TClonesArray*>(ioman->GetObject("MvdCluster"));
368  if (nullptr != fMvdCluster) {
370  static_cast<TClonesArray*>(ioman->GetObject("MvdClusterMatch"));
371  if (nullptr == fMvdClusterMatches) {
372  fMvdClusterMatches = new TClonesArray("CbmMatch", 100);
373  ioman->Register("MvdClusterMatch",
374  "MVD",
376  IsOutputBranchPersistent("MvdClusterMatch"));
377  }
378  }
379 
380  fMvdHits = static_cast<TClonesArray*>(ioman->GetObject("MvdHit"));
381  if (nullptr != fMvdHits) {
383  static_cast<TClonesArray*>(ioman->GetObject("MvdHitMatch"));
384  if (nullptr == fMvdHitMatches) {
385  fMvdHitMatches = new TClonesArray("CbmMatch", 100);
386  ioman->Register("MvdHitMatch",
387  "MVD",
389  IsOutputBranchPersistent("MvdHitMatch"));
390  }
391  }
392 
393  // TOF
394  fTofPoints = mcManager->InitBranch("TofPoint");
395  fTofHitDigiMatches = (TClonesArray*) ioman->GetObject("TofHitDigiMatch");
396 
397  fTofHits = static_cast<TClonesArray*>(ioman->GetObject("TofHit"));
398  if (nullptr != fTofHits) {
400  static_cast<TClonesArray*>(ioman->GetObject("TofHitMatch"));
401  if (nullptr == fTofHitMatches) {
402  fTofHitMatches = new TClonesArray("CbmMatch", 100);
403  ioman->Register("TofHitMatch",
404  "TOF",
406  IsOutputBranchPersistent("TofHitMatch"));
407  }
408  }
409 }
410 
411 
412 void CbmMatchRecoToMC::MatchClusters(const TClonesArray* digiMatches,
413  const TClonesArray* clusters,
414  TClonesArray* clusterMatches) {
415  if (!(digiMatches && clusters && clusterMatches)) return;
416  Int_t nofClusters = clusters->GetEntriesFast();
417  for (Int_t iCluster = 0; iCluster < nofClusters; iCluster++) {
418  CbmCluster* cluster = static_cast<CbmCluster*>(clusters->At(iCluster));
419  CbmMatch* clusterMatch = new ((*clusterMatches)[iCluster]) CbmMatch();
420  Int_t nofDigis = cluster->GetNofDigis();
421  for (Int_t iDigi = 0; iDigi < nofDigis; iDigi++) {
422  const CbmMatch* digiMatch =
423  static_cast<const CbmMatch*>(digiMatches->At(cluster->GetDigi(iDigi)));
424  clusterMatch->AddLinks(*digiMatch);
425  } //# digis in cluster
426  } //# clusters
427 }
428 
430  const TClonesArray* clusters,
431  TClonesArray* clusterMatches) {
432  if (!fDigiManager->IsMatchPresent(systemId)) return;
433  if (!(clusters && clusterMatches)) return;
434  Int_t nofClusters = clusters->GetEntriesFast();
435  for (Int_t iCluster = 0; iCluster < nofClusters; iCluster++) {
436  CbmCluster* cluster = static_cast<CbmCluster*>(clusters->At(iCluster));
437  CbmMatch* clusterMatch = new ((*clusterMatches)[iCluster]) CbmMatch();
438  Int_t nofDigis = cluster->GetNofDigis();
439  for (Int_t iDigi = 0; iDigi < nofDigis; iDigi++) {
440  Int_t digiIndex = cluster->GetDigi(iDigi);
441  const CbmMatch* digiMatch = fDigiManager->GetMatch(systemId, digiIndex);
442  clusterMatch->AddLinks(*digiMatch);
443  } //# digis in cluster
444  } //# clusters
445 }
446 
447 void CbmMatchRecoToMC::MatchHits(const TClonesArray* matches,
448  const TClonesArray* hits,
449  TClonesArray* hitMatches) {
450  if (!(matches && hits && hitMatches)) return;
451  Int_t nofHits = hits->GetEntriesFast();
452  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
453  CbmHit* hit = static_cast<CbmHit*>(hits->At(iHit));
454  CbmMatch* hitMatch = new ((*hitMatches)[iHit]) CbmMatch();
455  const CbmMatch* clusterMatch =
456  static_cast<const CbmMatch*>(matches->At(hit->GetRefId()));
457  hitMatch->AddLinks(*clusterMatch);
458  }
459 }
460 
461 void CbmMatchRecoToMC::MatchHitsSts(const TClonesArray* cluMatches,
462  const TClonesArray* hits,
463  TClonesArray* hitMatches) {
464  if (!(cluMatches && hits && hitMatches)) return;
465  Int_t nofHits = hits->GetEntriesFast();
466  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
467  CbmStsHit* hit = static_cast<CbmStsHit*>(hits->At(iHit));
468  CbmMatch* hitMatch = new ((*hitMatches)[iHit]) CbmMatch();
469  const CbmMatch* frontClusterMatch =
470  static_cast<const CbmMatch*>(cluMatches->At(hit->GetFrontClusterId()));
471  const CbmMatch* backClusterMatch =
472  static_cast<const CbmMatch*>(cluMatches->At(hit->GetBackClusterId()));
473  hitMatch->AddLinks(*frontClusterMatch);
474  hitMatch->AddLinks(*backClusterMatch);
475  }
476 }
477 
478 void CbmMatchRecoToMC::MatchHitsMvd(const TClonesArray* hits,
479  TClonesArray* hitMatches) {
480  if (!(hits && hitMatches)) return;
481  Int_t nofHits = hits->GetEntriesFast();
482  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
483  CbmPixelHit* hit = static_cast<CbmPixelHit*>(hits->At(iHit));
484  CbmMatch* hitMatch = new ((*hitMatches)[iHit]) CbmMatch();
485  const CbmMatch* digiMatch =
487  hitMatch->AddLinks(*digiMatch);
488  }
489 }
490 
491 void CbmMatchRecoToMC::MatchHitsTof(const TClonesArray* HitDigiMatches,
492  const TClonesArray* hits,
493  TClonesArray* hitMatches) {
494  if (!(HitDigiMatches && hits && hitMatches)) return;
495 
496  Int_t iNbTofDigis = fDigiManager->GetNofDigis(ECbmModuleId::kTof);
497  Int_t nofHits = hits->GetEntriesFast();
498  const CbmTofDigi* pTofDigi;
499  const CbmMatch* pMatchDigiPnt;
500 
501  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
502  CbmMatch* hitDigiMatch = static_cast<CbmMatch*>(HitDigiMatches->At(iHit));
503  CbmMatch* hitMatch = new ((*hitMatches)[iHit]) CbmMatch();
504 
505  Int_t iNbDigisHit = hitDigiMatch->GetNofLinks();
506  for (Int_t iDigi = 0; iDigi < iNbDigisHit; iDigi++) {
507  CbmLink lDigi = hitDigiMatch->GetLink(iDigi);
508  Int_t iDigiIdx = lDigi.GetIndex();
509 
510  if (iNbTofDigis <= iDigiIdx) {
511  LOG(error)
512  << "CbmTofHitFinderQa::FillHistos => Digi index from Hit #" << iHit
513  << " is bigger than nb entries in Digis arrays => ignore it!!!";
514  continue;
515  } // if( iNbTofDigis <= iDigiIdx )
516 
517  pTofDigi = fDigiManager->Get<CbmTofDigi>(iDigiIdx);
518  pMatchDigiPnt = fDigiManager->GetMatch(ECbmModuleId::kTof, iDigiIdx);
519  Int_t iNbPointsDigi = pMatchDigiPnt->GetNofLinks();
520  CbmLink lTruePoint =
521  pMatchDigiPnt->GetMatchedLink(); // Point generating the Digi
522  Int_t iTruePointIdx = lTruePoint.GetIndex();
523  for (Int_t iPoint = 0; iPoint < iNbPointsDigi; iPoint++) {
524  CbmLink lPoint = pMatchDigiPnt->GetLink(iPoint);
525  Int_t iPointIdx = lPoint.GetIndex();
526 
527  if (iPointIdx == iTruePointIdx)
528  hitMatch->AddLink(
529  CbmLink(pTofDigi->GetTot(),
530  iPointIdx,
531  lPoint.GetEntry(),
532  lPoint.GetFile())); // Point generating the Digi
533  else
534  hitMatch->AddLink(CbmLink(
535  0,
536  iPointIdx,
537  lPoint.GetEntry(),
538  lPoint.GetFile())); // Point whose Digi was hidden by True one
539  } // for( Int_t iPoint = 0; iPoint < iNbPointsDigi; iPoint ++)
540  } // for (Int_t iDigi = 0; iDigi < iNbDigisHit; iDigi++)
541  } // for (Int_t iHit = 0; iHit < nofHits; iHit++)
542 }
543 
545  const TClonesArray* hits,
546  TClonesArray* hitMatches) {
547  if (!(hits && hitMatches)) return;
548  Int_t nofHits = hits->GetEntriesFast();
549  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
550  CbmHit* hit = static_cast<CbmHit*>(hits->At(iHit));
551  CbmMatch* hitMatch = new ((*hitMatches)[iHit]) CbmMatch();
552  const FairMCPoint* point = static_cast<const FairMCPoint*>(
553  points->Get(0, fEventNumber, hit->GetRefId()));
554  hitMatch->AddLink(
555  CbmLink(point->GetEnergyLoss(), hit->GetRefId(), fEventNumber));
556  }
557 }
558 
559 void CbmMatchRecoToMC::MatchTracks(const TClonesArray* hitMatches,
561  const TClonesArray* tracks,
562  TClonesArray* trackMatches) {
563  if (!(hitMatches && points && tracks && trackMatches)) return;
564 
565  Bool_t editMode = (trackMatches->GetEntriesFast() != 0);
566 
567  Int_t nofTracks = tracks->GetEntriesFast();
568  for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
569  const CbmTrack* track = static_cast<const CbmTrack*>(tracks->At(iTrack));
570  CbmTrackMatchNew* trackMatch =
571  (editMode) ? static_cast<CbmTrackMatchNew*>(trackMatches->At(iTrack))
572  : new ((*trackMatches)[iTrack]) CbmTrackMatchNew();
573  Int_t nofHits = track->GetNofHits();
574  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
575  if ((track->GetHitType(iHit) == kMUCHPIXELHIT)
576  || (track->GetHitType(iHit) == kMUCHSTRAWHIT
577  && hitMatches == fMuchPixelHitMatches))
578  continue; //AZ
579  const CbmMatch* hitMatch =
580  static_cast<CbmMatch*>(hitMatches->At(track->GetHitIndex(iHit)));
581  Int_t nofLinks = hitMatch->GetNofLinks();
582  for (Int_t iLink = 0; iLink < nofLinks; iLink++) {
583  const FairMCPoint* point = static_cast<const FairMCPoint*>(
584  points->Get(hitMatch->GetLink(iLink)));
585  if (nullptr == point) continue;
587  if (CbmStsAddress::GetSystemId(point->GetDetectorID())
588  == ECbmModuleId::kSts) {
589  Int_t mcTrackId = point->GetTrackID();
590  CbmMCTrack* mcTrack =
591  (CbmMCTrack*) fMCTracks->Get(hitMatch->GetLink(iLink).GetFile(),
592  hitMatch->GetLink(iLink).GetEntry(),
593  mcTrackId);
594  if (mcTrack->GetNPoints(ECbmModuleId::kSts) < 2) continue;
595  }
597  trackMatch->AddLink(CbmLink(
598  1., point->GetTrackID(), hitMatch->GetLink(iLink).GetEntry()));
599  }
600  }
601  if (!trackMatch->GetNofLinks()) continue;
602  // Calculate number of true and wrong hits
603  Int_t trueCounter = trackMatch->GetNofTrueHits();
604  Int_t wrongCounter = trackMatch->GetNofWrongHits();
605  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
606  if ((track->GetHitType(iHit) == kMUCHPIXELHIT)
607  || (track->GetHitType(iHit) == kMUCHSTRAWHIT
608  && hitMatches == fMuchPixelHitMatches))
609  continue; //AZ
610  const CbmMatch* hitMatch =
611  static_cast<CbmMatch*>(hitMatches->At(track->GetHitIndex(iHit)));
612  Int_t nofLinks = hitMatch->GetNofLinks();
613  Bool_t hasTrue = false;
614  for (Int_t iLink = 0; iLink < nofLinks; iLink++) {
615  const FairMCPoint* point = static_cast<const FairMCPoint*>(
616  points->Get(hitMatch->GetLink(iLink)));
617  if (nullptr == point) continue;
618  if (
619  /*point->GetEventID() == trackMatch->GetMatchedLink().GetEntry() && */
620  point->GetTrackID()
621  == trackMatch->GetMatchedLink().GetIndex()) {
622  hasTrue = true;
623  break;
624  }
625  }
626  if (hasTrue)
627  trueCounter++;
628  else
629  wrongCounter++;
630  }
631  trackMatch->SetNofTrueHits(trueCounter);
632  trackMatch->SetNofWrongHits(wrongCounter);
633  // LOG(debug) << iTrack << " "; track->Print(); LOG(debug) << " " << trackMatch->ToString();
634  }
635 }
636 
637 void CbmMatchRecoToMC::MatchStsTracks(const TClonesArray* mvdHitMatches,
638  const TClonesArray* stsHitMatches,
639  CbmMCDataArray* mvdPoints,
640  CbmMCDataArray* stsPoints,
641  const TClonesArray* tracks,
642  TClonesArray* trackMatches) {
643  if (!((stsHitMatches && stsPoints && tracks && trackMatches)
644  && ((fIncludeMvdHitsInStsTrack) ? mvdHitMatches && mvdPoints : true)))
645  return;
646 
647  Bool_t editMode = (trackMatches->GetEntriesFast() != 0);
648 
649  Int_t nofTracks = tracks->GetEntriesFast();
650  for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
651  const CbmStsTrack* track =
652  static_cast<const CbmStsTrack*>(tracks->At(iTrack));
653  CbmTrackMatchNew* trackMatch =
654  (editMode) ? static_cast<CbmTrackMatchNew*>(trackMatches->At(iTrack))
655  : new ((*trackMatches)[iTrack]) CbmTrackMatchNew();
656  Int_t nofStsHits = track->GetNofStsHits();
657  for (Int_t iHit = 0; iHit < nofStsHits; iHit++) {
658  const CbmMatch* hitMatch =
659  static_cast<CbmMatch*>(stsHitMatches->At(track->GetHitIndex(iHit)));
660  Int_t nofLinks = hitMatch->GetNofLinks();
661  for (Int_t iLink = 0; iLink < nofLinks; iLink++) {
662  const CbmLink& link = hitMatch->GetLink(iLink);
663  const FairMCPoint* point =
664  static_cast<const FairMCPoint*>(stsPoints->Get(link));
665  if (nullptr == point) continue;
667  if (CbmStsAddress::GetSystemId(point->GetDetectorID())
668  == ECbmModuleId::kSts) {
669  Int_t mcTrackId = point->GetTrackID();
670  CbmMCTrack* mcTrack = (CbmMCTrack*) fMCTracks->Get(
671  link.GetFile(), link.GetEntry(), mcTrackId);
672  if (!mcTrack) continue;
673  if (mcTrack->GetNPoints(ECbmModuleId::kSts) < 2) continue;
674  }
676  trackMatch->AddLink(
677  CbmLink(1., point->GetTrackID(), link.GetEntry(), link.GetFile()));
678  }
679  }
680 
681  // Include MVD hits in STS matching if needed.
683  Int_t nofMvdHits = track->GetNofMvdHits();
684  for (Int_t iHit = 0; iHit < nofMvdHits; iHit++) {
685  const CbmMatch* hitMatch = static_cast<CbmMatch*>(
686  mvdHitMatches->At(track->GetMvdHitIndex(iHit)));
687  Int_t nofLinks = hitMatch->GetNofLinks();
688  for (Int_t iLink = 0; iLink < nofLinks; iLink++) {
689  const CbmLink& link = hitMatch->GetLink(iLink);
690  const FairMCPoint* point =
691  static_cast<const FairMCPoint*>(mvdPoints->Get(link));
692  if (nullptr == point) continue;
693  trackMatch->AddLink(
694  CbmLink(1., point->GetTrackID(), link.GetEntry(), link.GetFile()));
695  }
696  }
697  }
698 
699  if (!trackMatch->GetNofLinks()) continue;
700  // Calculate number of true and wrong hits
701  Int_t trueCounter = trackMatch->GetNofTrueHits();
702  Int_t wrongCounter = trackMatch->GetNofWrongHits();
703  for (Int_t iHit = 0; iHit < nofStsHits; iHit++) {
704  const CbmMatch* hitMatch =
705  static_cast<CbmMatch*>(stsHitMatches->At(track->GetHitIndex(iHit)));
706  Int_t nofLinks = hitMatch->GetNofLinks();
707  Bool_t hasTrue = false;
708  for (Int_t iLink = 0; iLink < nofLinks; iLink++) {
709  const FairMCPoint* point = static_cast<const FairMCPoint*>(
710  stsPoints->Get(hitMatch->GetLink(iLink)));
711  if (nullptr == point) continue;
712  if (point->GetTrackID() == trackMatch->GetMatchedLink().GetIndex()) {
713  hasTrue = true;
714  break;
715  }
716  }
717  if (hasTrue)
718  trueCounter++;
719  else
720  wrongCounter++;
721  }
722 
723  // Include MVD hits in STS track matching if needed
725  Int_t nofMvdHits = track->GetNofMvdHits();
726  for (Int_t iHit = 0; iHit < nofMvdHits; iHit++) {
727  const CbmMatch* hitMatch = static_cast<CbmMatch*>(
728  mvdHitMatches->At(track->GetMvdHitIndex(iHit)));
729  Int_t nofLinks = hitMatch->GetNofLinks();
730  Bool_t hasTrue = false;
731  for (Int_t iLink = 0; iLink < nofLinks; iLink++) {
732  const FairMCPoint* point = static_cast<const FairMCPoint*>(
733  mvdPoints->Get(hitMatch->GetLink(iLink)));
734  if (nullptr == point) continue;
735  if (
736  /*point->GetEventID() == trackMatch->GetMatchedLink().GetEntry() && */
737  point->GetTrackID()
738  == trackMatch->GetMatchedLink().GetIndex()) {
739  hasTrue = true;
740  break;
741  }
742  }
743  if (hasTrue)
744  trueCounter++;
745  else
746  wrongCounter++;
747  }
748  }
749  trackMatch->SetNofTrueHits(trueCounter);
750  trackMatch->SetNofWrongHits(wrongCounter);
751  // LOG(debug) << iTrack << " "; track->Print(); LOG(debug) << " " << trackMatch->ToString();
752  }
753 }
754 
755 
756 void CbmMatchRecoToMC::MatchRichRings(const TClonesArray* richRings,
757  const TClonesArray* richHits,
758  // const TClonesArray* richDigis,
759  // const TClonesArray* richDigiMatches,
760  CbmMCDataArray* richMcPoints,
762  TClonesArray* ringMatches) {
763  // Loop over RichRings
764  Int_t nRings = richRings->GetEntriesFast();
765  for (Int_t iRing = 0; iRing < nRings; iRing++) {
766  const CbmRichRing* ring =
767  static_cast<const CbmRichRing*>(richRings->At(iRing));
768  if (nullptr == ring) continue;
769 
770  CbmTrackMatchNew* ringMatch =
771  new ((*ringMatches)[iRing]) CbmTrackMatchNew();
772 
773  Int_t nofHits = ring->GetNofHits();
774  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
775  const CbmRichHit* hit =
776  static_cast<const CbmRichHit*>(richHits->At(ring->GetHit(iHit)));
777  if (nullptr == hit) continue;
778 
779  vector<pair<Int_t, Int_t>> motherIds = GetMcTrackMotherIdsForRichHit(
780  fDigiManager, hit, richMcPoints, mcTracks, fEventNumber);
781  for (UInt_t i = 0; i < motherIds.size(); i++) {
782  ringMatch->AddLink(1., motherIds[i].second, motherIds[i].first);
783  }
784  }
785 
786  if (ringMatch->GetNofLinks() != 0) {
787 
788  Int_t bestTrackId = ringMatch->GetMatchedLink().GetIndex();
789  Int_t bestTrackEventId = ringMatch->GetMatchedLink().GetEntry();
790 
791  Int_t trueCounter = 0;
792  Int_t wrongCounter = 0;
793  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
794  const CbmRichHit* hit =
795  static_cast<const CbmRichHit*>(richHits->At(ring->GetHit(iHit)));
796  if (nullptr == hit) continue;
797  vector<pair<Int_t, Int_t>> motherIds = GetMcTrackMotherIdsForRichHit(
798  fDigiManager, hit, richMcPoints, mcTracks, fEventNumber);
799  if (std::find(motherIds.begin(),
800  motherIds.end(),
801  std::make_pair(bestTrackEventId, bestTrackId))
802  != motherIds.end()) {
803  trueCounter++;
804  } else {
805  wrongCounter++;
806  }
807  }
808 
809  ringMatch->SetNofTrueHits(trueCounter);
810  ringMatch->SetNofWrongHits(wrongCounter);
811  } else {
812  ringMatch->SetNofTrueHits(0);
813  ringMatch->SetNofWrongHits(0);
814  }
815 
816  } // Ring loop
817 }
818 
819 
820 vector<pair<Int_t, Int_t>>
822  const CbmRichHit* hit,
823  CbmMCDataArray* richPoints,
825  Int_t /*eventNumber*/) {
826  vector<pair<Int_t, Int_t>> result;
827  if (nullptr == hit) return result;
828  Int_t digiIndex = hit->GetRefId();
829  if (digiIndex < 0) return result;
830  const CbmRichDigi* digi = digiMan->Get<CbmRichDigi>(digiIndex);
831  if (nullptr == digi) return result;
832  const CbmMatch* digiMatch = digiMan->GetMatch(ECbmModuleId::kRich, digiIndex);
833  if (digiMatch == nullptr) return result;
834 
835  vector<CbmLink> links = digiMatch->GetLinks();
836  for (UInt_t i = 0; i < links.size(); i++) {
837  Int_t pointId = links[i].GetIndex();
838  Int_t eventId = links[i].GetEntry();
839  if (pointId < 0) continue; // noise hit
840  const CbmRichPoint* pMCpt =
841  static_cast<const CbmRichPoint*>(richPoints->Get(0, eventId, pointId));
842 
843  if (nullptr == pMCpt) continue;
844  Int_t mcTrackIndex = pMCpt->GetTrackID();
845  if (mcTrackIndex < 0) continue;
846  //TODO: Currently we support only legacy mode of CbmMCDataArray
847  const CbmMCTrack* mcTrack =
848  static_cast<const CbmMCTrack*>(mcTracks->Get(0, eventId, mcTrackIndex));
849  // CbmMCTrack* pMCtr = (CbmMCTrack*) mcTracks->At(mcTrackIndex);
850  if (nullptr == mcTrack) continue;
851  if (mcTrack->GetPdgCode() != 50000050)
852  continue; // select only Cherenkov photons
853  Int_t motherId = mcTrack->GetMotherId();
854  // several photons can have same mother track
855  // count only unique motherIds
856  pair<Int_t, Int_t> val = std::make_pair(eventId, motherId);
857  if (std::find(result.begin(), result.end(), val) == result.end()) {
858  result.push_back(val);
859  }
860  }
861 
862  return result;
863 }
864 
865 vector<Int_t>
867  const CbmRichHit* hit,
868  const TClonesArray* richPoints,
869  const TClonesArray* mcTracks) {
870  vector<Int_t> result;
871  if (nullptr == hit) return result;
872  Int_t digiIndex = hit->GetRefId();
873  if (digiIndex < 0) return result;
874  const CbmRichDigi* digi = digiMan->Get<CbmRichDigi>(digiIndex);
875  if (nullptr == digi) return result;
876  const CbmMatch* digiMatch = digiMan->GetMatch(ECbmModuleId::kRich, digiIndex);
877  if (digiMatch == nullptr) return result;
878 
879  vector<CbmLink> links = digiMatch->GetLinks();
880  for (UInt_t i = 0; i < links.size(); i++) {
881  Int_t pointId = links[i].GetIndex();
882  if (pointId < 0) continue; // noise hit
883 
884  const CbmRichPoint* pMCpt =
885  static_cast<const CbmRichPoint*>(richPoints->At(pointId));
886  if (nullptr == pMCpt) continue;
887  Int_t mcTrackIndex = pMCpt->GetTrackID();
888  if (mcTrackIndex < 0) continue;
889  //TODO: Currently we support only legacy mode of CbmMCDataArray
890  const CbmMCTrack* mcTrack =
891  static_cast<const CbmMCTrack*>(mcTracks->At(mcTrackIndex));
892  // CbmMCTrack* pMCtr = (CbmMCTrack*) mcTracks->At(mcTrackIndex);
893  if (nullptr == mcTrack) continue;
894  if (mcTrack->GetPdgCode() != 50000050)
895  continue; // select only Cherenkov photons
896  Int_t motherId = mcTrack->GetMotherId();
897  // several photons can have same mother track
898  // count only unique motherIds
899  if (std::find(result.begin(), result.end(), motherId) == result.end()) {
900  result.push_back(motherId);
901  }
902  }
903 
904  return result;
905 }
906 
CbmMatchRecoToMC::SetIncludeMvdHitsInStsTrack
void SetIncludeMvdHitsInStsTrack(Bool_t includeMvdHitsInStsTrack)
Definition: CbmMatchRecoToMC.cxx:107
CbmRichPoint.h
CbmMatchRecoToMC::ReadAndCreateDataBranches
void ReadAndCreateDataBranches()
Read and create data branches.
Definition: CbmMatchRecoToMC.cxx:193
CbmMatchRecoToMC::CbmMatchRecoToMC
CbmMatchRecoToMC()
Constructor.
Definition: CbmMatchRecoToMC.cxx:45
CbmMatchRecoToMC::fMvdClusterMatches
TClonesArray * fMvdClusterMatches
Hits [in].
Definition: CbmMatchRecoToMC.h:166
CbmMCTrack::GetMotherId
Int_t GetMotherId() const
Definition: CbmMCTrack.h:71
CbmMatch::GetMatchedLink
const CbmLink & GetMatchedLink() const
Definition: CbmMatch.h:37
CbmMCDataManager::GetObject
CbmMCDataObject * GetObject(const char *name)
Definition: CbmMCDataManager.cxx:137
CbmMatch
Definition: CbmMatch.h:22
CbmMCDataManager.h
CbmMatchRecoToMC::fMvdHits
TClonesArray * fMvdHits
Clusters [in].
Definition: CbmMatchRecoToMC.h:165
CbmTrackMatchNew::GetNofWrongHits
Int_t GetNofWrongHits() const
Definition: CbmTrackMatchNew.h:33
CbmMatchRecoToMC::fMvdCluster
TClonesArray * fMvdCluster
MC points [in].
Definition: CbmMatchRecoToMC.h:164
ClassImp
ClassImp(CbmMatchRecoToMC)
CbmMatch::GetLink
const CbmLink & GetLink(Int_t i) const
Definition: CbmMatch.h:35
CbmMatch::GetNofLinks
Int_t GetNofLinks() const
Definition: CbmMatch.h:38
CbmTrack::GetNofHits
virtual Int_t GetNofHits() const
Definition: CbmTrack.h:53
CbmMatchRecoToMC::fTrdClusterMatches
TClonesArray * fTrdClusterMatches
Tracks [in].
Definition: CbmMatchRecoToMC.h:198
CbmRichDigi
Definition: CbmRichDigi.h:25
CbmMatchRecoToMC::Finish
virtual void Finish()
Derived from FairTask.
Definition: CbmMatchRecoToMC.cxx:191
CbmMatchRecoToMC::~CbmMatchRecoToMC
virtual ~CbmMatchRecoToMC()
Destructor.
Definition: CbmMatchRecoToMC.cxx:47
CbmDigiManager::Init
InitStatus Init()
Initialisation.
Definition: CbmDigiManager.cxx:71
CbmMatchRecoToMC::fTrdHits
TClonesArray * fTrdHits
Clusters [in].
Definition: CbmMatchRecoToMC.h:196
CbmMatchRecoToMC::fStsHits
TClonesArray * fStsHits
Clusters [in].
Definition: CbmMatchRecoToMC.h:172
CbmMatchRecoToMC::fRichMcPoints
CbmMCDataArray * fRichMcPoints
Track matches [out].
Definition: CbmMatchRecoToMC.h:179
CbmMCTrack::GetPdgCode
Int_t GetPdgCode() const
Definition: CbmMCTrack.h:70
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmMCDataManager::InitBranch
CbmMCDataArray * InitBranch(const char *name)
Definition: CbmMCDataManager.cxx:106
CbmMatchRecoToMC::fMuchPoints
CbmMCDataArray * fMuchPoints
[out]
Definition: CbmMatchRecoToMC.h:185
CbmMCDataArray.h
CbmMatchRecoToMC::Exec
virtual void Exec(Option_t *opt)
Derived from FairTask.
Definition: CbmMatchRecoToMC.cxx:118
CbmMatchRecoToMC::fStsTrackMatches
TClonesArray * fStsTrackMatches
Hit matches [out].
Definition: CbmMatchRecoToMC.h:176
CbmMatchRecoToMC::fRichHits
TClonesArray * fRichHits
MC points [in].
Definition: CbmMatchRecoToMC.h:180
ECbmModuleId::kMvd
@ kMvd
Micro-Vertex Detector.
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmMCDataArray
Access to a MC data branch for time-based analysis.
Definition: CbmMCDataArray.h:35
CbmMatchRecoToMC::fMuchClusterMatches
TClonesArray * fMuchClusterMatches
Tracks [in].
Definition: CbmMatchRecoToMC.h:189
CbmMatchRecoToMC::fStsTracks
TClonesArray * fStsTracks
Hits [in].
Definition: CbmMatchRecoToMC.h:173
CbmStsHit::GetFrontClusterId
Int_t GetFrontClusterId() const
Definition: CbmStsHit.h:93
CbmDigiManager::GetNofDigis
static Int_t GetNofDigis(ECbmModuleId systemId)
Definition: CbmDigiManager.cxx:62
CbmRichRing::GetNofHits
Int_t GetNofHits() const
Definition: CbmRichRing.h:40
CbmRichRing
Definition: CbmRichRing.h:17
CbmHit::GetRefId
Int_t GetRefId() const
Definition: CbmHit.h:72
CbmMatchRecoToMC
Definition: CbmMatchRecoToMC.h:26
CbmMatchRecoToMC::fStsPoints
CbmMCDataArray * fStsPoints
Hit matches [out].
Definition: CbmMatchRecoToMC.h:170
CbmMatchRecoToMC::MatchHits
void MatchHits(const TClonesArray *matches, const TClonesArray *hits, TClonesArray *hitMatches)
Definition: CbmMatchRecoToMC.cxx:447
CbmTofDigi.h
CbmRichRing.h
ECbmModuleId::kTof
@ kTof
Time-of-flight Detector.
CbmTrackMatchNew::SetNofTrueHits
void SetNofTrueHits(Int_t nofTrueHits)
Definition: CbmTrackMatchNew.h:45
CbmMatch.h
CbmMatchRecoToMC::fMvdPoints
CbmMCDataArray * fMvdPoints
Interface to digi branches.
Definition: CbmMatchRecoToMC.h:163
CbmMatchRecoToMC.h
FairTask for matching RECO data to MC.
CbmMatchRecoToMC::fTrdTracks
TClonesArray * fTrdTracks
Hits [in].
Definition: CbmMatchRecoToMC.h:197
CbmDigiManager::Instance
static CbmDigiManager * Instance()
Static instance.
Definition: CbmDigiManager.h:93
CbmCluster::GetNofDigis
Int_t GetNofDigis() const
Number of digis in cluster.
Definition: CbmCluster.h:69
CbmMatchRecoToMC::fMuchPixelHitMatches
TClonesArray * fMuchPixelHitMatches
Cluster matches [out].
Definition: CbmMatchRecoToMC.h:190
CbmDigiManager::IsMatchPresent
static Bool_t IsMatchPresent(ECbmModuleId systemId)
Presence of a digi match branch.
Definition: CbmDigiManager.cxx:104
CbmRichDigi.h
CbmStsTrack::GetNofMvdHits
Int_t GetNofMvdHits() const
Definition: CbmStsTrack.h:84
CbmMatchRecoToMC::Init
virtual InitStatus Init()
Derived from FairTask.
Definition: CbmMatchRecoToMC.cxx:112
CbmStsHit
data class for a reconstructed 3-d hit in the STS
Definition: CbmStsHit.h:31
CbmStsAddress::GetSystemId
ECbmModuleId GetSystemId(Int_t address)
Get system Id (should be ECbmModuleId::kSts)
Definition: CbmStsAddress.cxx:190
CbmMatchRecoToMC::fTofPoints
CbmMCDataArray * fTofPoints
Track matches [out].
Definition: CbmMatchRecoToMC.h:203
CbmMatchRecoToMC::fMvdHitMatches
TClonesArray * fMvdHitMatches
Cluster matches [out].
Definition: CbmMatchRecoToMC.h:167
CbmRichRing::GetHit
UInt_t GetHit(Int_t i) const
Definition: CbmRichRing.h:42
CbmMatchRecoToMC::fMuchTrackMatches
TClonesArray * fMuchTrackMatches
Hit matches [out].
Definition: CbmMatchRecoToMC.h:191
CbmTrack
Definition: CbmTrack.h:32
CbmStsTrack.h
Data class for STS tracks.
CbmHit.h
CbmMatchRecoToMC::fMCTracks
CbmMCDataArray * fMCTracks
Definition: CbmMatchRecoToMC.h:159
CbmMatchRecoToMC::fDigiManager
CbmDigiManager * fDigiManager
Monte-Carlo tracks.
Definition: CbmMatchRecoToMC.h:160
tracks
TClonesArray * tracks
Definition: Analyze_matching.h:17
CbmMCTrack::GetNPoints
Int_t GetNPoints(ECbmModuleId detId) const
Definition: CbmMCTrack.cxx:186
mcTracks
static vector< vector< QAMCTrack > > mcTracks
Definition: CbmTofHitFinderTBQA.cxx:112
CbmTrack.h
CbmDigiManager::Get
const Digi * Get(Int_t index) const
Get a digi object.
Definition: CbmDigiManager.h:52
CbmMatchRecoToMC::fTofHits
TClonesArray * fTofHits
CbmTofPoint array.
Definition: CbmMatchRecoToMC.h:204
CbmMatchRecoToMC::fTrdHitMatches
TClonesArray * fTrdHitMatches
Cluster matches [out].
Definition: CbmMatchRecoToMC.h:199
CbmMCDataArray::Get
TObject * Get(const CbmLink *lnk)
Definition: CbmMCDataArray.h:47
CbmTrack::GetHitIndex
Int_t GetHitIndex(Int_t iHit) const
Definition: CbmTrack.h:54
CbmMatchRecoToMC::fTrdTrackMatches
TClonesArray * fTrdTrackMatches
Hit matches [out].
Definition: CbmMatchRecoToMC.h:200
CbmTrackMatchNew.h
CbmMatch::AddLink
void AddLink(const CbmLink &newLink)
Definition: CbmMatch.cxx:42
CbmMatchRecoToMC::fRichTrackMatches
TClonesArray * fRichTrackMatches
Rings [in].
Definition: CbmMatchRecoToMC.h:182
CbmMatchRecoToMC::GetMcTrackMotherIdsForRichHit
static std::vector< std::pair< Int_t, Int_t > > GetMcTrackMotherIdsForRichHit(CbmDigiManager *digiMan, const CbmRichHit *hit, CbmMCDataArray *richPoints, CbmMCDataArray *mcTracks, Int_t eventNumber)
Return McTrack Ids for RICH hit C++11 efficient way to return vector.
Definition: CbmMatchRecoToMC.cxx:821
CbmDigiManager::GetMatch
const CbmMatch * GetMatch(ECbmModuleId systemId, UInt_t index) const
Get a match object.
Definition: CbmDigiManager.cxx:54
CbmTrackMatchNew::SetNofWrongHits
void SetNofWrongHits(Int_t nofWrongHits)
Definition: CbmTrackMatchNew.h:46
ECbmModuleId::kRich
@ kRich
Ring-Imaging Cherenkov Detector.
CbmMatchRecoToMC::fStsHitMatches
TClonesArray * fStsHitMatches
Cluster matches [out].
Definition: CbmMatchRecoToMC.h:175
CbmDigiManager
CbmDigiManager.
Definition: CbmDigiManager.h:37
CbmMatchRecoToMC::fMuchClusters
TClonesArray * fMuchClusters
MC points [in].
Definition: CbmMatchRecoToMC.h:186
CbmMatchRecoToMC::MatchHitsSts
void MatchHitsSts(const TClonesArray *clusterMmatches, const TClonesArray *hits, TClonesArray *hitMatches)
Match STS hits, using cluster match objects.
Definition: CbmMatchRecoToMC.cxx:461
CbmPixelHit.h
CbmTrack::GetHitType
HitType GetHitType(Int_t iHit) const
Definition: CbmTrack.h:55
first
bool first
Definition: LKFMinuit.cxx:143
CbmTofDigi
Data class for expanded digital TOF information.
Definition: CbmTofDigi.h:38
CbmMCDataManager
Task class creating and managing CbmMCDataArray objects.
Definition: CbmMCDataManager.h:27
ECbmModuleId::kTrd
@ kTrd
Transition Radiation Detector.
CbmMatchRecoToMC::fRichRings
TClonesArray * fRichRings
Hits [in].
Definition: CbmMatchRecoToMC.h:181
CbmMatchRecoToMC::fTofHitDigiMatches
TClonesArray * fTofHitDigiMatches
CbmTofHit array.
Definition: CbmMatchRecoToMC.h:205
CbmMatchRecoToMC::fEventNumber
static Int_t fEventNumber
Definition: CbmMatchRecoToMC.h:154
CbmMatchRecoToMC::fTrdClusters
TClonesArray * fTrdClusters
MC points [in].
Definition: CbmMatchRecoToMC.h:195
points
TClonesArray * points
Definition: Analyze_matching.h:18
CbmMCTrack.h
CbmStsHit::GetBackClusterId
Int_t GetBackClusterId() const
Definition: CbmStsHit.h:69
CbmMatchRecoToMC::MatchHitsTof
void MatchHitsTof(const TClonesArray *HitDigiMatches, const TClonesArray *hits, TClonesArray *hitMatches)
Definition: CbmMatchRecoToMC.cxx:491
CbmTrackMatchNew::GetNofTrueHits
Int_t GetNofTrueHits() const
Definition: CbmTrackMatchNew.h:32
CbmMatch::AddLinks
void AddLinks(const CbmMatch &match)
Definition: CbmMatch.cxx:35
CbmDigiManager.h
CbmCluster
Base class for cluster objects.
Definition: CbmCluster.h:26
CbmMatchRecoToMC::MatchRichRings
void MatchRichRings(const TClonesArray *richRings, const TClonesArray *richHits, CbmMCDataArray *richMcPoints, CbmMCDataArray *mcTracks, TClonesArray *ringMatches)
Definition: CbmMatchRecoToMC.cxx:756
CbmMatchRecoToMC::fStsClusterMatches
TClonesArray * fStsClusterMatches
Tracks [in].
Definition: CbmMatchRecoToMC.h:174
CbmMatchRecoToMC::fMuchPixelHits
TClonesArray * fMuchPixelHits
Clusters [in].
Definition: CbmMatchRecoToMC.h:187
CbmMCTrack
Definition: CbmMCTrack.h:34
CbmHit
Definition: CbmHit.h:38
CbmMatchRecoToMC::MatchTracks
void MatchTracks(const TClonesArray *hitMatches, CbmMCDataArray *points, const TClonesArray *tracks, TClonesArray *trackMatches)
Definition: CbmMatchRecoToMC.cxx:559
CbmMatchRecoToMC::fStsClusters
TClonesArray * fStsClusters
MC points [in].
Definition: CbmMatchRecoToMC.h:171
kMUCHSTRAWHIT
@ kMUCHSTRAWHIT
Definition: CbmHit.h:24
hits
static vector< vector< QAHit > > hits
Definition: CbmTofHitFinderTBQA.cxx:114
CbmStsTrack::GetMvdHitIndex
Int_t GetMvdHitIndex(Int_t iHit) const
Definition: CbmStsTrack.h:70
CbmPixelHit
Definition: CbmPixelHit.h:21
CbmStsAddress.h
kMUCHPIXELHIT
@ kMUCHPIXELHIT
Definition: CbmHit.h:23
ECbmModuleId::kMuch
@ kMuch
Muon detection system.
CbmTrackMatchNew
Definition: CbmTrackMatchNew.h:19
CbmMatch::GetLinks
const std::vector< CbmLink > & GetLinks() const
Definition: CbmMatch.h:36
CbmMatchRecoToMC::MatchStsTracks
void MatchStsTracks(const TClonesArray *mvdHitMatches, const TClonesArray *stsHitMatches, CbmMCDataArray *mvdPoints, CbmMCDataArray *stsPoints, const TClonesArray *tracks, TClonesArray *trackMatches)
Definition: CbmMatchRecoToMC.cxx:637
CbmMatchRecoToMC::MatchHitsToPoints
void MatchHitsToPoints(CbmMCDataArray *points, const TClonesArray *hits, TClonesArray *hitMatches)
Definition: CbmMatchRecoToMC.cxx:544
CbmCluster.h
Base class for cluster objects.
CbmTofDigi::GetTot
Double_t GetTot() const
Alias for GetCharge.
Definition: CbmTofDigi.h:120
CbmRichHit.h
CbmMatchRecoToMC::fTrdPoints
CbmMCDataArray * fTrdPoints
Track matches [out].
Definition: CbmMatchRecoToMC.h:194
CbmStsTrack
Definition: CbmStsTrack.h:37
CbmRichPoint
Definition: CbmRichPoint.h:24
ECbmModuleId::kSts
@ kSts
Silicon Tracking System.
CbmMatchRecoToMC::MatchClusters
void MatchClusters(const TClonesArray *digiMatches, const TClonesArray *clusters, TClonesArray *clusterMatches)
Generic creation of cluster match objects.
Definition: CbmMatchRecoToMC.cxx:412
CbmCluster::GetDigi
Int_t GetDigi(Int_t index) const
Get digi at position index.
Definition: CbmCluster.h:76
CbmMatchRecoToMC::fMuchTracks
TClonesArray * fMuchTracks
Hits [in].
Definition: CbmMatchRecoToMC.h:188
CbmMatchRecoToMC::fTofHitMatches
TClonesArray * fTofHitMatches
Match Hit -> Digi [out].
Definition: CbmMatchRecoToMC.h:206
CbmMatchRecoToMC::MatchHitsMvd
void MatchHitsMvd(const TClonesArray *hits, TClonesArray *hitMatches)
Definition: CbmMatchRecoToMC.cxx:478
CbmMatchRecoToMC::fIncludeMvdHitsInStsTrack
Bool_t fIncludeMvdHitsInStsTrack
Definition: CbmMatchRecoToMC.h:156
CbmRichHit
Definition: CbmRichHit.h:19
CbmStsHit.h
Data class for a reconstructed hit in the STS.
CbmStsTrack::GetNofStsHits
Int_t GetNofStsHits() const
Definition: CbmStsTrack.h:90