CMS 3D CMS Logo

HGCalRecHitSimpleAlgo.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_HGCalRecAlgos_HGCalRecHitSimpleAlgo_HH
2 #define RecoLocalCalo_HGCalRecAlgos_HGCalRecHitSimpleAlgo_HH
3 
18 #include <iostream>
19 
21  public:
22  // default ctor
24  adcToGeVConstant_ = -1;
25  adcToGeVConstantIsSet_ = false;
26  }
27 
28  void setLayerWeights(const std::vector<float>& weights) override {
29  weights_ = weights;
30  }
31 
32  void setADCToGeVConstant(const float value) override {
35  }
36 
37 
38  // destructor
39  ~HGCalRecHitSimpleAlgo() override { };
40 
43  const uint32_t& flags = 0) const override {
44 
46  throw cms::Exception("HGCalRecHitSimpleAlgoBadConfig")
47  << "makeRecHit: adcToGeVConstant_ not set before calling this method!";
48  }
49 
50  DetId baseid = uncalibRH.id();
51  unsigned layer = 0;
52  if( DetId::Hcal == baseid.det() && HcalEndcap == baseid.subdetId() ) {
53  layer = HcalDetId(baseid).depth() + 40;
54  } else if ( DetId::Forward == baseid.det() && HGCEE == baseid.subdetId() ) {
55  layer = HGCalDetId(baseid).layer();
56  } else if ( DetId::Forward == baseid.det() && HGCHEF == baseid.subdetId() ) {
57  layer = HGCalDetId(baseid).layer() + 28;
58  } else if ( DetId::HGCalEE == baseid.det() ) {
59  layer = HGCSiliconDetId(baseid).layer();
60  } else if ( DetId::HGCalHSi == baseid.det() ) {
61  layer = HGCSiliconDetId(baseid).layer() + 28;
62  } else if ( DetId::HGCalHSc == baseid.det() ) {
63  layer = HGCScintillatorDetId(baseid).layer() + 28;
64  } else {
65  throw cms::Exception("InvalidRecHit")
66  << "HGCalRecHitSimpleAlgo encountered a non-HGCal det id: " << baseid.det() << ' ' << baseid.subdetId() << ' ' << baseid.rawId();
67  }
68 
69  // float clockToNsConstant = 25;
70  float energy = uncalibRH.amplitude() * weights_[layer] * 0.001f;
71  float time = uncalibRH.jitter();
72 
73  //if(time<0) time = 0; // fast-track digi conversion
74 
75  HGCRecHit rh( uncalibRH.id(), energy, time );
76 
77  // Now fill flags
78  // all rechits from the digitizer are "good" at present
80 
81  return rh;
82  }
83 
84 private:
87  std::vector<float> weights_;
88 };
89 #endif
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: HGCRecHit.h:95
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
void setADCToGeVConstant(const float value) override
void setLayerWeights(const std::vector< float > &weights) override
make rechits from dataframes
int depth() const
get the tower depth
Definition: HcalDetId.h:162
int layer() const
get the layer #
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Definition: value.py:1
Definition: DetId.h:18
HGCRecHit makeRecHit(const HGCUncalibratedRecHit &uncalibRH, const uint32_t &flags=0) const override
Compute parameters.
int layer() const
get the layer #
std::vector< float > weights_
int layer() const
get the layer #
Definition: HGCalDetId.h:48
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39