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>
10 
15 class HcalMCParams;
16 class HcalRecoParams;
17 class HcalTopology;
18 
19 namespace CLHEP {
20  class HepRandomEngine;
21 }
22 
24 public:
27  ~HcalPulseShapes();
28  // only needed if you'll be getting shapes by DetId
29  void beginRun(edm::EventSetup const & es);
30  void endRun();
31 
32  const Shape& hbShape() const { return hpdShape_; }
33  const Shape& heShape() const { return hpdShape_; }
34  const Shape& hfShape() const { return hfShape_; }
35  const Shape& hoShape(bool sipm=false) const { return sipm ? siPMShape_ : hpdShape_; }
36  // return Shape for given shapeType.
37  const Shape& getShape(int shapeType) const;
39  const Shape& shape(const HcalDetId & detId) const;
40  const Shape& shapeForReco(const HcalDetId & detId) const;
42  const Shape& defaultShape(const HcalDetId & detId) const;
43  //public static helpers
44  static const int nBinsSiPM_ = 250;
45  static constexpr float deltaTSiPM_ = 0.5;
46  static constexpr float invDeltaTSiPM_ = 2.0;
47  static double analyticPulseShapeSiPMHO(double t);
48  static double analyticPulseShapeSiPMHE(double t);
49  static constexpr float Y11RANGE_ = nBinsSiPM_;
50  static constexpr float Y11MAX_ = 0.04;
51  static double Y11TimePDF(double t);
52  static double generatePhotonTime(CLHEP::HepRandomEngine* engine);
53  //this function can take function pointers *or* functors!
54  template <class F1, class F2>
55  static std::vector<double> convolve(unsigned nbin, F1 f1, F2 f2){
56  std::vector<double> result(2*nbin-1,0.);
57  for(unsigned i = 0; i < 2*nbin-1; ++i){
58  for(unsigned j = 0; j < std::min(i+1,nbin); ++j){
59  double tmp = f1(j)*f2(i-j);
60  if(std::isnan(tmp) or std::isinf(tmp)) continue;
61  result[i] += tmp;
62  }
63  }
64  return result;
65  }
66 
67 private:
68  void computeHPDShape(float, float, float, float, float ,
69  float, float, float, Shape&);
70  void computeHFShape();
71  void computeSiPMShape();
72  void computeSiPMShape2017();
73  void computeSiPMShapeData2017();
74  Shape hpdShape_, hfShape_, siPMShape_, siPMShape2017_, siPMShapeData2017_;
75  Shape hpdShape_v2, hpdShapeMC_v2;
76  Shape hpdShape_v3, hpdShapeMC_v3;
77  Shape hpdBV30Shape_v2, hpdBV30ShapeMC_v2;
81  typedef std::map<int, const Shape *> ShapeMap;
82  ShapeMap theShapes;
83 
84 };
85 #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