CMS 3D CMS Logo

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

#include <DetStatus.h>

Inheritance diagram for DetStatus:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DetStatus (const edm::ParameterSet &)
 
 ~DetStatus () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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::EDFilter
typedef EDFilter 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
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 9 of file DetStatus.h.

Constructor & Destructor Documentation

◆ DetStatus()

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

Definition at line 12 of file DetStatus.cc.

12  {
13  verbose_ = pset.getUntrackedParameter<bool>("DebugOn", false);
14  AndOr_ = pset.getParameter<bool>("AndOr");
15  applyfilter_ = pset.getParameter<bool>("ApplyFilter");
16  DetNames_ = pset.getParameter<std::vector<std::string> >("DetectorType");
17 
18  // build a map
19  DetMap_ = 0;
20 
21  for (unsigned int detreq = 0; detreq < DetNames_.size(); detreq++) {
22  for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) {
23  if (DetNames_[detreq] == DcsStatus::partitionName[detlist]) {
24  //edm::LogPrint("DetStatus") << __PRETTY_FUNCTION__ << " requested:" << DetNames_[detreq] << std::endl;
25 
26  // set for DCSRecord
27  requestedPartitions_.set(detlist, true);
28 
29  // set for DCSStatus
30  DetMap_ |= (1 << DcsStatus::partitionList[detlist]);
31 
32  if (verbose_) {
33  edm::LogInfo("DetStatus") << "DCSStatus filter: asked partition " << DcsStatus::partitionName[detlist]
34  << " bit " << DcsStatus::partitionList[detlist] << std::endl;
35  }
36  }
37  }
38  }
39  scalersToken_ = consumes<DcsStatusCollection>(edm::InputTag("scalersRawToDigi"));
40  dcsRecordToken_ = consumes<DCSRecord>(edm::InputTag("onlineMetaDataDigis"));
41 }

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

◆ ~DetStatus()

DetStatus::~DetStatus ( )
override

Definition at line 46 of file DetStatus.cc.

46 {}

Member Function Documentation

◆ checkForDCSRecord()

bool DetStatus::checkForDCSRecord ( const DCSRecord dcsRecod)
private

Definition at line 82 of file DetStatus.cc.

84 {
85  bool accepted = false;
86 
87  if (verbose_) {
88  edm::LogInfo("DetStatus") << "Using softFED#1022 for reading DCS bits" << std::endl;
89  }
90 
91  for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) {
92  if (requestedPartitions_.test(detlist)) {
93  if (AndOr_) {
94  accepted = (accepted & dcsRecord.highVoltageReady(detlist));
95  } else {
96  accepted = (accepted || dcsRecord.highVoltageReady(detlist));
97  }
98  }
99  }
100 
101  if (verbose_) {
102  edm::LogInfo("DetStatus") << "DCSStatus filter: " << accepted << "( AndOr: " << AndOr_ << ")" << std::endl;
103  edm::LogVerbatim("DetStatus") << "Partitions ON: ";
104  for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) {
105  if ((dcsRecord.highVoltageReady(detlist))) {
106  edm::LogVerbatim("DetStatus") << " " << DcsStatus::partitionName[detlist];
107  }
108  }
109  edm::LogVerbatim("DetStatus") << std::endl;
110  }
111 
112  return accepted;
113 }

References cms::dd::accepted(), DQMOffline_cff::dcsRecord, DcsStatus::nPartitions, and DcsStatus::partitionName.

◆ checkForDCSStatus()

bool DetStatus::checkForDCSStatus ( const DcsStatusCollection dcsStatus)
private

Definition at line 49 of file DetStatus.cc.

51 {
52  if (verbose_) {
53  edm::LogInfo("DetStatus") << "Using FED#735 for reading DCS bits" << std::endl;
54  }
55 
56  bool accepted = false;
57  unsigned int curr_dcs = (dcsStatus)[0].ready();
58  if (verbose_) {
59  edm::LogVerbatim("DetStatus") << "curr_dcs = " << curr_dcs << std::endl;
60  }
61 
62  if (AndOr_)
63  accepted = ((DetMap_ & curr_dcs) == DetMap_);
64  else
65  accepted = ((DetMap_ & curr_dcs) != 0);
66 
67  if (verbose_) {
68  edm::LogInfo("DetStatus") << "DCSStatus filter: requested map: " << DetMap_ << " dcs in event: " << curr_dcs
69  << " filter: " << accepted << "( AndOr: " << AndOr_ << ")" << std::endl;
70  edm::LogVerbatim("DetStatus") << "Partitions ON: ";
71  for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) {
72  if ((dcsStatus)[0].ready(DcsStatus::partitionList[detlist])) {
73  edm::LogVerbatim("DetStatus") << " " << DcsStatus::partitionName[detlist];
74  }
75  }
76  edm::LogVerbatim("DetStatus") << std::endl;
77  }
78  return accepted;
79 }

References cms::dd::accepted(), DcsStatus::nPartitions, DcsStatus::partitionList, and DcsStatus::partitionName.

◆ filter()

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

Implements edm::EDFilter.

Definition at line 116 of file DetStatus.cc.

118 {
119  bool accepted = false;
120 
121  // If FED#735 is available use it to extract DcsStatusCollection.
122  // If not, use softFED#1022 to extract DCSRecord.
123  // Populate DCS Bits array with received information.
124 
126  evt.getByToken(scalersToken_, dcsStatus);
129 
130  if (dcsStatus.isValid() && !dcsStatus->empty()) {
131  accepted = checkForDCSStatus(*dcsStatus);
132  } else if (dcsRecord.isValid()) {
133  if (evt.eventAuxiliary().isRealData()) {
134  // in case of real data check for DCS
136  } else {
137  // in case of MC accept in any case
138  accepted = true;
139  }
140  } else {
141  edm::LogError("DetStatus")
142  << "Error! can't get the product, neither DCSRecord, nor scalersRawToDigi: accept in any case!";
143  accepted = true;
144  }
145 
146  if (!applyfilter_) {
147  accepted = true;
148  }
149 
150  return accepted;
151 }

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

Member Data Documentation

◆ AndOr_

bool DetStatus::AndOr_
private

Definition at line 19 of file DetStatus.h.

◆ applyfilter_

bool DetStatus::applyfilter_
private

Definition at line 18 of file DetStatus.h.

◆ dcsRecordToken_

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

Definition at line 24 of file DetStatus.h.

◆ DetMap_

unsigned int DetStatus::DetMap_
private

Definition at line 22 of file DetStatus.h.

◆ DetNames_

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

Definition at line 20 of file DetStatus.h.

◆ requestedPartitions_

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

Definition at line 21 of file DetStatus.h.

◆ scalersToken_

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

Definition at line 23 of file DetStatus.h.

◆ verbose_

bool DetStatus::verbose_
private

Definition at line 17 of file DetStatus.h.

DetStatus::scalersToken_
edm::EDGetTokenT< DcsStatusCollection > scalersToken_
Definition: DetStatus.h:23
DcsStatus::partitionName
static const char *const partitionName[]
Definition: DcsStatus.h:31
edm::LogInfo
Definition: MessageLogger.h:254
edm::Handle
Definition: AssociativeIterator.h:50
cms::dd::accepted
bool accepted(std::vector< std::regex > const &, std::string_view)
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
DetStatus::checkForDCSStatus
bool checkForDCSStatus(const DcsStatusCollection &dcsStatus)
Definition: DetStatus.cc:49
edm::LogError
Definition: MessageLogger.h:183
DetStatus::requestedPartitions_
std::bitset< DcsStatus::nPartitions > requestedPartitions_
Definition: DetStatus.h:21
edm::LogVerbatim
Definition: MessageLogger.h:297
DQMOffline_cff.dcsRecord
dcsRecord
Definition: DQMOffline_cff.py:27
DetStatus::DetMap_
unsigned int DetMap_
Definition: DetStatus.h:22
DetStatus::dcsRecordToken_
edm::EDGetTokenT< DCSRecord > dcsRecordToken_
Definition: DetStatus.h:24
DcsStatus::partitionList
static const int partitionList[]
Definition: DcsStatus.h:30
edm::Event::eventAuxiliary
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:94
DetStatus::verbose_
bool verbose_
Definition: DetStatus.h:17
DetStatus::checkForDCSRecord
bool checkForDCSRecord(const DCSRecord &dcsRecod)
Definition: DetStatus.cc:82
DcsStatus::nPartitions
Definition: DcsStatus.h:59
edm::EventAuxiliary::isRealData
bool isRealData() const
Definition: EventAuxiliary.h:74
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
DetStatus::DetNames_
std::vector< std::string > DetNames_
Definition: DetStatus.h:20
DetStatus::AndOr_
bool AndOr_
Definition: DetStatus.h:19
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
DetStatus::applyfilter_
bool applyfilter_
Definition: DetStatus.h:18