CMS 3D CMS Logo

HcalPulseShapes.h
Go to the documentation of this file.
1 #ifndef CALIBCALORIMETRY_HCALALGOS_HCALPULSESHAPES_H
2 #define CALIBCALORIMETRY_HCALALGOS_HCALPULSESHAPES_H 1
3 
4 #include <map>
5 #include <vector>
6 #include <cmath>
11 
16 class HcalMCParams;
17 class HcalRecoParams;
18 class HcalTopology;
19 
20 namespace CLHEP {
21  class HepRandomEngine;
22 }
23 
25 public:
28  ~HcalPulseShapes();
29  // only needed if you'll be getting shapes by DetId
30  void beginRun(edm::EventSetup const & es);
31  void endRun();
32  void beginRun(const HcalTopology* topo, const edm::ESHandle<HcalMCParams>& mcParams, const edm::ESHandle<HcalRecoParams>& recoParams);
33 
34  const Shape& hbShape() const { return hpdShape_; }
35  const Shape& heShape() const { return hpdShape_; }
36  const Shape& hfShape() const { return hfShape_; }
37  const Shape& hoShape(bool sipm=false) const { return sipm ? siPMShapeHO_ : hpdShape_; }
38  // return Shape for given shapeType.
39  const Shape& getShape(int shapeType) const;
41  const Shape& shape(const HcalDetId & detId) const;
42  const Shape& shapeForReco(const HcalDetId & detId) const;
44  const Shape& defaultShape(const HcalDetId & detId) const;
45  //public static helpers
46  static const int nBinsSiPM_ = 250;
47  static constexpr float deltaTSiPM_ = 0.5;
48  static constexpr float invDeltaTSiPM_ = 2.0;
49  static double analyticPulseShapeSiPMHO(double t);
50  static double analyticPulseShapeSiPMHE(double t);
51  static constexpr float Y11RANGE_ = nBinsSiPM_;
52  static constexpr float Y11MAX203_ = 0.04;
53  static constexpr float Y11MAX206_ = 0.08;
54  static double Y11203(double t);
55  static double Y11206(double t);
56  static double generatePhotonTime(CLHEP::HepRandomEngine* engine, unsigned int signalShape);
57  static double generatePhotonTime203(CLHEP::HepRandomEngine* engine);
58  static double generatePhotonTime206(CLHEP::HepRandomEngine* engine);
59  //this function can take function pointers *or* functors!
60  template <class F1, class F2>
61  static std::vector<double> convolve(unsigned nbin, F1 f1, F2 f2){
62  std::vector<double> result(2*nbin-1,0.);
63  for(unsigned i = 0; i < 2*nbin-1; ++i){
64  for(unsigned j = 0; j < std::min(i+1,nbin); ++j){
65  double tmp = f1(j)*f2(i-j);
66  if(std::isnan(tmp) or std::isinf(tmp)) continue;
67  result[i] += tmp;
68  }
69  }
70  return result;
71  }
72 
73 private:
74  void computeHPDShape(float, float, float, float, float ,
75  float, float, float, Shape&);
76  void computeHFShape();
77  void computeSiPMShapeHO();
78  void computeSiPMShapeHE203();
79  void computeSiPMShapeHE206();
80  void computeSiPMShapeData2017();
81  void computeSiPMShapeData2018();
82  Shape hpdShape_, hfShape_, siPMShapeHO_;
83  Shape siPMShapeMC2017_, siPMShapeData2017_;
84  Shape siPMShapeMC2018_, siPMShapeData2018_;
85  Shape hpdShape_v2, hpdShapeMC_v2;
86  Shape hpdShape_v3, hpdShapeMC_v3;
87  Shape hpdBV30Shape_v2, hpdBV30ShapeMC_v2;
91  typedef std::map<int, const Shape *> ShapeMap;
92  ShapeMap theShapes;
93 
94 };
95 #endif
const Shape & heShape() const
const Shape & hoShape(bool sipm=false) const
#define constexpr
std::map< int, const Shape * > ShapeMap
HcalRecoParams * theRecoParams
static std::vector< double > convolve(unsigned nbin, F1 f1, F2 f2)
bool isnan(float x)
Definition: math.h:13
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
T min(T a, T b)
Definition: MathUtil.h:58
const Shape & hfShape() const
const HcalTopology * theTopology
HcalMCParams * theMCParams
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const Shape & hbShape() const
HcalPulseShape Shape
TEveGeoShape * getShape(const char *name, TGeoBBox *shape, Color_t color)
Definition: BuilderUtils.cc:42