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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
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)
 

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<>
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::EDFilterBase
typedef EDFilterAdaptorBase 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::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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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 11 of file DetStatus.cc.

Constructor & Destructor Documentation

◆ DetStatus()

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

Definition at line 39 of file DetStatus.cc.

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 }

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

◆ ~DetStatus()

DetStatus::~DetStatus ( )
override

Definition at line 73 of file DetStatus.cc.

73 {}

Member Function Documentation

◆ checkForDCSRecord()

bool DetStatus::checkForDCSRecord ( const DCSRecord dcsRecod)
private

Definition at line 109 of file DetStatus.cc.

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 (requestedPartitions_.test(detlist)) {
120  if (AndOr_) {
121  accepted = (accepted & dcsRecord.highVoltageReady(detlist));
122  } else {
123  accepted = (accepted || dcsRecord.highVoltageReady(detlist));
124  }
125  }
126  }
127 
128  if (verbose_) {
129  edm::LogInfo("DetStatus") << "DCSStatus filter: " << accepted << "( AndOr: " << AndOr_ << ")" << std::endl;
130  edm::LogVerbatim("DetStatus") << "Partitions ON: ";
131  for (unsigned int detlist = 0; detlist < DcsStatus::nPartitions; detlist++) {
132  if ((dcsRecord.highVoltageReady(detlist))) {
133  edm::LogVerbatim("DetStatus") << " " << DcsStatus::partitionName[detlist];
134  }
135  }
136  edm::LogVerbatim("DetStatus") << std::endl;
137  }
138 
139  return accepted;
140 }

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

◆ checkForDCSStatus()

bool DetStatus::checkForDCSStatus ( const DcsStatusCollection dcsStatus)
private

Definition at line 76 of file DetStatus.cc.

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 }

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

◆ fillDescriptions()

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

Definition at line 181 of file DetStatus.cc.

181  {
183  desc.addUntracked<bool>("DebugOn", false);
184  desc.add<bool>("AndOr", true);
185  desc.add<bool>("ApplyFilter", true);
186  desc.add<std::vector<std::string>>("DetectorType", {});
187  descriptions.add("detStatus", desc);
188 }

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

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 143 of file DetStatus.cc.

145 {
146  bool accepted = false;
147 
148  // If FED#735 is available use it to extract DcsStatusCollection.
149  // If not, use softFED#1022 to extract DCSRecord.
150  // Populate DCS Bits array with received information.
151 
153  evt.getByToken(scalersToken_, dcsStatus);
156 
157  if (dcsStatus.isValid() && !dcsStatus->empty()) {
158  accepted = checkForDCSStatus(*dcsStatus);
159  } else if (dcsRecord.isValid()) {
160  if (evt.eventAuxiliary().isRealData()) {
161  // in case of real data check for DCS
162  accepted = checkForDCSRecord(*dcsRecord);
163  } else {
164  // in case of MC accept in any case
165  accepted = true;
166  }
167  } else {
168  edm::LogError("DetStatus")
169  << "Error! can't get the product, neither DCSRecord, nor scalersRawToDigi: accept in any case!";
170  accepted = true;
171  }
172 
173  if (!applyfilter_) {
174  accepted = true;
175  }
176 
177  return accepted;
178 }

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

DetStatus::scalersToken_
edm::EDGetTokenT< DcsStatusCollection > scalersToken_
Definition: DetStatus.cc:27
DcsStatus::partitionName
static const char *const partitionName[]
Definition: DcsStatus.h:31
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
DetStatus::checkForDCSStatus
bool checkForDCSStatus(const DcsStatusCollection &dcsStatus)
Definition: DetStatus.cc:76
DetStatus::requestedPartitions_
std::bitset< DcsStatus::nPartitions > requestedPartitions_
Definition: DetStatus.cc:25
DQMOffline_cff.dcsRecord
dcsRecord
Definition: DQMOffline_cff.py:27
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
DetStatus::DetMap_
unsigned int DetMap_
Definition: DetStatus.cc:26
DetStatus::dcsRecordToken_
edm::EDGetTokenT< DCSRecord > dcsRecordToken_
Definition: DetStatus.cc:28
DcsStatus::partitionList
static const int partitionList[]
Definition: DcsStatus.h:30
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
edm::Event::eventAuxiliary
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:95
DetStatus::verbose_
bool verbose_
Definition: DetStatus.cc:21
DetStatus::checkForDCSRecord
bool checkForDCSRecord(const DCSRecord &dcsRecod)
Definition: DetStatus.cc:109
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.cc:24
DetStatus::AndOr_
bool AndOr_
Definition: DetStatus.cc:23
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
DetStatus::applyfilter_
bool applyfilter_
Definition: DetStatus.cc:22