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<>

Public Member Functions

 HBHEPhase1Reconstructor (const edm::ParameterSet &)
 
 ~HBHEPhase1Reconstructor () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::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 HcalTopology &htopo, const HcalDbService &cond, const HcalChannelPropertiesVec &prop, 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, int soi, HBHERecHit *rh)
 
void setAsicSpecificBits (const QIE11DataFrame &frame, const HcalCoder &coder, const HBHEChannelInfo &info, const HcalCalibrations &calib, int soi, HBHERecHit *rh)
 
void setCommonStatusBits (const HBHEChannelInfo &info, const HcalCalibrations &calib, HBHERecHit *rh)
 

Private Attributes

std::string algoConfigClass_
 
edm::ESGetToken< HcalDbService, HcalDbRecordconditionsToken_
 
bool dropZSmarkedPassed_
 
edm::ESGetToken< HcalFrontEndMap, HcalFrontEndMapRcdfeMapToken_
 
std::unique_ptr< HBHEStatusBitSetterhbheFlagSetterQIE11_
 
std::unique_ptr< HBHEStatusBitSetterhbheFlagSetterQIE8_
 
std::unique_ptr< HBHEPulseShapeFlagSetterhbhePulseShapeFlagSetterQIE11_
 
std::unique_ptr< HBHEPulseShapeFlagSetterhbhePulseShapeFlagSetterQIE8_
 
edm::ESGetToken< HcalTopology, HcalRecNumberingRecordhtopoToken_
 
bool makeRecHits_
 
const HBHENegativeEFilternegEFilter_
 
edm::ESGetToken< HBHENegativeEFilter, HBHENegativeEFilterRcdnegToken_
 
bool processQIE11_
 
bool processQIE8_
 
edm::ESGetToken< HcalChannelPropertiesVec, HcalChannelPropertiesRecordpropertiesToken_
 
std::unique_ptr< AbsHBHEPhase1Algoreco_
 
std::unique_ptr< AbsHcalAlgoDatarecoConfig_
 
edm::ESGetToken< HFPhase1PMTParams, HFPhase1PMTParamsRcdrecoConfigToken_
 
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_
 
bool use8ts_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: Phase 1 reconstruction module for HB/HE

Implementation: [Notes on implementation]

Definition at line 284 of file HBHEPhase1Reconstructor.cc.

Constructor & Destructor Documentation

◆ HBHEPhase1Reconstructor()

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

Definition at line 373 of file HBHEPhase1Reconstructor.cc.

References algoConfigClass_, conditionsToken_, Exception, feMapToken_, edm::ParameterSet::getParameter(), hbheFlagSetterQIE11_, hbheFlagSetterQIE8_, hbhePulseShapeFlagSetterQIE11_, hbhePulseShapeFlagSetterQIE8_, htopoToken_, makeRecHits_, negToken_, processQIE11_, processQIE8_, propertiesToken_, reco_, recoConfigToken_, saveInfos_, setNegativeFlagsQIE11_, setNegativeFlagsQIE8_, setNoiseFlagsQIE11_, setNoiseFlagsQIE8_, setPulseShapeFlagsQIE11_, setPulseShapeFlagsQIE8_, tok_qie11_, and tok_qie8_.

374  : algoConfigClass_(conf.getParameter<std::string>("algoConfigClass")),
375  processQIE8_(conf.getParameter<bool>("processQIE8")),
376  processQIE11_(conf.getParameter<bool>("processQIE11")),
377  saveInfos_(conf.getParameter<bool>("saveInfos")),
378  saveDroppedInfos_(conf.getParameter<bool>("saveDroppedInfos")),
379  makeRecHits_(conf.getParameter<bool>("makeRecHits")),
380  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
381  tsFromDB_(conf.getParameter<bool>("tsFromDB")),
382  recoParamsFromDB_(conf.getParameter<bool>("recoParamsFromDB")),
383  saveEffectivePedestal_(conf.getParameter<bool>("saveEffectivePedestal")),
384  use8ts_(conf.getParameter<bool>("use8ts")),
385  sipmQTSShift_(conf.getParameter<int>("sipmQTSShift")),
386  sipmQNTStoSum_(conf.getParameter<int>("sipmQNTStoSum")),
387  setNegativeFlagsQIE8_(conf.getParameter<bool>("setNegativeFlagsQIE8")),
388  setNegativeFlagsQIE11_(conf.getParameter<bool>("setNegativeFlagsQIE11")),
389  setNoiseFlagsQIE8_(conf.getParameter<bool>("setNoiseFlagsQIE8")),
390  setNoiseFlagsQIE11_(conf.getParameter<bool>("setNoiseFlagsQIE11")),
391  setPulseShapeFlagsQIE8_(conf.getParameter<bool>("setPulseShapeFlagsQIE8")),
392  setPulseShapeFlagsQIE11_(conf.getParameter<bool>("setPulseShapeFlagsQIE11")),
393  reco_(parseHBHEPhase1AlgoDescription(conf.getParameter<edm::ParameterSet>("algorithm"), consumesCollector())),
394  negEFilter_(nullptr) {
395  // Check that the reco algorithm has been successfully configured
396  if (!reco_.get())
397  throw cms::Exception("HBHEPhase1BadConfig") << "Invalid HBHEPhase1Algo algorithm configuration" << std::endl;
398  if (reco_->isConfigurable()) {
399  if ("HFPhase1PMTParams" != algoConfigClass_) {
400  throw cms::Exception("HBHEPhase1BadConfig")
401  << "Invalid HBHEPhase1Reconstructor \"algoConfigClass\" parameter value \"" << algoConfigClass_ << '"'
402  << std::endl;
403  }
404  recoConfigToken_ = esConsumes<edm::Transition::BeginRun>();
405  }
406 
407  // Configure the status bit setters that have been turned on
408  if (setNoiseFlagsQIE8_)
409  hbheFlagSetterQIE8_ = parse_HBHEStatusBitSetter(conf.getParameter<edm::ParameterSet>("flagParametersQIE8"));
410 
412  hbheFlagSetterQIE11_ = parse_HBHEStatusBitSetter(conf.getParameter<edm::ParameterSet>("flagParametersQIE11"));
413 
416  parse_HBHEPulseShapeFlagSetter(conf.getParameter<edm::ParameterSet>("pulseShapeParametersQIE8"),
417  conf.getParameter<bool>("setLegacyFlagsQIE8"));
418 
421  parse_HBHEPulseShapeFlagSetter(conf.getParameter<edm::ParameterSet>("pulseShapeParametersQIE11"),
422  conf.getParameter<bool>("setLegacyFlagsQIE11"));
423 
424  // Consumes and produces statements
425  if (processQIE8_)
426  tok_qie8_ = consumes<HBHEDigiCollection>(conf.getParameter<edm::InputTag>("digiLabelQIE8"));
427 
428  if (processQIE11_)
429  tok_qie11_ = consumes<QIE11DigiCollection>(conf.getParameter<edm::InputTag>("digiLabelQIE11"));
430 
431  if (saveInfos_)
432  produces<HBHEChannelInfoCollection>();
433 
434  if (makeRecHits_)
435  produces<HBHERecHitCollection>();
436 
437  // ES tokens
438  htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
439  conditionsToken_ = esConsumes<HcalDbService, HcalDbRecord>();
440  propertiesToken_ = esConsumes<HcalChannelPropertiesVec, HcalChannelPropertiesRecord>();
442  negToken_ = esConsumes<HBHENegativeEFilter, HBHENegativeEFilterRcd>();
444  feMapToken_ = esConsumes<HcalFrontEndMap, HcalFrontEndMapRcd, edm::Transition::BeginRun>();
445 }
std::unique_ptr< HBHEPulseShapeFlagSetter > hbhePulseShapeFlagSetterQIE8_
const HBHENegativeEFilter * negEFilter_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< HFPhase1PMTParams, HFPhase1PMTParamsRcd > recoConfigToken_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE11_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE8_
edm::ESGetToken< HBHENegativeEFilter, HBHENegativeEFilterRcd > negToken_
std::unique_ptr< AbsHBHEPhase1Algo > parseHBHEPhase1AlgoDescription(const edm::ParameterSet &ps, edm::ConsumesCollector iC)
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
edm::EDGetTokenT< QIE11DigiCollection > tok_qie11_
edm::EDGetTokenT< HBHEDigiCollection > tok_qie8_
std::unique_ptr< AbsHBHEPhase1Algo > reco_
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
std::unique_ptr< HBHEPulseShapeFlagSetter > hbhePulseShapeFlagSetterQIE11_
edm::ESGetToken< HcalFrontEndMap, HcalFrontEndMapRcd > feMapToken_
edm::ESGetToken< HcalChannelPropertiesVec, HcalChannelPropertiesRecord > propertiesToken_

◆ ~HBHEPhase1Reconstructor()

HBHEPhase1Reconstructor::~HBHEPhase1Reconstructor ( )
override

Definition at line 447 of file HBHEPhase1Reconstructor.cc.

447  {
448  // do anything here that needs to be done at destruction time
449  // (e.g. close files, deallocate resources etc.)
450 }

Member Function Documentation

◆ beginRun()

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

Definition at line 739 of file HBHEPhase1Reconstructor.cc.

References Exception, feMapToken_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), patZpeak::handle, hbheFlagSetterQIE11_, hbheFlagSetterQIE8_, alignCSCRings::r, reco_, recoConfig_, recoConfigToken_, setNoiseFlagsQIE11_, and setNoiseFlagsQIE8_.

739  {
740  if (reco_->isConfigurable()) {
741  recoConfig_ = std::make_unique<HFPhase1PMTParams>(es.getData(recoConfigToken_));
742  if (!reco_->configure(recoConfig_.get()))
743  throw cms::Exception("HBHEPhase1BadConfig")
744  << "Failed to configure HBHEPhase1Algo algorithm from EventSetup" << std::endl;
745  }
746 
748  if (auto handle = es.getHandle(feMapToken_)) {
749  const HcalFrontEndMap& hfemap = *handle;
750  if (setNoiseFlagsQIE8_)
751  hbheFlagSetterQIE8_->SetFrontEndMap(&hfemap);
753  hbheFlagSetterQIE11_->SetFrontEndMap(&hfemap);
754  } else {
755  edm::LogWarning("EventSetup") << "HBHEPhase1Reconstructor failed to get HcalFrontEndMap!" << std::endl;
756  }
757  }
758 
759  reco_->beginRun(r, es);
760 }
edm::ESGetToken< HFPhase1PMTParams, HFPhase1PMTParamsRcd > recoConfigToken_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE11_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE8_
std::unique_ptr< AbsHBHEPhase1Algo > reco_
edm::ESGetToken< HcalFrontEndMap, HcalFrontEndMapRcd > feMapToken_
std::unique_ptr< AbsHcalAlgoData > recoConfig_
Log< level::Warning, false > LogWarning

◆ endRun()

void HBHEPhase1Reconstructor::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivate

Definition at line 762 of file HBHEPhase1Reconstructor.cc.

References reco_.

762 { reco_->endRun(); }
std::unique_ptr< AbsHBHEPhase1Algo > reco_

◆ fillDescriptions()

void HBHEPhase1Reconstructor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 770 of file HBHEPhase1Reconstructor.cc.

References add_param_set, edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, fillDescriptionForParseHBHEPhase1Algo(), HLT_2023v12_cff::flagParametersQIE11, HLT_2023v12_cff::flagParametersQIE8, HLT_2023v12_cff::pulseShapeParametersQIE11, HLT_2023v12_cff::pulseShapeParametersQIE8, and AlCaHLTBitMon_QueryRunRegistry::string.

770  {
772 
773  desc.add<edm::InputTag>("digiLabelQIE8");
774  desc.add<edm::InputTag>("digiLabelQIE11");
775  desc.add<std::string>("algoConfigClass");
776  desc.add<bool>("processQIE8");
777  desc.add<bool>("processQIE11");
778  desc.add<bool>("saveInfos");
779  desc.add<bool>("saveDroppedInfos");
780  desc.add<bool>("makeRecHits");
781  desc.add<bool>("dropZSmarkedPassed");
782  desc.add<bool>("tsFromDB");
783  desc.add<bool>("recoParamsFromDB");
784  desc.add<bool>("saveEffectivePedestal", false);
785  desc.add<bool>("use8ts", false);
786  desc.add<int>("sipmQTSShift", 0);
787  desc.add<int>("sipmQNTStoSum", 3);
788  desc.add<bool>("setNegativeFlagsQIE8");
789  desc.add<bool>("setNegativeFlagsQIE11");
790  desc.add<bool>("setNoiseFlagsQIE8");
791  desc.add<bool>("setNoiseFlagsQIE11");
792  desc.add<bool>("setPulseShapeFlagsQIE8");
793  desc.add<bool>("setPulseShapeFlagsQIE11");
794  desc.add<bool>("setLegacyFlagsQIE8");
795  desc.add<bool>("setLegacyFlagsQIE11");
796 
802 
803  descriptions.addDefault(desc);
804 }
void addDefault(ParameterSetDescription const &psetDescription)
#define add_param_set(name)
edm::ParameterSetDescription fillDescriptionForParseHBHEPhase1Algo()

◆ processData()

template<class DFrame , class Collection >
void HBHEPhase1Reconstructor::processData ( const Collection &  coll,
const HcalTopology htopo,
const HcalDbService cond,
const HcalChannelPropertiesVec prop,
const bool  isRealData,
HBHEChannelInfo info,
HBHEChannelInfoCollection infoColl,
HBHERecHitCollection rechits 
)
private

Definition at line 456 of file HBHEPhase1Reconstructor.cc.

References gpuClustering::adc, HcalCoderDb::adc2fC(), HcalChannelProperties::calib, HcalChannelProperties::channelCoder, callgraph::cs, HcalTopology::detId2denseId(), dropZSmarkedPassed_, HcalRecoParam::firstSample(), amptDefault_cfi::frame, HcalSiPMParameter::getauxi2(), HcalSiPMParameter::getDarkCurrent(), HcalSiPMParameter::getFCByPE(), HcalSiPMParameter::getType(), HBHEChannelInfo::hasEffectivePedestals(), HBHEChannelInfo::hasTimeInfo(), HcalBarrel, HcalEndcap, HBHERecHit::id(), submitPVValidationJobs::infos, HBHEChannelInfo::isDropped(), HBHEChannelInfo::MAXSAMPLES, hcaldqm::utilities::maxTS(), SiStripPI::min, HcalChannelProperties::paramTs, HcalChannelProperties::pedsAndGains, HcalRecoParam::pulseShapeID(), DetId::rawId(), HI_PhotonSkim_cff::rechits, reco_, recoParamsFromDB_, alignCSCRings::s, saveDroppedInfos_, saveInfos_, setAsicSpecificBits(), HBHEChannelInfo::setChannelInfo(), setCommonStatusBits(), HBHEChannelInfo::setSample(), HcalChannelProperties::shape, HcalChannelProperties::siPMParameter, sipmQNTStoSum_, sipmQTSShift_, HcalDetId::subdet(), submitPVValidationJobs::t, HcalChannelProperties::taggedBadByDb, tsFromDB_, and use8ts_.

463  {
464  // If "saveDroppedInfos_" flag is set, fill the info with something
465  // meaningful even if the database tells us to drop this channel.
466  // Note that this flag affects only "infos", the rechits are still
467  // not going to be constructed from such channels.
468  const bool skipDroppedChannels = !(infos && saveDroppedInfos_);
469 
470  // Iterate over the input collection
471  for (typename Collection::const_iterator it = coll.begin(); it != coll.end(); ++it) {
472  const DFrame& frame(*it);
473  const HcalDetId cell(frame.id());
474 
475  // Protection against calibration channels which are not
476  // in the database but can still come in the QIE11DataFrame
477  // in the laser calibs, etc.
478  const HcalSubdetector subdet = cell.subdet();
479  if (!(subdet == HcalSubdetector::HcalBarrel || subdet == HcalSubdetector::HcalEndcap))
480  continue;
481 
482  // Look up the channel properties. This lookup is O(1).
483  const HcalChannelProperties& properties(prop.at(htopo.detId2denseId(cell)));
484 
485  // Check if the database tells us to drop this channel
486  if (properties.taggedBadByDb && skipDroppedChannels)
487  continue;
488 
489  // Check if the channel is zero suppressed
490  bool dropByZS = false;
492  if (frame.zsMarkAndPass())
493  dropByZS = true;
494  if (dropByZS && skipDroppedChannels)
495  continue;
496 
497  // ADC decoding tool
498  const HcalCoderDb coder(*properties.channelCoder, *properties.shape);
499 
500  const bool saveEffectivePeds = channelInfo->hasEffectivePedestals();
501  const double fcByPE = properties.siPMParameter->getFCByPE();
502  double darkCurrent = 0.;
503  double lambda = 0.;
504  const double noisecorr = properties.siPMParameter->getauxi2();
505  if (!saveEffectivePeds || saveInfos_) {
506  // needed for the dark current in the M2 in alternative of the effectivePed
507  darkCurrent = properties.siPMParameter->getDarkCurrent();
508  lambda = cond.getHcalSiPMCharacteristics()->getCrossTalk(properties.siPMParameter->getType());
509  }
510 
511  // ADC to fC conversion
512  CaloSamples cs;
513  coder.adc2fC(frame, cs);
514 
515  // Prepare to iterate over time slices
516  const int nRead = cs.size();
517  const int maxTS = std::min(nRead, static_cast<int>(HBHEChannelInfo::MAXSAMPLES));
518  const int soi = tsFromDB_ ? properties.paramTs->firstSample() : frame.presamples();
519  const bool badSOI = !(maxTS >= 3 && soi > 0 && soi < maxTS - 1);
520  if (badSOI) {
521  edm::LogWarning("HBHEDigi") << " bad SOI/maxTS in cell " << cell
522  << "\n expect maxTS >= 3 && soi > 0 && soi < maxTS - 1"
523  << "\n got maxTS = " << maxTS << ", SOI = " << soi;
524  }
525 
526  const RawChargeFromSample<DFrame> rcfs(sipmQTSShift_, sipmQNTStoSum_, cond, properties, cs, soi, frame, maxTS);
527  int soiCapid = 4;
528 
529  // Typical expected cases:
530  // maxTS = 10, SOI = 4 (typical 10-TS situation, in data or MC)
531  // maxTS = 10, SOI = 5 (new, for better modeling of SiPM noise in MC)
532  // maxTS = 8, SOI = 3 (typical 8-TS situation in data)
533  //
534  // We want to fill the HBHEChannelInfo object with either
535  // 8 or 10 time slices, depending on the maxTS value and
536  // on the "use8ts_" parameter setting. If we want 8 time
537  // slices in the HBHEChannelInfo, we want the SOI to fall
538  // on the time slice number 3. For now, this number is not
539  // expected to change and will be hardwired.
540  //
541  int nTSToCopy = maxTS;
542  int tsShift = 0;
543  if (maxTS > 8 && use8ts_) {
544  const int soiWanted = 3;
545 
546  // We need to chop off the excess time slices
547  // and configure the TS shift for filling
548  // HBHEChannelInfo from the data frame.
549  nTSToCopy = 8;
550  tsShift = determineIndexShift(soi, nRead, soiWanted, nTSToCopy);
551  }
552 
553  // Go over time slices and fill the samples
554  for (int copyTS = 0; copyTS < nTSToCopy; ++copyTS) {
555  const int inputTS = copyTS + tsShift;
556  auto s(frame[inputTS]);
557  const uint8_t adc = s.adc();
558  const int capid = s.capid();
559  const HcalPipelinePedestalAndGain& pAndGain(properties.pedsAndGains.at(capid));
560 
561  // Always use QIE-only pedestal for this computation
562  const double rawCharge = rcfs.getRawCharge(cs[inputTS], pAndGain.pedestal(false));
563  const float t = getTDCTimeFromSample(s);
564  const float dfc = getDifferentialChargeGain(
565  *properties.channelCoder, *properties.shape, adc, capid, channelInfo->hasTimeInfo());
566  channelInfo->setSample(copyTS,
567  adc,
568  dfc,
569  rawCharge,
570  pAndGain.pedestal(saveEffectivePeds),
571  pAndGain.pedestalWidth(saveEffectivePeds),
572  pAndGain.gain(),
573  pAndGain.gainWidth(),
574  t);
575  if (inputTS == soi)
576  soiCapid = capid;
577  }
578 
579  // Fill the overall channel info items
580  const int fitSoi = soi - tsShift;
581  const int pulseShapeID = properties.paramTs->pulseShapeID();
582  const std::pair<bool, bool> hwerr = findHWErrors(frame, maxTS);
583  channelInfo->setChannelInfo(cell,
584  pulseShapeID,
585  nTSToCopy,
586  fitSoi,
587  soiCapid,
588  darkCurrent,
589  fcByPE,
590  lambda,
591  noisecorr,
592  hwerr.first,
593  hwerr.second,
594  properties.taggedBadByDb || dropByZS || badSOI);
595 
596  // If needed, add the channel info to the output collection
597  const bool makeThisRechit = !channelInfo->isDropped();
598  if (infos && (saveDroppedInfos_ || makeThisRechit))
599  infos->push_back(*channelInfo);
600 
601  // Reconstruct the rechit
602  if (rechits && makeThisRechit) {
603  const HcalRecoParam* pptr = nullptr;
604  if (recoParamsFromDB_)
605  pptr = properties.paramTs;
606  HBHERecHit rh = reco_->reconstruct(*channelInfo, pptr, *properties.calib, isRealData);
607  if (rh.id().rawId()) {
608  setAsicSpecificBits(frame, coder, *channelInfo, *properties.calib, soi, &rh);
609  setCommonStatusBits(*channelInfo, *properties.calib, &rh);
610  rechits->push_back(rh);
611  }
612  }
613  }
614 }
int maxTS(DIGI const &digi, double ped=0)
Definition: Utilities.h:103
void setCommonStatusBits(const HBHEChannelInfo &info, const HcalCalibrations &calib, HBHERecHit *rh)
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
static const unsigned MAXSAMPLES
HcalSubdetector
Definition: HcalAssistant.h:31
std::unique_ptr< AbsHBHEPhase1Algo > reco_
constexpr HcalDetId id() const
get the id
Definition: HBHERecHit.h:41
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Definition: plugin.cc:23
Log< level::Warning, false > LogWarning
uint16_t *__restrict__ uint16_t const *__restrict__ adc
void setAsicSpecificBits(const HBHEDataFrame &frame, const HcalCoder &coder, const HBHEChannelInfo &info, const HcalCalibrations &calib, int soi, HBHERecHit *rh)

◆ produce()

void HBHEPhase1Reconstructor::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
overrideprivate

Definition at line 667 of file HBHEPhase1Reconstructor.cc.

References submitPVValidationJobs::conditions, conditionsToken_, MillePedeFileConverter_cfg::e, options_cfi::eventSetup, hbheFlagSetterQIE11_, hbheFlagSetterQIE8_, htopoToken_, submitPVValidationJobs::infos, HLTBitAnalyser_cfi::isData, makeRecHits_, eostools::move(), negEFilter_, negToken_, MillePedeFileConverter_cfg::out, processQIE11_, processQIE8_, propertiesToken_, saveEffectivePedestal_, saveInfos_, setNegativeFlagsQIE11_, setNegativeFlagsQIE8_, setNoiseFlagsQIE11_, setNoiseFlagsQIE8_, edm::SortedCollection< T, SORT >::size(), edm::DataFrameContainer::size(), tok_qie11_, and tok_qie8_.

667  {
668  using namespace edm;
669 
670  // Get the Hcal topology
671  const HcalTopology* htopo = &eventSetup.getData(htopoToken_);
672 
673  // Fetch the calibrations
675  const HcalChannelPropertiesVec* prop = &eventSetup.getData(propertiesToken_);
676 
677  // Configure the negative energy filter
679  negEFilter_ = &eventSetup.getData(negToken_);
680  }
681 
682  // Find the input data
683  unsigned maxOutputSize = 0;
685  if (processQIE8_) {
686  e.getByToken(tok_qie8_, hbDigis);
687  maxOutputSize += hbDigis->size();
688  }
689 
691  if (processQIE11_) {
692  e.getByToken(tok_qie11_, heDigis);
693  maxOutputSize += heDigis->size();
694  }
695 
696  // Create new output collections
697  std::unique_ptr<HBHEChannelInfoCollection> infos;
698  if (saveInfos_) {
699  infos = std::make_unique<HBHEChannelInfoCollection>();
700  infos->reserve(maxOutputSize);
701  }
702 
703  std::unique_ptr<HBHERecHitCollection> out;
704  if (makeRecHits_) {
705  out = std::make_unique<HBHERecHitCollection>();
706  out->reserve(maxOutputSize);
707  }
708 
709  // Process the input collections, filling the output ones
710  const bool isData = e.isRealData();
711  if (processQIE8_) {
712  if (setNoiseFlagsQIE8_)
713  hbheFlagSetterQIE8_->Clear();
714 
715  HBHEChannelInfo channelInfo(false, false);
716  processData<HBHEDataFrame>(*hbDigis, *htopo, *conditions, *prop, isData, &channelInfo, infos.get(), out.get());
717  if (setNoiseFlagsQIE8_)
718  hbheFlagSetterQIE8_->SetFlagsFromRecHits(*out);
719  }
720 
721  if (processQIE11_) {
723  hbheFlagSetterQIE11_->Clear();
724 
725  HBHEChannelInfo channelInfo(true, saveEffectivePedestal_);
726  processData<QIE11DataFrame>(*heDigis, *htopo, *conditions, *prop, isData, &channelInfo, infos.get(), out.get());
728  hbheFlagSetterQIE11_->SetFlagsFromRecHits(*out);
729  }
730 
731  // Add the output collections to the event record
732  if (saveInfos_)
733  e.put(std::move(infos));
734  if (makeRecHits_)
735  e.put(std::move(out));
736 }
const HBHENegativeEFilter * negEFilter_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE11_
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE8_
size_type size() const
edm::ESGetToken< HBHENegativeEFilter, HBHENegativeEFilterRcd > negToken_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
std::vector< HcalChannelProperties > HcalChannelPropertiesVec
edm::EDGetTokenT< QIE11DigiCollection > tok_qie11_
edm::EDGetTokenT< HBHEDigiCollection > tok_qie8_
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
HLT enums.
edm::ESGetToken< HcalChannelPropertiesVec, HcalChannelPropertiesRecord > propertiesToken_
def move(src, dest)
Definition: eostools.py:511

◆ runHBHENegativeEFilter()

void HBHEPhase1Reconstructor::runHBHENegativeEFilter ( const HBHEChannelInfo info,
HBHERecHit rh 
)
private

Definition at line 656 of file HBHEPhase1Reconstructor.cc.

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

Referenced by setAsicSpecificBits().

656  {
657  double ts[HBHEChannelInfo::MAXSAMPLES];
658  const unsigned nRead = info.nSamples();
659  for (unsigned i = 0; i < nRead; ++i)
660  ts[i] = info.tsCharge(i);
661  const bool passes = negEFilter_->checkPassFilter(info.id(), &ts[0], nRead);
662  if (!passes)
664 }
const HBHENegativeEFilter * negEFilter_
static const TGPicture * info(bool iBackgroundIsBlack)
constexpr void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.h:36
static const unsigned MAXSAMPLES
bool checkPassFilter(const HcalDetId &id, const double *ts, unsigned lenTS) const

◆ setAsicSpecificBits() [1/2]

void HBHEPhase1Reconstructor::setAsicSpecificBits ( const HBHEDataFrame frame,
const HcalCoder coder,
const HBHEChannelInfo info,
const HcalCalibrations calib,
int  soi,
HBHERecHit rh 
)
private

Definition at line 620 of file HBHEPhase1Reconstructor.cc.

References hbheFlagSetterQIE8_, hbhePulseShapeFlagSetterQIE8_, info(), runHBHENegativeEFilter(), HBHERecHit::setAuxTDC(), setNegativeFlagsQIE8_, setNoiseFlagsQIE8_, setPulseShapeFlagsQIE8_, and mitigatedMETSequence_cff::U.

Referenced by processData().

625  {
626  if (setNoiseFlagsQIE8_)
627  hbheFlagSetterQIE8_->rememberHit(*rh);
628 
630  hbhePulseShapeFlagSetterQIE8_->SetPulseShapeFlags(*rh, frame, coder, calib);
631 
634 
635  rh->setAuxTDC(0U);
636 }
std::unique_ptr< HBHEPulseShapeFlagSetter > hbhePulseShapeFlagSetterQIE8_
static const TGPicture * info(bool iBackgroundIsBlack)
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE8_
constexpr void setAuxTDC(const uint32_t aux)
Definition: HBHERecHit.h:58
void runHBHENegativeEFilter(const HBHEChannelInfo &info, HBHERecHit *rh)

◆ setAsicSpecificBits() [2/2]

void HBHEPhase1Reconstructor::setAsicSpecificBits ( const QIE11DataFrame frame,
const HcalCoder coder,
const HBHEChannelInfo info,
const HcalCalibrations calib,
int  soi,
HBHERecHit rh 
)
private

Definition at line 638 of file HBHEPhase1Reconstructor.cc.

References hbheFlagSetterQIE11_, hbhePulseShapeFlagSetterQIE11_, info(), runHBHENegativeEFilter(), HBHERecHit::setAuxTDC(), setNegativeFlagsQIE11_, setNoiseFlagsQIE11_, and setPulseShapeFlagsQIE11_.

643  {
645  hbheFlagSetterQIE11_->rememberHit(*rh);
646 
648  hbhePulseShapeFlagSetterQIE11_->SetPulseShapeFlags(*rh, frame, coder, calib);
649 
652 
653  rh->setAuxTDC(packTDCData(frame, soi));
654 }
static const TGPicture * info(bool iBackgroundIsBlack)
std::unique_ptr< HBHEStatusBitSetter > hbheFlagSetterQIE11_
constexpr void setAuxTDC(const uint32_t aux)
Definition: HBHERecHit.h:58
void runHBHENegativeEFilter(const HBHEChannelInfo &info, HBHERecHit *rh)
std::unique_ptr< HBHEPulseShapeFlagSetter > hbhePulseShapeFlagSetterQIE11_

◆ setCommonStatusBits()

void HBHEPhase1Reconstructor::setCommonStatusBits ( const HBHEChannelInfo info,
const HcalCalibrations calib,
HBHERecHit rh 
)
private

Definition at line 616 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

618  {}

Member Data Documentation

◆ algoConfigClass_

std::string HBHEPhase1Reconstructor::algoConfigClass_
private

Definition at line 297 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor().

◆ conditionsToken_

edm::ESGetToken<HcalDbService, HcalDbRecord> HBHEPhase1Reconstructor::conditionsToken_
private

Definition at line 335 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

◆ dropZSmarkedPassed_

bool HBHEPhase1Reconstructor::dropZSmarkedPassed_
private

Definition at line 303 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

◆ feMapToken_

edm::ESGetToken<HcalFrontEndMap, HcalFrontEndMapRcd> HBHEPhase1Reconstructor::feMapToken_
private

Definition at line 338 of file HBHEPhase1Reconstructor.cc.

Referenced by beginRun(), and HBHEPhase1Reconstructor().

◆ hbheFlagSetterQIE11_

std::unique_ptr<HBHEStatusBitSetter> HBHEPhase1Reconstructor::hbheFlagSetterQIE11_
private

◆ hbheFlagSetterQIE8_

std::unique_ptr<HBHEStatusBitSetter> HBHEPhase1Reconstructor::hbheFlagSetterQIE8_
private

◆ hbhePulseShapeFlagSetterQIE11_

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

Definition at line 331 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and setAsicSpecificBits().

◆ hbhePulseShapeFlagSetterQIE8_

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

Definition at line 330 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and setAsicSpecificBits().

◆ htopoToken_

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> HBHEPhase1Reconstructor::htopoToken_
private

Definition at line 334 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

◆ makeRecHits_

bool HBHEPhase1Reconstructor::makeRecHits_
private

Definition at line 302 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

◆ negEFilter_

const HBHENegativeEFilter* HBHEPhase1Reconstructor::negEFilter_
private

Definition at line 327 of file HBHEPhase1Reconstructor.cc.

Referenced by produce(), and runHBHENegativeEFilter().

◆ negToken_

edm::ESGetToken<HBHENegativeEFilter, HBHENegativeEFilterRcd> HBHEPhase1Reconstructor::negToken_
private

Definition at line 337 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

◆ processQIE11_

bool HBHEPhase1Reconstructor::processQIE11_
private

Definition at line 299 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

◆ processQIE8_

bool HBHEPhase1Reconstructor::processQIE8_
private

Definition at line 298 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

◆ propertiesToken_

edm::ESGetToken<HcalChannelPropertiesVec, HcalChannelPropertiesRecord> HBHEPhase1Reconstructor::propertiesToken_
private

Definition at line 336 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

◆ reco_

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

Definition at line 322 of file HBHEPhase1Reconstructor.cc.

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

◆ recoConfig_

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

Definition at line 323 of file HBHEPhase1Reconstructor.cc.

Referenced by beginRun().

◆ recoConfigToken_

edm::ESGetToken<HFPhase1PMTParams, HFPhase1PMTParamsRcd> HBHEPhase1Reconstructor::recoConfigToken_
private

Definition at line 324 of file HBHEPhase1Reconstructor.cc.

Referenced by beginRun(), and HBHEPhase1Reconstructor().

◆ recoParamsFromDB_

bool HBHEPhase1Reconstructor::recoParamsFromDB_
private

Definition at line 305 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

◆ saveDroppedInfos_

bool HBHEPhase1Reconstructor::saveDroppedInfos_
private

Definition at line 301 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

◆ saveEffectivePedestal_

bool HBHEPhase1Reconstructor::saveEffectivePedestal_
private

Definition at line 306 of file HBHEPhase1Reconstructor.cc.

Referenced by produce().

◆ saveInfos_

bool HBHEPhase1Reconstructor::saveInfos_
private

Definition at line 300 of file HBHEPhase1Reconstructor.cc.

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

◆ setNegativeFlagsQIE11_

bool HBHEPhase1Reconstructor::setNegativeFlagsQIE11_
private

◆ setNegativeFlagsQIE8_

bool HBHEPhase1Reconstructor::setNegativeFlagsQIE8_
private

◆ setNoiseFlagsQIE11_

bool HBHEPhase1Reconstructor::setNoiseFlagsQIE11_
private

◆ setNoiseFlagsQIE8_

bool HBHEPhase1Reconstructor::setNoiseFlagsQIE8_
private

◆ setPulseShapeFlagsQIE11_

bool HBHEPhase1Reconstructor::setPulseShapeFlagsQIE11_
private

Definition at line 317 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and setAsicSpecificBits().

◆ setPulseShapeFlagsQIE8_

bool HBHEPhase1Reconstructor::setPulseShapeFlagsQIE8_
private

Definition at line 316 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and setAsicSpecificBits().

◆ sipmQNTStoSum_

int HBHEPhase1Reconstructor::sipmQNTStoSum_
private

Definition at line 309 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

◆ sipmQTSShift_

int HBHEPhase1Reconstructor::sipmQTSShift_
private

Definition at line 308 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

◆ tok_qie11_

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

Definition at line 321 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

◆ tok_qie8_

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

Definition at line 320 of file HBHEPhase1Reconstructor.cc.

Referenced by HBHEPhase1Reconstructor(), and produce().

◆ tsFromDB_

bool HBHEPhase1Reconstructor::tsFromDB_
private

Definition at line 304 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().

◆ use8ts_

bool HBHEPhase1Reconstructor::use8ts_
private

Definition at line 307 of file HBHEPhase1Reconstructor.cc.

Referenced by processData().