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::ProductRegistryHelper

Public Member Functions

 DetStatus (const edm::ParameterSet &)
 
 ~DetStatus ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

bool filter (edm::Event &, edm::EventSetup const &)
 

Private Attributes

bool AndOr_
 
bool applyfilter_
 
unsigned int DetMap_
 
std::vector< std::string > DetNames_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 7 of file DetStatus.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file DetStatus.cc.

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

13  {
14  verbose_ = pset.getUntrackedParameter<bool>( "DebugOn", false );
15  AndOr_ = pset.getParameter<bool>( "AndOr");
16  applyfilter_ = pset.getParameter<bool>( "ApplyFilter");
17  DetNames_ = pset.getParameter<std::vector<std::string> >( "DetectorType" );
18 
19  // build a map
20  DetMap_=0;
21  for (unsigned int detreq=0;detreq<DetNames_.size();detreq++)
22  {
23  for (unsigned int detlist=0;detlist<DcsStatus::nPartitions;detlist++)
24  {
25 
26  if (DetNames_[detreq]==DcsStatus::partitionName[detlist])
27  {
28  DetMap_|=(1 << DcsStatus::partitionList[detlist]);
29  if (verbose_)
30  std::cout << "DCSStatus filter: asked partition " << DcsStatus::partitionName[detlist] << " bit " << DcsStatus::partitionList[detlist] << std::endl;
31 
32  }
33  }
34  }
35 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
static const char * partitionName[]
Definition: DcsStatus.h:33
bool AndOr_
Definition: DetStatus.h:16
bool verbose_
Definition: DetStatus.h:14
bool applyfilter_
Definition: DetStatus.h:15
std::vector< std::string > DetNames_
Definition: DetStatus.h:17
tuple cout
Definition: gather_cfg.py:121
static const int partitionList[]
Definition: DcsStatus.h:32
unsigned int DetMap_
Definition: DetStatus.h:18
DetStatus::~DetStatus ( )

Definition at line 40 of file DetStatus.cc.

40  {
41 }

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 43 of file DetStatus.cc.

References gather_cfg::cout, edm::Event::eventAuxiliary(), edm::Event::getByLabel(), 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().

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

Member Data Documentation

bool DetStatus::AndOr_
private

Definition at line 16 of file DetStatus.h.

bool DetStatus::applyfilter_
private

Definition at line 15 of file DetStatus.h.

unsigned int DetStatus::DetMap_
private

Definition at line 18 of file DetStatus.h.

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

Definition at line 17 of file DetStatus.h.

bool DetStatus::verbose_
private

Definition at line 14 of file DetStatus.h.