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 
17 namespace CLHEP {
18  class HepRandomEngine;
19 }
20 
22 public:
25  ~HcalPulseShapes();
26  // only needed if you'll be getting shapes by DetId
27  void beginRun(edm::EventSetup const & es);
28  void beginRun(const HcalDbService* conditions);
29 
30  const Shape& hbShape() const { return hpdShape_; }
31  const Shape& heShape() const { return hpdShape_; }
32  const Shape& hfShape() const { return hfShape_; }
33  const Shape& hoShape(bool sipm=false) const { return sipm ? siPMShapeHO_ : hpdShape_; }
34  // return Shape for given shapeType.
35  const Shape& getShape(int shapeType) const;
37  const Shape& shape(const HcalDetId & detId) const;
38  const Shape& shapeForReco(const HcalDetId & detId) const;
40  const Shape& defaultShape(const HcalDetId & detId) const;
41  //public static helpers
42  static const int nBinsSiPM_ = 250;
43  static constexpr float deltaTSiPM_ = 0.5;
44  static constexpr float invDeltaTSiPM_ = 2.0;
45  static double analyticPulseShapeSiPMHO(double t);
46  static double analyticPulseShapeSiPMHE(double t);
47  static constexpr float Y11RANGE_ = nBinsSiPM_;
48  static constexpr float Y11MAX203_ = 0.04;
49  static constexpr float Y11MAX206_ = 0.08;
50  static double Y11203(double t);
51  static double Y11206(double t);
52  static double generatePhotonTime(CLHEP::HepRandomEngine* engine, unsigned int signalShape);
53  static double generatePhotonTime203(CLHEP::HepRandomEngine* engine);
54  static double generatePhotonTime206(CLHEP::HepRandomEngine* engine);
55  //this function can take function pointers *or* functors!
56  template <class F1, class F2>
57  static std::vector<double> convolve(unsigned nbin, F1 f1, F2 f2){
58  std::vector<double> result(2*nbin-1,0.);
59  for(unsigned i = 0; i < 2*nbin-1; ++i){
60  for(unsigned j = 0; j < std::min(i+1,nbin); ++j){
61  double tmp = f1(j)*f2(i-j);
62  if(std::isnan(tmp) or std::isinf(tmp)) continue;
63  result[i] += tmp;
64  }
65  }
66  return result;
67  }
68 
69 private:
70  void computeHPDShape(float, float, float, float, float ,
71  float, float, float, Shape&);
72  void computeHFShape();
73  void computeSiPMShapeHO();
74  void computeSiPMShapeHE203();
75  void computeSiPMShapeHE206();
76  void computeSiPMShapeData2017();
77  void computeSiPMShapeData2018();
78  Shape hpdShape_, hfShape_, siPMShapeHO_;
79  Shape siPMShapeMC2017_, siPMShapeData2017_;
80  Shape siPMShapeMC2018_, siPMShapeData2018_;
81  Shape hpdShape_v2, hpdShapeMC_v2;
82  Shape hpdShape_v3, hpdShapeMC_v3;
83  Shape hpdBV30Shape_v2, hpdBV30ShapeMC_v2;
85  typedef std::map<int, const Shape *> ShapeMap;
86  ShapeMap theShapes;
87 
88 };
89 #endif
const Shape & heShape() const
const Shape & hoShape(bool sipm=false) const
#define constexpr
std::map< int, const Shape * > ShapeMap
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 HcalDbService * theDbService
const Shape & hfShape() const
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