CMS 3D CMS Logo

HGCalRecHitWorkerSimple.cc
Go to the documentation of this file.
8 
11 {
13  tools_.reset(new hgcal::RecHitTools());
14  constexpr float keV2GeV = 1e-6;
15  // HGCee constants
16  hgcEE_keV2DIGI_ = ps.getParameter<double>("HGCEE_keV2DIGI");
17  hgcEE_fCPerMIP_ = ps.getParameter < std::vector<double> > ("HGCEE_fCPerMIP");
18  hgcEE_isSiFE_ = ps.getParameter<bool>("HGCEE_isSiFE");
20 
21  // HGChef constants
22  hgcHEF_keV2DIGI_ = ps.getParameter<double>("HGCHEF_keV2DIGI");
23  hgcHEF_fCPerMIP_ = ps.getParameter < std::vector<double> > ("HGCHEF_fCPerMIP");
24  hgcHEF_isSiFE_ = ps.getParameter<bool>("HGCHEF_isSiFE");
26 
27  // HGCheb constants
28  hgcHEB_keV2DIGI_ = ps.getParameter<double>("HGCHEB_keV2DIGI");
29  hgcHEB_isSiFE_ = ps.getParameter<bool>("HGCHEB_isSiFE");
31 
32  // layer weights (from Valeri/Arabella)
33  const auto& dweights = ps.getParameter < std::vector<double> > ("layerWeights");
34  for (auto weight : dweights)
35  {
36  weights_.push_back(weight);
37  }
38 
39  rechitMaker_->setLayerWeights(weights_);
40 
41  // residual correction for cell thickness
42  const auto& rcorr = ps.getParameter < std::vector<double> > ("thicknessCorrection");
43  rcorr_.clear();
44  rcorr_.push_back(1.f);
45  for (auto corr : rcorr)
46  {
47  rcorr_.push_back(1.0 / corr);
48  }
49 
50 
51  hgcEE_noise_fC_ = ps.getParameter < std::vector<double> > ("HGCEE_noise_fC");
52  hgcEE_cce_ = ps.getParameter< std::vector<double> > ("HGCEE_cce");
53  hgcHEF_noise_fC_ = ps.getParameter < std::vector<double> > ("HGCHEF_noise_fC");
54  hgcHEF_cce_ = ps.getParameter< std::vector<double> > ("HGCHEF_cce");
55  hgcHEB_noise_MIP_ = ps.getParameter<double>("HGCHEB_noise_MIP");
56 
57  // don't produce rechit if detid is a ghost one
58  rangeMatch_ = ps.getParameter<uint32_t>("rangeMatch");
59  rangeMask_ = ps.getParameter<uint32_t>("rangeMask");
60 }
61 
63 {
64  tools_->getEventSetup(es);
65  if (hgcEE_isSiFE_)
66  {
67  edm::ESHandle < HGCalGeometry > hgceeGeoHandle;
68  es.get<IdealGeometryRecord>().get("HGCalEESensitive", hgceeGeoHandle);
69  ddds_[0] = &(hgceeGeoHandle->topology().dddConstants());
70  }
71  else
72  {
73  ddds_[0] = nullptr;
74  }
75  if (hgcHEF_isSiFE_)
76  {
77  edm::ESHandle < HGCalGeometry > hgchefGeoHandle;
78  es.get<IdealGeometryRecord>().get("HGCalHESiliconSensitive", hgchefGeoHandle);
79  ddds_[1] = &(hgchefGeoHandle->topology().dddConstants());
80  }
81  else
82  {
83  ddds_[1] = nullptr;
84  }
85  ddds_[2] = nullptr;
86 }
87 
90 {
91  DetId detid = uncalibRH.id();
92 // don't produce rechit if detid is a ghost one
93 
94  if((detid & rangeMask_) == rangeMatch_)
95  return false;
96 
97  int thickness = -1;
98  float sigmaNoiseGeV = 0.f;
99  unsigned int layer = tools_->getLayerWithOffset(detid);
100  HGCalDetId hid;
101  float cce_correction = 1.0;
102 
103  switch (detid.subdetId())
104  {
105  case HGCEE:
106  rechitMaker_->setADCToGeVConstant(float(hgceeUncalib2GeV_));
107  hid = detid;
108  thickness = ddds_[hid.subdetId() - 3]->waferTypeL(hid.wafer());
109  cce_correction = hgcEE_cce_[thickness - 1];
110  sigmaNoiseGeV = 1e-3 * weights_[layer] * rcorr_[thickness]
111  * hgcEE_noise_fC_[thickness - 1] / hgcEE_fCPerMIP_[thickness - 1];
112  break;
113  case HGCHEF:
114  rechitMaker_->setADCToGeVConstant(float(hgchefUncalib2GeV_));
115  hid = detid;
116  thickness = ddds_[hid.subdetId() - 3]->waferTypeL(hid.wafer());
117  cce_correction = hgcHEF_cce_[thickness - 1];
118  sigmaNoiseGeV = 1e-3 * weights_[layer] * rcorr_[thickness]
119  * hgcHEF_noise_fC_[thickness - 1] / hgcHEF_fCPerMIP_[thickness - 1];
120  break;
121  case HcalEndcap:
122  case HGCHEB:
123  rechitMaker_->setADCToGeVConstant(float(hgchebUncalib2GeV_));
124  hid = detid;
125  sigmaNoiseGeV = 1e-3 * hgcHEB_noise_MIP_ * weights_[layer];
126  break;
127  default:
128  throw cms::Exception("NonHGCRecHit") << "Rechit with detid = " << detid.rawId()
129  << " is not HGC!";
130  }
131 
132  // make the rechit and put in the output collection
133 
134  HGCRecHit myrechit(rechitMaker_->makeRecHit(uncalibRH, 0));
135  const double new_E = myrechit.energy() * (thickness == -1 ? 1.0 : rcorr_[thickness])/cce_correction;
136 
137 
138  myrechit.setEnergy(new_E);
139  myrechit.setSignalOverSigmaNoise(new_E/sigmaNoiseGeV);
140  result.push_back(myrechit);
141 
142  return true;
143 }
144 
146 {
147 }
148 
T getParameter(std::string const &) const
std::vector< float > weights_
std::vector< double > hgcEE_cce_
std::array< const HGCalDDDConstants *, 3 > ddds_
std::vector< double > hgcHEF_fCPerMIP_
std::vector< double > hgcEE_fCPerMIP_
void push_back(T const &t)
Definition: weight.py:1
std::vector< double > hgcEE_noise_fC_
#define constexpr
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
std::vector< double > hgcHEF_cce_
float energy() const
Definition: CaloRecHit.h:17
std::vector< double > hgcHEF_noise_fC_
std::vector< double > rcorr_
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
void set(const edm::EventSetup &es) override
double f[11][100]
int wafer() const
get the wafer #
Definition: HGCalDetId.h:42
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
JetCorrectorParameters corr
Definition: classes.h:5
std::unique_ptr< hgcal::RecHitTools > tools_
Definition: DetId.h:18
const HGCalDDDConstants & dddConstants() const
HGCalRecHitWorkerSimple(const edm::ParameterSet &)
const T & get() const
Definition: EventSetup.h:59
bool run(const edm::Event &evt, const HGCUncalibratedRecHit &uncalibRH, HGCRecHitCollection &result) override
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::unique_ptr< HGCalRecHitSimpleAlgo > rechitMaker_