All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
ChargeSpreader.h
Go to the documentation of this file.
1 #ifndef ChargeSpreader_h
2 #define ChargeSpreader_h
3 
4 #include <marlin/Global.h>
5 
6 #include <map>
7 
8 struct AsicKey ;
10 
11 /**
12 \addtogroup CaloDigi CaloDigi
13 @{
14 
15 */
16 
17 
19 {
20  float cellSize = 10.f ;
21  float range = 30.f ;
22  float padSeparation = 0.f ;
23 
24  //erf
25  std::vector<float> erfWidth = {2} ;
26  std::vector<float> erfWeigth = {1} ;
27 
28  //exact
29  float d = 1.f ;
30 } ;
31 
32 
34 {
35  public :
36  ChargeSpreader() ;
37  virtual ~ChargeSpreader() ;
38 
39  virtual void setParameters(ChargeSpreaderParameters param) { parameters = param ; }
40 
41  virtual void init() = 0 ;
42 
43  typedef std::pair<int,int> I_J_Coordinates ;
44  virtual void addCharge( float charge , float posI , float posJ , SimDigitalGeomCellId* ) ;
45  void newHit(float cellSize_) { chargeMap.clear() ; parameters.cellSize = cellSize_ ; }
46 
47  const std::map<I_J_Coordinates,float>& getChargeMap() const { return chargeMap ; }
48 
49  protected :
50  virtual float computeIntegral(float x1 , float x2 , float y1 , float y2) const = 0 ;
51 
52  std::map<I_J_Coordinates,float> chargeMap ;
54 
55  float normalisation = 0.f ; //store inverse of normalisation (to multiply instead of divide)
56 } ;
57 
58 
60 {
61  public :
63  virtual ~GaussianSpreader() ;
64  virtual void init() ;
65 
66  protected :
67  virtual float computeIntegral(float x1 , float x2 , float y1 , float y2) const ;
68 } ;
69 
71 {
72  public :
73  ExactSpreader() ;
74  virtual ~ExactSpreader() ;
75  virtual void init() ;
76 
77  protected :
78  float computeIntegral(float x1 , float x2 , float y1 , float y2) const ;
79 } ;
80 
82 {
83  public :
84  ExactSpreaderPerAsic(std::string fileName) ;
85  virtual ~ExactSpreaderPerAsic() ;
86 
87  virtual void setParameters(ChargeSpreaderParameters param) { parameters = param ; dGlobal = parameters.d ; }
88 
89  virtual void addCharge(float charge, float posI, float posJ , SimDigitalGeomCellId* cellID) ;
90 
91  protected :
92 
93  float dGlobal = 1.0f ;
94  void readFile(std::string fileName) ;
95 
96 
97  std::map<AsicKey,float> dMap ;
98 } ;
99 
100 /** @} */
101 
102 #endif //ChargeSpreader_h
virtual void addCharge(float charge, float posI, float posJ, SimDigitalGeomCellId *cellID)
virtual void addCharge(float charge, float posI, float posJ, SimDigitalGeomCellId *)
virtual ~ExactSpreader()
virtual void init()=0
std::vector< float > erfWeigth
std::map< AsicKey, float > dMap
void readFile(std::string fileName)
std::map< I_J_Coordinates, float > chargeMap
virtual ~ExactSpreaderPerAsic()
virtual float computeIntegral(float x1, float x2, float y1, float y2) const =0
std::vector< float > erfWidth
void newHit(float cellSize_)
virtual float computeIntegral(float x1, float x2, float y1, float y2) const
virtual void init()
virtual void init()
std::pair< int, int > I_J_Coordinates
virtual void setParameters(ChargeSpreaderParameters param)
ChargeSpreaderParameters parameters
ExactSpreaderPerAsic(std::string fileName)
virtual ~ChargeSpreader()
virtual void setParameters(ChargeSpreaderParameters param)
virtual ~GaussianSpreader()
float computeIntegral(float x1, float x2, float y1, float y2) const
const std::map< I_J_Coordinates, float > & getChargeMap() const