CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HGCalRecHitSimpleAlgo.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_HGCalRecAlgos_HGCalRecHitSimpleAlgo_HH
2 #define RecoLocalCalo_HGCalRecAlgos_HGCalRecHitSimpleAlgo_HH
3 
15 #include <iostream>
16 
18  public:
19  // default ctor
21  adcToGeVConstant_ = -1;
22  adcToGeVConstantIsSet_ = false;
23  }
24 
25  virtual void setLayerWeights(const std::vector<float>& weights) override {
26  weights_ = weights;
27  }
28 
29  virtual void setADCToGeVConstant(const float value) override {
32  }
33 
34 
35  // destructor
36  virtual ~HGCalRecHitSimpleAlgo() { };
37 
39  virtual HGCRecHit makeRecHit(const HGCUncalibratedRecHit& uncalibRH,
40  const uint32_t& flags = 0) const override {
41 
43  throw cms::Exception("HGCalRecHitSimpleAlgoBadConfig")
44  << "makeRecHit: adcToGeVConstant_ not set before calling this method!";
45  }
46 
47  DetId baseid = uncalibRH.id();
48  unsigned layer = 0;
49  if( DetId::Hcal == baseid.det() && HcalEndcap == baseid.subdetId() ) {
50  layer = HcalDetId(baseid).depth() + 40;
51  } else if ( DetId::Forward == baseid.det() && HGCEE == baseid.subdetId() ) {
52  layer = HGCalDetId(baseid).layer();
53  }else if ( DetId::Forward == baseid.det() && HGCHEF == baseid.subdetId() ) {
54  layer = HGCalDetId(baseid).layer() + 28;
55  } else {
56  throw cms::Exception("InvalidRecHit")
57  << "HGCalRecHitSimpleAlgo encountered a non-HGCal det id: " << baseid.det() << ' ' << baseid.subdetId() << ' ' << baseid.rawId();
58  }
59 
60  HGCalDetId hid(uncalibRH.id());
61 
62 
63  // float clockToNsConstant = 25;
64  float energy = uncalibRH.amplitude() * weights_[layer] * 0.001f;
65  float time = uncalibRH.jitter();
66 
67  //if(time<0) time = 0; // fast-track digi conversion
68 
69  HGCRecHit rh( uncalibRH.id(), energy, time );
70 
71  // Now fill flags
72  // all rechits from the digitizer are "good" at present
74 
75  return rh;
76  }
77 
78 private:
81  std::vector<float> weights_;
82 };
83 #endif
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
virtual HGCRecHit makeRecHit(const HGCUncalibratedRecHit &uncalibRH, const uint32_t &flags=0) const override
Compute parameters.
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
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