All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
FPCCDDigitizer.h
Go to the documentation of this file.
1 #ifndef FPCCDDigitizer_h
2 #define FPCCDDigitizer_h 1
3 
4 #include "FPCCDPixelHit.h"
5 
6 #include "marlin/Processor.h"
7 #include "marlin/EventModifier.h"
8 #include "lcio.h"
9 #include <string>
10 #include <vector>
11 
12 #include <marlin/Global.h>
13 #include <IMPL/LCEventImpl.h>
14 #include <gear/GEAR.h>
15 #include <gearimpl/Vector3D.h>
16 #include <gear/BField.h>
17 #include <gear/ZPlanarParameters.h>
18 #include <gear/ZPlanarLayerLayout.h>
19 
20 #include <TFile.h>
21 #include <TTree.h>
22 
23 
24 /**
25 \addtogroup TrackDigi TrackDigi
26 @{
27 
28 \addtogroup FPCCDDigitizer FPCCDDigitizer
29 @{
30 Produces VTXPixelHits collection from VXDCollection collections.
31  * ======= FPCCDDigitizer ========== <br>
32  *
33  * Some modifications are done.
34  * 1. pixel size is changeable in each layer.
35  * 2. some utilities for pair-BG study are set.
36  * @author Tatsuya Mori, Tohoku University: 2014-02-10
37  *
38  *
39  *
40  * Produces VTXPixelHits collection from VXDCollection collections. <br>
41  * VXDCollection is a SimTrackerHit object and VTXPixelHits collection
42  * is a LCGenericObject object, where FPCCD pixel hit information is stored.
43  * Format of LCGenericObject is described in FPCCDData.cc
44  *
45  * PixelHit ID is given by ( layer, ladder, xi, zeta ). xi and zeta are
46  * pixel address in a coordinate system local to a ladder. zeta is along
47  * Z axis, xi is in the ladder plain and eta is perpendicular to the plain
48  * of ladder. Further description will be found in the source code of
49  * FPCCDID::encodeFPCCDID(...)
50  *
51  * Conversion of SimTrackerHit to PixelHits is performed in
52  * FPCCDDigitizer::makePixelHits(...).
53  *
54  * Parameters of this process
55  * Debug : default(0). : if 1, print debug information
56  * FPCCD_PixelSize : default(0.005) : FPCCD pixel size, which is used
57  * digitization
58  *
59  * <br>
60  * @author Akiya Miyamoto, KEK: 2010-04-19
61  */
62 
63 class FPCCDData;
64 
65 namespace EVENT {
66  class SimTrackerHit;
67 }
68 namespace IMPL {
69  class SimTrackerHitImpl;
70 }
71 
72 typedef struct {
73  int layer;
74  int ladder;
75  int xi;
76  int zeta;
77 } FPCCDID_t;
78 
79 
80 // =================================================================
81 class FPCCDDigitizer : public marlin::Processor, public marlin::EventModifier {
82 
83  public:
84  FPCCDDigitizer(const FPCCDDigitizer&) = delete;
85  FPCCDDigitizer& operator=(const FPCCDDigitizer&) = delete;
86 
87  virtual Processor* newProcessor() { return new FPCCDDigitizer ; }
88 
89 
90  FPCCDDigitizer() ;
91 
92  virtual const std::string & name() const { return Processor::name() ; }
93 
94  virtual void modifyEvent( LCEvent * evt ) ;
95 
96 
97  /** Called at the begin of the job before anything is read.
98  * Use to initialize the processor, e.g. book histograms.
99  */
100  virtual void init() ;
101 
102  /** Called for every run.
103  */
104  virtual void processRunHeader( LCRunHeader* run ) ;
105 
106  /** Called for every event - the working horse.
107  */
108  // virtual void processEvent( LCEvent * evt ) ;
109 
110  virtual void check( LCEvent * evt ) ;
111 
112  /** Called after data processing for clean up.
113  */
114  virtual void end() ;
115 
116  // make PixelHits from SimTrackerHits.
117  void makePixelHits(IMPL::SimTrackerHitImpl *simHit, FPCCDData &pxHits);
118  void makePixelHits(IMPL::SimTrackerHitImpl *simHit, FPCCDData &pxHits, int nth_simthit);
119 
120  // Initialize Geometry data
121  void InitGeometry();
122 
123  int getLadderID(const gear::Vector3D* pos, const int layer);
124 
125  void getInOutPosOnLadder( int layer, gear::Vector3D* outpos, gear::Vector3D* inpos, gear::Vector3D* pos,gear::Vector3D* mom);
126  void getInOutPosOfHelixOnLadder( int layer, gear::Vector3D* outpos, gear::Vector3D* inpos, gear::Vector3D* pos,gear::Vector3D* mom, gear::Vector3D* BField,float charge);
127  void ModifyIntoLadder( gear::Vector3D* bemodifiedpos,const int layer,gear::Vector3D* pos,gear::Vector3D* mom);
128  void makeCandidates( std::pair<const gear::Vector3D*,int> edge, std::pair<int,int>* cand_array, int layer);
129  void makeNewSimTHit( IMPL::SimTrackerHitImpl* simthit, gear::Vector3D* newpos, gear::Vector3D* newmom, int layer, int ladder, double newPathLength);
130  bool inSensitiveRegion( gear::Vector3D* pos, int layer);
131 
132  gear::Vector3D* getLocalPos(const gear::Vector3D* pos, const int layer,const int ladder);
133  std::vector<std::pair<const gear::Vector3D*, int> > getIntersectionOfTrkAndPix(const int layer,gear::Vector3D* top,gear::Vector3D* bottom);
134  std::map< std::pair< int, int>*, double> getLocalPixel(IMPL::SimTrackerHitImpl* simthit, std::vector<std::pair<const gear::Vector3D*, int> > edgeofpixel);
135  std::pair< int, int>* FindPixel(std::pair<const gear::Vector3D*, int> f_fst, std::pair<const gear::Vector3D*, int> f_nxt, int f_layer);
136 
137  protected:
138 
139  std::string _colNameVTX{};
140  std::string _outColNameVTX{};
141  LCCollection* col{};
142 
143  int _nRun{};
144  int _nEvt{};
145  int _debug{};
148  double _cutThetaFrom{};
149  double _cutThetaTo{};
150  double _cutPhiFrom{};
151  double _cutPhiTo{};
152 
153  bool _cutMode{};
157  float _pixelSize{};
158  FloatVec _pixelSizeVec{};
159  IntVec _escapedEvtVec{};
160  int _esc_count{};
161  float _pixelheight{};
162 
163  static int _mcp_number;
164 
165  static const int _ARRAY_NUM = 2000;
166  struct{
167  double x[_ARRAY_NUM];
168  double y[_ARRAY_NUM];
169  }_position{};
170  struct{
172  double x[_ARRAY_NUM];
173  double y[_ARRAY_NUM];
174  double z[_ARRAY_NUM];
180  }_simthits{};
181  struct{
182  double px[_ARRAY_NUM];
183  double py[_ARRAY_NUM];
184  double pz[_ARRAY_NUM];
185  double vx[_ARRAY_NUM];
186  double vy[_ARRAY_NUM];
187  double vz[_ARRAY_NUM];
188  }_ori_mcp{};
189 
190  struct{
192  }_something{};
193 
194  struct{
195  int x[6];
196  int y[6];
197  }_counter{};
198 
199 
200  TFile* _rootf{};
201  TTree* _tree{};
202  std::string _rootFileName{};
203  std::string _treeName{};
204 
205  float _momCut{};
206 
207  double _sigmaConst{};
208 
210 
211  bool _isSignal{};
212 
213 // Variables to store geometry information
214  int _nLayer{}; // Number of layers
215  int _maxLadder{}; // max no. of ladder in each layer
216 
217  struct GeoData_t {
218  int nladder{};
219  double rmin{}; // distance of inner surface of sensitive region from IP
220  double dphi{}; // azimuthal angle step of each ladder
221  double phi0{}; // aximuthal angle offset
222  std::vector<double> cosphi{}; // cos[phi_ladder], cos_phi of each ladder
223  std::vector<double> sinphi{}; // sin[phi_ladder], sin_phi of each ladder
224  double sthick{}; // sensitive region thickness
225  double sximin{}; // minimum xi of sensitive region.
226  double sximax{}; // maximum xi of sensitive region
227  double hlength{}; // ladder's half length in z
228  };
229  std::vector<GeoData_t> _geodata{};
230 
231 } ;
232 /** @} @} */
233 #endif
std::string _outColNameVTX
std::vector< std::pair< const gear::Vector3D *, int > > getIntersectionOfTrkAndPix(const int layer, gear::Vector3D *top, gear::Vector3D *bottom)
double px[_ARRAY_NUM]
double vy[_ARRAY_NUM]
int pdg[_ARRAY_NUM]
void getInOutPosOfHelixOnLadder(int layer, gear::Vector3D *outpos, gear::Vector3D *inpos, gear::Vector3D *pos, gear::Vector3D *mom, gear::Vector3D *BField, float charge)
int getLadderID(const gear::Vector3D *pos, const int layer)
struct FPCCDDigitizer::@14 _position
double x[_ARRAY_NUM]
struct FPCCDDigitizer::@18 _counter
double pz[_ARRAY_NUM]
virtual void modifyEvent(LCEvent *evt)
CLHEP::Hep3Vector Vector3D
struct FPCCDDigitizer::@17 _something
std::map< std::pair< int, int > *, double > getLocalPixel(IMPL::SimTrackerHitImpl *simthit, std::vector< std::pair< const gear::Vector3D *, int > > edgeofpixel)
bool inSensitiveRegion(gear::Vector3D *pos, int layer)
double y[_ARRAY_NUM]
std::vector< GeoData_t > _geodata
static const int _ARRAY_NUM
virtual void end()
Called after data processing for clean up.
virtual void init()
Called at the begin of the job before anything is read.
void makePixelHits(IMPL::SimTrackerHitImpl *simHit, FPCCDData &pxHits)
double vx[_ARRAY_NUM]
bool _ladder_Number_encoded_in_cellID
std::vector< double > sinphi
double vz[_ARRAY_NUM]
std::vector< double > cosphi
std::string _colNameVTX
double py[_ARRAY_NUM]
struct FPCCDDigitizer::@16 _ori_mcp
void makeCandidates(std::pair< const gear::Vector3D *, int > edge, std::pair< int, int > *cand_array, int layer)
virtual void processRunHeader(LCRunHeader *run)
Called for every run.
virtual Processor * newProcessor()
std::string _treeName
void ModifyIntoLadder(gear::Vector3D *bemodifiedpos, const int layer, gear::Vector3D *pos, gear::Vector3D *mom)
gear::Vector3D * getLocalPos(const gear::Vector3D *pos, const int layer, const int ladder)
int xiID[_ARRAY_NUM]
std::pair< int, int > * FindPixel(std::pair< const gear::Vector3D *, int > f_fst, std::pair< const gear::Vector3D *, int > f_nxt, int f_layer)
void makeNewSimTHit(IMPL::SimTrackerHitImpl *simthit, gear::Vector3D *newpos, gear::Vector3D *newmom, int layer, int ladder, double newPathLength)
int zetaID[_ARRAY_NUM]
LCCollection * col
FPCCDDigitizer & operator=(const FPCCDDigitizer &)=delete
static int _mcp_number
void getInOutPosOnLadder(int layer, gear::Vector3D *outpos, gear::Vector3D *inpos, gear::Vector3D *pos, gear::Vector3D *mom)
FloatVec _pixelSizeVec
std::string _rootFileName
struct FPCCDDigitizer::@15 _simthits
virtual const std::string & name() const
double z[_ARRAY_NUM]
int nloopx[_ARRAY_NUM]
virtual void check(LCEvent *evt)
Called for every event - the working horse.
int nloopy[_ARRAY_NUM]