CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
DetStatus Class Reference
Inheritance diagram for DetStatus:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DetStatus (const edm::ParameterSet &)
 
 ~DetStatus () override
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=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 EDFilteroperator= (const EDFilter &)=delete
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Private Member Functions

bool checkForDCSRecord (const DCSRecord &dcsRecod)
 
bool checkForDCSStatus (const DcsStatusCollection &dcsStatus)
 
bool filter (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

bool AndOr_
 
bool applyfilter_
 
edm::EDGetTokenT< DCSRecorddcsRecordToken_
 
unsigned int DetMap_
 
std::vector< std::string > DetNames_
 
std::bitset< DcsStatus::nPartitionsrequestedPartitions_
 
edm::EDGetTokenT< DcsStatusCollectionscalersToken_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
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
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 11 of file DetStatus.cc.

Constructor & Destructor Documentation

◆ DetStatus()

DetStatus::DetStatus ( const edm::ParameterSet pset)

Definition at line 39 of file DetStatus.cc.

References ProducerED_cfi::InputTag, DcsStatus::nPartitions, DcsStatus::partitionList, DcsStatus::partitionName, and muonDTDigis_cfi::pset.

39  {
40  verbose_ = pset.getUntrackedParameter<bool>("DebugOn", false);
41  AndOr_ = pset.getParameter<bool>("AndOr");
42  applyfilter_ = pset.getParameter<bool>("ApplyFilter");
43  DetNames_ = pset.getParameter<std::vector<std::string>>("DetectorType");
44 
45  // build a map
46  DetMap_ = 0;
47 
48  for (unsigned int detreq = 0; detreq < DetNames_.size(); detreq++) {
49  for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) {
50  if (DetNames_[detreq] == DcsStatus::partitionName[detlist]) {
51  //edm::LogPrint("DetStatus") << __PRETTY_FUNCTION__ << " requested:" << DetNames_[detreq] << std::endl;
52 
53  // set for DCSRecord
54  requestedPartitions_.set(detlist, true);
55 
56  // set for DCSStatus
57  DetMap_ |= (1 << DcsStatus::partitionList[detlist]);
58 
59  if (verbose_) {
60  edm::LogInfo("DetStatus") << "DCSStatus filter: asked partition " << DcsStatus::partitionName[detlist]
61  << " bit " << DcsStatus::partitionList[detlist] << std::endl;
62  }
63  }
64  }
65  }
66  scalersToken_ = consumes<DcsStatusCollection>(edm::InputTag("scalersRawToDigi"));
67  dcsRecordToken_ = consumes<DCSRecord>(edm::InputTag("onlineMetaDataDigis"));
68 }
bool AndOr_
Definition: DetStatus.cc:23
bool verbose_
Definition: DetStatus.cc:21
std::bitset< DcsStatus::nPartitions > requestedPartitions_
Definition: DetStatus.cc:25
edm::EDGetTokenT< DcsStatusCollection > scalersToken_
Definition: DetStatus.cc:27
bool applyfilter_
Definition: DetStatus.cc:22
static const char *const partitionName[]
Definition: DcsStatus.h:31
Log< level::Info, false > LogInfo
std::vector< std::string > DetNames_
Definition: DetStatus.cc:24
static const int partitionList[]
Definition: DcsStatus.h:30
unsigned int DetMap_
Definition: DetStatus.cc:26
edm::EDGetTokenT< DCSRecord > dcsRecordToken_
Definition: DetStatus.cc:28

◆ ~DetStatus()

DetStatus::~DetStatus ( )
overridedefault

Member Function Documentation

◆ checkForDCSRecord()

bool DetStatus::checkForDCSRecord ( const DCSRecord dcsRecod)
private

Definition at line 109 of file DetStatus.cc.

References DQMOffline_cff::dcsRecord, DcsStatus::nPartitions, and DcsStatus::partitionName.

111 {
112  bool accepted = false;
113 
114  if (verbose_) {
115  edm::LogInfo("DetStatus") << "Using softFED#1022 for reading DCS bits" << std::endl;
116  }
117 
118  for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) {
119  if (verbose_)
120  edm::LogInfo("DetStatus") << "testing " << DcsStatus::partitionName[detlist];
121  if (requestedPartitions_.test(detlist)) {
122  if (verbose_)
123  edm::LogInfo("DetStatus") << " " << DcsStatus::partitionName[detlist] << "in the requested list" << std::endl;
124  if (AndOr_) {
125  accepted = dcsRecord.highVoltageReady(detlist);
126  if (!accepted)
127  break;
128  } else {
129  accepted = (accepted || dcsRecord.highVoltageReady(detlist));
130  }
131  }
132  }
133 
134  if (verbose_) {
135  edm::LogInfo("DetStatus") << "DCSStatus filter: " << accepted << " ( AndOr: " << AndOr_ << ")" << std::endl;
136  edm::LogVerbatim("DetStatus") << "Partitions ON: ";
137  for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) {
138  if ((dcsRecord.highVoltageReady(detlist))) {
139  edm::LogVerbatim("DetStatus") << " " << DcsStatus::partitionName[detlist];
140  }
141  }
142  edm::LogVerbatim("DetStatus") << std::endl;
143  }
144 
145  return accepted;
146 }
Log< level::Info, true > LogVerbatim
bool AndOr_
Definition: DetStatus.cc:23
bool verbose_
Definition: DetStatus.cc:21
std::bitset< DcsStatus::nPartitions > requestedPartitions_
Definition: DetStatus.cc:25
static const char *const partitionName[]
Definition: DcsStatus.h:31
Log< level::Info, false > LogInfo

◆ checkForDCSStatus()

bool DetStatus::checkForDCSStatus ( const DcsStatusCollection dcsStatus)
private

Definition at line 76 of file DetStatus.cc.

References DcsStatus::nPartitions, DcsStatus::partitionList, and DcsStatus::partitionName.

78 {
79  if (verbose_) {
80  edm::LogInfo("DetStatus") << "Using FED#735 for reading DCS bits" << std::endl;
81  }
82 
83  bool accepted = false;
84  unsigned int curr_dcs = (dcsStatus)[0].ready();
85  if (verbose_) {
86  edm::LogVerbatim("DetStatus") << "curr_dcs = " << curr_dcs << std::endl;
87  }
88 
89  if (AndOr_)
90  accepted = ((DetMap_ & curr_dcs) == DetMap_);
91  else
92  accepted = ((DetMap_ & curr_dcs) != 0);
93 
94  if (verbose_) {
95  edm::LogInfo("DetStatus") << "DCSStatus filter: requested map: " << DetMap_ << " dcs in event: " << curr_dcs
96  << " filter: " << accepted << "( AndOr: " << AndOr_ << ")" << std::endl;
97  edm::LogVerbatim("DetStatus") << "Partitions ON: ";
98  for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) {
99  if ((dcsStatus)[0].ready(DcsStatus::partitionList[detlist])) {
100  edm::LogVerbatim("DetStatus") << " " << DcsStatus::partitionName[detlist];
101  }
102  }
103  edm::LogVerbatim("DetStatus") << std::endl;
104  }
105  return accepted;
106 }
Log< level::Info, true > LogVerbatim
bool AndOr_
Definition: DetStatus.cc:23
bool verbose_
Definition: DetStatus.cc:21
static const char *const partitionName[]
Definition: DcsStatus.h:31
Log< level::Info, false > LogInfo
static const int partitionList[]
Definition: DcsStatus.h:30
unsigned int DetMap_
Definition: DetStatus.cc:26

◆ fillDescriptions()

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

Definition at line 188 of file DetStatus.cc.

References edm::ConfigurationDescriptions::add(), and submitPVResolutionJobs::desc.

188  {
190  desc.addUntracked<bool>("DebugOn", false);
191  desc.add<bool>("AndOr", true);
192  desc.add<bool>("ApplyFilter", true);
193  desc.add<std::vector<std::string>>("DetectorType", {});
194  descriptions.add("detStatus", desc);
195 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ filter()

bool DetStatus::filter ( edm::Event evt,
edm::EventSetup const &  es 
)
overrideprivatevirtual

Implements edm::stream::EDFilterBase.

Definition at line 149 of file DetStatus.cc.

References DQMOffline_cff::dcsRecord, edm::Event::eventAuxiliary(), edm::Event::getByToken(), edm::EventAuxiliary::isRealData(), and edm::HandleBase::isValid().

151 {
152  bool accepted = false;
153 
154  // If FED#735 is available use it to extract DcsStatusCollection.
155  // If not, use softFED#1022 to extract DCSRecord.
156  // Populate DCS Bits array with received information.
157 
159  evt.getByToken(scalersToken_, dcsStatus);
162 
163  // if the old style DCS status is valid (Run1 + Run2)
164  if (dcsStatus.isValid() && !dcsStatus->empty()) {
165  accepted = checkForDCSStatus(*dcsStatus);
166  } else if (dcsRecord.isValid()) {
167  if (evt.eventAuxiliary().isRealData()) {
168  // in case of real data check for DCSRecord content (Run >=3)
169  accepted = checkForDCSRecord(*dcsRecord);
170  } else {
171  // in case of MC accept in any case
172  accepted = true;
173  }
174  } else {
175  edm::LogError("DetStatus")
176  << "Error! can't get the product, neither DCSRecord, nor scalersRawToDigi: accept in any case!";
177  accepted = true;
178  }
179 
180  if (!applyfilter_) {
181  accepted = true;
182  }
183 
184  return accepted;
185 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:95
Log< level::Error, false > LogError
edm::EDGetTokenT< DcsStatusCollection > scalersToken_
Definition: DetStatus.cc:27
bool applyfilter_
Definition: DetStatus.cc:22
bool isRealData() const
bool checkForDCSRecord(const DCSRecord &dcsRecod)
Definition: DetStatus.cc:109
bool isValid() const
Definition: HandleBase.h:70
bool checkForDCSStatus(const DcsStatusCollection &dcsStatus)
Definition: DetStatus.cc:76
edm::EDGetTokenT< DCSRecord > dcsRecordToken_
Definition: DetStatus.cc:28

Member Data Documentation

◆ AndOr_

bool DetStatus::AndOr_
private

Definition at line 23 of file DetStatus.cc.

◆ applyfilter_

bool DetStatus::applyfilter_
private

Definition at line 22 of file DetStatus.cc.

◆ dcsRecordToken_

edm::EDGetTokenT<DCSRecord> DetStatus::dcsRecordToken_
private

Definition at line 28 of file DetStatus.cc.

◆ DetMap_

unsigned int DetStatus::DetMap_
private

Definition at line 26 of file DetStatus.cc.

◆ DetNames_

std::vector<std::string> DetStatus::DetNames_
private

Definition at line 24 of file DetStatus.cc.

◆ requestedPartitions_

std::bitset<DcsStatus::nPartitions> DetStatus::requestedPartitions_
private

Definition at line 25 of file DetStatus.cc.

◆ scalersToken_

edm::EDGetTokenT<DcsStatusCollection> DetStatus::scalersToken_
private

Definition at line 27 of file DetStatus.cc.

◆ verbose_

bool DetStatus::verbose_
private

Definition at line 21 of file DetStatus.cc.