CMS 3D CMS Logo

HGCalRecHitWorkerSimple.cc
Go to the documentation of this file.
2 
3 #include <memory>
4 
13 
15  rechitMaker_ = std::make_unique<HGCalRecHitSimpleAlgo>();
16  tools_ = std::make_unique<hgcal::RecHitTools>();
17  constexpr float keV2GeV = 1e-6;
18  // HGCee constants
19  hgcEE_keV2DIGI_ = ps.getParameter<double>("HGCEE_keV2DIGI");
20  hgcEE_fCPerMIP_ = ps.getParameter<std::vector<double> >("HGCEE_fCPerMIP");
21  hgcEE_isSiFE_ = ps.getParameter<bool>("HGCEE_isSiFE");
23 
24  // HGChef constants
25  hgcHEF_keV2DIGI_ = ps.getParameter<double>("HGCHEF_keV2DIGI");
26  hgcHEF_fCPerMIP_ = ps.getParameter<std::vector<double> >("HGCHEF_fCPerMIP");
27  hgcHEF_isSiFE_ = ps.getParameter<bool>("HGCHEF_isSiFE");
29 
30  // HGCheb constants
31  hgcHEB_keV2DIGI_ = ps.getParameter<double>("HGCHEB_keV2DIGI");
32  hgcHEB_isSiFE_ = ps.getParameter<bool>("HGCHEB_isSiFE");
34 
35  // HGChfnose constants
36  hgcHFNose_keV2DIGI_ = ps.getParameter<double>("HGCHFNose_keV2DIGI");
37  hgcHFNose_fCPerMIP_ = ps.getParameter<std::vector<double> >("HGCHFNose_fCPerMIP");
38  hgcHFNose_isSiFE_ = ps.getParameter<bool>("HGCHFNose_isSiFE");
40 
41  // layer weights (from Valeri/Arabella)
42  const auto& dweights = ps.getParameter<std::vector<double> >("layerWeights");
43  for (auto weight : dweights) {
44  weights_.push_back(weight);
45  }
46  const auto& weightnose = ps.getParameter<std::vector<double> >("layerNoseWeights");
47  for (auto const& weight : weightnose)
48  weightsNose_.emplace_back(weight);
49 
50  rechitMaker_->setLayerWeights(weights_);
51  rechitMaker_->setNoseLayerWeights(weightsNose_);
52 
53  // residual correction for cell thickness
54  // first for silicon
55  const auto& rcorr = ps.getParameter<std::vector<double> >("thicknessCorrection");
56  rcorr_.clear();
57  rcorr_.push_back(1.f);
58  for (auto corr : rcorr) {
59  rcorr_.push_back(1.0 / corr);
60  }
61  // here for scintillator
62  rcorrscint_ = 1.0 / ps.getParameter<double>("sciThicknessCorrection");
63 
64  //This is for the index position in CE_H silicon thickness cases
65  deltasi_index_regemfac_ = ps.getParameter<int>("deltasi_index_regemfac");
66  const auto& rcorrnose = ps.getParameter<std::vector<double> >("thicknessNoseCorrection");
67  rcorrNose_.clear();
68  rcorrNose_.push_back(1.f);
69  for (auto corr : rcorrnose) {
70  rcorrNose_.push_back(1.0 / corr);
71  }
72 
73  hgcEE_noise_fC_ = ps.getParameter<edm::ParameterSet>("HGCEE_noise_fC").getParameter<std::vector<double> >("values");
74  hgcEE_cce_ = ps.getParameter<edm::ParameterSet>("HGCEE_cce").getParameter<std::vector<double> >("values");
75  hgcHEF_noise_fC_ = ps.getParameter<edm::ParameterSet>("HGCHEF_noise_fC").getParameter<std::vector<double> >("values");
76  hgcHEF_cce_ = ps.getParameter<edm::ParameterSet>("HGCHEF_cce").getParameter<std::vector<double> >("values");
77  hgcHEB_noise_MIP_ = ps.getParameter<edm::ParameterSet>("HGCHEB_noise_MIP").getParameter<double>("noise_MIP");
79  ps.getParameter<edm::ParameterSet>("HGCHFNose_noise_fC").getParameter<std::vector<double> >("values");
80  hgcHFNose_cce_ = ps.getParameter<edm::ParameterSet>("HGCHFNose_cce").getParameter<std::vector<double> >("values");
81 
82  // don't produce rechit if detid is a ghost one
83  rangeMatch_ = ps.getParameter<uint32_t>("rangeMatch");
84  rangeMask_ = ps.getParameter<uint32_t>("rangeMask");
85 
86  // error for recHit time
88  ps.getParameter<double>("maxValSiPar"),
89  ps.getParameter<double>("constSiPar"),
90  ps.getParameter<double>("noiseSiPar"));
91 }
92 
96  tools_->setGeometry(*geom);
97  rechitMaker_->set(*geom);
98  if (hgcEE_isSiFE_) {
99  edm::ESHandle<HGCalGeometry> hgceeGeoHandle;
100  es.get<IdealGeometryRecord>().get("HGCalEESensitive", hgceeGeoHandle);
101  ddds_[0] = &(hgceeGeoHandle->topology().dddConstants());
102  } else {
103  ddds_[0] = nullptr;
104  }
105  if (hgcHEF_isSiFE_) {
106  edm::ESHandle<HGCalGeometry> hgchefGeoHandle;
107  es.get<IdealGeometryRecord>().get("HGCalHESiliconSensitive", hgchefGeoHandle);
108  ddds_[1] = &(hgchefGeoHandle->topology().dddConstants());
109  } else {
110  ddds_[1] = nullptr;
111  }
112  ddds_[2] = nullptr;
113  if (hgcHFNose_isSiFE_) {
114  edm::ESHandle<HGCalGeometry> hgchfnoseGeoHandle;
115  es.get<IdealGeometryRecord>().get("HGCalHFNoseSensitive", hgchfnoseGeoHandle);
116  ddds_[3] = &(hgchfnoseGeoHandle->topology().dddConstants());
117  } else {
118  ddds_[3] = nullptr;
119  }
120 }
121 
123  const HGCUncalibratedRecHit& uncalibRH,
125  DetId detid = uncalibRH.id();
126  // don't produce rechit if detid is a ghost one
127 
128  if (detid.det() == DetId::Forward || detid.det() == DetId::Hcal) {
129  if ((detid & rangeMask_) == rangeMatch_)
130  return false;
131  }
132 
133  int thickness = -1;
134  float sigmaNoiseGeV = 0.f;
135  unsigned int layer = tools_->getLayerWithOffset(detid);
136  float cce_correction = 1.0;
137  int idtype(0);
138 
139  switch (detid.det()) {
140  case DetId::HGCalEE:
141  idtype = hgcee;
142  thickness = 1 + HGCSiliconDetId(detid).type();
143  break;
144  case DetId::HGCalHSi:
145  idtype = hgcfh;
146  thickness = 1 + HGCSiliconDetId(detid).type();
147  break;
148  case DetId::HGCalHSc:
149  idtype = hgcbh;
150  break;
151  default:
152  switch (detid.subdetId()) {
153  case HGCEE:
154  idtype = hgcee;
155  thickness = ddds_[detid.subdetId() - 3]->waferTypeL(HGCalDetId(detid).wafer());
156  break;
157  case HGCHEF:
158  idtype = hgcfh;
159  thickness = ddds_[detid.subdetId() - 3]->waferTypeL(HGCalDetId(detid).wafer());
160  break;
161  case HcalEndcap:
162  [[fallthrough]];
163  case HGCHEB:
164  idtype = hgcbh;
165  break;
166  case HFNose:
167  idtype = hgchfnose;
168  thickness = 1 + HFNoseDetId(detid).type();
169  break;
170  default:
171  break;
172  }
173  }
174  switch (idtype) {
175  case hgcee:
176  rechitMaker_->setADCToGeVConstant(float(hgceeUncalib2GeV_));
177  cce_correction = hgcEE_cce_[thickness - 1];
178  sigmaNoiseGeV =
180  break;
181  case hgcfh:
182  rechitMaker_->setADCToGeVConstant(float(hgchefUncalib2GeV_));
183  cce_correction = hgcHEF_cce_[thickness - 1];
184  sigmaNoiseGeV = 1e-3 * weights_[layer] * rcorr_[thickness + deltasi_index_regemfac_] *
186  break;
187  case hgcbh:
188  rechitMaker_->setADCToGeVConstant(float(hgchebUncalib2GeV_));
189  sigmaNoiseGeV = 1e-3 * hgcHEB_noise_MIP_ * weights_[layer] * rcorrscint_;
190  break;
191  case hgchfnose:
192  rechitMaker_->setADCToGeVConstant(float(hgchfnoseUncalib2GeV_));
193  cce_correction = hgcHFNose_cce_[thickness - 1];
194  sigmaNoiseGeV = 1e-3 * weightsNose_[layer] * rcorrNose_[thickness] * hgcHFNose_noise_fC_[thickness - 1] /
196  break;
197  default:
198  throw cms::Exception("NonHGCRecHit") << "Rechit with detid = " << detid.rawId() << " is not HGC!";
199  }
200 
201  // make the rechit and put in the output collection
202 
203  HGCRecHit myrechit(rechitMaker_->makeRecHit(uncalibRH, 0));
204  double new_E = myrechit.energy();
205  if (detid.det() == DetId::Forward && detid.subdetId() == ForwardSubdetector::HFNose) {
206  new_E *= (thickness == -1 ? 1.0 : rcorrNose_[thickness]) / cce_correction;
207  } //regional factors for silicon in CE_H
208  else if (idtype == hgcfh) {
209  new_E *= rcorr_[thickness + deltasi_index_regemfac_] / cce_correction;
210  } //regional factors for scintillator and silicon in CE_E
211  else {
212  new_E *= (thickness == -1 ? rcorrscint_ : rcorr_[thickness]) / cce_correction;
213  }
214 
215  myrechit.setEnergy(new_E);
216  float SoN = new_E / sigmaNoiseGeV;
217  myrechit.setSignalOverSigmaNoise(SoN);
218 
219  if (detid.det() == DetId::HGCalHSc || myrechit.time() < 0.) {
220  myrechit.setTimeError(-1.);
221  } else {
222  float timeError = timeEstimatorSi_.getTimeError("recHit", SoN);
223  myrechit.setTimeError(timeError);
224  }
225 
226  result.push_back(myrechit);
227 
228  return true;
229 }
230 
232 
HGCalRecHitWorkerSimple::hgcHFNose_keV2DIGI_
double hgcHFNose_keV2DIGI_
Definition: HGCalRecHitWorkerSimple.h:38
HGCalRecHitWorkerSimple::rcorrNose_
std::vector< double > rcorrNose_
Definition: HGCalRecHitWorkerSimple.h:58
HGCalRecHitWorkerSimple::hgcHEF_fCPerMIP_
std::vector< double > hgcHEF_fCPerMIP_
Definition: HGCalRecHitWorkerSimple.h:35
HGCalRecHitWorkerSimple::rangeMask_
uint32_t rangeMask_
Definition: HGCalRecHitWorkerSimple.h:56
HGCalRecHitWorkerSimple::hgcHFNose_noise_fC_
std::vector< double > hgcHFNose_noise_fC_
Definition: HGCalRecHitWorkerSimple.h:45
HGCalTopology::dddConstants
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
MessageLogger.h
CaloRecHit::energy
constexpr float energy() const
Definition: CaloRecHit.h:29
HGCalRecHitWorkerSimple::weightsNose_
std::vector< float > weightsNose_
Definition: HGCalRecHitWorkerSimple.h:61
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HGCalRecHitWorkerSimple::weights_
std::vector< float > weights_
Definition: HGCalRecHitWorkerSimple.h:61
HGCalRecHitWorkerSimple::hgchfnoseUncalib2GeV_
double hgchfnoseUncalib2GeV_
Definition: HGCalRecHitWorkerSimple.h:38
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
DetId::Hcal
Definition: DetId.h:28
HGCalRecHitWorkerSimple::deltasi_index_regemfac_
int deltasi_index_regemfac_
Definition: HGCalRecHitWorkerSimple.h:60
edm::SortedCollection
Definition: SortedCollection.h:49
HGCalRecHitWorkerSimple::hgcHEF_cce_
std::vector< double > hgcHEF_cce_
Definition: HGCalRecHitWorkerSimple.h:36
HFNoseDetId
Definition: HFNoseDetId.h:22
HGCalRecHitWorkerSimple
Definition: HGCalRecHitWorkerSimple.h:20
HGCUncalibratedRecHit
Definition: HGCUncalibratedRecHit.h:7
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
HGCalRecHitWorkerSimple::hgcEE_isSiFE_
bool hgcEE_isSiFE_
Definition: HGCalRecHitWorkerSimple.h:41
ForwardSubdetector.h
HGCalRecHitWorkerSimple::hgcbh
Definition: HGCalRecHitWorkerSimple.h:29
DetId
Definition: DetId.h:17
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
MakerMacros.h
HGCalRecHitWorkerSimple::hgcEE_fCPerMIP_
std::vector< double > hgcEE_fCPerMIP_
Definition: HGCalRecHitWorkerSimple.h:32
HGCalRecHitWorkerFactory.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
HGCalRecHitWorkerSimple::hgcHEB_noise_MIP_
double hgcHEB_noise_MIP_
Definition: HGCalRecHitWorkerSimple.h:46
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:114
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
HFNose
Definition: ForwardSubdetector.h:11
HGCalRecHitWorkerSimple::hgcHFNose_fCPerMIP_
std::vector< double > hgcHFNose_fCPerMIP_
Definition: HGCalRecHitWorkerSimple.h:39
HGCalRecHitWorkerSimple::hgcfh
Definition: HGCalRecHitWorkerSimple.h:29
HGCalRecHitWorkerSimple::hgcHEF_noise_fC_
std::vector< double > hgcHEF_noise_fC_
Definition: HGCalRecHitWorkerSimple.h:44
HGCalRecHitWorkerSimple::hgcHEF_keV2DIGI_
double hgcHEF_keV2DIGI_
Definition: HGCalRecHitWorkerSimple.h:34
HGCalRecHitWorkerSimple::hgchebUncalib2GeV_
double hgchebUncalib2GeV_
Definition: HGCalRecHitWorkerSimple.h:37
HGCUncalibratedRecHit::id
DetId id() const
Definition: HGCUncalibratedRecHit.h:33
HGCalRecHitWorkerSimple::rcorr_
std::vector< double > rcorr_
Definition: HGCalRecHitWorkerSimple.h:58
HGCalRecHitWorkerSimple::hgcHFNose_cce_
std::vector< double > hgcHFNose_cce_
Definition: HGCalRecHitWorkerSimple.h:40
edm::ESHandle< CaloGeometry >
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HGCalRecHitWorkerSimple::set
void set(const edm::EventSetup &es) override
Definition: HGCalRecHitWorkerSimple.cc:93
HGCalRecHitWorkerSimple::timeEstimatorSi_
hgcalsimclustertime::ComputeClusterTime timeEstimatorSi_
Definition: HGCalRecHitWorkerSimple.h:65
StringToEnumValue.h
HGCalRecHitWorkerSimple::~HGCalRecHitWorkerSimple
~HGCalRecHitWorkerSimple() override
Definition: HGCalRecHitWorkerSimple.cc:231
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
HGCalGeometry::topology
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:111
HGCalRecHitWorkerSimple::hgcEE_noise_fC_
std::vector< double > hgcEE_noise_fC_
Definition: HGCalRecHitWorkerSimple.h:43
HGCalRecHitWorkerSimple::rcorrscint_
double rcorrscint_
Definition: HGCalRecHitWorkerSimple.h:59
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
HGCRecHit
Definition: HGCRecHit.h:14
HGCEE
Definition: ForwardSubdetector.h:8
ComputeClusterTime.h
HFNoseDetId::type
int type() const
get the type
Definition: HFNoseDetId.h:50
edm::ParameterSet
Definition: ParameterSet.h:47
HGCalRecHitWorkerSimple::HGCalRecHitWorkerSimple
HGCalRecHitWorkerSimple(const edm::ParameterSet &)
Definition: HGCalRecHitWorkerSimple.cc:14
Event.h
edmplugin::PluginFactory
Definition: PluginFactory.h:34
HGCalRecHitWorkerSimple::hgcHEB_isSiFE_
bool hgcHEB_isSiFE_
Definition: HGCalRecHitWorkerSimple.h:41
HGCalRecHitWorkerSimple::hgcee
Definition: HGCalRecHitWorkerSimple.h:29
HGCalRecHitWorkerSimple::hgcHEF_isSiFE_
bool hgcHEF_isSiFE_
Definition: HGCalRecHitWorkerSimple.h:41
HGCalRecHitWorkerSimple::hgchefUncalib2GeV_
double hgchefUncalib2GeV_
Definition: HGCalRecHitWorkerSimple.h:34
edm::EventSetup
Definition: EventSetup.h:57
HcalSubdetector.h
HGCalRecHitWorkerBaseClass
Definition: HGCalRecHitWorkerBaseClass.h:12
HGCalRecHitWorkerSimple::hgcHEB_keV2DIGI_
double hgcHEB_keV2DIGI_
Definition: HGCalRecHitWorkerSimple.h:37
get
#define get
HGCalRecHitWorkerSimple::run
bool run(const edm::Event &evt, const HGCUncalibratedRecHit &uncalibRH, HGCRecHitCollection &result) override
Definition: HGCalRecHitWorkerSimple.cc:122
HGCalRecHitWorkerSimple::tools_
std::unique_ptr< hgcal::RecHitTools > tools_
Definition: HGCalRecHitWorkerSimple.h:63
HGCalRecHitWorkerSimple::hgcHFNose_isSiFE_
bool hgcHFNose_isSiFE_
Definition: HGCalRecHitWorkerSimple.h:41
HGCalDetId
Definition: HGCalDetId.h:8
HGCalRecHitWorkerSimple::hgchfnose
Definition: HGCalRecHitWorkerSimple.h:29
HGCalDetId.h
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HGCalRecHitWorkerSimple::rechitMaker_
std::unique_ptr< HGCalRecHitSimpleAlgo > rechitMaker_
Definition: HGCalRecHitWorkerSimple.h:62
HcalEndcap
Definition: HcalAssistant.h:34
DetId::HGCalHSc
Definition: DetId.h:34
Exception
Definition: hltDiff.cc:246
hgcalsimclustertime::ComputeClusterTime
Definition: ComputeClusterTime.h:23
HGCSiliconDetId::type
int type() const
get the type
Definition: HGCSiliconDetId.h:51
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalRecHitWorkerSimple::hgceeUncalib2GeV_
double hgceeUncalib2GeV_
Definition: HGCalRecHitWorkerSimple.h:31
mps_fire.result
result
Definition: mps_fire.py:311
HGCHEF
Definition: ForwardSubdetector.h:9
hgcalsimclustertime::ComputeClusterTime::getTimeError
float getTimeError(std::string type, float xVal)
Definition: ComputeClusterTime.cc:46
HGCalRecHitWorkerSimple::rangeMatch_
uint32_t rangeMatch_
Definition: HGCalRecHitWorkerSimple.h:55
DetId::Forward
Definition: DetId.h:30
HGCalRecHitWorkerSimple::ddds_
std::array< const HGCalDDDConstants *, 4 > ddds_
Definition: HGCalRecHitWorkerSimple.h:48
edm::Event
Definition: Event.h:73
HGCalRecHitWorkerSimple.h
HGCalRecHitWorkerSimple::hgcEE_cce_
std::vector< double > hgcEE_cce_
Definition: HGCalRecHitWorkerSimple.h:33
HGCalRecHitWorkerSimple::hgcEE_keV2DIGI_
double hgcEE_keV2DIGI_
Definition: HGCalRecHitWorkerSimple.h:31
weight
Definition: weight.py:1
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
HGCHEB
Definition: ForwardSubdetector.h:10
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37