CbmRoot
CbmRichRingTrackAssignIdeal.cxx
Go to the documentation of this file.
1 
9 
10 #include "TClonesArray.h"
11 
12 #include "CbmRichRing.h"
13 
14 #include "CbmGlobalTrack.h"
15 #include "CbmMCTrack.h"
16 #include "CbmTrackMatchNew.h"
17 #include "FairRootManager.h"
18 #include "FairTrackParam.h"
19 
20 #include <iostream>
21 
22 using std::cout;
23 using std::endl;
24 
26  : fMcTracks(NULL)
27  , fGlobalTracks(NULL)
28  , fRingMatches(NULL)
29  , fStsTrackMatches(NULL) {}
30 
32 
34  FairRootManager* ioman = FairRootManager::Instance();
35  if (NULL == ioman) {
36  Fatal("CbmRichRingTrackAssignIdeal::Init", "RootManager not instantised!");
37  }
38 
39  fMcTracks = (TClonesArray*) ioman->GetObject("MCTrack");
40  if (NULL == fMcTracks) {
41  Fatal("CbmRichRingTrackAssignIdeal::Init", "No MCTrack array!");
42  }
43 
44  fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
45  if (NULL == fGlobalTracks) {
46  Fatal("CbmRichRingTrackAssignIdeal::Init", "No GlobalTrack array!");
47  }
48 
49  fRingMatches = (TClonesArray*) ioman->GetObject("RichRingMatch");
50  if (NULL == fRingMatches) {
51  Fatal("CbmRichRingTrackAssignIdeal::Init", "No RichRingMatch array!");
52  }
53 
54  fStsTrackMatches = (TClonesArray*) ioman->GetObject("StsTrackMatch");
55  if (NULL == fStsTrackMatches) {
56  Fatal("CbmRichRingTrackAssignIdeal::Init", "No StsTrackMatch array!");
57  }
58 }
59 
61  TClonesArray* richProj) {
62  Int_t nofTracks = richProj->GetEntriesFast();
63  Int_t nofRings = rings->GetEntriesFast();
64 
65  for (Int_t iRing = 0; iRing < nofRings; iRing++) {
66  CbmRichRing* pRing = (CbmRichRing*) rings->At(iRing);
67  if (NULL == pRing) continue;
68  if (pRing->GetNofHits() < fMinNofHitsInRing) continue;
69 
70  CbmTrackMatchNew* pRingMatch = (CbmTrackMatchNew*) fRingMatches->At(iRing);
71  if (NULL == pRingMatch) continue;
72  Int_t ringID = pRingMatch->GetMatchedLink().GetIndex();
73  // Double_t xRing = pRing->GetCenterX();
74  // Double_t yRing = pRing->GetCenterY();
75 
76  for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
77  FairTrackParam* pTrack = (FairTrackParam*) richProj->At(iTrack);
78  if (NULL == pTrack) continue;
79  Double_t xTrack = pTrack->GetX();
80  Double_t yTrack = pTrack->GetY();
81 
82  // no projection to photodetector plane
83  if (xTrack == 0 && yTrack == 0) continue;
84 
85  CbmGlobalTrack* gTrack = (CbmGlobalTrack*) fGlobalTracks->At(iTrack);
86  if (NULL == gTrack) continue;
87  if (gTrack->GetStsTrackIndex() == -1) continue;
88  CbmTrackMatchNew* pTrackMatch =
90  if (NULL == pTrackMatch) continue;
91 
92  if (pTrackMatch->GetMatchedLink().GetIndex() == ringID) {
93  gTrack->SetRichRingIndex(iRing);
94  } // ideal assignement
95  } // loop tracks
96  } // loop rings
97 }
CbmMatch::GetMatchedLink
const CbmLink & GetMatchedLink() const
Definition: CbmMatch.h:37
CbmRichRingTrackAssignIdeal::fGlobalTracks
TClonesArray * fGlobalTracks
Definition: CbmRichRingTrackAssignIdeal.h:51
CbmGlobalTrack.h
CbmRichRing::GetNofHits
Int_t GetNofHits() const
Definition: CbmRichRing.h:40
CbmRichRing
Definition: CbmRichRing.h:17
CbmRichRingTrackAssignIdeal::fMcTracks
TClonesArray * fMcTracks
Definition: CbmRichRingTrackAssignIdeal.h:50
CbmRichRingTrackAssignIdeal::~CbmRichRingTrackAssignIdeal
virtual ~CbmRichRingTrackAssignIdeal()
Destructor.
Definition: CbmRichRingTrackAssignIdeal.cxx:31
CbmRichRingTrackAssignIdeal.h
Ideal Ring-Track Assignment. CbmRichRingMatch must be run prior to this procedure.
CbmRichRing.h
CbmRichRingTrackAssignIdeal::fStsTrackMatches
TClonesArray * fStsTrackMatches
Definition: CbmRichRingTrackAssignIdeal.h:53
CbmGlobalTrack::GetStsTrackIndex
Int_t GetStsTrackIndex() const
Definition: CbmGlobalTrack.h:38
CbmTrackMatchNew.h
CbmRichRingTrackAssignIdeal::DoAssign
virtual void DoAssign(TClonesArray *rings, TClonesArray *richProj)
Inherited from CbmRichRingTrackAssignBase.
Definition: CbmRichRingTrackAssignIdeal.cxx:60
CbmRichRingTrackAssignIdeal::Init
void Init()
Inherited from CbmRichRingTrackAssignBase.
Definition: CbmRichRingTrackAssignIdeal.cxx:33
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
richProj
TClonesArray * richProj
Definition: Compute_distance.h:18
CbmMCTrack.h
CbmRichRingTrackAssignIdeal::fRingMatches
TClonesArray * fRingMatches
Definition: CbmRichRingTrackAssignIdeal.h:52
CbmTrackMatchNew
Definition: CbmTrackMatchNew.h:19
CbmRichRingTrackAssignBase::fMinNofHitsInRing
int fMinNofHitsInRing
Definition: CbmRichRingTrackAssignBase.h:51
CbmGlobalTrack::SetRichRingIndex
void SetRichRingIndex(Int_t iRing)
Definition: CbmGlobalTrack.h:57
CbmRichRingTrackAssignIdeal::CbmRichRingTrackAssignIdeal
CbmRichRingTrackAssignIdeal()
Default constructor.
Definition: CbmRichRingTrackAssignIdeal.cxx:25
rings
TClonesArray * rings
Definition: Analyze_matching.h:21