ForwardTracking  1.10.0
TrackingFeedbackProcessor.h
1 #ifndef TrackingFeedbackProcessor_h
2 #define TrackingFeedbackProcessor_h 1
3 
4 #include <string>
5 
6 #include "marlin/Processor.h"
7 #include "lcio.h"
8 #include "EVENT/LCCollection.h"
9 #include "EVENT/MCParticle.h"
10 #include "EVENT/LCRelation.h"
11 #include "EVENT/Track.h"
12 
13 #include "TROOT.h"
14 #include "TTree.h"
15 #include "TFile.h"
16 
17 #include "TrueTrack.h"
18 #include "RecoTrack.h"
19 
20 
21 
22 using namespace lcio ;
23 using namespace marlin ;
24 
25 
102 class TrackingFeedbackProcessor : public Processor {
103 
104  public:
105 
106  virtual Processor* newProcessor() { return new TrackingFeedbackProcessor ; }
107 
108 
110 
114  virtual void init() ;
115 
118  virtual void processRunHeader( LCRunHeader* run ) ;
119 
122  virtual void processEvent( LCEvent * evt ) ;
123 
124 
125  virtual void check( LCEvent * evt ) ;
126 
127 
130  virtual void end() ;
131 
132 
133  protected:
134 
135 
136  double _Bz; //B field in z direction
137 
138 
142  std::string _TrackCollection;
143 
144 
145  std::string _tableFileName;
146 
147 
148  int _nRun ;
149  int _nEvt ;
150 
151  double _cutPtMin;
152  double _cutDistToIPMax;
153  double _cutChi2Prob;
154  int _cutNHitsMin;
155  bool _cutNHitsMin_HitsCountOncePerLayer;
156  double _cutThetaMin;
157  double _cutThetaMax;
158  bool _cutFitFails;
159 
160 
161  bool _MSOn ;
162  bool _ElossOn ;
163  bool _SmoothOn ;
164 
165 
166 
167  unsigned _nComplete; // complete tracks without extra points
168  unsigned _nCompletePlus; // complete tracks with extra points
169  unsigned _nLost; // lost tracks = tracks that do exist in reality (mcp), but are not represented in the tracksearch results
170  unsigned _nIncomplete; // incomplete tracks without extra points. i.e.: tracks that are too short (for example 1 or 2 hits are still missing)
171  unsigned _nIncompletePlus; // incomplete tracks with extra points. the reconstructed track belongs to the true track that hold more than half of the points of the track
172  unsigned _nGhost; // ghost tracks = tracks that are reconstructed, but don't actually exist. Pure fiction. a ghost track
173  // is a track, where no real track owns more than half of the tracks hits.
174  unsigned _nFoundCompletely; // tracks have been found that contain all the hits of this track
175  unsigned _nRecoTracks; // the number of reconstructed tracks, that were compared to the true tracks
176  unsigned _nDismissedTrueTracks; // number of the true tracks, that haven't been used
177  unsigned _nValidTrueTracks; // number of valid true tracks, i.e. true tracks not failing the cuts
178  unsigned _nClones; // the number of tracks that are reconstructed although there already is a reconstruction
179  // --> The number of clones for a true track is nReco - 1, or 0 if there are no reco tracks
180 
181  unsigned _nComplete_Sum;
182  unsigned _nCompletePlus_Sum;
183  unsigned _nLost_Sum;
184  unsigned _nIncomplete_Sum;
185  unsigned _nIncompletePlus_Sum;
186  unsigned _nGhost_Sum;
187  unsigned _nFoundCompletely_Sum;
188  unsigned _nRecoTracks_Sum;
189  unsigned _nDismissedTrueTracks_Sum;
190  unsigned _nValidTrueTracks_Sum;
191  unsigned _nClones_Sum;
192 
193 
194  std::vector< TrueTrack* > _trueTracks;
195  std::vector< RecoTrack* > _recoTracks;
196 
197  bool _drawMCPTracks;
198  bool _saveAllEventsSummary;
199  std::string _summaryFileName;
200 
201 
202 
203 
204  void checkTheTrack( RecoTrack* recoTrack );
205  TrueTrack* getAssignedTrueTrack( std::vector<TrueTrack*> relatedTrueTracks , unsigned& nHitsFromAssignedTrueTrack );
206 
207  unsigned getNumberOfHitsFromDifferentLayers( std::vector< TrackerHit* > hits );
208  double getDistToIP( MCParticle* mcp );
209 
210  MarlinTrk::IMarlinTrkSystem* _trkSystem;
211 
212  TTree * _treeTrueTracks;
213  TTree * _treeRecoTracks;
214  TFile * _rootFile;
215  std::string _rootFileName;
216  bool _rootFileAppend;
217  std::string _treeNameTrueTracks;
218  std::string _treeNameRecoTracks;
219 
220 
221  void saveRootInformation();
222  void makeRootBranches();
223  void setRootBranches();
224 
225 
226  float _rateOfFoundHitsMin; //more than this number of hits of the real track must be in the reco track
227  float _rateOfAssignedHitsMin; //more than this number of hits of the reco track must belong to the assigned true track
228 
229 
230 
231  int _trueTrack_nComplete;
232  int _trueTrack_nCompletePlus;
233  int _trueTrack_nIncomplete;
234  int _trueTrack_nIncompletePlus;
235  int _trueTrack_nSum;
236  double _trueTrack_pt;
237  double _trueTrack_theta;
238  int _trueTrack_nHits;
239  double _trueTrack_vertexX;
240  double _trueTrack_vertexY;
241  double _trueTrack_vertexZ;
242  double _trueTrack_chi2prob;
243  double _trueTrack_chi2;
244  int _trueTrack_Ndf;
245 
246  int _recoTrack_nTrueTracks;
247  double _recoTrack_pt;
248  double _recoTrack_chi2prob;
249  double _recoTrack_chi2;
250  int _recoTrack_Ndf;
251 
252 
253 } ;
254 
255 #endif
256 
257 
258 
A class to make linking reconstructed tracks and true tracks easier.
Definition: RecoTrack.h:38
std::string _colNameMCTrueTracksRel
Input collection name.
Definition: TrackingFeedbackProcessor.h:141
Feedback for the efficiency and the ghostrate of the tracking.
Definition: TrackingFeedbackProcessor.h:102
A class to make linking reconstructed tracks and true tracks easier.
Definition: TrueTrack.h:21