43 #include "CLHEP/Matrix/Matrix.h" 44 #include "CLHEP/Matrix/SymMatrix.h" 80 LogDebug(
"EcalUncalibRecHitInfo") <<
"total # EBdigis: " << EBdigis->
size() ;
97 LogDebug(
"EcalUncalibRecHitInfo") <<
"total # EEdigis: " << EEdigis->
size() ;
104 if (!EBdigis && !EEdigis)
134 LogDebug(
"EcalUncalibRecHitDebug") <<
"Fetching EcalTBWeights from DB " ;
145 LogDebug(
"EcalUncalibRecHitDebug") <<
"EcalTBWeightMap.size(): " << std::setprecision(3) << wgts->
getMap().size() ;
151 LogDebug(
"EcalUncalibRecHitDebug") <<
"fetching pedestals....";
158 LogDebug(
"EcalUncalibRecHitDebug") <<
"done." ;
163 auto EBuncalibRechits = std::make_unique<EBUncalibratedRecHitCollection>();
164 auto EEuncalibRechits = std::make_unique<EEUncalibratedRecHitCollection>();
172 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
178 if (recTDC->
offset() == -999.)
180 edm::LogError(
"EcalUncalibRecHitError") <<
"TDC bin completely out of range. Returning" ;
186 for(
unsigned int idig = 0; idig < EBdigis->
size(); ++idig) {
195 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up pedestal for crystal: " <<
EBDetId(itdg.
id()) ;
198 if( pedIter == pedMap.
end() ) {
199 edm::LogError(
"EcalUncalibRecHitError") <<
"error!! could not find pedestals for channel: " <<
EBDetId(itdg.
id())
200 <<
"\n no uncalib rechit will be made for this digi!" 212 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up gainRatios for crystal: " <<
EBDetId(itdg.
id()) ;
215 if( gainIter == gainMap.
end() ) {
216 edm::LogError(
"EcalUncalibRecHitError") <<
"error!! could not find gain ratios for channel: " <<
EBDetId(itdg.
id())
217 <<
"\n no uncalib rechit will be made for this digi!" 222 double gainRatios[3];
229 if( git == grpMap.
end() ) {
230 edm::LogError(
"EcalUncalibRecHitError") <<
"No group id found for this crystal. something wrong with EcalWeightXtalGroups in your DB?" 231 <<
"\n no uncalib rechit will be made for digi with id: " <<
EBDetId(itdg.
id())
239 double sampleGainRef = 1;
240 int sampleSwitch = 999;
244 if(gainSample != sampleGainRef) {sampleGainRef = gainSample; sampleSwitch =
sample;}
251 if (recTDC->
offset() <= 0.)
253 if (recTDC->
offset() >= 1.)
260 edm::LogError(
"EcalUncalibRecHitError") <<
"TDC bin out of range " << tdcBin <<
" offset " << recTDC->
offset();
277 wit = wgts->
getMap().find( std::make_pair(gid,tdcid) );
278 if( wit == wgts->
getMap().end() ) {
279 edm::LogError(
"EcalUncalibRecHitError") <<
"No weights found for EcalGroupId: " << gid.
id() <<
" and EcalTDCId: " << tdcid
280 <<
"\n skipping digi with id: " <<
EBDetId(itdg.
id())
290 LogDebug(
"EcalUncalibRecHitDebug") <<
"accessing matrices of weights...";
313 EBuncalibRechits->push_back( aHit );
316 LogDebug(
"EcalUncalibRecHitDebug") <<
"processed EBDataFrame with id: " 318 <<
"uncalib rechit amplitude: " << aHit.
amplitude()
330 for(
unsigned int idig = 0; idig < EEdigis->
size(); ++idig) {
338 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up pedestal for crystal: " <<
EEDetId(itdg.
id()) ;
342 if( pedIter == pedMap.
end() ) {
343 edm::LogError(
"EcalUncalibRecHitError") <<
"error!! could not find pedestals for channel: " <<
EEDetId(itdg.
id())
344 <<
"\n no uncalib rechit will be made for this digi!" 356 LogDebug(
"EcalUncalibRecHitDebug") <<
"looking up gainRatios for crystal: " <<
EEDetId(itdg.
id()) ;
360 if( gainIter == gainMap.
end() ) {
361 edm::LogError(
"EcalUncalibRecHitError") <<
"error!! could not find gain ratios for channel: " <<
EEDetId(itdg.
id())
362 <<
"\n no uncalib rechit will be made for this digi!" 367 double gainRatios[3];
374 if( git == grpMap.
end() ) {
375 edm::LogError(
"EcalUncalibRecHitError") <<
"No group id found for this crystal. something wrong with EcalWeightXtalGroups in your DB?" 376 <<
"\n no uncalib rechit will be made for digi with id: " <<
EEDetId(itdg.
id())
384 double sampleGainRef = 1;
385 int sampleSwitch = 999;
389 if(gainSample != sampleGainRef) {sampleGainRef = gainSample; sampleSwitch =
sample;}
396 if (recTDC->
offset() <= 0.)
398 if (recTDC->
offset() >= 1.)
405 edm::LogError(
"EcalUncalibRecHitError") <<
"TDC bin out of range " << tdcBin <<
" offset " << recTDC->
offset();
422 wit = wgts->
getMap().find( std::make_pair(gid,tdcid) );
423 if( wit == wgts->
getMap().end() ) {
424 edm::LogError(
"EcalUncalibRecHitError") <<
"No weights found for EcalGroupId: " << gid.
id() <<
" and EcalTDCId: " << tdcid
425 <<
"\n skipping digi with id: " <<
EEDetId(itdg.
id())
435 LogDebug(
"EcalUncalibRecHitDebug") <<
"accessing matrices of weights...";
459 EEuncalibRechits->push_back( aHit );
462 LogDebug(
"EcalUncalibRecHitDebug") <<
"processed EEDataFrame with id: " 464 <<
"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
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_
uint32_t rawId() const
get the raw id
const EBShape testbeamEBShape
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
EcalTBWeightUncalibRecHitProducer(const edm::ParameterSet &ps)
~EcalTBWeightUncalibRecHitProducer()
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_
virtual void produce(edm::Event &evt, const edm::EventSetup &es)
EcalWeightMatrix & getWeightsBeforeGainSwitch()
T const * product() const
std::vector< Item >::const_iterator const_iterator
float gain12Over6() const
const EEShape testbeamEEShape
const_iterator find(uint32_t rawId) const
const EcalTBWeightMap & getMap() const
math::Matrix< 3, 10 >::type EcalWeightMatrix
edm::InputTag EBdigiCollection_
const_iterator end() const
EcalUncalibRecHitRecWeightsAlgo< EBDataFrame > EBalgo_
T const * product() const