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