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
 
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)
 
 ~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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 filter (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

bool AndOr_
 
bool applyfilter_
 
unsigned int DetMap_
 
std::vector< std::string > DetNames_
 
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::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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Definition at line 8 of file DetStatus.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file DetStatus.cc.

References gather_cfg::cout, funct::false, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), DcsStatus::nPartitions, DcsStatus::partitionList, and DcsStatus::partitionName.

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  for (unsigned int detreq=0;detreq<DetNames_.size();detreq++)
21  {
22  for (unsigned int detlist=0;detlist<DcsStatus::nPartitions;detlist++)
23  {
24 
25  if (DetNames_[detreq]==DcsStatus::partitionName[detlist])
26  {
27  DetMap_|=(1 << DcsStatus::partitionList[detlist]);
28  if (verbose_)
29  std::cout << "DCSStatus filter: asked partition " << DcsStatus::partitionName[detlist] << " bit " << DcsStatus::partitionList[detlist] << std::endl;
30 
31  }
32  }
33  }
34  edm::InputTag scalersTag("scalersRawToDigi");
35  scalersToken_=consumes<DcsStatusCollection>(scalersTag);
36 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool AndOr_
Definition: DetStatus.h:17
bool verbose_
Definition: DetStatus.h:15
edm::EDGetTokenT< DcsStatusCollection > scalersToken_
Definition: DetStatus.h:20
bool applyfilter_
Definition: DetStatus.h:16
static const char *const partitionName[]
Definition: DcsStatus.h:33
std::vector< std::string > DetNames_
Definition: DetStatus.h:18
static const int partitionList[]
Definition: DcsStatus.h:32
unsigned int DetMap_
Definition: DetStatus.h:19
DetStatus::~DetStatus ( )
override

Definition at line 41 of file DetStatus.cc.

41  {
42 }

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 44 of file DetStatus.cc.

References cms::dd::accepted(), gather_cfg::cout, DEFINE_FWK_MODULE, edm::Event::eventAuxiliary(), edm::Event::getByToken(), edm::EventAuxiliary::isRealData(), edm::HandleBase::isValid(), DcsStatus::nPartitions, DcsStatus::partitionList, and DcsStatus::partitionName.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

44  {
45 
46  bool accepted=false;
47 
49  evt.getByToken(scalersToken_, dcsStatus);
50 
51  if (dcsStatus.isValid())
52  {
53  if (dcsStatus->empty())
54  {
55  // Only complain in case it's real data. Accept in any case.
56  if (evt.eventAuxiliary().isRealData())
57  edm::LogError("DetStatus") << "Error! dcsStatus has size 0, accept in any case" ;
58  accepted=true;
59  }
60  else
61  {
62  unsigned int curr_dcs=(*dcsStatus)[0].ready();
63  if (verbose_)
64  std::cout << "curr_dcs = " << curr_dcs << std::endl;
65  if(AndOr_)
66  accepted=((DetMap_ & curr_dcs)== DetMap_);
67  else
68  accepted=((DetMap_ & curr_dcs)!= 0);
69 
70  if (verbose_)
71 
72  {
73  std::cout << "DCSStatus filter: requested map: " << DetMap_ << " dcs in event: " <<curr_dcs << " filter: " << accepted << std::endl;
74  std::cout << "Partitions ON: " ;
75  for (unsigned int detlist=0;detlist<DcsStatus::nPartitions;detlist++)
76  {
77  if ((*dcsStatus)[0].ready(DcsStatus::partitionList[detlist]))
78  {
79  std::cout << " " << DcsStatus::partitionName[detlist];
80  }
81  }
82  std::cout << std::endl ;
83  }
84  }
85  }
86  else
87  {
88  edm::LogError("DetStatus") << "Error! can't get the product: scalersRawToDigi, accept in any case" ;
89  accepted=true;
90  }
91 
92  if (! applyfilter_) accepted=true;
93  return accepted;
94 }
bool isRealData() const
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:92
bool AndOr_
Definition: DetStatus.h:17
bool verbose_
Definition: DetStatus.h:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< DcsStatusCollection > scalersToken_
Definition: DetStatus.h:20
bool applyfilter_
Definition: DetStatus.h:16
static const char *const partitionName[]
Definition: DcsStatus.h:33
bool isValid() const
Definition: HandleBase.h:74
bool accepted(std::vector< std::string_view > const &, std::string_view)
static const int partitionList[]
Definition: DcsStatus.h:32
unsigned int DetMap_
Definition: DetStatus.h:19

Member Data Documentation

bool DetStatus::AndOr_
private

Definition at line 17 of file DetStatus.h.

bool DetStatus::applyfilter_
private

Definition at line 16 of file DetStatus.h.

unsigned int DetStatus::DetMap_
private

Definition at line 19 of file DetStatus.h.

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

Definition at line 18 of file DetStatus.h.

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

Definition at line 20 of file DetStatus.h.

bool DetStatus::verbose_
private

Definition at line 15 of file DetStatus.h.