All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
RealisticCaloDigi.h
Go to the documentation of this file.
1 #ifndef REALISTICCALODIGI_H
2 #define REALISTICCALODIGI_H 1
3 
4 #include "marlin/Processor.h"
5 #include <IMPL/LCFlagImpl.h>
6 #include <EVENT/SimCalorimeterHit.h>
7 #include "lcio.h"
8 #include <string>
9 #include <vector>
10 #include <functional>
11 #include <optional>
12 
13 using namespace lcio ;
14 using namespace marlin ;
15 
16 
17 
18 /**
19 \addtogroup CaloDigi CaloDigi
20 @{
21 
22 \addtogroup RealisticCaloDigi RealisticCaloDigi
23 @{
24 Realistic digitisation of calorimeter hits.
25 === RealisticCaloDigi Processor === <br>
26  Digitisation of calorimeter hits
27  e.g. timing, dead cells, miscalibrations
28  this is virtual class, technology-blind
29  technology-specific classes can inherit from this one
30  D. Jeans 02/2016, rewrite of parts of ILDCaloDigi, DDCaloDigi
31  R. Ete 11/2020, rewrite of charge integration and extension of timing treatment
32  */
33 
34 class RealisticCaloDigi : virtual public Processor {
35 
36  public:
37 
39  RealisticCaloDigi ( const RealisticCaloDigi& ) = delete;
40  RealisticCaloDigi& operator=(const RealisticCaloDigi&) = delete;
41 
42  virtual void init() ;
43  virtual void processRunHeader( LCRunHeader* run ) ;
44  virtual void processEvent( LCEvent * evt ) ;
45  virtual void check( LCEvent * evt ) ;
46  virtual void end() ;
47 
48  protected:
49 
50  // energy scales we know about
51  enum { MIP, GEVDEP, NPE };
52  // integration result types
53  using integr_res = std::pair<float,float>;
54  using integr_res_opt = std::optional<integr_res>;
55  using integr_function = std::function<integr_res_opt(const EVENT::SimCalorimeterHit*)>;
56 
57  virtual float EnergyDigi(float energy, int id0, int id1);
58  virtual integr_res_opt Integrate( const SimCalorimeterHit * hit ) const;
59 
60  integr_res_opt StandardIntegration( const SimCalorimeterHit * hit ) const ;
61  integr_res_opt ROCIntegration( const SimCalorimeterHit * hit ) const ;
62  float SmearTime(float time) const;
63 
64  // virtual methods to be be overloaded in tech-specific derived classes
65  virtual int getMyUnit() const = 0 ;
66  virtual float digitiseDetectorEnergy(float energy) const = 0 ;
67  virtual float convertEnergy( float energy, int inScale ) const = 0; // convert energy from input to output scale
68 
69  // general parameters
70 
71  std::vector<std::string> _inputCollections{};
72  std::vector<std::string> _outputCollections{};
73  std::vector<std::string> _outputRelCollections{};
74 
75 
76  // parameters for digitization effects
77 
78  std::string _integration_method{}; // timing calculation method
79  float _threshold_value{}; // hit energy threshold
80  std::string _threshold_unit{}; // hit energy threshold unit
81 
82  int _time_apply{}; // apply timing cuts?
83  int _time_correctForPropagation{}; // correct times for propagation?
84  float _time_windowMin{}; // defn of timing window
85  float _time_windowMax{};
86  float _fast_shaper{}; // fast shaper value. unit in ns
87  float _slow_shaper{}; // slow shaper value. unit in ns
88  float _time_resol{}; // time resolution (unit ns)
89 
90  float _calib_mip{}; // MIP calibration factor (most probable energy deposit by MIP in active material of one layer)
91 
92  float _misCalib_uncorrel{}; // general miscalibration (uncorrelated between channels)
93  bool _misCalib_uncorrel_keep{}; // if true, use the same cell miscalibs over events (requires more memory)
94 
95  float _misCalib_correl{}; // general miscalibration (100% uncorrelated between channels)
96 
97  float _deadCell_fraction{}; // fraction of random dead channels
98  bool _deadCell_keep{}; // keep same cells dead between events? (requires more memory)
99 
100  float _elec_noiseMip{}; // electronics noise (as fraction of MIP)
101  float _elec_rangeMip{}; // electronics dynamic range (in terms of MIPs)
102 
103  std::string _cellIDLayerString{};
104 
105  // internal variables
106 
107  int _threshold_iunit{};
108 
109  LCFlagImpl _flag{};
110  LCFlagImpl _flag_rel{};
111 
112  float _event_correl_miscalib{};
113 
114  std::map < std::pair <int, int> , float > _cell_miscalibs{};
115  std::map < std::pair <int, int> , bool > _cell_dead{};
116  integr_function _integr_function{};
117 
118 } ;
119 
120 /** @} @}*/
121 
122 #endif
std::optional< integr_res > integr_res_opt
std::function< integr_res_opt(const EVENT::SimCalorimeterHit *)> integr_function
std::pair< float, float > integr_res