CMS 3D CMS Logo

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