MarlinTrkProcessors  2.4.1
CalcTrackerHitResiduals.h
1 #ifndef CalcTrackerHitResiduals_h
2 #define CalcTrackerHitResiduals_h 1
3 
4 #include "marlin/Processor.h"
5 #include "lcio.h"
6 #include <string>
7 
8 #include <EVENT/TrackerHit.h>
9 #include <EVENT/SimTrackerHit.h>
10 #include <IMPL/LCCollectionVec.h>
11 
12 #include <UTIL/BitField64.h>
13 #include <UTIL/ILDConf.h>
14 
15 namespace EVENT{
16  class MCParticle ;
17  class Track ;
18 }
19 
20 namespace IMPL {
21  class TrackImpl ;
22 }
23 
24 namespace UTIL{
25  class LCRelationNavigator ;
26 }
27 
28 
29 namespace MarlinTrk{
30  class IMarlinTrkSystem ;
31 }
32 
33 class TFile;
34 class TH1F;
35 
36 #define MAXBUFFERSIZE 100
37 
56 class CalcTrackerHitResiduals : public marlin::Processor {
57 
58 public:
59 
60  virtual marlin::Processor* newProcessor() { return new CalcTrackerHitResiduals ; }
61 
62 
64 
68  virtual void init() ;
69 
72  virtual void processRunHeader( LCRunHeader* run ) ;
73 
76  virtual void processEvent( LCEvent * evt ) ;
77 
78 
79  virtual void check( LCEvent * evt ) ;
80 
81 
84  virtual void end() ;
85 
86 protected:
87 
88 // void bookHistograms();
89 
90  void createHistogramBuffers();
91 
92  void fill_histo(const std::string& name, float value);
93 
94  void write_buffer_to_histo( std::map<std::string, std::list<float>*>::iterator it_buffer );
95 
96  const LCObjectVec* getSimHits( TrackerHit* trkhit, const FloatVec* weights = NULL);
97 
98 
99 
100  UTIL::BitField64* _encoder;
101  int getDetectorID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::subdet]; }
102  int getSideID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::side]; };
103  int getLayerID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::layer]; };
104  int getModuleID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::module]; };
105  int getSensorID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::sensor]; };
106 
107 
109  LCCollection* GetCollection( LCEvent * evt, std::string colName ) ;
110 
112  LCRelationNavigator* GetRelations( LCEvent * evt, std::string RelName ) ;
113 
115  void SetupInputCollections( LCEvent * evt ) ;
116 
117 
120  std::vector< std::string > _colNamesTrackerHits;
121 
124  std::vector< std::string > _colNamesTrackerHitRelations;
125 
126 
127 // int _nEventPrintout ;
128  int _n_run ;
129  int _n_evt ;
130  int _current_evt_number ;
131 
132 
133  std::vector< LCCollection* > _colTrackerHits;
134  std::vector< LCRelationNavigator* > _navTrackerHitRel;
135 
136 
137  TFile* _root_file;
138 
139  std::map<std::string, TH1F*> _histo_map;
140  std::map<std::string, TH1F*>::iterator _histo_map_it;
141 
142  std::map<std::string, std::list<float>*> _histo_buffer_map;
143 
144 
145 } ;
146 
147 #endif
148 
149 
150 
virtual void processEvent(LCEvent *evt)
Called for every event - the working horse.
Definition: CalcTrackerHitResiduals.cc:136
LCRelationNavigator * GetRelations(LCEvent *evt, std::string RelName)
helper function to get relations using try catch block
Definition: CalcTrackerHitResiduals.cc:464
virtual void processRunHeader(LCRunHeader *run)
Called for every run.
Definition: CalcTrackerHitResiduals.cc:131
Set the LCIO Extensions to relate SimTrackerHits to TrackerHits via a pointer.
Definition: CalcTrackerHitResiduals.h:56
virtual void end()
Called after data processing for clean up.
Definition: CalcTrackerHitResiduals.cc:375
std::vector< std::string > _colNamesTrackerHits
input TrackerHit collections
Definition: CalcTrackerHitResiduals.h:120
LCCollection * GetCollection(LCEvent *evt, std::string colName)
helper function to get collection using try catch block
Definition: CalcTrackerHitResiduals.cc:445
std::vector< std::string > _colNamesTrackerHitRelations
input relation collections
Definition: CalcTrackerHitResiduals.h:124
virtual void init()
Called at the begin of the job before anything is read.
Definition: CalcTrackerHitResiduals.cc:100
void SetupInputCollections(LCEvent *evt)
sets up the different collections
Definition: CalcTrackerHitResiduals.cc:410