CMS 3D CMS Logo

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