Overlay  0.16.0
OverlayBX.h
1 #ifndef OverlayBX_h
2 #define OverlayBX_h 1
3 
4 #include "marlin/Processor.h"
5 #include "marlin/EventModifier.h"
6 #include "lcio.h"
7 #include <string>
8 #include <vector>
9 
10 
11 #ifdef MARLIN_USE_AIDA
12 #include <vector>
13 #include <AIDA/AIDA.h>
14 typedef std::vector< AIDA::IHistogram1D* > Hist1DVec ;
15 #endif
16 
17 
18 #include "CLHEP/Vector/TwoVector.h"
19 
20 namespace overlay{
21 
23  struct VXDLadder{
24  double phi ; // phi off ladder
25  CLHEP::Hep2Vector p0 ; // 'left' end of ladder in r-phi
26  CLHEP::Hep2Vector p1 ; // 'right' end of ladder in r-phi
27  CLHEP::Hep2Vector u ; // unit vector along ladder in r-phi
28  };
29  typedef std::vector< std::vector< VXDLadder > > VXDLadders ;
30 
32  struct VXDLayer{
33  int nBX ;
34  double width ;
35  double ladderArea ;
36  int nLadders ;
37  VXDLayer(): nBX(0), width(0), ladderArea(0), nLadders(0) {}
38  };
39  typedef std::vector< VXDLayer > VXDLayers ;
40 
41 
42  // /** Helper struct for TPC parameters */
43  // struct TPCParameters{ };
44 
45 
94  class OverlayBX : public marlin::Processor, public marlin::EventModifier {
95 
96  public:
97 
98  virtual marlin::Processor* newProcessor() { return new OverlayBX ; }
99 
100 
101  OverlayBX() ;
102 
103  virtual const std::string & name() const { return Processor::name() ; }
104 
105  virtual void modifyEvent( LCEvent * evt ) ;
106 
107 
111  virtual void init() ;
112 
115  virtual void processRunHeader( LCRunHeader* run ) ;
116 
119  // virtual void processEvent( LCEvent * evt ) ;
120 
121 
122  virtual void check( LCEvent * evt ) ;
123 
124 
127  virtual void end() ;
128 
129 
130  protected:
131 
133  // LCEvent* readNextEvent() ;
134 
136  LCEvent* readNextEvent(int bxNum) ;
137 
139  void init_geometry() ;
141  int mergeVXDColsFromBX( LCCollection* vxdCol , LCCollection* vxdBGCol , int bxNum ) ;
143  int mergeTPCColsFromBX( LCCollection* tpcCol , LCCollection* tpcBGCol , float zPosShift ) ;
144 
145  // ---- variables for processor parameters -----
146  StringVec _inputFileNames ;
147  int _eventsPerBX;
148  float _bxTime_s ;
149  float _tpcVdrift_mm_s ;
150  int _maxBXsTPC ;
151 
152  bool _keepPairsTruthInfo ;
153  bool _phiRotateTPCHits ;
154 
155  FloatVec _vxdLayerReadOutTimes ;
156 
157  StringVec _tpcCollections ;
158  // std::string _tpcCollection ;
159 
160  std::string _mcpCollection ;
161 
162  std::string _vxdCollection ;
163  StringVec _mergeCollections ;
164  int _ranSeed ;
165 
166  //---- class member variables ------
167  typedef std::map<std::string, std::string> StrMap ;
168  StrMap _tpcMap;
169  StrMap _colMap;
170  // std::map<std::string, std::string> _colMap;
171 
172  std::vector< LCReader* > _lcReaders ;
173  int _maxBXs ;
174  int _nRun ;
175  int _nEvt ;
176  // VXDLadders _vxdLadders ;
177  VXDLayers _vxdLayers ;
178 
179  int _lastBXNum ;
180  int _lastEvent ;
181  int _currentRdr ;
182 
183 #ifdef MARLIN_USE_AIDA
184  Hist1DVec _hist1DVec ;
185 #endif
186 
187  } ;
188 
189 } // namespace
190 
191 
192 #endif
193 
194 
195 
virtual void init()
Called at the begin of the job before anything is read.
Definition: OverlayBX.cc:165
int mergeVXDColsFromBX(LCCollection *vxdCol, LCCollection *vxdBGCol, int bxNum)
helper function
Definition: OverlayBX.cc:659
Helper struct for VXD ladder geometry.
Definition: OverlayBX.h:23
LCEvent * readNextEvent(int bxNum)
helper function for (randomly) reading the next event
Definition: OverlayBX.cc:328
Helper struct for VXD layer geometry.
Definition: OverlayBX.h:32
virtual void processRunHeader(LCRunHeader *run)
Called for every run.
Definition: OverlayBX.cc:266
virtual void end()
Called after data processing for clean up.
Definition: OverlayBX.cc:955
Helper struct for TPC parameters.
Definition: OverlayBX.h:94
virtual void check(LCEvent *evt)
Called for every event - the working horse.
Definition: OverlayBX.cc:845
int mergeTPCColsFromBX(LCCollection *tpcCol, LCCollection *tpcBGCol, float zPosShift)
helper function
Definition: OverlayBX.cc:729
void init_geometry()
helper function
Definition: OverlayBX.cc:990