CMS 3D CMS Logo

EBHitResponse.h
Go to the documentation of this file.
1 #ifndef EcalSimAlgos_EBHitResponse_h
2 #define EcalSimAlgos_EBHitResponse_h
3 
8 
9 class APDSimParameters;
10 
11 namespace CLHEP {
12  class HepRandomEngine;
13 }
14 
15 template <class constset>
17 public:
19 
20  typedef std::vector<double> VecD;
21 
22  static constexpr size_t kNOffsets = constset::kNOffsets;
23 
24  static constexpr double kSamplePeriod = constset::Samp_Period;
25 
26  EBHitResponseImpl(const CaloVSimParameterMap* parameterMap,
27  const CaloVShape* shape,
28  bool apdOnly,
29  const APDSimParameters* apdPars = nullptr,
30  const CaloVShape* apdShape = nullptr);
31 
32  ~EBHitResponseImpl() override;
33 
34  void initialize(CLHEP::HepRandomEngine*);
35 
36  virtual bool keepBlank() const { return false; }
37 
38  void setIntercal(const EcalIntercalibConstantsMC* ical);
39 
40  void add(const PCaloHit& hit, CLHEP::HepRandomEngine*) override;
41 
42  void initializeHits() override;
43 
44  void finalizeHits() override;
45 
46  void run(MixCollection<PCaloHit>& hits, CLHEP::HepRandomEngine*) override;
47 
48  unsigned int samplesSize() const override;
49 
50  EcalSamples* operator[](unsigned int i) override;
51 
52  const EcalSamples* operator[](unsigned int i) const override;
53 
54 protected:
55  unsigned int samplesSizeAll() const override;
56 
57  EcalSamples* vSamAll(unsigned int i) override;
58 
59  const EcalSamples* vSamAll(unsigned int i) const override;
60 
61  EcalSamples* vSam(unsigned int i) override;
62 
63  void putAPDSignal(const DetId& detId, double npe, double time);
64 
65  void putAnalogSignal(const PCaloHit& inputHit, CLHEP::HepRandomEngine*) override;
66 
67 private:
68  const VecD& offsets() const { return m_timeOffVec; }
69 
70  const double nonlFunc(double enr) const {
71  return (pelo > enr ? pext : (pehi > enr ? nonlFunc1(enr) : pfac * atan(log10(enr - pehi + 0.00001)) + poff));
72  }
73 
74  const double nonlFunc1(double energy) const {
75  const double enr(log10(energy));
76  const double enr2(enr * enr);
77  const double enr3(enr2 * enr);
78  return (pcub * enr3 + pqua * enr2 + plin * enr + pcon);
79  }
80 
81  const APDSimParameters* apdParameters() const;
82  const CaloVShape* apdShape() const;
83 
84  double apdSignalAmplitude(const PCaloHit& hit, CLHEP::HepRandomEngine*) const;
85 
86  void findIntercalibConstant(const DetId& detId, double& icalconst) const;
87 
88  const bool m_apdOnly;
92 
93  std::vector<double> m_timeOffVec;
94 
95  std::vector<double> m_apdNpeVec;
96  std::vector<double> m_apdTimeVec;
97 
98  const double pcub, pqua, plin, pcon, pelo, pehi, pasy, pext, poff, pfac;
99 
100  std::vector<EBSamples> m_vSam;
101 
103 };
104 
107 #include "EBHitResponse.icc"
108 #endif
const APDSimParameters * apdParameters() const
void putAnalogSignal(const PCaloHit &inputHit, CLHEP::HepRandomEngine *) override
void findIntercalibConstant(const DetId &detId, double &icalconst) const
std::vector< double > m_apdTimeVec
Definition: EBHitResponse.h:96
std::vector< double > VecD
Definition: EBHitResponse.h:20
std::vector< EBSamples > m_vSam
const double pext
Definition: EBHitResponse.h:98
~EBHitResponseImpl() override
virtual bool keepBlank() const
Definition: EBHitResponse.h:36
EcalSamples * operator[](unsigned int i) override
const bool m_apdOnly
Definition: EBHitResponse.h:88
Electronic response of the preamp.
Definition: CaloVShape.h:11
const double pqua
Definition: EBHitResponse.h:98
const double pfac
Definition: EBHitResponse.h:98
const EcalIntercalibConstantsMC * m_intercal
Definition: EBHitResponse.h:91
static constexpr double kSamplePeriod
Definition: EBHitResponse.h:24
std::vector< double > m_timeOffVec
Definition: EBHitResponse.h:93
void initializeHits() override
static constexpr size_t kNOffsets
Definition: EBHitResponse.h:22
const CaloVShape * apdShape() const
unsigned int samplesSize() const override
const double pcon
Definition: EBHitResponse.h:98
const double nonlFunc(double enr) const
Definition: EBHitResponse.h:70
const double nonlFunc1(double energy) const
Definition: EBHitResponse.h:74
const double pehi
Definition: EBHitResponse.h:98
std::vector< double > m_apdNpeVec
Definition: EBHitResponse.h:95
CaloTSamples< float, constset::sampleSize > EBSamples
Definition: EBHitResponse.h:18
const double poff
Definition: EBHitResponse.h:98
CaloTSamplesBase< float > EcalSamples
EBHitResponseImpl< ecalPh2 > EBHitResponse_Ph2
void setIntercal(const EcalIntercalibConstantsMC *ical)
Definition: DetId.h:17
EBHitResponseImpl(const CaloVSimParameterMap *parameterMap, const CaloVShape *shape, bool apdOnly, const APDSimParameters *apdPars=nullptr, const CaloVShape *apdShape=nullptr)
EcalSamples * vSamAll(unsigned int i) override
void initialize(CLHEP::HepRandomEngine *)
void finalizeHits() override
const VecD & offsets() const
Definition: EBHitResponse.h:68
void add(const PCaloHit &hit, CLHEP::HepRandomEngine *) override
const APDSimParameters * m_apdPars
Definition: EBHitResponse.h:89
EcalSamples * vSam(unsigned int i) override
void putAPDSignal(const DetId &detId, double npe, double time)
const CaloVShape * m_apdShape
Definition: EBHitResponse.h:90
const double plin
Definition: EBHitResponse.h:98
const double pcub
Definition: EBHitResponse.h:98
const double pasy
Definition: EBHitResponse.h:98
void run(MixCollection< PCaloHit > &hits, CLHEP::HepRandomEngine *) override
EBHitResponseImpl< ecalPh1 > EBHitResponse
const double pelo
Definition: EBHitResponse.h:98
double apdSignalAmplitude(const PCaloHit &hit, CLHEP::HepRandomEngine *) const
unsigned int samplesSizeAll() const override
const CaloVShape * shape() const