CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HBHEPhase1Reconstructor Class Reference

#include <RecoLocalCalo/HcalRecProducers/plugins/HBHEPhase1Reconstructor.cc>

Inheritance diagram for HBHEPhase1Reconstructor:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HBHEPhase1Reconstructor (const edm::ParameterSet &)
 
 ~HBHEPhase1Reconstructor () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
template<class DataFrame , class Collection >
void processData (const Collection &coll, const HcalDbService &cond, const HcalChannelQuality &qual, const HcalSeverityLevelComputer &severity, const bool isRealData, HBHEChannelInfo *info, HBHEChannelInfoCollection *infoColl, HBHERecHitCollection *rechits)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
void runHBHENegativeEFilter (const HBHEChannelInfo &info, HBHERecHit *rh)
 
void setAsicSpecificBits (const HBHEDataFrame &frame, const HcalCoder &coder, const HBHEChannelInfo &info, const HcalCalibrations &calib, HBHERecHit *rh)
 
void setAsicSpecificBits (const QIE11DataFrame &frame, const HcalCoder &coder, const HBHEChannelInfo &info, const HcalCalibrations &calib, HBHERecHit *rh)
 
void setCommonStatusBits (const HBHEChannelInfo &info, const HcalCalibrations &calib, HBHERecHit *rh)
 

Private Attributes

std::string algoConfigClass_
 
bool dropZSmarkedPassed_
 
std::unique_ptr< HBHEStatusBitSetterhbheFlagSetterQIE11_
 
std::unique_ptr< HBHEStatusBitSetterhbheFlagSetterQIE8_
 
std::unique_ptr< HBHEPulseShapeFlagSetterhbhePulseShapeFlagSetterQIE11_
 
std::unique_ptr< HBHEPulseShapeFlagSetterhbhePulseShapeFlagSetterQIE8_
 
bool makeRecHits_
 
const HBHENegativeEFilternegEFilter_
 
std::unique_ptr< HcalRecoParamsparamTS_
 
bool processQIE11_
 
bool processQIE8_
 
std::unique_ptr< AbsHBHEPhase1Algoreco_
 
std::unique_ptr< AbsHcalAlgoDatarecoConfig_
 
bool recoParamsFromDB_
 
bool saveDroppedInfos_
 
bool saveEffectivePedestal_
 
bool saveInfos_
 
bool setNegativeFlagsQIE11_
 
bool setNegativeFlagsQIE8_
 
bool setNoiseFlagsQIE11_
 
bool setNoiseFlagsQIE8_
 
bool setPulseShapeFlagsQIE11_
 
bool setPulseShapeFlagsQIE8_
 
int sipmQNTStoSum_
 
int sipmQTSShift_
 
edm::EDGetTokenT< QIE11DigiCollectiontok_qie11_
 
edm::EDGetTokenT< HBHEDigiCollectiontok_qie8_
 
bool tsFromDB_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Phase 1 reconstruction module for HB/HE

Implementation: [Notes on implementation]

Definition at line 285 of file HBHEPhase1Reconstructor.cc.

Constructor & Destructor Documentation

HBHEPhase1Reconstructor::HBHEPhase1Reconstructor ( const edm::ParameterSet conf)
explicit

Definition at line 362 of file HBHEPhase1Reconstructor.cc.

References edm::ParameterSet::getParameter(), hbheFlagSetterQIE11_, hbheFlagSetterQIE8_, hbhePulseShapeFlagSetterQIE11_, hbhePulseShapeFlagSetterQIE8_, makeRecHits_, processQIE11_, processQIE8_, reco_, saveInfos_, setNoiseFlagsQIE11_, setNoiseFlagsQIE8_, setPulseShapeFlagsQIE11_, setPulseShapeFlagsQIE8_, tok_qie11_, and tok_qie8_.

363  : algoConfigClass_(conf.getParameter<std::string>("algoConfigClass")),
364  processQIE8_(conf.getParameter<bool>("processQIE8")),
365  processQIE11_(conf.getParameter<bool>("processQIE11")),
366  saveInfos_(conf.getParameter<bool>("saveInfos")),
367  saveDroppedInfos_(conf.getParameter<bool>("saveDroppedInfos")),
368  makeRecHits_(conf.getParameter<bool>("makeRecHits")),
369  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
370  tsFromDB_(conf.getParameter<bool>("tsFromDB")),
371  recoParamsFromDB_(conf.getParameter<bool>("recoParamsFromDB")),
372  saveEffectivePedestal_(conf.getParameter<bool>("saveEffectivePedestal")),
373  sipmQTSShift_(conf.getParameter<int>("sipmQTSShift")),
374  sipmQNTStoSum_(conf.getParameter<int>("sipmQNTStoSum")),
375  setNegativeFlagsQIE8_(conf.getParameter<bool>("setNegativeFlagsQIE8")),
376  setNegativeFlagsQIE11_(conf.getParameter<bool>("setNegativeFlagsQIE11")),
377  setNoiseFlagsQIE8_(conf.getParameter<bool>("setNoiseFlagsQIE8")),
378  setNoiseFlagsQIE11_(conf.getParameter<bool>("setNoiseFlagsQIE11")),
379  setPulseShapeFlagsQIE8_(conf.getParameter<bool>("setPulseShapeFlagsQIE8")),
380  setPulseShapeFlagsQIE11_(conf.getParameter<bool>("setPulseShapeFlagsQIE11")),
382  negEFilter_(nullptr)
383 {
384  // Check that the reco algorithm has been successfully configured
385  if (!reco_.get())
386  throw cms::Exception("HBHEPhase1BadConfig")
387  << "Invalid HBHEPhase1Algo algorithm configuration"
388  << std::endl;
389 
390  // Configure the status bit setters that have been turned on
391  if (setNoiseFlagsQIE8_)
392  hbheFlagSetterQIE8_ = parse_HBHEStatusBitSetter(
393  conf.getParameter<edm::ParameterSet>("flagParametersQIE8"));
394 
396  hbheFlagSetterQIE11_ = parse_HBHEStatusBitSetter(
397  conf.getParameter<edm::ParameterSet>("flagParametersQIE11"));
398 
400  hbhePulseShapeFlagSetterQIE8_ = parse_HBHEPulseShapeFlagSetter(
401  conf.getParameter<edm::ParameterSet>("pulseShapeParametersQIE8"),
402  conf.getParameter<bool>("setLegacyFlagsQIE8"));
403 
405  hbhePulseShapeFlagSetterQIE11_ = parse_HBHEPulseShapeFlagSetter(
406  conf.getParameter<edm::ParameterSet>("pulseShapeParametersQIE11"),
407  conf.getParameter<bool>("setLegacyFlagsQIE11"));
408 
409  // Consumes and produces statements
410  if (processQIE8_)
411  tok_qie8_ = consumes<HBHEDigiCollection>(
412  conf.getParameter<edm::InputTag>("digiLabelQIE8"));
413 
414  if (processQIE11_)
415  tok_qie11_ = consumes<QIE11DigiCollection>(
416  conf.getParameter<edm::InputTag>("digiLabelQIE11"));
417 
418  if (saveInfos_)
419  produces<HBHEChannelInfoCollection>();
420 
421  if (makeRecHits_)
422  produces<HBHERecHitCollection>();
423 }
std::unique_ptr< HBHEPulseShapeFlagSetter > hbhePulseShapeFlagSetterQIE8_
T getParameter(std::string const &) const
const HBHENegativeEFilter * negEFilter_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE11_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE8_
edm::EDGetTokenT< QIE11DigiCollection > tok_qie11_
edm::EDGetTokenT< HBHEDigiCollection > tok_qie8_
std::unique_ptr< AbsHBHEPhase1Algo > parseHBHEPhase1AlgoDescription(const edm::ParameterSet &ps)
std::unique_ptr< AbsHBHEPhase1Algo > reco_
std::unique_ptr< HBHEPulseShapeFlagSetter > hbhePulseShapeFlagSetterQIE11_
HBHEPhase1Reconstructor::~HBHEPhase1Reconstructor ( )
override

Definition at line 426 of file HBHEPhase1Reconstructor.cc.

427 {
428  // do anything here that needs to be done at destruction time
429  // (e.g. close files, deallocate resources etc.)
430 }

Member Function Documentation

void HBHEPhase1Reconstructor::beginRun ( edm::Run const &  r,
edm::EventSetup const &  es 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 704 of file HBHEPhase1Reconstructor.cc.

References algoConfigClass_, Exception, fetchHcalAlgoData(), edm::EventSetup::get(), hbheFlagSetterQIE11_, hbheFlagSetterQIE8_, edm::ESHandleBase::isValid(), AlCaHLTBitMon_ParallelJobs::p, paramTS_, edm::ESHandle< T >::product(), reco_, recoConfig_, setNoiseFlagsQIE11_, and setNoiseFlagsQIE8_.

705 {
707  es.get<HcalRecoParamsRcd>().get(p);
708  paramTS_ = std::make_unique<HcalRecoParams>(*p.product());
709 
710  if (reco_->isConfigurable())
711  {
713  if (!recoConfig_.get())
714  throw cms::Exception("HBHEPhase1BadConfig")
715  << "Invalid HBHEPhase1Reconstructor \"algoConfigClass\" parameter value \""
716  << algoConfigClass_ << '"' << std::endl;
717  if (!reco_->configure(recoConfig_.get()))
718  throw cms::Exception("HBHEPhase1BadConfig")
719  << "Failed to configure HBHEPhase1Algo algorithm from EventSetup"
720  << std::endl;
721  }
722 
724  {
726  es.get<HcalFrontEndMapRcd>().get(hfemap);
727  if (hfemap.isValid())
728  {
729  if (setNoiseFlagsQIE8_)
730  hbheFlagSetterQIE8_->SetFrontEndMap(hfemap.product());
732  hbheFlagSetterQIE11_->SetFrontEndMap(hfemap.product());
733  }
734  else
735  edm::LogWarning("EventSetup") <<
736  "HBHEPhase1Reconstructor failed to get HcalFrontEndMap!" << std::endl;
737  }
738 
739  reco_->beginRun(r, es);
740 }
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE11_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE8_
std::unique_ptr< AbsHcalAlgoData > fetchHcalAlgoData(const std::string &className, const edm::EventSetup &es)
std::unique_ptr< HcalRecoParams > paramTS_
std::unique_ptr< AbsHBHEPhase1Algo > reco_
std::unique_ptr< AbsHcalAlgoData > recoConfig_
bool isValid() const
Definition: ESHandle.h:47
T const * product() const
Definition: ESHandle.h:86
void HBHEPhase1Reconstructor::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 743 of file HBHEPhase1Reconstructor.cc.

References reco_.

744 {
745  reco_->endRun();
746 }
std::unique_ptr< AbsHBHEPhase1Algo > reco_
void HBHEPhase1Reconstructor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 755 of file HBHEPhase1Reconstructor.cc.

References edm::ParameterSetDescription::add(), add_param_set, edm::ConfigurationDescriptions::addDefault(), electronCleaner_cfi::algorithm, DEFINE_FWK_MODULE, HBHEPhase1Reconstructor_cfi::flagParametersQIE11, HBHEPhase1Reconstructor_cfi::flagParametersQIE8, HBHEPhase1Reconstructor_cfi::pulseShapeParametersQIE11, hcalLocalReco_cff::pulseShapeParametersQIE8, and AlCaHLTBitMon_QueryRunRegistry::string.

756 {
758 
759  desc.add<edm::InputTag>("digiLabelQIE8");
760  desc.add<edm::InputTag>("digiLabelQIE11");
761  desc.add<std::string>("algoConfigClass");
762  desc.add<bool>("processQIE8");
763  desc.add<bool>("processQIE11");
764  desc.add<bool>("saveInfos");
765  desc.add<bool>("saveDroppedInfos");
766  desc.add<bool>("makeRecHits");
767  desc.add<bool>("dropZSmarkedPassed");
768  desc.add<bool>("tsFromDB");
769  desc.add<bool>("recoParamsFromDB");
770  desc.add<bool>("saveEffectivePedestal", false);
771  desc.add<int>("sipmQTSShift", 0);
772  desc.add<int>("sipmQNTStoSum", 3);
773  desc.add<bool>("setNegativeFlagsQIE8");
774  desc.add<bool>("setNegativeFlagsQIE11");
775  desc.add<bool>("setNoiseFlagsQIE8");
776  desc.add<bool>("setNoiseFlagsQIE11");
777  desc.add<bool>("setPulseShapeFlagsQIE8");
778  desc.add<bool>("setPulseShapeFlagsQIE11");
779  desc.add<bool>("setLegacyFlagsQIE8");
780  desc.add<bool>("setLegacyFlagsQIE11");
781 
787 
788  descriptions.addDefault(desc);
789 }
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define add_param_set(name)
template<class DFrame , class Collection >
void HBHEPhase1Reconstructor::processData ( const Collection &  coll,
const HcalDbService cond,
const HcalChannelQuality qual,
const HcalSeverityLevelComputer severity,
const bool  isRealData,
HBHEChannelInfo info,
HBHEChannelInfoCollection infoColl,
HBHERecHitCollection rechits 
)
private

Definition at line 437 of file HBHEPhase1Reconstructor.cc.

References QIE11DataFrame::Sample::adc(), HcalCoderDb::adc2fC(), QIE11DataFrame::Sample::capid(), fwrapper::cs, HcalSeverityLevelComputer::dropChannel(), dropZSmarkedPassed_, HcalRecoParam::firstSample(), HcalCalibrationWidths::gain(), muonCSCDigis_cfi::gain, HcalSiPMCharacteristics::getCrossTalk(), HcalSiPMParameter::getDarkCurrent(), HcalDbService::getHcalCalibrations(), HcalDbService::getHcalCalibrationWidths(), HcalDbService::getHcalCoder(), HcalDbService::getHcalShape(), HcalDbService::getHcalSiPMCharacteristics(), HcalDbService::getHcalSiPMParameter(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), HBHEChannelInfo::hasTimeInfo(), HcalBarrel, HcalEndcap, HcalOuter, HBHERecHit::id(), HBHEChannelInfo::isDropped(), HBHEChannelInfo::MAXSAMPLES, hcaldqm::utilities::maxTS(), min(), paramTS_, HcalCalibrationWidths::pedestal(), HcalCalibrations::pedestal(), HcalRecoParam::pulseShapeID(), edm::SortedCollection< T, SORT >::push_back(), DetId::rawId(), reco_, recoParamsFromDB_, HcalCalibrations::respcorrgain(), alignCSCRings::s, saveDroppedInfos_, saveEffectivePedestal_, setAsicSpecificBits(), HBHEChannelInfo::setChannelInfo(), setCommonStatusBits(), HBHEChannelInfo::setSample(), sipmQNTStoSum_, sipmQTSShift_, CaloSamples::size(), HcalDetId::subdet(), lumiQTWidget::t, and tsFromDB_.

445 {
446  // If "saveDroppedInfos_" flag is set, fill the info with something
447  // meaningful even if the database tells us to drop this channel.
448  // Note that this flag affects only "infos", the rechits are still
449  // not going to be constructed from such channels.
450  const bool skipDroppedChannels = !(infos && saveDroppedInfos_);
451 
452  // Iterate over the input collection
453  for (typename Collection::const_iterator it = coll.begin();
454  it != coll.end(); ++it)
455  {
456  const DFrame& frame(*it);
457  const HcalDetId cell(frame.id());
458 
459  // Protection against calibration channels which are not
460  // in the database but can still come in the QIE11DataFrame
461  // in the laser calibs, etc.
462  const HcalSubdetector subdet = cell.subdet();
463  if (!(subdet == HcalSubdetector::HcalBarrel ||
464  subdet == HcalSubdetector::HcalEndcap ||
465  subdet == HcalSubdetector::HcalOuter))
466  continue;
467 
468  // Check if the database tells us to drop this channel
469  const HcalChannelStatus* mydigistatus = qual.getValues(cell.rawId());
470  const bool taggedBadByDb = severity.dropChannel(mydigistatus->getValue());
471  if (taggedBadByDb && skipDroppedChannels)
472  continue;
473 
474  // Check if the channel is zero suppressed
475  bool dropByZS = false;
477  if (frame.zsMarkAndPass())
478  dropByZS = true;
479  if (dropByZS && skipDroppedChannels)
480  continue;
481 
482  // Basic ADC decoding tools
483  const HcalRecoParam* param_ts = paramTS_->getValues(cell.rawId());
484  const HcalCalibrations& calib = cond.getHcalCalibrations(cell);
485  const HcalCalibrationWidths& calibWidth = cond.getHcalCalibrationWidths(cell);
486  const HcalQIECoder* channelCoder = cond.getHcalCoder(cell);
487  const HcalQIEShape* shape = cond.getHcalShape(channelCoder);
488  const HcalCoderDb coder(*channelCoder, *shape);
489 
490  // needed for the dark current in the M2
491  const HcalSiPMParameter& siPMParameter(*cond.getHcalSiPMParameter(cell));
492  const double darkCurrent = siPMParameter.getDarkCurrent();
493  const double fcByPE = siPMParameter.getFCByPE();
494  const double lambda = cond.getHcalSiPMCharacteristics()->getCrossTalk(siPMParameter.getType());
495 
496  // ADC to fC conversion
497  CaloSamples cs;
498  coder.adc2fC(frame, cs);
499 
500  // Prepare to iterate over time slices
501  const int nRead = cs.size();
502  const int maxTS = std::min(nRead, static_cast<int>(HBHEChannelInfo::MAXSAMPLES));
503  const int soi = tsFromDB_ ? param_ts->firstSample() : frame.presamples();
504  const RawChargeFromSample<DFrame> rcfs(sipmQTSShift_, sipmQNTStoSum_, saveEffectivePedestal_,
505  cond, cell, cs, soi, frame, maxTS);
506  int soiCapid = 4;
507 
508  // Go over time slices and fill the samples
509  for (int ts = 0; ts < maxTS; ++ts)
510  {
511  auto s(frame[ts]);
512  const uint8_t adc = s.adc();
513  const int capid = s.capid();
514  //optionally store "effective" pedestal = QIE contribution (default, from calib.pedestal()) + SiPM contribution (dark current + crosstalk)
515  //only done for pedestal mean, to be used for pedestal subtraction downstream
516  const double pedestal = calib.pedestal(capid) + (saveEffectivePedestal_ ? darkCurrent * 25. / (1. - lambda) : 0.);
517  const double pedestalWidth = calibWidth.pedestal(capid);
518  const double gain = calib.respcorrgain(capid);
519  const double gainWidth = calibWidth.gain(capid);
520  const double rawCharge = rcfs.getRawCharge(cs[ts], pedestal);
521  const float t = getTDCTimeFromSample(s);
522  const float dfc = getDifferentialChargeGain(*channelCoder, *shape, adc,
523  capid, channelInfo->hasTimeInfo());
524  channelInfo->setSample(ts, adc, dfc, rawCharge,
525  pedestal, pedestalWidth,
526  gain, gainWidth, t);
527  if (ts == soi)
528  soiCapid = capid;
529  }
530 
531  // Fill the overall channel info items
532  const int pulseShapeID = param_ts->pulseShapeID();
533  const std::pair<bool,bool> hwerr = findHWErrors(frame, maxTS);
534  channelInfo->setChannelInfo(cell, pulseShapeID, maxTS, soi, soiCapid,
535  darkCurrent, fcByPE, lambda,
536  hwerr.first, hwerr.second,
537  taggedBadByDb || dropByZS);
538 
539  // If needed, add the channel info to the output collection
540  const bool makeThisRechit = !channelInfo->isDropped();
541  if (infos && (saveDroppedInfos_ || makeThisRechit))
542  infos->push_back(*channelInfo);
543 
544  // Reconstruct the rechit
545  if (rechits && makeThisRechit)
546  {
547  const HcalRecoParam* pptr = nullptr;
548  if (recoParamsFromDB_)
549  pptr = param_ts;
550  HBHERecHit rh = reco_->reconstruct(*channelInfo, pptr, calib, isRealData);
551  if (rh.id().rawId())
552  {
553  setAsicSpecificBits(frame, coder, *channelInfo, calib, &rh);
554  setCommonStatusBits(*channelInfo, calib, &rh);
555  rechits->push_back(rh);
556  }
557  }
558  }
559 }
int adc(sample_type sample)
get the ADC sample (12 bits)
unsigned int firstSample() const
Definition: HcalRecoParam.h:32
double gain(int fCapId) const
get gain width for capid=0..3
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
auto_ptr< ClusterSequence > cs
int maxTS(DIGI const &digi, double ped=0)
Definition: Utilities.h:94
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
void setCommonStatusBits(const HBHEChannelInfo &info, const HcalCalibrations &calib, HBHERecHit *rh)
HcalDetId id() const
get the id
Definition: HBHERecHit.h:25
void push_back(T const &t)
double pedestal(int fCapId) const
get pedestal for capid=0..3
const Item * getValues(DetId fId, bool throwOnFail=true) const
float getCrossTalk(int type) const
get cross talk
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::unique_ptr< HcalRecoParams > paramTS_
static const unsigned MAXSAMPLES
double pedestal(int fCapId) const
get pedestal width for capid=0..3
HcalSubdetector
Definition: HcalAssistant.h:31
bool dropChannel(const uint32_t &mystatus) const
std::unique_ptr< AbsHBHEPhase1Algo > reco_
T min(T a, T b)
Definition: MathUtil.h:58
float getDarkCurrent() const
get dark current
const HcalCalibrationWidths & getHcalCalibrationWidths(const HcalGenericDetId &fId) const
unsigned int pulseShapeID() const
Definition: HcalRecoParam.h:34
JetCorrectorParametersCollection coll
Definition: classes.h:10
int size() const
get the size
Definition: CaloSamples.h:24
const HcalSiPMCharacteristics * getHcalSiPMCharacteristics() const
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
void setAsicSpecificBits(const HBHEDataFrame &frame, const HcalCoder &coder, const HBHEChannelInfo &info, const HcalCalibrations &calib, HBHERecHit *rh)
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
uint32_t getValue() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
const HcalSiPMParameter * getHcalSiPMParameter(const HcalGenericDetId &fId) const
void HBHEPhase1Reconstructor::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
overrideprivate

Definition at line 611 of file HBHEPhase1Reconstructor.cc.

References edm::EventSetup::get(), edm::Event::getByToken(), hbheFlagSetterQIE11_, hbheFlagSetterQIE8_, benchmark_cfg::infos, edm::EventBase::isRealData(), makeRecHits_, eostools::move(), negEFilter_, MillePedeFileConverter_cfg::out, AlCaHLTBitMon_ParallelJobs::p, paramTS_, processQIE11_, processQIE8_, edm::ESHandle< T >::product(), edm::Event::put(), saveInfos_, setNegativeFlagsQIE11_, setNegativeFlagsQIE8_, setNoiseFlagsQIE11_, setNoiseFlagsQIE8_, edm::SortedCollection< T, SORT >::size(), edm::DataFrameContainer::size(), tok_qie11_, and tok_qie8_.

612 {
613  using namespace edm;
614 
615  // Get the Hcal topology
617  eventSetup.get<HcalRecNumberingRecord>().get(htopo);
618  paramTS_->setTopo(htopo.product());
619 
620  // Fetch the calibrations
621  ESHandle<HcalDbService> conditions;
622  eventSetup.get<HcalDbRecord>().get(conditions);
623 
625  eventSetup.get<HcalChannelQualityRcd>().get("withTopo", p);
626 
628  eventSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
629 
630  // Configure the negative energy filter
633  {
634  eventSetup.get<HBHENegativeEFilterRcd>().get(negEHandle);
635  negEFilter_ = negEHandle.product();
636  }
637 
638  // Find the input data
639  unsigned maxOutputSize = 0;
641  if (processQIE8_)
642  {
643  e.getByToken(tok_qie8_, hbDigis);
644  maxOutputSize += hbDigis->size();
645  }
646 
648  if (processQIE11_)
649  {
650  e.getByToken(tok_qie11_, heDigis);
651  maxOutputSize += heDigis->size();
652  }
653 
654  // Create new output collections
655  std::unique_ptr<HBHEChannelInfoCollection> infos;
656  if (saveInfos_)
657  {
658  infos = std::make_unique<HBHEChannelInfoCollection>();
659  infos->reserve(maxOutputSize);
660  }
661 
662  std::unique_ptr<HBHERecHitCollection> out;
663  if (makeRecHits_)
664  {
665  out = std::make_unique<HBHERecHitCollection>();
666  out->reserve(maxOutputSize);
667  }
668 
669  // Process the input collections, filling the output ones
670  const bool isData = e.isRealData();
671  if (processQIE8_)
672  {
673  if (setNoiseFlagsQIE8_)
674  hbheFlagSetterQIE8_->Clear();
675 
676  HBHEChannelInfo channelInfo(false);
677  processData<HBHEDataFrame>(*hbDigis, *conditions, *p, *mycomputer,
678  isData, &channelInfo, infos.get(), out.get());
679  if (setNoiseFlagsQIE8_)
680  hbheFlagSetterQIE8_->SetFlagsFromRecHits(*out);
681  }
682 
683  if (processQIE11_)
684  {
686  hbheFlagSetterQIE11_->Clear();
687 
688  HBHEChannelInfo channelInfo(true);
689  processData<QIE11DataFrame>(*heDigis, *conditions, *p, *mycomputer,
690  isData, &channelInfo, infos.get(), out.get());
692  hbheFlagSetterQIE11_->SetFlagsFromRecHits(*out);
693  }
694 
695  // Add the output collections to the event record
696  if (saveInfos_)
697  e.put(std::move(infos));
698  if (makeRecHits_)
699  e.put(std::move(out));
700 }
const HBHENegativeEFilter * negEFilter_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE11_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE8_
bool isRealData() const
Definition: EventBase.h:64
std::unique_ptr< HcalRecoParams > paramTS_
edm::EDGetTokenT< QIE11DigiCollection > tok_qie11_
edm::EDGetTokenT< HBHEDigiCollection > tok_qie8_
const T & get() const
Definition: EventSetup.h:55
HLT enums.
size_type size() const
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
void HBHEPhase1Reconstructor::runHBHENegativeEFilter ( const HBHEChannelInfo info,
HBHERecHit rh 
)
private

Definition at line 597 of file HBHEPhase1Reconstructor.cc.

References HBHENegativeEFilter::checkPassFilter(), HcalPhase1FlagLabels::HBHENegativeNoise, mps_fire::i, HBHEChannelInfo::id(), HBHEChannelInfo::MAXSAMPLES, negEFilter_, HBHEChannelInfo::nSamples(), CaloRecHit::setFlagField(), and HBHEChannelInfo::tsCharge().

Referenced by setAsicSpecificBits().

599 {
600  double ts[HBHEChannelInfo::MAXSAMPLES];
601  const unsigned nRead = info.nSamples();
602  for (unsigned i=0; i<nRead; ++i)
603  ts[i] = info.tsCharge(i);
604  const bool passes = negEFilter_->checkPassFilter(info.id(), &ts[0], nRead);
605  if (!passes)
607 }
const HBHENegativeEFilter * negEFilter_
void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.cc:20
HcalDetId id() const
bool checkPassFilter(const HcalDetId &id, const double *ts, unsigned lenTS) const
static const unsigned MAXSAMPLES
double tsCharge(const unsigned ts) const
unsigned nSamples() const
void HBHEPhase1Reconstructor::setAsicSpecificBits ( const HBHEDataFrame frame,
const HcalCoder coder,
const HBHEChannelInfo info,
const HcalCalibrations calib,
HBHERecHit rh 
)
private

Definition at line 567 of file HBHEPhase1Reconstructor.cc.

References hbheFlagSetterQIE8_, hbhePulseShapeFlagSetterQIE8_, runHBHENegativeEFilter(), setNegativeFlagsQIE8_, setNoiseFlagsQIE8_, and setPulseShapeFlagsQIE8_.

Referenced by processData().

571 {
572  if (setNoiseFlagsQIE8_)
573  hbheFlagSetterQIE8_->rememberHit(*rh);
574 
576  hbhePulseShapeFlagSetterQIE8_->SetPulseShapeFlags(*rh, frame, coder, calib);
577 
579  runHBHENegativeEFilter(info, rh);
580 }
std::unique_ptr< HBHEPulseShapeFlagSetter > hbhePulseShapeFlagSetterQIE8_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE8_
void runHBHENegativeEFilter(const HBHEChannelInfo &info, HBHERecHit *rh)
void HBHEPhase1Reconstructor::setAsicSpecificBits ( const QIE11DataFrame frame,
const HcalCoder coder,
const HBHEChannelInfo info,
const HcalCalibrations calib,
HBHERecHit rh 
)
private

Definition at line 582 of file HBHEPhase1Reconstructor.cc.

References hbheFlagSetterQIE11_, hbhePulseShapeFlagSetterQIE11_, runHBHENegativeEFilter(), setNegativeFlagsQIE11_, setNoiseFlagsQIE11_, and setPulseShapeFlagsQIE11_.

586 {
588  hbheFlagSetterQIE11_->rememberHit(*rh);
589 
591  hbhePulseShapeFlagSetterQIE11_->SetPulseShapeFlags(*rh, frame, coder, calib);
592 
594  runHBHENegativeEFilter(info, rh);
595 }
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE11_
void runHBHENegativeEFilter(const HBHEChannelInfo &info, HBHERecHit *rh)
std::unique_ptr< HBHEPulseShapeFlagSetter > hbhePulseShapeFlagSetterQIE11_
void HBHEPhase1Reconstructor::setCommonStatusBits ( const HBHEChannelInfo info,
const HcalCalibrations calib,
HBHERecHit rh 
)
private

Definition at line 561 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

564 {
565 }

Member Data Documentation

std::string HBHEPhase1Reconstructor::algoConfigClass_
private

Definition at line 299 of file HBHEPhase1Reconstructor.cc.

Referenced by beginRun().

bool HBHEPhase1Reconstructor::dropZSmarkedPassed_
private

Definition at line 305 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

std::unique_ptr<HBHEStatusBitSetter> HBHEPhase1Reconstructor::hbheFlagSetterQIE11_
private
std::unique_ptr<HBHEStatusBitSetter> HBHEPhase1Reconstructor::hbheFlagSetterQIE8_
private
std::unique_ptr<HBHEPulseShapeFlagSetter> HBHEPhase1Reconstructor::hbhePulseShapeFlagSetterQIE11_
private

Definition at line 332 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and setAsicSpecificBits().

std::unique_ptr<HBHEPulseShapeFlagSetter> HBHEPhase1Reconstructor::hbhePulseShapeFlagSetterQIE8_
private

Definition at line 331 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and setAsicSpecificBits().

bool HBHEPhase1Reconstructor::makeRecHits_
private

Definition at line 304 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

const HBHENegativeEFilter* HBHEPhase1Reconstructor::negEFilter_
private

Definition at line 328 of file HBHEPhase1Reconstructor.cc.

Referenced by produce(), and runHBHENegativeEFilter().

std::unique_ptr<HcalRecoParams> HBHEPhase1Reconstructor::paramTS_
private

Definition at line 325 of file HBHEPhase1Reconstructor.cc.

Referenced by beginRun(), processData(), and produce().

bool HBHEPhase1Reconstructor::processQIE11_
private

Definition at line 301 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

bool HBHEPhase1Reconstructor::processQIE8_
private

Definition at line 300 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

std::unique_ptr<AbsHBHEPhase1Algo> HBHEPhase1Reconstructor::reco_
private

Definition at line 323 of file HBHEPhase1Reconstructor.cc.

Referenced by beginRun(), endRun(), HBHEPhase1Reconstructor(), and processData().

std::unique_ptr<AbsHcalAlgoData> HBHEPhase1Reconstructor::recoConfig_
private

Definition at line 324 of file HBHEPhase1Reconstructor.cc.

Referenced by beginRun().

bool HBHEPhase1Reconstructor::recoParamsFromDB_
private

Definition at line 307 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

bool HBHEPhase1Reconstructor::saveDroppedInfos_
private

Definition at line 303 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

bool HBHEPhase1Reconstructor::saveEffectivePedestal_
private

Definition at line 308 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

bool HBHEPhase1Reconstructor::saveInfos_
private

Definition at line 302 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

bool HBHEPhase1Reconstructor::setNegativeFlagsQIE11_
private

Definition at line 314 of file HBHEPhase1Reconstructor.cc.

Referenced by produce(), and setAsicSpecificBits().

bool HBHEPhase1Reconstructor::setNegativeFlagsQIE8_
private

Definition at line 313 of file HBHEPhase1Reconstructor.cc.

Referenced by produce(), and setAsicSpecificBits().

bool HBHEPhase1Reconstructor::setNoiseFlagsQIE11_
private
bool HBHEPhase1Reconstructor::setNoiseFlagsQIE8_
private
bool HBHEPhase1Reconstructor::setPulseShapeFlagsQIE11_
private

Definition at line 318 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and setAsicSpecificBits().

bool HBHEPhase1Reconstructor::setPulseShapeFlagsQIE8_
private

Definition at line 317 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and setAsicSpecificBits().

int HBHEPhase1Reconstructor::sipmQNTStoSum_
private

Definition at line 310 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

int HBHEPhase1Reconstructor::sipmQTSShift_
private

Definition at line 309 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

edm::EDGetTokenT<QIE11DigiCollection> HBHEPhase1Reconstructor::tok_qie11_
private

Definition at line 322 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

edm::EDGetTokenT<HBHEDigiCollection> HBHEPhase1Reconstructor::tok_qie8_
private

Definition at line 321 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

bool HBHEPhase1Reconstructor::tsFromDB_
private

Definition at line 306 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().