"MarlinReco"  1.32.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  CCDDigitizer(const CCDDigitizer&) = delete;
88  CCDDigitizer& operator=(const CCDDigitizer&) = delete;
89 
90  virtual Processor* newProcessor() { return new CCDDigitizer ; }
91 
92 
93  CCDDigitizer() ;
94 
98  virtual void init() ;
99 
103  virtual void processRunHeader( LCRunHeader* run ) ;
104 
107  virtual void processEvent( LCEvent * evt ) ;
108 
111  virtual void check( LCEvent * evt ) ;
112 
115  virtual void end() ;
116 
117 
118  protected:
119 
122  std::string _colName{};
123  std::string _outputCollectionName{};
124  std::string _colVTXRelation{};
125 
128  int _nRun{};
129 
132  int _nEvt{};
136  double _cutOnDeltaRays{};
139  double _diffusionCoefficient{};
140 
141 
142 
143  int _numberOfLayers{};
144  double _pixelSizeX{};
145  double _pixelSizeY{};
146  double _electronsPerKeV{};
147  double _segmentDepth{};
148  double _currentTotalCharge{};
149 
150  std::vector<int> _laddersInLayer{};
151  std::vector<float> _layerRadius{};
152  std::vector<float> _layerThickness{};
153  std::vector<float> _layerHalfThickness{};
154  std::vector<float> _layerLadderLength{};
155  std::vector<float> _layerLadderHalfWidth{};
156  std::vector<float> _layerPhiOffset{};
157  std::vector<float> _layerActiveSiOffset{};
158  std::vector<float> _layerHalfPhi{};
159  std::vector<float> _layerLadderGap{};
160  std::vector<float> _bkgdHitsInLayer{};
161  std::vector<float> _layerLadderWidth{};
162 
163  int _currentLayer{};
164  int _currentModule{};
165  int _generateBackground{};
166  double _currentParticleMomentum{};
167  double _currentParticleEnergy{};
168  double _currentParticleMass{};
169  double _currentPhi{};
170 
171  double PI{},TWOPI{},PI2{};
172 
173  int _produceFullPattern{};
174  int _numberOfSegments{};
175  int _debug{};
176  int _PoissonSmearing{};
177  int _electronicEffects{};
178  int _useMCPMomentum{};
179 
180  int _recmethod{};
181  double _threshold{};
182  double _saturation{};
183  int _framesize{};
184  int maxnionpoint{};
185 
186  double _currentLocalPosition[3]{};
187  double _electronicNoise{};
188  double _segmentLength{};
189 
190  IonisationPointVec _ionisationPoints{};
191 
192 
193  MyG4UniversalFluctuationForSi * _fluctuate{};
194 
195 
196  //Finds coordinates
197  void FindLocalPosition(SimTrackerHit * hit,
198  double * localPosition,
199  double * localDirection);
200 
201  void TransformToLab(double * xLoc, double * xLab);
202  void ProduceIonisationPoints( SimTrackerHit * hit);
203  void diffusion(double xdif,double ydif, double sigma);
204 
205  void ProduceHits(SimTrackerHitImplVec & simTrkVec);
206  void TransformXYToCellID(double x, double y,
207  int & ix,
208  int & iy,double & xdif,double & ydif);
209  void TransformCellIDToXY(int ix, int iy,
210  double & x, double & y);
211  void PoissonSmearer( SimTrackerHitImplVec & simTrkVec );
212  void GainSmearer( SimTrackerHitImplVec & simTrkVec );
213  void PrintInfo( SimTrackerHit * simTrkHit, TrackerHitImpl * recoHit);
214  TrackerHitImpl * ReconstructTrackerHit(SimTrackerHitImplVec & simTrkVec );
215  void TrackerHitToLab( TrackerHitImpl * recoHit );
216 
217  void generateBackground(LCCollectionVec * col);
218  void settanlorentzangle(double B, double E, double mu, double T);
219  void settanlorentzangleb(double B, double E, double mu, double T);
220 
221 // double _currentLocalPosition[3];
222 // double _currentEntryPoint[3];
223 // double _currentExitPoint[3];
224 
225  double _energyLoss{};
226  std::vector <SimTrackerHitImplVec> _hitsInLayer{};
227 
228  double depdep{};
229  double undep{};
230  double epitaxdep{};
231 
232  double pxl[maxpixx][maxpixy]{};
233  int midpixx{};
234  int midpixy{};
235  double stepx{};
236  double stepy{};
237  double xobsoffset{};
238  double yobsoffset{};
239 
240  double sigmacoefficient{};
241  double sigmin{};
242  double _difcoef{};
243  double _efield{};
244  double _biasvolt{};
245  double _bfield{};
246  double _T{};
247  double _mu{};
248  double TanLorentzAngle{};
249 
250 
251 #ifdef CCD_diagnostics
252  double dirraw[3]{};
253  double posraw[3]{};
254  AIDA::IHistogram1D* histdist{};
255  AIDA::IHistogram1D* histcluster{};
256  AIDA::IHistogram2D* histclustxy{};
257  AIDA::IHistogram1D* histcharge{};
258  AIDA::IHistogram2D* histdistxy{};
259  AIDA::IHistogram1D* histNionpoint{};
260  AIDA::IHistogram1D* histzcoord{};
261  AIDA::IHistogram1D* histenergy{};
262  AIDA::IHistogram1D* histsignal{};
263  AIDA::IHistogram1D* histsignalframe{};
264  AIDA::IHistogram1D* histenergycentre{};
265  int Nionpoint{};
266 #endif
267 
268  // table
269  // double sigstep;
270 // double table [numsigstep][numhitstepx][numhitstepy][maxpixx][maxpixy];
271 // void diffusiontable(double xdif,double ydif, double sigma);
272 // void settable();
273 // table//
274 
275 };
276 
277 
278 
279 #endif
Definition: CCDDigitizer.h:83
Definition: MyG4UniversalFluctuationForSi.h:52
Definition: CCDDigitizer.h:52