CMS 3D CMS Logo

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