CMS 3D CMS Logo

HGCalRecHitWorkerSimple.cc
Go to the documentation of this file.
9 
12  tools_.reset(new hgcal::RecHitTools());
13  constexpr float keV2GeV = 1e-6;
14  // HGCee constants
15  hgcEE_keV2DIGI_ = ps.getParameter<double>("HGCEE_keV2DIGI");
16  hgcEE_fCPerMIP_ = ps.getParameter<std::vector<double> >("HGCEE_fCPerMIP");
17  hgcEE_isSiFE_ = ps.getParameter<bool>("HGCEE_isSiFE");
19 
20  // HGChef constants
21  hgcHEF_keV2DIGI_ = ps.getParameter<double>("HGCHEF_keV2DIGI");
22  hgcHEF_fCPerMIP_ = ps.getParameter<std::vector<double> >("HGCHEF_fCPerMIP");
23  hgcHEF_isSiFE_ = ps.getParameter<bool>("HGCHEF_isSiFE");
25 
26  // HGCheb constants
27  hgcHEB_keV2DIGI_ = ps.getParameter<double>("HGCHEB_keV2DIGI");
28  hgcHEB_isSiFE_ = ps.getParameter<bool>("HGCHEB_isSiFE");
30 
31  // HGChfnose constants
32  hgcHFNose_keV2DIGI_ = ps.getParameter<double>("HGCHFNose_keV2DIGI");
33  hgcHFNose_fCPerMIP_ = ps.getParameter<std::vector<double> >("HGCHFNose_fCPerMIP");
34  hgcHFNose_isSiFE_ = ps.getParameter<bool>("HGCHFNose_isSiFE");
36 
37  // layer weights (from Valeri/Arabella)
38  const auto& dweights = ps.getParameter<std::vector<double> >("layerWeights");
39  for (auto weight : dweights) {
40  weights_.push_back(weight);
41  }
42  const auto& weightnose = ps.getParameter<std::vector<double> >("layerNoseWeights");
43  for (auto const& weight : weightnose)
44  weightsNose_.emplace_back(weight);
45 
46  rechitMaker_->setLayerWeights(weights_);
47  rechitMaker_->setNoseLayerWeights(weightsNose_);
48 
49  // residual correction for cell thickness
50  const auto& rcorr = ps.getParameter<std::vector<double> >("thicknessCorrection");
51  rcorr_.clear();
52  rcorr_.push_back(1.f);
53  for (auto corr : rcorr) {
54  rcorr_.push_back(1.0 / corr);
55  }
56  const auto& rcorrnose = ps.getParameter<std::vector<double> >("thicknessNoseCorrection");
57  rcorrNose_.clear();
58  rcorrNose_.push_back(1.f);
59  for (auto corr : rcorrnose) {
60  rcorrNose_.push_back(1.0 / corr);
61  }
62 
63  hgcEE_noise_fC_ = ps.getParameter<edm::ParameterSet>("HGCEE_noise_fC").getParameter<std::vector<double> >("values");
64  hgcEE_cce_ = ps.getParameter<edm::ParameterSet>("HGCEE_cce").getParameter<std::vector<double> >("values");
65  hgcHEF_noise_fC_ = ps.getParameter<edm::ParameterSet>("HGCHEF_noise_fC").getParameter<std::vector<double> >("values");
66  hgcHEF_cce_ = ps.getParameter<edm::ParameterSet>("HGCHEF_cce").getParameter<std::vector<double> >("values");
67  hgcHEB_noise_MIP_ = ps.getParameter<edm::ParameterSet>("HGCHEB_noise_MIP").getParameter<double>("noise_MIP");
69  ps.getParameter<edm::ParameterSet>("HGCHFNose_noise_fC").getParameter<std::vector<double> >("values");
70  hgcHFNose_cce_ = ps.getParameter<edm::ParameterSet>("HGCHFNose_cce").getParameter<std::vector<double> >("values");
71 
72  // don't produce rechit if detid is a ghost one
73  rangeMatch_ = ps.getParameter<uint32_t>("rangeMatch");
74  rangeMask_ = ps.getParameter<uint32_t>("rangeMask");
75 }
76 
78  tools_->getEventSetup(es);
79  rechitMaker_->set(es);
80  if (hgcEE_isSiFE_) {
81  edm::ESHandle<HGCalGeometry> hgceeGeoHandle;
82  es.get<IdealGeometryRecord>().get("HGCalEESensitive", hgceeGeoHandle);
83  ddds_[0] = &(hgceeGeoHandle->topology().dddConstants());
84  } else {
85  ddds_[0] = nullptr;
86  }
87  if (hgcHEF_isSiFE_) {
88  edm::ESHandle<HGCalGeometry> hgchefGeoHandle;
89  es.get<IdealGeometryRecord>().get("HGCalHESiliconSensitive", hgchefGeoHandle);
90  ddds_[1] = &(hgchefGeoHandle->topology().dddConstants());
91  } else {
92  ddds_[1] = nullptr;
93  }
94  ddds_[2] = nullptr;
95  if (hgcHFNose_isSiFE_) {
96  edm::ESHandle<HGCalGeometry> hgchfnoseGeoHandle;
97  es.get<IdealGeometryRecord>().get("HGCalHFNoseSensitive", hgchfnoseGeoHandle);
98  ddds_[3] = &(hgchfnoseGeoHandle->topology().dddConstants());
99  } else {
100  ddds_[3] = nullptr;
101  }
102 }
103 
105  const HGCUncalibratedRecHit& uncalibRH,
107  DetId detid = uncalibRH.id();
108  // don't produce rechit if detid is a ghost one
109 
110  if (detid.det() == DetId::Forward || detid.det() == DetId::Hcal) {
111  if ((detid & rangeMask_) == rangeMatch_)
112  return false;
113  }
114 
115  int thickness = -1;
116  float sigmaNoiseGeV = 0.f;
117  unsigned int layer = tools_->getLayerWithOffset(detid);
118  float cce_correction = 1.0;
119  int idtype(0);
120 
121  switch (detid.det()) {
122  case DetId::HGCalEE:
123  idtype = hgcee;
124  thickness = 1 + HGCSiliconDetId(detid).type();
125  break;
126  case DetId::HGCalHSi:
127  idtype = hgcfh;
128  thickness = 1 + HGCSiliconDetId(detid).type();
129  break;
130  case DetId::HGCalHSc:
131  idtype = hgcbh;
132  break;
133  default:
134  switch (detid.subdetId()) {
135  case HGCEE:
136  idtype = hgcee;
137  thickness = ddds_[detid.subdetId() - 3]->waferTypeL(HGCalDetId(detid).wafer());
138  break;
139  case HGCHEF:
140  idtype = hgcfh;
141  thickness = ddds_[detid.subdetId() - 3]->waferTypeL(HGCalDetId(detid).wafer());
142  break;
143  case HcalEndcap:
144  [[fallthrough]];
145  case HGCHEB:
146  idtype = hgcbh;
147  break;
148  case HFNose:
149  idtype = hgchfnose;
150  thickness = 1 + HFNoseDetId(detid).type();
151  break;
152  default:
153  break;
154  }
155  }
156  switch (idtype) {
157  case hgcee:
158  rechitMaker_->setADCToGeVConstant(float(hgceeUncalib2GeV_));
159  cce_correction = hgcEE_cce_[thickness - 1];
160  sigmaNoiseGeV =
161  1e-3 * weights_[layer] * rcorr_[thickness] * hgcEE_noise_fC_[thickness - 1] / hgcEE_fCPerMIP_[thickness - 1];
162  break;
163  case hgcfh:
164  rechitMaker_->setADCToGeVConstant(float(hgchefUncalib2GeV_));
165  cce_correction = hgcHEF_cce_[thickness - 1];
166  sigmaNoiseGeV = 1e-3 * weights_[layer] * rcorr_[thickness] * hgcHEF_noise_fC_[thickness - 1] /
167  hgcHEF_fCPerMIP_[thickness - 1];
168  break;
169  case hgcbh:
170  rechitMaker_->setADCToGeVConstant(float(hgchebUncalib2GeV_));
171  sigmaNoiseGeV = 1e-3 * hgcHEB_noise_MIP_ * weights_[layer];
172  break;
173  case hgchfnose:
174  rechitMaker_->setADCToGeVConstant(float(hgchfnoseUncalib2GeV_));
175  cce_correction = hgcHFNose_cce_[thickness - 1];
176  sigmaNoiseGeV = 1e-3 * weightsNose_[layer] * rcorrNose_[thickness] * hgcHFNose_noise_fC_[thickness - 1] /
177  hgcHFNose_fCPerMIP_[thickness - 1];
178  break;
179  default:
180  throw cms::Exception("NonHGCRecHit") << "Rechit with detid = " << detid.rawId() << " is not HGC!";
181  }
182 
183  // make the rechit and put in the output collection
184 
185  HGCRecHit myrechit(rechitMaker_->makeRecHit(uncalibRH, 0));
186  double new_E = myrechit.energy();
187  if (detid.det() == DetId::Forward && detid.subdetId() == ForwardSubdetector::HFNose) {
188  new_E *= (thickness == -1 ? 1.0 : rcorrNose_[thickness]) / cce_correction;
189  } else {
190  new_E *= (thickness == -1 ? 1.0 : rcorr_[thickness]) / cce_correction;
191  }
192 
193  myrechit.setEnergy(new_E);
194  myrechit.setSignalOverSigmaNoise(new_E / sigmaNoiseGeV);
195  result.push_back(myrechit);
196 
197  return true;
198 }
199 
201 
constexpr float energy() const
Definition: CaloRecHit.h:29
T getParameter(std::string const &) const
std::vector< float > weights_
std::vector< double > hgcEE_cce_
int type() const
get the type
Definition: HFNoseDetId.h:49
std::vector< float > weightsNose_
std::vector< double > hgcHEF_fCPerMIP_
std::vector< double > hgcEE_fCPerMIP_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void push_back(T const &t)
Definition: weight.py:1
std::vector< double > hgcEE_noise_fC_
std::vector< double > hgcHFNose_cce_
std::vector< double > hgcHEF_cce_
std::vector< double > hgcHFNose_fCPerMIP_
std::vector< double > hgcHEF_noise_fC_
int type() const
get the type
std::vector< double > rcorr_
const HGCalTopology & topology() const
void set(const edm::EventSetup &es) override
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
double f[11][100]
JetCorrectorParameters corr
Definition: classes.h:5
std::unique_ptr< hgcal::RecHitTools > tools_
Definition: DetId.h:17
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
HGCalRecHitWorkerSimple(const edm::ParameterSet &)
T get() const
Definition: EventSetup.h:73
bool run(const edm::Event &evt, const HGCUncalibratedRecHit &uncalibRH, HGCRecHitCollection &result) override
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::unique_ptr< HGCalRecHitSimpleAlgo > rechitMaker_
std::vector< double > rcorrNose_
#define constexpr
std::array< const HGCalDDDConstants *, 4 > ddds_
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
std::vector< double > hgcHFNose_noise_fC_