CMS 3D CMS Logo

DigitizerUtility.h
Go to the documentation of this file.
1 #ifndef __SimTracker_SiPhase2Digitizer_DigitizerUtility_h
2 #define __SimTracker_SiPhase2Digitizer_DigitizerUtility_h
3 
4 #include <map>
5 #include <memory>
6 #include <vector>
7 #include <iostream>
8 
12 
13 namespace DigitizerUtility {
14  class Amplitude {
15  public:
16  Amplitude() : _amp(0.0) {}
17  Amplitude( float amp, const PSimHit* hitp, float frac=0, size_t hitIndex=0, unsigned int tofBin=0) :
18  _amp(amp) {
19  if (frac > 0) {
20  if (hitp != nullptr) _simInfoList.push_back({frac, std::make_unique<SimHitInfoForLinks>(hitp,hitIndex,tofBin)});
21  else _simInfoList.push_back({frac, nullptr});
22  }
23  }
24 
25  // can be used as a float by convers.
26  operator float() const {return _amp;}
27  float ampl() const {return _amp;}
28  const std::vector<std::pair<float, std::unique_ptr<SimHitInfoForLinks> > >& simInfoList() const {return _simInfoList;}
29 
30  void operator+= (const Amplitude& other) {
31  _amp += other._amp;
32  // in case of digi from the noise, the MC information need not be there
33  for (auto const& ic : other.simInfoList()) {
34  if (ic.first > -0.5) _simInfoList.push_back({ic.first, std::make_unique<SimHitInfoForLinks>(*ic.second)});
35  }
36  }
37  void operator+= (const float& amp) {
38  _amp += amp;
39  }
40  void set (const float amplitude) { // Used to reset the amplitude
41  _amp = amplitude;
42  }
43  // void setind (const float indamplitude) { // Used to reset the amplitude
44  // _frac = idamplitude;
45  // }
46 
47  private:
48  float _amp;
49  std::vector<std::pair<float, std::unique_ptr<SimHitInfoForLinks> > > _simInfoList;
50  };
51 
52  //*********************************************************
53  // Define a class for 3D ionization points and energy
54  //*********************************************************
56  public:
57  EnergyDepositUnit(): _energy(0),_position(0,0,0) {}
58  EnergyDepositUnit(float energy,float x, float y, float z):
59  _energy(energy),_position(x,y,z) {}
61  _energy(energy),_position(position) {}
62  float x() const{return _position.x();}
63  float y() const{return _position.y();}
64  float z() const{return _position.z();}
65  float energy() const { return _energy;}
66  private:
67  float _energy;
69  };
70 
71  //**********************************************************
72  // define class to store signals on the collection surface
73  //**********************************************************
74  class SignalPoint {
75  public:
76  SignalPoint(): _pos(0,0), _time(0), _amplitude(0),
77  _sigma_x(1.), _sigma_y(1.), _hitp(nullptr) {}
78 
79  SignalPoint(float x, float y, float sigma_x, float sigma_y,
80  float t, float a=1.0):
81  _pos(x,y), _time(t), _amplitude(a), _sigma_x(sigma_x),
82  _sigma_y(sigma_y), _hitp(nullptr) {}
83 
84  SignalPoint(float x, float y, float sigma_x, float sigma_y,
85  float t, const PSimHit& hit, float a=1.0):
86  _pos(x,y), _time(t), _amplitude(a), _sigma_x(sigma_x),
87  _sigma_y(sigma_y),_hitp(&hit) {}
88 
89  const LocalPoint& position() const {return _pos;}
90  float x() const {return _pos.x();}
91  float y() const {return _pos.y();}
92  float sigma_x() const {return _sigma_x;}
93  float sigma_y() const {return _sigma_y;}
94  float time() const {return _time;}
95  float amplitude() const {return _amplitude;}
96  const PSimHit& hit() {return *_hitp;}
97  SignalPoint& set_amplitude(float amp) {_amplitude = amp; return *this;}
98  private:
100  float _time;
101  float _amplitude;
102  float _sigma_x; // gaussian sigma in the x direction (cm)
103  float _sigma_y; // " " y direction (cm) */
104  const PSimHit* _hitp;
105  };
106  struct DigiSimInfo {
107  int sig_tot;
108  bool ot_bit;
109  std::vector<std::pair<float, SimHitInfoForLinks*> > simInfoList;
110  };
111 }
112 #endif
SignalPoint(float x, float y, float sigma_x, float sigma_y, float t, const PSimHit &hit, float a=1.0)
#define nullptr
SignalPoint(float x, float y, float sigma_x, float sigma_y, float t, float a=1.0)
Amplitude(float amp, const PSimHit *hitp, float frac=0, size_t hitIndex=0, unsigned int tofBin=0)
EnergyDepositUnit(float energy, Local3DPoint position)
std::vector< std::pair< float, std::unique_ptr< SimHitInfoForLinks > > > _simInfoList
SignalPoint & set_amplitude(float amp)
EnergyDepositUnit(float energy, float x, float y, float z)
const LocalPoint & position() const
void operator+=(const Amplitude &other)
double a
Definition: hdecay.h:121
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::vector< std::pair< float, SimHitInfoForLinks * > > simInfoList
const std::vector< std::pair< float, std::unique_ptr< SimHitInfoForLinks > > > & simInfoList() const