69 LogDebug(
"EcalUncalibRecHitInfo") <<
"total # EBdigis: " << EBdigis->
size();
83 LogDebug(
"EcalUncalibRecHitInfo") <<
"total # EEdigis: " << EEdigis->
size();
88 if (!EBdigis && !EEdigis)
108 LogDebug(
"EcalUncalibRecHitDebug") <<
"Fetching EcalTBWeights from DB ";
113 LogDebug(
"EcalUncalibRecHitDebug") <<
"EcalTBWeightMap.size(): " << std::setprecision(3) << wgts.getMap().size();
118 LogDebug(
"EcalUncalibRecHitDebug") <<
"fetching pedestals....";
122 LogDebug(
"EcalUncalibRecHitDebug") <<
"done.";
126 auto EBuncalibRechits = std::make_unique<EBUncalibratedRecHitCollection>();
127 auto EEuncalibRechits = std::make_unique<EEUncalibratedRecHitCollection>();
135 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
141 if (recTDC->
offset() == -999.) {
142 edm::LogError(
"EcalUncalibRecHitError") <<
"TDC bin completely out of range. Returning";
147 for (
unsigned int idig = 0; idig < EBdigis->
size(); ++idig) {
152 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up pedestal for crystal: " <<
EBDetId(itdg.
id());
155 if (pedIter == pedMap.
end()) {
157 <<
"error!! could not find pedestals for channel: " <<
EBDetId(itdg.
id())
158 <<
"\n no uncalib rechit will be made for this digi!";
164 pedVec[0] = aped.mean_x12;
165 pedVec[1] = aped.mean_x6;
166 pedVec[2] = aped.mean_x1;
167 pedRMSVec[0] = aped.rms_x12;
168 pedRMSVec[1] = aped.rms_x6;
169 pedRMSVec[2] = aped.rms_x1;
173 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up gainRatios for crystal: " <<
EBDetId(itdg.
id());
176 if (gainIter == gainMap.
end()) {
178 <<
"error!! could not find gain ratios for channel: " <<
EBDetId(itdg.
id())
179 <<
"\n no uncalib rechit will be made for this digi!";
183 double gainRatios[3];
190 if (git == grpMap.
end()) {
192 <<
"No group id found for this crystal. something wrong with EcalWeightXtalGroups in your DB?" 193 <<
"\n no uncalib rechit will be made for digi with id: " <<
EBDetId(itdg.
id());
199 double sampleGainRef = 1;
200 int sampleSwitch = 999;
203 if (gainSample != sampleGainRef) {
204 sampleGainRef = gainSample;
212 if (recTDC->
offset() <= 0.)
214 else if (recTDC->
offset() >= 1.)
221 <<
"TDC bin out of range " << tdcBin <<
" offset " << recTDC->
offset();
238 wit = wgts.getMap().find(std::make_pair(gid, tdcid));
239 if (wit == wgts.getMap().end()) {
241 <<
"No weights found for EcalGroupId: " << gid.
id() <<
" and EcalTDCId: " << tdcid
242 <<
"\n skipping digi with id: " <<
EBDetId(itdg.
id());
250 LogDebug(
"EcalUncalibRecHitDebug") <<
"accessing matrices of weights...";
270 EBuncalibRechits->push_back(aHit);
273 LogDebug(
"EcalUncalibRecHitDebug") <<
"processed EBDataFrame with id: " <<
EBDetId(itdg.
id()) <<
"\n" 274 <<
"uncalib rechit amplitude: " << aHit.
amplitude();
283 for (
unsigned int idig = 0; idig < EEdigis->
size(); ++idig) {
288 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up pedestal for crystal: " <<
EEDetId(itdg.
id());
291 if (pedIter == pedMap.
end()) {
293 <<
"error!! could not find pedestals for channel: " <<
EEDetId(itdg.
id())
294 <<
"\n no uncalib rechit will be made for this digi!";
300 pedVec[0] = aped.mean_x12;
301 pedVec[1] = aped.mean_x6;
302 pedVec[2] = aped.mean_x1;
303 pedRMSVec[0] = aped.rms_x12;
304 pedRMSVec[1] = aped.rms_x6;
305 pedRMSVec[2] = aped.rms_x1;
309 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up gainRatios for crystal: " <<
EEDetId(itdg.
id());
312 if (gainIter == gainMap.
end()) {
314 <<
"error!! could not find gain ratios for channel: " <<
EEDetId(itdg.
id())
315 <<
"\n no uncalib rechit will be made for this digi!";
319 double gainRatios[3];
326 if (git == grpMap.
end()) {
328 <<
"No group id found for this crystal. something wrong with EcalWeightXtalGroups in your DB?" 329 <<
"\n no uncalib rechit will be made for digi with id: " <<
EEDetId(itdg.
id());
335 double sampleGainRef = 1;
336 int sampleSwitch = 999;
339 if (gainSample != sampleGainRef) {
340 sampleGainRef = gainSample;
348 if (recTDC->
offset() <= 0.)
350 else if (recTDC->
offset() >= 1.)
357 <<
"TDC bin out of range " << tdcBin <<
" offset " << recTDC->
offset();
374 wit = wgts.getMap().find(std::make_pair(gid, tdcid));
375 if (wit == wgts.getMap().end()) {
377 <<
"No weights found for EcalGroupId: " << gid.
id() <<
" and EcalTDCId: " << tdcid
378 <<
"\n skipping digi with id: " <<
EEDetId(itdg.
id());
386 LogDebug(
"EcalUncalibRecHitDebug") <<
"accessing matrices of weights...";
406 EEuncalibRechits->push_back(aHit);
409 LogDebug(
"EcalUncalibRecHitDebug") <<
"processed EEDataFrame with id: " <<
EEDetId(itdg.
id()) <<
"\n" 410 <<
"uncalib rechit amplitude: " << aHit.
amplitude();
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const std::string ebHitCollection_
T const * product() const
const edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > tbWeightsToken_
math::Matrix< 3, 10 >::type EcalWeightMatrix
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Log< level::Error, false > LogError
const edm::EDGetTokenT< EcalTBTDCRecInfo > tbTDCRecInfoToken_
const edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
EcalUncalibRecHitRecWeightsAlgo< EBDataFrame > ebAlgo_
const bool use2004OffsetConvention_
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedestalsToken_
const std::string eeHitCollection_
const EBShape testbeamEBShape
const edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > gainRatiosToken_
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *pedestalsRMS, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalShapeBase &testbeamPulseShape)
Compute parameters.
const edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
EcalMGPASample sample(int i) const
EcalWeightMatrix & getWeightsAfterGainSwitch()
const_iterator find(uint32_t rawId) const
EcalUncalibRecHitRecWeightsAlgo< EEDataFrame > eeAlgo_
float gain12Over6() const
EcalWeightMatrix & getWeightsBeforeGainSwitch()
constexpr uint32_t rawId() const
get the raw id
std::vector< Item >::const_iterator const_iterator
const EEShape testbeamEEShape
const edm::InputTag eeDigiCollection_
const self & getMap() const
const_iterator end() const
const edm::InputTag ebDigiCollection_
const edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > weightXtalGroupsToken_
int gainId() const
get the gainId (2 bits)