PandaRoot
PndTrackFunctor.h
Go to the documentation of this file.
1 /*
2  * PndTrackFunctor.h
3  *
4  * Created on: 02.02.2017
5  * Author: Stockmanns
6  */
7 
8 #ifndef PNDTOOLS_TRACKINGQA_PNDTRACKFUNCTOR_H_
9 #define PNDTOOLS_TRACKINGQA_PNDTRACKFUNCTOR_H_
10 
11 #include "FairMultiLinkedData.h"
12 #include "FairRootManager.h"
13 
14 #include <functional>
15 
16 class PndTrackFunctor : public std::binary_function<FairMultiLinkedData *, Bool_t, Bool_t> {
17  public:
18  virtual Bool_t operator()(FairMultiLinkedData *a, Bool_t primary) { return Call(a, primary); };
19  static PndTrackFunctor *make_PndTrackFunctor(std::string functorName);
20  virtual Bool_t Call(FairMultiLinkedData *a, Bool_t primary) = 0;
21  virtual void Print() = 0;
22 
23  virtual ~PndTrackFunctor(){};
24 };
25 
27  Bool_t Call(FairMultiLinkedData *a, Bool_t)
28  { // primary //[R.K.03/2017] unused variable(s)
29  FairRootManager *ioman = FairRootManager::Instance();
30  Bool_t possibleTrack = kFALSE;
31  possibleTrack =
32  (possibleTrack | ((a->GetLinksWithType(ioman->GetBranchId("MVDHitsPixel")).GetNLinks() + a->GetLinksWithType(ioman->GetBranchId("MVDHitsStrip")).GetNLinks()) > 3));
33 
34  possibleTrack = (possibleTrack | ((a->GetLinksWithType(ioman->GetBranchId("MVDHitsPixel")).GetNLinks() + a->GetLinksWithType(ioman->GetBranchId("MVDHitsStrip")).GetNLinks() +
35  a->GetLinksWithType(ioman->GetBranchId("STTHit")).GetNLinks() + a->GetLinksWithType(ioman->GetBranchId("GEMHit")).GetNLinks()) > 5));
36 
37  return possibleTrack;
38  }
39 
40  void Print() { std::cout << "StandardTrackFunctor: > 3 Hits in MVD or > 5 Hits in (MVD+Stt+GEM)" << std::endl; }
41 };
42 
44  Bool_t Call(FairMultiLinkedData *a, Bool_t)
45  { // primary //[R.K.03/2017] unused variable(s)
46  FairRootManager *ioman = FairRootManager::Instance();
47  Bool_t possibleTrack = kFALSE;
48 
49  possibleTrack = (possibleTrack | (a->GetLinksWithType(ioman->GetBranchId("STTHit")).GetNLinks() > 5));
50 
51  return possibleTrack;
52  }
53  void Print() { std::cout << "OnlySttFunctor: > 5 Hits in Stt" << std::endl; }
54 };
55 
57  Bool_t Call(FairMultiLinkedData *a, Bool_t)
58  {
59  FairRootManager *ioman = FairRootManager::Instance();
60  Bool_t possibleTrack = kFALSE;
61 
62  possibleTrack = (possibleTrack | (a->GetLinksWithType(ioman->GetBranchId("STTSortedHits")).GetNLinks() > 5));
63 
64  return possibleTrack;
65  }
66  void Print() { std::cout << "OnlySttTimeBasedFunctor: > 5 Hits in Stt" << std::endl; }
67 };
68 
70  Bool_t Call(FairMultiLinkedData *a, Bool_t)
71  { // primary //[R.K.03/2017] unused variable(s)
72  FairRootManager *ioman = FairRootManager::Instance();
73  Bool_t possibleTrack = kFALSE;
74  Bool_t mvdHits = ((a->GetLinksWithType(ioman->GetBranchId("MVDHitsPixel")).GetNLinks() + a->GetLinksWithType(ioman->GetBranchId("MVDHitsStrip")).GetNLinks()) > 2);
75 
76  if (mvdHits) {
77  possibleTrack = (a->GetLinksWithType(ioman->GetBranchId("STTHit")).GetNLinks() > 1) | (a->GetLinksWithType(ioman->GetBranchId("GEMHit")).GetNLinks() > 1);
78  }
79  return possibleTrack;
80  }
81  void Print() { std::cout << "RiemannMvdSttGemFunctor: > 2 Hits in MVD and >0 Hits in (Stt+Gem)" << std::endl; }
82 };
83 
85  Bool_t Call(FairMultiLinkedData *a, Bool_t primary)
86  {
87  if (primary == kFALSE)
88  return kFALSE;
89  FairRootManager *ioman = FairRootManager::Instance();
90  Bool_t possibleTrack = kFALSE;
91 
92  Int_t nHitsMvdPixel = a->GetLinksWithType(ioman->GetBranchId("MVDHitsPixel")).GetNLinks();
93  Int_t nHitsMvdStrip = a->GetLinksWithType(ioman->GetBranchId("MVDHitsStrip")).GetNLinks();
94  if (nHitsMvdPixel + nHitsMvdStrip > 2) { // First requirement: more than two MVD hits
95  // Int_t nHitsStt = a->GetLinksWithType(ioman->GetBranchId("STTHit")).GetNLinks();
96  // Int_t nHitsGem = a->GetLinksWithType(ioman->GetBranchId("GEMHit")).GetNLinks();
97  possibleTrack = kTRUE;
98  // possibleTrack = (nHitsMvdPixel + nHitsMvdStrip + nHitsStt + nHitsGem > 6); // Second requirement: More than six hits total
99  }
100  return possibleTrack;
101  }
102  void Print() { std::cout << "CircleHoughTrackFunctor: >= 3 Hits in MVD and primary track" << std::endl; }
103 };
104 
106  Bool_t Call(FairMultiLinkedData *a, Bool_t)
107  { // primary //[R.K.03/2017] unused variable(s)
108  FairRootManager *ioman = FairRootManager::Instance();
109  Bool_t possibleTrack = kFALSE;
110 
111  possibleTrack = (possibleTrack | (a->GetLinksWithType(ioman->GetBranchId("FTSHit")).GetNLinks() > 5));
112 
113  return possibleTrack;
114  }
115  void Print() { std::cout << "FTSTrackFunctor: > 5 Hits in Fts" << std::endl; }
116 };
117 
119  Bool_t Call(FairMultiLinkedData *a, Bool_t primary)
120  {
121  FairRootManager *ioman = FairRootManager::Instance();
122  Bool_t possibleTrack = kFALSE;
123 
124  possibleTrack = (possibleTrack | !(a->GetLinksWithType(ioman->GetBranchId("FTSHit")).GetNLinks() > 0));
125  if (possibleTrack == kFALSE)
126  return kFALSE;
127  StandardTrackFunctor standard;
128  possibleTrack = kFALSE;
129  possibleTrack = (possibleTrack | standard(a, primary));
130 
131  return possibleTrack;
132  }
133  void Print() { std::cout << "noFTSTrackFunctor: no Hits in Fts + standardFunctor!" << std::endl; }
134 };
135 
137  Bool_t Call(FairMultiLinkedData *, Bool_t)
138  { // a primary//[R.K.03/2017] unused variable(s)
139  return kTRUE;
140  }
141  void Print() { std::cout << "AllTracksFunctor: take everything" << std::endl; }
142 };
143 
144 #endif /* PNDTOOLS_TRACKINGQA_PNDTRACKFUNCTOR_H_ */
virtual void Print()=0
virtual ~PndTrackFunctor()
static PndTrackFunctor * make_PndTrackFunctor(std::string functorName)
virtual Bool_t operator()(FairMultiLinkedData *a, Bool_t primary)
virtual Bool_t Call(FairMultiLinkedData *a, Bool_t primary)=0