"MarlinReco"  1.16.0
ILDCaloDigi.h
1 #ifndef DIGITIZER_ILDCCALODIGI_H
2 #define DIGITIZER_ILDCCALODIGI_H 1
3 
4 #include "marlin/Processor.h"
5 #include <IMPL/CalorimeterHitImpl.h>
6 #include <IMPL/LCFlagImpl.h>
7 #include "CalorimeterHitType.h"
8 #include "lcio.h"
9 #include <string>
10 #include <vector>
11 #include "TFile.h"
12 #include "TH1.h"
13 #include "TH2.h"
14 #include "ScintillatorPpdDigi.h"
15 #include "CLHEP/Random/MTwistEngine.h"
16 
17 using namespace lcio ;
18 using namespace marlin ;
19 
20 const int MAX_LAYERS = 200;
21 const int MAX_STAVES = 16;
22 
75 class ILDCaloDigi : public Processor {
76 
77  public:
78 
79  virtual Processor* newProcessor() { return new ILDCaloDigi ; }
80 
81 
82  ILDCaloDigi() ;
83 
84  virtual void init() ;
85 
86  virtual void processRunHeader( LCRunHeader* run ) ;
87 
88  virtual void processEvent( LCEvent * evt ) ;
89 
90  virtual void check( LCEvent * evt ) ;
91 
92  virtual void end() ;
93 
94  virtual void fillECALGaps() ;
95 
96  float digitalHcalCalibCoeff(CHT::Layout,float energy );
97 
98  float analogueHcalCalibCoeff(CHT::Layout, int layer );
99 
100  float digitalEcalCalibCoeff(int layer );
101 
102  float analogueEcalCalibCoeff(int layer );
103 
104  protected:
105 
106  float ecalEnergyDigi(float energy, int id0, int id1);
107  float ahcalEnergyDigi(float energy, int id0, int id1);
108 
109  float siliconDigi(float energy);
110  float scintillatorDigi(float energy, bool isEcal);
111  LCCollection* combineVirtualStripCells(LCCollection* col, bool isBarrel, int orientation );
112 
113  int getNumberOfVirtualCells();
114  std::vector < std::pair <int, int> > & getLayerConfig();
115  void checkConsistency(std::string colName, int layer);
116  std::pair < int, int > getLayerProperties( std::string colName, int layer );
117  int getStripOrientationFromColName( std::string colName );
118 
119 
120  int _nRun ;
121  int _nEvt ;
122 
123  LCFlagImpl _flag;
124 
125  std::vector<std::string> _ecalCollections;
126  std::vector<std::string> _hcalCollections;
127  std::vector<std::string> _outputEcalCollections;
128  std::vector<std::string> _outputHcalCollections;
129 
130  std::string _outputRelCollection;
131 
132  float _thresholdEcal;
133  std::string _unitThresholdEcal;
134  std::vector<float> _thresholdHcal;
135  std::string _unitThresholdHcal;
136 
137  int _digitalEcal;
138  int _mapsEcalCorrection;
139  int _digitalHcal;
140 
141  bool _ECAL_stripHits;
142 
143  std::vector<float> _calibrCoeffEcal;
144  std::vector<float> _calibrCoeffHcalBarrel;
145  std::vector<float> _calibrCoeffHcalEndCap;
146  std::vector<float> _calibrCoeffHcalOther;
147 
148  std::vector<int> _ecalLayers;
149  std::vector<int> _hcalLayers;
150 
151  int _ecalGapCorrection;
152  float _ecalGapCorrectionFactor;
153  float _ecalModuleGapCorrectionFactor;
154  float _ecalEndcapCorrectionFactor;
155  float _hcalEndcapCorrectionFactor;
156  int _hcalGapCorrection;
157  float _hcalModuleGapCorrectionFactor;
158 
159  std::vector<CalorimeterHitImpl*> _calHitsByStaveLayer[MAX_STAVES][MAX_LAYERS];
160  std::vector<int> _calHitsByStaveLayerModule[MAX_STAVES][MAX_LAYERS];
161 
162  float _zOfEcalEndcap;
163  float _barrelPixelSizeT[MAX_LAYERS];
164  float _barrelPixelSizeZ[MAX_LAYERS];
165  float _endcapPixelSizeX[MAX_LAYERS];
166  float _endcapPixelSizeY[MAX_LAYERS];
167  float _barrelStaveDir[MAX_STAVES][2];
168 
169  int _histograms;
170 
171  // timing
172  int _useEcalTiming;
173  int _ecalCorrectTimesForPropagation;
174  float _ecalTimeWindowMin;
175  float _ecalBarrelTimeWindowMax;
176  float _ecalEndcapTimeWindowMax;
177  float _ecalDeltaTimeHitResolution;
178  float _ecalTimeResolution;
179  bool _ecalSimpleTimingCut;
180 
181  int _useHcalTiming;
182  int _hcalCorrectTimesForPropagation;
183  float _hcalTimeWindowMin;
184  float _hcalBarrelTimeWindowMax;
185  float _hcalEndcapTimeWindowMax;
186  float _hcalDeltaTimeHitResolution;
187  float _hcalTimeResolution;
188  bool _hcalSimpleTimingCut;
189 
190  ScintillatorPpdDigi* _scEcalDigi;
191  ScintillatorPpdDigi* _scHcalDigi;
192 
193 
194  // parameters for extra ECAL digitization effects
195  float _calibEcalMip; // MIP calibration factor
196  int _applyEcalDigi; // which realistic calib to apply
197  float _ecal_PPD_pe_per_mip; // # photoelectrons/MIP for MPPC
198  int _ecal_PPD_n_pixels; // # pixels in MPPC
199  float _ehEnergy; // energy to create e-h pair in silicon
200  float _ecal_misCalibNpix; // miscalibration of # MPPC pixels
201 
202  float _misCalibEcal_uncorrel; // general ECAL miscalibration (uncorrelated between channels)
203  bool _misCalibEcal_uncorrel_keep; // if true, use the same ECAL cell miscalibs in each event (requires more memory)
204  float _misCalibEcal_correl; // general ECAL miscalibration (100% uncorrelated between channels)
205 
206  float _deadCellFractionEcal; // fraction of random dead channels
207  bool _deadCellEcal_keep; // keep same cells dead between events?
208 
209  float _strip_abs_length; // absorption length along strip for non-uniformity modeling
210  float _ecal_pixSpread; // relative spread of MPPC pixel signal
211  float _ecal_elec_noise; // electronics noise (as fraction of MIP)
212  float _ecalMaxDynMip; // electronics dynamic range (in terms of MIPs)
213  int _ecalStrip_default_nVirt; // # virtual cells used in Mokka simulation of strips (if available, this is taken from gear file)
214  std::string _ecal_deafult_layer_config; // ECAL layer configuration (if available, this is taken from gear file)
215 
216  // parameters for extra AHCAL digitization effects
217  float _calibHcalMip; // MIP calibration factor
218  int _applyHcalDigi; // which realistic calib to apply
219  float _hcal_PPD_pe_per_mip; // # photoelectrons/MIP for MPPC
220  int _hcal_PPD_n_pixels; // # pixels in MPPC
221  float _hcal_misCalibNpix; // miscalibration of # MPPC pixels
222 
223  float _misCalibHcal_uncorrel; // general ECAL miscalibration (uncorrelated between channels)
224  bool _misCalibHcal_uncorrel_keep; // if true, use the same AHCAL cell miscalibs in each event (requires more memory)
225  float _misCalibHcal_correl; // general ECAL miscalibration (100% uncorrelated between channels)
226 
227  float _deadCellFractionHcal; // fraction of random dead channels
228  bool _deadCellHcal_keep; // keep same cells dead between events?
229  float _hcal_pixSpread; // relative spread of MPPC pixel signal
230  float _hcal_elec_noise; // electronics noise (as fraction of MIP)
231  float _hcalMaxDynMip; // electronics dynamic range (in terms of MIPs)
232 
233 
234 
235  // internal variables
236  std::vector < std::pair <int, int> > _layerTypes;
237  int _strip_virt_cells;
238  int _countWarnings;
239  std::string _ecalLayout;
240 
241  float _event_correl_miscalib_ecal;
242  float _event_correl_miscalib_hcal;
243 
244  CLHEP::MTwistEngine *_randomEngineDeadCellEcal;
245  CLHEP::MTwistEngine *_randomEngineDeadCellHcal;
246 
247  std::map < std::pair <int, int> , float > _ECAL_cell_miscalibs;
248  std::map < std::pair <int, int> , bool > _ECAL_cell_dead;
249  std::map < std::pair <int, int> , float > _HCAL_cell_miscalibs;
250  std::map < std::pair <int, int> , bool > _HCAL_cell_dead;
251 
252  enum {
253  SQUARE,
254  STRIP_ALIGN_ALONG_SLAB,
255  STRIP_ALIGN_ACROSS_SLAB,
256  SIECAL=0,
257  SCECAL
258  };
259 
260  std::string _cellIDLayerString ;
261  std::string _cellIDModuleString ;
262  std::string _cellIDStaveString ;
263  std::string _cellIDIndexIString ;
264  std::string _cellIDIndexJString ;
265 
266  TH1F* fEcal;
267  TH1F* fHcal;
268  TH1F* fEcalC;
269  TH1F* fHcalC;
270  TH1F* fEcalC1;
271  TH1F* fHcalC1;
272  TH1F* fEcalC2;
273  TH1F* fHcalC2;
274  TH2F* fHcalCvsE;
275  TH2F* fHcalLayer1;
276  TH2F* fHcalLayer11;
277  TH2F* fHcalLayer21;
278  TH2F* fHcalLayer31;
279  TH2F* fHcalLayer41;
280  TH2F* fHcalLayer51;
281  TH2F* fHcalLayer61;
282  TH2F* fHcalLayer71;
283  TH1F* fHcalRLayer1;
284  TH1F* fHcalRLayer11;
285  TH1F* fHcalRLayer21;
286  TH1F* fHcalRLayer31;
287  TH1F* fHcalRLayer41;
288  TH1F* fHcalRLayer51;
289  TH1F* fHcalRLayer61;
290  TH1F* fHcalRLayer71;
291  TH1F* fHcalRLayerNorm;
292 
293  TH1F* fEcalRLayerNorm;
294  TH2F* fEcalLayer1;
295  TH2F* fEcalLayer11;
296  TH2F* fEcalLayer21;
297  TH1F* fEcalRLayer1;
298  TH1F* fEcalRLayer11;
299  TH1F* fEcalRLayer21;
300 
301 } ;
302 
303 #endif
304 
305 
306 
Definition: ScintillatorPpdDigi.h:4
=== ILDCaloDigi Processor === Simple calorimeter digitizer Processor.
Definition: ILDCaloDigi.h:75