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 
11 
12 namespace DigitizerUtility {
13 
14  class SimHitInfo {
15  public:
16  SimHitInfo(const PSimHit* hitp, float corrTime, size_t hitIndex, uint32_t tofBin)
17  : eventId_(hitp->eventId()), trackId_(hitp->trackId()), hitIndex_(hitIndex), tofBin_(tofBin), time_(corrTime) {}
18 
19  uint32_t hitIndex() const { return hitIndex_; };
20  uint32_t tofBin() const { return tofBin_; };
21  EncodedEventId eventId() const { return eventId_; };
22  uint32_t trackId() const { return trackId_; };
23  float time() const { return time_; };
24 
25  private:
27  uint32_t trackId_;
28  uint32_t hitIndex_;
29  uint32_t tofBin_;
30  float time_;
31  };
32 
33  class Amplitude {
34  public:
35  Amplitude() : _amp(0.0) {}
36  Amplitude(float amp, const PSimHit* hitp, float frac = 0, float tcor = 0, size_t hitIndex = 0, uint32_t tofBin = 0)
37  : _amp(amp) {
38  if (frac > 0) {
39  if (hitp != nullptr)
40  _simInfoList.push_back({frac, std::make_unique<SimHitInfo>(hitp, tcor, hitIndex, tofBin)});
41  else
42  _simInfoList.push_back({frac, nullptr});
43  }
44  }
45 
46  // can be used as a float by convers.
47  operator float() const { return _amp; }
48  float ampl() const { return _amp; }
49  const std::vector<std::pair<float, std::unique_ptr<SimHitInfo> > >& simInfoList() const { return _simInfoList; }
50 
51  void operator+=(const Amplitude& other) {
52  _amp += other._amp;
53  // in case of digi from the noise, the MC information need not be there
54  for (auto const& ic : other.simInfoList()) {
55  if (ic.first > -0.5)
56  _simInfoList.push_back({ic.first, std::make_unique<SimHitInfo>(*ic.second)});
57  }
58  }
59  void operator+=(const float& amp) { _amp += amp; }
60  void set(const float amplitude) { // Used to reset the amplitude
61  _amp = amplitude;
62  }
63 
64  private:
65  float _amp;
66  std::vector<std::pair<float, std::unique_ptr<SimHitInfo> > > _simInfoList;
67  };
68 
69  //*********************************************************
70  // Define a class for 3D ionization points and energy
71  //*********************************************************
73  public:
74  EnergyDepositUnit() : _energy(0), _position(0, 0, 0) {}
75  EnergyDepositUnit(float energy, float x, float y, float z) : _energy(energy), _position(x, y, z) {}
77  float x() const { return _position.x(); }
78  float y() const { return _position.y(); }
79  float z() const { return _position.z(); }
80  float energy() const { return _energy; }
81 
82  // Allow migration between pixel cells
84 
85  private:
86  float _energy;
88  };
89 
90  //**********************************************************
91  // define class to store signals on the collection surface
92  //**********************************************************
93  class SignalPoint {
94  public:
95  SignalPoint() : _pos(0, 0), _time(0), _amplitude(0), _sigma_x(1.), _sigma_y(1.), _hitp(nullptr) {}
96 
97  SignalPoint(float x, float y, float sigma_x, float sigma_y, float t, float a = 1.0)
98  : _pos(x, y), _time(t), _amplitude(a), _sigma_x(sigma_x), _sigma_y(sigma_y), _hitp(nullptr) {}
99 
100  SignalPoint(float x, float y, float sigma_x, float sigma_y, float t, const PSimHit& hit, float a = 1.0)
102 
103  const LocalPoint& position() const { return _pos; }
104  float x() const { return _pos.x(); }
105  float y() const { return _pos.y(); }
106  float sigma_x() const { return _sigma_x; }
107  float sigma_y() const { return _sigma_y; }
108  float time() const { return _time; }
109  float amplitude() const { return _amplitude; }
110  const PSimHit& hit() { return *_hitp; }
112  _amplitude = amp;
113  return *this;
114  }
115 
116  private:
118  float _time;
119  float _amplitude;
120  float _sigma_x; // gaussian sigma in the x direction (cm)
121  float _sigma_y; // " " y direction (cm) */
122  const PSimHit* _hitp;
123  };
124  struct DigiSimInfo {
125  int sig_tot;
126  bool ot_bit;
127  std::vector<std::pair<float, SimHitInfo*> > simInfoList;
128  };
129 } // namespace DigitizerUtility
130 #endif
CustomPhysics_cfi.amplitude
amplitude
Definition: CustomPhysics_cfi.py:12
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
DigitizerUtility::SimHitInfo::time_
float time_
Definition: DigitizerUtility.h:30
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
DigitizerUtility
Definition: DigitizerUtility.h:12
DigitizerUtility::EnergyDepositUnit::y
float y() const
Definition: DigitizerUtility.h:78
pos
Definition: PixelAliasList.h:18
DigitizerUtility::SignalPoint::position
const LocalPoint & position() const
Definition: DigitizerUtility.h:103
DigitizerUtility::Amplitude::_simInfoList
std::vector< std::pair< float, std::unique_ptr< SimHitInfo > > > _simInfoList
Definition: DigitizerUtility.h:66
DigitizerUtility::SignalPoint::x
float x() const
Definition: DigitizerUtility.h:104
DigitizerUtility::SimHitInfo::eventId
EncodedEventId eventId() const
Definition: DigitizerUtility.h:21
DigitizerUtility::SimHitInfo::hitIndex
uint32_t hitIndex() const
Definition: DigitizerUtility.h:19
DigitizerUtility::Amplitude::simInfoList
const std::vector< std::pair< float, std::unique_ptr< SimHitInfo > > > & simInfoList() const
Definition: DigitizerUtility.h:49
DigitizerUtility::Amplitude::set
void set(const float amplitude)
Definition: DigitizerUtility.h:60
DigitizerUtility::DigiSimInfo::simInfoList
std::vector< std::pair< float, SimHitInfo * > > simInfoList
Definition: DigitizerUtility.h:127
DigitizerUtility::SignalPoint::_pos
LocalPoint _pos
Definition: DigitizerUtility.h:117
DigitizerUtility::SignalPoint::set_amplitude
SignalPoint & set_amplitude(float amp)
Definition: DigitizerUtility.h:111
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
EncodedEventId
Definition: EncodedEventId.h:11
DigitizerUtility::EnergyDepositUnit
Definition: DigitizerUtility.h:72
DigitizerUtility::SimHitInfo::time
float time() const
Definition: DigitizerUtility.h:23
DigitizerUtility::EnergyDepositUnit::_energy
float _energy
Definition: DigitizerUtility.h:86
DigitizerUtility::SignalPoint::sigma_x
float sigma_x() const
Definition: DigitizerUtility.h:106
PSimHit.h
DivergingColor.frac
float frac
Definition: DivergingColor.py:175
DigitizerUtility::SimHitInfo::trackId
uint32_t trackId() const
Definition: DigitizerUtility.h:22
DigitizerUtility::DigiSimInfo::sig_tot
int sig_tot
Definition: DigitizerUtility.h:125
DigitizerUtility::SimHitInfo::tofBin
uint32_t tofBin() const
Definition: DigitizerUtility.h:20
DigitizerUtility::Amplitude::Amplitude
Amplitude(float amp, const PSimHit *hitp, float frac=0, float tcor=0, size_t hitIndex=0, uint32_t tofBin=0)
Definition: DigitizerUtility.h:36
DigitizerUtility::SignalPoint::_time
float _time
Definition: DigitizerUtility.h:118
DigitizerUtility::Amplitude
Definition: DigitizerUtility.h:33
DigitizerUtility::SignalPoint::amplitude
float amplitude() const
Definition: DigitizerUtility.h:109
trackingPlots.other
other
Definition: trackingPlots.py:1460
Point3DBase< float, LocalTag >
DigitizerUtility::SignalPoint::_sigma_x
float _sigma_x
Definition: DigitizerUtility.h:120
DigitizerUtility::SimHitInfo::hitIndex_
uint32_t hitIndex_
Definition: DigitizerUtility.h:28
DigitizerUtility::EnergyDepositUnit::x
float x() const
Definition: DigitizerUtility.h:77
a
double a
Definition: hdecay.h:119
DigitizerUtility::SignalPoint::_sigma_y
float _sigma_y
Definition: DigitizerUtility.h:121
DigitizerUtility::SimHitInfo::trackId_
uint32_t trackId_
Definition: DigitizerUtility.h:27
DigitizerUtility::SimHitInfo::SimHitInfo
SimHitInfo(const PSimHit *hitp, float corrTime, size_t hitIndex, uint32_t tofBin)
Definition: DigitizerUtility.h:16
DigitizerUtility::SignalPoint::time
float time() const
Definition: DigitizerUtility.h:108
DigitizerUtility::EnergyDepositUnit::EnergyDepositUnit
EnergyDepositUnit(float energy, float x, float y, float z)
Definition: DigitizerUtility.h:75
DigitizerUtility::EnergyDepositUnit::z
float z() const
Definition: DigitizerUtility.h:79
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
DigitizerUtility::Amplitude::_amp
float _amp
Definition: DigitizerUtility.h:65
DigitizerUtility::SignalPoint::SignalPoint
SignalPoint(float x, float y, float sigma_x, float sigma_y, float t, float a=1.0)
Definition: DigitizerUtility.h:97
DigitizerUtility::EnergyDepositUnit::EnergyDepositUnit
EnergyDepositUnit(float energy, Local3DPoint position)
Definition: DigitizerUtility.h:76
DigitizerUtility::SignalPoint::_hitp
const PSimHit * _hitp
Definition: DigitizerUtility.h:122
DigitizerUtility::DigiSimInfo::ot_bit
bool ot_bit
Definition: DigitizerUtility.h:126
DigitizerUtility::EnergyDepositUnit::migrate_position
void migrate_position(const Local3DPoint &pos)
Definition: DigitizerUtility.h:83
DigitizerUtility::SimHitInfo::eventId_
EncodedEventId eventId_
Definition: DigitizerUtility.h:23
DigitizerUtility::Amplitude::operator+=
void operator+=(const Amplitude &other)
Definition: DigitizerUtility.h:51
DigitizerUtility::SimHitInfo
Definition: DigitizerUtility.h:14
DigitizerUtility::EnergyDepositUnit::EnergyDepositUnit
EnergyDepositUnit()
Definition: DigitizerUtility.h:74
DigitizerUtility::SignalPoint::SignalPoint
SignalPoint(float x, float y, float sigma_x, float sigma_y, float t, const PSimHit &hit, float a=1.0)
Definition: DigitizerUtility.h:100
DigitizerUtility::Amplitude::operator+=
void operator+=(const float &amp)
Definition: DigitizerUtility.h:59
DigitizerUtility::SignalPoint::hit
const PSimHit & hit()
Definition: DigitizerUtility.h:110
DigitizerUtility::SignalPoint
Definition: DigitizerUtility.h:93
DigitizerUtility::DigiSimInfo
Definition: DigitizerUtility.h:124
DigitizerUtility::SignalPoint::SignalPoint
SignalPoint()
Definition: DigitizerUtility.h:95
DigitizerUtility::Amplitude::ampl
float ampl() const
Definition: DigitizerUtility.h:48
PSimHit
Definition: PSimHit.h:15
DigitizerUtility::SignalPoint::_amplitude
float _amplitude
Definition: DigitizerUtility.h:119
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
DigitizerUtility::SignalPoint::y
float y() const
Definition: DigitizerUtility.h:105
DigitizerUtility::EnergyDepositUnit::_position
Local3DPoint _position
Definition: DigitizerUtility.h:87
DigitizerUtility::SignalPoint::sigma_y
float sigma_y() const
Definition: DigitizerUtility.h:107
DigitizerUtility::Amplitude::Amplitude
Amplitude()
Definition: DigitizerUtility.h:35
DigitizerUtility::SimHitInfo::tofBin_
uint32_t tofBin_
Definition: DigitizerUtility.h:29
hit
Definition: SiStripHitEffFromCalibTree.cc:88
DigitizerUtility::EnergyDepositUnit::energy
float energy() const
Definition: DigitizerUtility.h:80
EncodedEventId.h