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 
19 #include <iostream>
20 
22 public:
23  // default ctor
25  adcToGeVConstant_ = -1;
26  adcToGeVConstantIsSet_ = false;
27  }
28 
29  void setLayerWeights(const std::vector<float>& weights) override { weights_ = weights; }
30 
31  void setNoseLayerWeights(const std::vector<float>& weights) { weightsNose_ = weights; }
32 
33  void setADCToGeVConstant(const float value) override {
36  }
37 
38  // destructor
39  ~HGCalRecHitSimpleAlgo() override{};
40 
42  HGCRecHit makeRecHit(const HGCUncalibratedRecHit& uncalibRH, const uint32_t& flags = 0) const override {
44  throw cms::Exception("HGCalRecHitSimpleAlgoBadConfig")
45  << "makeRecHit: adcToGeVConstant_ not set before calling this method!";
46  }
47 
48  DetId baseid = uncalibRH.id();
49  unsigned layer = rhtools_.getLayerWithOffset(baseid);
50  bool hfnose = DetId::Forward == baseid.det() && HFNose == baseid.subdetId();
51 
52  // float clockToNsConstant = 25;
53  float energy = (hfnose ? (uncalibRH.amplitude() * weightsNose_[layer] * 0.001f)
54  : (uncalibRH.amplitude() * weights_[layer] * 0.001f));
55  float time = uncalibRH.jitter();
56 
57  //if(time<0) time = 0; // fast-track digi conversion
58 
59  HGCRecHit rh(uncalibRH.id(), energy, time);
60 
61  // Now fill flags
62  // all rechits from the digitizer are "good" at present
64 
65  return rh;
66  }
67 
68 private:
71  std::vector<float> weights_, weightsNose_;
72 };
73 #endif
hgcal::RecHitTools rhtools_
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: HGCRecHit.h:101
void setADCToGeVConstant(const float value) override
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
void setLayerWeights(const std::vector< float > &weights) override
make rechits from dataframes
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: value.py:1
Definition: DetId.h:17
std::vector< float > weights_
std::vector< float > weightsNose_
HGCRecHit makeRecHit(const HGCUncalibratedRecHit &uncalibRH, const uint32_t &flags=0) const override
Compute parameters.
void setNoseLayerWeights(const std::vector< float > &weights)
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:376