"MarlinReco"  1.16.0
CCDDigitizer.h
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 
21 #ifndef CCDDigitizer_h
22 #define CCDDigitizer_h 1
23 
24 #include "marlin/Processor.h"
25 #include "lcio.h"
26 #include "EVENT/SimTrackerHit.h"
27 #include "IMPL/TrackerHitImpl.h"
28 #include "IMPL/SimTrackerHitImpl.h"
29 #include <string>
30 #include <vector>
31 #include "MyG4UniversalFluctuationForSi.h"
32 #include "EVENT/LCIO.h"
33 #include <IMPL/LCCollectionVec.h>
34 
35 
36 
37 #ifdef CCD_diagnostics
38 #include <AIDA/IHistogramFactory.h>
39 #include <AIDA/IHistogram1D.h>
40 #include <AIDA/IHistogram2D.h>
41 #include <AIDA/IAxis.h>
42 #include <AIDA/ITree.h>
43 
44 #include <marlin/Global.h>
45 #include <marlin/VerbosityLevels.h>
46 #include <marlin/AIDAProcessor.h>
47 #endif
48 
49 using namespace lcio ;
50 using namespace marlin ;
51 
53  double x;
54  double y;
55  double z;
56  double eloss;
57 };
58 
59 
60 typedef std::vector<IonisationPoint> IonisationPointVec;
61 typedef std::vector<TrackerHitImpl*> TrackerHitImplVec;
62 typedef std::vector<SimTrackerHitImpl*> SimTrackerHitImplVec;
63 
64 
65 
66 #define maxpixx 9// grid size in local(ladder) x axis
67 #define maxpixy 9// grid size in local(ladder) y axis
68 //grid size in which diffusion is computed, the charge, which diffuses outside this grid, is lost;value may be redefined again after sigmacoefficient or thickness of active layer is changed
69 
70 //we approach the continual distribution of the diffusion with discrete points:
71 #define Numstepx 10// Number of points at which amplitude of diffusion is calculated within one pixel in x direction
72 #define Numstepy 10// Number of points at which amplitude of diffusion is calculated within one pixel in y direction
73 //according to first tests increasing the number of steps effects the performance of the processor only slightly and non- systematically
74 
75 //if using a table, numhitstep must be adjusted when changing Numstep
76 //table
77 //#define numhitstepx 6//must be =(Numstepx/2)+1
78 //#define numhitstepy 6//must be =(Numstepy/2)+1
79 //#define numsigstep 20
80 //table//
81 
82 
83 class CCDDigitizer : public Processor {
84 
85  public:
86 
87  virtual Processor* newProcessor() { return new CCDDigitizer ; }
88 
89 
90  CCDDigitizer() ;
91 
95  virtual void init() ;
96 
100  virtual void processRunHeader( LCRunHeader* run ) ;
101 
104  virtual void processEvent( LCEvent * evt ) ;
105 
108  virtual void check( LCEvent * evt ) ;
109 
112  virtual void end() ;
113 
114 
115  protected:
116 
119  std::string _colName ;
120  std::string _outputCollectionName;
121  std::string _colVTXRelation ;
122 
125  int _nRun ;
126 
129  int _nEvt ;
137 
138 
139 
140  int _numberOfLayers;
141  double _pixelSizeX;
142  double _pixelSizeY;
143  double _electronsPerKeV;
144  double _segmentDepth;
145  double _currentTotalCharge;
146 
147  std::vector<int> _laddersInLayer;
148  std::vector<float> _layerRadius;
149  std::vector<float> _layerThickness;
150  std::vector<float> _layerHalfThickness;
151  std::vector<float> _layerLadderLength;
152  std::vector<float> _layerLadderHalfWidth;
153  std::vector<float> _layerPhiOffset;
154  std::vector<float> _layerActiveSiOffset;
155  std::vector<float> _layerHalfPhi;
156  std::vector<float> _layerLadderGap;
157  std::vector<float> _bkgdHitsInLayer;
158  std::vector<float> _layerLadderWidth;
159 
160  int _currentLayer;
161  int _currentModule;
162  int _generateBackground;
163  double _currentParticleMomentum;
164  double _currentParticleEnergy;
165  double _currentParticleMass;
166  double _currentPhi;
167 
168  double PI,TWOPI,PI2;
169 
170  int _produceFullPattern;
171  int _numberOfSegments;
172  int _debug;
173  int _PoissonSmearing;
174  int _electronicEffects;
175  int _useMCPMomentum;
176 
177  int _recmethod;
178  double _threshold;
179  double _saturation;
180  int _framesize;
181  int maxnionpoint;
182 
183  double _currentLocalPosition[3];
184  double _electronicNoise;
185  double _segmentLength;
186 
187  IonisationPointVec _ionisationPoints;
188 
189 
190  MyG4UniversalFluctuationForSi * _fluctuate;
191 
192 
193  //Finds coordinates
194  void FindLocalPosition(SimTrackerHit * hit,
195  double * localPosition,
196  double * localDirection);
197 
198  void TransformToLab(double * xLoc, double * xLab);
199  void ProduceIonisationPoints( SimTrackerHit * hit);
200  void diffusion(double xdif,double ydif, double sigma);
201 
202  void ProduceHits(SimTrackerHitImplVec & simTrkVec);
203  void TransformXYToCellID(double x, double y,
204  int & ix,
205  int & iy,double & xdif,double & ydif);
206  void TransformCellIDToXY(int ix, int iy,
207  double & x, double & y);
208  void PoissonSmearer( SimTrackerHitImplVec & simTrkVec );
209  void GainSmearer( SimTrackerHitImplVec & simTrkVec );
210  void PrintInfo( SimTrackerHit * simTrkHit, TrackerHitImpl * recoHit);
211  TrackerHitImpl * ReconstructTrackerHit(SimTrackerHitImplVec & simTrkVec );
212  void TrackerHitToLab( TrackerHitImpl * recoHit );
213 
214  void generateBackground(LCCollectionVec * col);
215  void settanlorentzangle(double B, double E, double mu, double T);
216  void settanlorentzangleb(double B, double E, double mu, double T);
217 
218 // double _currentLocalPosition[3];
219 // double _currentEntryPoint[3];
220 // double _currentExitPoint[3];
221 
222  double _energyLoss;
223  std::vector <SimTrackerHitImplVec> _hitsInLayer;
224 
225  double depdep;
226  double undep;
227  double epitaxdep;
228 
229  double pxl[maxpixx][maxpixy];
230  int midpixx;
231  int midpixy;
232  double stepx;
233  double stepy;
234  double xobsoffset;
235  double yobsoffset;
236 
237  double sigmacoefficient;
238  double sigmin;
239  double _difcoef;
240  double _efield;
241  double _biasvolt;
242  double _bfield;
243  double _T;
244  double _mu;
245  double TanLorentzAngle;
246 
247 
248 #ifdef CCD_diagnostics
249  double dirraw[3];
250  double posraw[3];
251  AIDA::IHistogram1D* histdist;
252  AIDA::IHistogram1D* histcluster;
253  AIDA::IHistogram2D* histclustxy;
254  AIDA::IHistogram1D* histcharge;
255  AIDA::IHistogram2D* histdistxy;
256  AIDA::IHistogram1D* histNionpoint;
257  AIDA::IHistogram1D* histzcoord;
258  AIDA::IHistogram1D* histenergy;
259  AIDA::IHistogram1D* histsignal;
260  AIDA::IHistogram1D* histsignalframe;
261  AIDA::IHistogram1D* histenergycentre;
262  int Nionpoint;
263 #endif
264 
265  // table
266  // double sigstep;
267 // double table [numsigstep][numhitstepx][numhitstepy][maxpixx][maxpixy];
268 // void diffusiontable(double xdif,double ydif, double sigma);
269 // void settable();
270 // table//
271 
272 };
273 
274 
275 
276 #endif
277 
Definition: CCDDigitizer.h:83
Definition: MyG4UniversalFluctuationForSi.h:52
int _nRun
Run number.
Definition: CCDDigitizer.h:125
double _cutOnDeltaRays
tangent of Lorentz angle
Definition: CCDDigitizer.h:133
double _diffusionCoefficient
Diffusion coefficient in mm for nominla layer thickness.
Definition: CCDDigitizer.h:136
std::string _colName
Input collection name.
Definition: CCDDigitizer.h:119
int _nEvt
Event number.
Definition: CCDDigitizer.h:129
Definition: CCDDigitizer.h:52