#include <DetStatus.h>
Public Member Functions | |
DetStatus (const edm::ParameterSet &) | |
~DetStatus () | |
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_ |
Definition at line 7 of file DetStatus.h.
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.
{ verbose_ = pset.getUntrackedParameter<bool>( "DebugOn", false ); AndOr_ = pset.getParameter<bool>( "AndOr"); applyfilter_ = pset.getParameter<bool>( "ApplyFilter"); DetNames_ = pset.getParameter<std::vector<std::string> >( "DetectorType" ); // build a map DetMap_=0; for (unsigned int detreq=0;detreq<DetNames_.size();detreq++) { for (unsigned int detlist=0;detlist<DcsStatus::nPartitions;detlist++) { if (DetNames_[detreq]==DcsStatus::partitionName[detlist]) { DetMap_|=(1 << DcsStatus::partitionList[detlist]); if (verbose_) std::cout << "DCSStatus filter: asked partition " << DcsStatus::partitionName[detlist] << " bit " << DcsStatus::partitionList[detlist] << std::endl; } } } }
DetStatus::~DetStatus | ( | ) |
Definition at line 40 of file DetStatus.cc.
{ }
bool DetStatus::filter | ( | edm::Event & | evt, |
edm::EventSetup const & | es | ||
) | [private, virtual] |
Implements edm::EDFilter.
Definition at line 43 of file DetStatus.cc.
References gather_cfg::cout, edm::Event::eventAuxiliary(), edm::Event::getByLabel(), edm::HandleBase::isValid(), DcsStatus::nPartitions, DcsStatus::partitionList, and DcsStatus::partitionName.
{ bool accepted=false; edm::Handle<DcsStatusCollection> dcsStatus; evt.getByLabel("scalersRawToDigi", dcsStatus); if (dcsStatus.isValid()) { if (dcsStatus->empty()) { // Only complain in case it's real data. Accept in any case. if (evt.eventAuxiliary().isRealData()) edm::LogError("DetStatus") << "Error! dcsStatus has size 0, accept in any case" ; accepted=true; } else { unsigned int curr_dcs=(*dcsStatus)[0].ready(); if (verbose_) std::cout << "curr_dcs = " << curr_dcs << std::endl; if(AndOr_) accepted=((DetMap_ & curr_dcs)== DetMap_); else accepted=((DetMap_ & curr_dcs)!= 0); if (verbose_) { std::cout << "DCSStatus filter: requested map: " << DetMap_ << " dcs in event: " <<curr_dcs << " filter: " << accepted << std::endl; std::cout << "Partitions ON: " ; for (unsigned int detlist=0;detlist<DcsStatus::nPartitions;detlist++) { if ((*dcsStatus)[0].ready(DcsStatus::partitionList[detlist])) { std::cout << " " << DcsStatus::partitionName[detlist]; } } std::cout << std::endl ; } } } else { edm::LogError("DetStatus") << "Error! can't get the product: scalersRawToDigi, accept in any case" ; accepted=true; } if (! applyfilter_) accepted=true; return accepted; }
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.