43 #include "CLHEP/Matrix/Matrix.h" 44 #include "CLHEP/Matrix/SymMatrix.h" 84 LogDebug(
"EcalUncalibRecHitInfo") <<
"total # EBdigis: " << EBdigis->
size() ;
101 LogDebug(
"EcalUncalibRecHitInfo") <<
"total # EEdigis: " << EEdigis->
size() ;
108 if (!EBdigis && !EEdigis)
138 LogDebug(
"EcalUncalibRecHitDebug") <<
"Fetching EcalTBWeights from DB " ;
149 LogDebug(
"EcalUncalibRecHitDebug") <<
"EcalTBWeightMap.size(): " << std::setprecision(3) << wgts->
getMap().size() ;
155 LogDebug(
"EcalUncalibRecHitDebug") <<
"fetching pedestals....";
162 LogDebug(
"EcalUncalibRecHitDebug") <<
"done." ;
167 auto EBuncalibRechits = std::make_unique<EBUncalibratedRecHitCollection>();
168 auto EEuncalibRechits = std::make_unique<EEUncalibratedRecHitCollection>();
176 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
182 if (recTDC->
offset() == -999.)
184 edm::LogError(
"EcalUncalibRecHitError") <<
"TDC bin completely out of range. Returning" ;
190 for(
unsigned int idig = 0; idig < EBdigis->
size(); ++idig) {
199 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up pedestal for crystal: " <<
EBDetId(itdg.
id()) ;
202 if( pedIter == pedMap.
end() ) {
203 edm::LogError(
"EcalUncalibRecHitError") <<
"error!! could not find pedestals for channel: " <<
EBDetId(itdg.
id())
204 <<
"\n no uncalib rechit will be made for this digi!" 216 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up gainRatios for crystal: " <<
EBDetId(itdg.
id()) ;
219 if( gainIter == gainMap.
end() ) {
220 edm::LogError(
"EcalUncalibRecHitError") <<
"error!! could not find gain ratios for channel: " <<
EBDetId(itdg.
id())
221 <<
"\n no uncalib rechit will be made for this digi!" 226 double gainRatios[3];
233 if( git == grpMap.
end() ) {
234 edm::LogError(
"EcalUncalibRecHitError") <<
"No group id found for this crystal. something wrong with EcalWeightXtalGroups in your DB?" 235 <<
"\n no uncalib rechit will be made for digi with id: " <<
EBDetId(itdg.
id())
243 double sampleGainRef = 1;
244 int sampleSwitch = 999;
248 if(gainSample != sampleGainRef) {sampleGainRef = gainSample; sampleSwitch =
sample;}
255 if (recTDC->
offset() <= 0.)
257 if (recTDC->
offset() >= 1.)
264 edm::LogError(
"EcalUncalibRecHitError") <<
"TDC bin out of range " << tdcBin <<
" offset " << recTDC->
offset();
281 wit = wgts->
getMap().find( std::make_pair(gid,tdcid) );
282 if( wit == wgts->
getMap().end() ) {
283 edm::LogError(
"EcalUncalibRecHitError") <<
"No weights found for EcalGroupId: " << gid.
id() <<
" and EcalTDCId: " << tdcid
284 <<
"\n skipping digi with id: " <<
EBDetId(itdg.
id())
294 LogDebug(
"EcalUncalibRecHitDebug") <<
"accessing matrices of weights...";
317 EBuncalibRechits->push_back( aHit );
320 LogDebug(
"EcalUncalibRecHitDebug") <<
"processed EBDataFrame with id: " 322 <<
"uncalib rechit amplitude: " << aHit.
amplitude()
334 for(
unsigned int idig = 0; idig < EEdigis->
size(); ++idig) {
342 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up pedestal for crystal: " <<
EEDetId(itdg.
id()) ;
346 if( pedIter == pedMap.
end() ) {
347 edm::LogError(
"EcalUncalibRecHitError") <<
"error!! could not find pedestals for channel: " <<
EEDetId(itdg.
id())
348 <<
"\n no uncalib rechit will be made for this digi!" 360 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up gainRatios for crystal: " <<
EEDetId(itdg.
id()) ;
364 if( gainIter == gainMap.
end() ) {
365 edm::LogError(
"EcalUncalibRecHitError") <<
"error!! could not find gain ratios for channel: " <<
EEDetId(itdg.
id())
366 <<
"\n no uncalib rechit will be made for this digi!" 371 double gainRatios[3];
378 if( git == grpMap.
end() ) {
379 edm::LogError(
"EcalUncalibRecHitError") <<
"No group id found for this crystal. something wrong with EcalWeightXtalGroups in your DB?" 380 <<
"\n no uncalib rechit will be made for digi with id: " <<
EEDetId(itdg.
id())
388 double sampleGainRef = 1;
389 int sampleSwitch = 999;
393 if(gainSample != sampleGainRef) {sampleGainRef = gainSample; sampleSwitch =
sample;}
400 if (recTDC->
offset() <= 0.)
402 if (recTDC->
offset() >= 1.)
409 edm::LogError(
"EcalUncalibRecHitError") <<
"TDC bin out of range " << tdcBin <<
" offset " << recTDC->
offset();
426 wit = wgts->
getMap().find( std::make_pair(gid,tdcid) );
427 if( wit == wgts->
getMap().end() ) {
428 edm::LogError(
"EcalUncalibRecHitError") <<
"No weights found for EcalGroupId: " << gid.
id() <<
" and EcalTDCId: " << tdcid
429 <<
"\n skipping digi with id: " <<
EEDetId(itdg.
id())
439 LogDebug(
"EcalUncalibRecHitDebug") <<
"accessing matrices of weights...";
463 EEuncalibRechits->push_back( aHit );
466 LogDebug(
"EcalUncalibRecHitDebug") <<
"processed EEDataFrame with id: " 468 <<
"uncalib rechit amplitude: " << aHit.
amplitude()
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::InputTag tdcRecInfoCollection_
const self & getMap() const
constexpr uint32_t rawId() const
get the raw id
EcalMGPASample sample(int i) const
int gainId() const
get the gainId (2 bits)
std::string EEhitCollection_
std::string EBhitCollection_
const unsigned int id() const
edm::InputTag EEdigiCollection_
const EBShape testbeamEBShape
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
EcalTBWeightUncalibRecHitProducer(const edm::ParameterSet &ps)
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *pedestalsRMS, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalShapeBase &testbeamPulseShape)
Compute parameters.
EcalWeightMatrix & getWeightsAfterGainSwitch()
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
EcalUncalibRecHitRecWeightsAlgo< EEDataFrame > EEalgo_
bool use2004OffsetConvention_
EcalWeightMatrix & getWeightsBeforeGainSwitch()
T const * product() const
std::vector< Item >::const_iterator const_iterator
float gain12Over6() const
const EEShape testbeamEEShape
void produce(edm::Event &evt, const edm::EventSetup &es) override
const_iterator find(uint32_t rawId) const
const EcalTBWeightMap & getMap() const
math::Matrix< 3, 10 >::type EcalWeightMatrix
edm::InputTag EBdigiCollection_
const_iterator end() const
~EcalTBWeightUncalibRecHitProducer() override
EcalUncalibRecHitRecWeightsAlgo< EBDataFrame > EBalgo_
T const * product() const