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