CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
< DcsStatusCollection
scalersToken_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
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 &)
 
- 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 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, edm::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
tuple cout
Definition: gather_cfg.py:145
volatile std::atomic< bool > shutdown_flag false
static const int partitionList[]
Definition: DcsStatus.h:32
unsigned int DetMap_
Definition: DetStatus.h:19
DetStatus::~DetStatus ( )

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 gather_cfg::cout, 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
bool AndOr_
Definition: DetStatus.h:17
bool verbose_
Definition: DetStatus.h:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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:75
EventAuxiliary const & eventAuxiliary() const
Definition: Event.h:77
tuple cout
Definition: gather_cfg.py:145
struct DcsStatusRaw_v4 dcsStatus
Definition: ScalersRaw.h:227
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.