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
DetectorStateFilter Class Reference

#include <DetectorStateFilter.h>

Inheritance diagram for DetectorStateFilter:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DetectorStateFilter (const edm::ParameterSet &)
 
 ~DetectorStateFilter ()
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- 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 (const std::string &iProcessName, std::vector< const char * > &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

const edm::EDGetTokenT
< DcsStatusCollection
dcsStatusLabel_
 
bool detectorOn_
 
const std::string detectorType_
 
uint64_t nEvents_
 
uint64_t nSelectedEvents_
 
const 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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase 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::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 9 of file DetectorStateFilter.h.

Constructor & Destructor Documentation

DetectorStateFilter::DetectorStateFilter ( const edm::ParameterSet pset)

Definition at line 15 of file DetectorStateFilter.cc.

References detectorOn_, nEvents_, and nSelectedEvents_.

16  : verbose_ ( pset.getUntrackedParameter<bool> ( "DebugOn", false ) )
17  , detectorType_ ( pset.getUntrackedParameter<std::string>( "DetectorType", "sistrip") )
18  , dcsStatusLabel_ ( consumes<DcsStatusCollection>( pset.getUntrackedParameter<edm::InputTag>( "DcsStatusLabel", edm::InputTag("scalersRawToDigi")) ) )
19 {
20  nEvents_ = 0;
21  nSelectedEvents_ = 0;
22  detectorOn_ = false;
23 }
T getUntrackedParameter(std::string const &, T const &) const
const std::string detectorType_
const edm::EDGetTokenT< DcsStatusCollection > dcsStatusLabel_
DetectorStateFilter::~DetectorStateFilter ( )

Definition at line 27 of file DetectorStateFilter.cc.

27  {
28 }

Member Function Documentation

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

Implements edm::stream::EDFilterBase.

Definition at line 30 of file DetectorStateFilter.cc.

References DcsStatus::BPIX, gather_cfg::cout, dcsStatusLabel_, detectorOn_, detectorType_, DcsStatus::FPIX, edm::Event::getByToken(), edm::EventBase::isRealData(), edm::HandleBase::isValid(), nEvents_, nSelectedEvents_, DcsStatus::TECm, DcsStatus::TECp, DcsStatus::TIBTID, DcsStatus::TOB, and verbose_.

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().

30  {
31 
32  nEvents_++;
33  // Check Detector state Only for Real Data and return true for MC
34  if (evt.isRealData()) {
36  evt.getByToken(dcsStatusLabel_, dcsStatus);
37  if (dcsStatus.isValid()) {
38  if (detectorType_ == "pixel" && dcsStatus->size() > 0 ) {
39  if ((*dcsStatus)[0].ready(DcsStatus::BPIX) &&
40  (*dcsStatus)[0].ready(DcsStatus::FPIX)) {
41  detectorOn_ = true;
43  } else detectorOn_ = false;
44  if ( verbose_ ) std::cout << " Total Events " << nEvents_
45  << " Selected Events " << nSelectedEvents_
46  << " DCS States : " << " BPix " << (*dcsStatus)[0].ready(DcsStatus::BPIX)
47  << " FPix " << (*dcsStatus)[0].ready(DcsStatus::FPIX)
48  << " Detector State " << detectorOn_<< std::endl;
49  } else if (detectorType_ == "sistrip" && dcsStatus->size() > 0) {
50  if ((*dcsStatus)[0].ready(DcsStatus::TIBTID) &&
51  (*dcsStatus)[0].ready(DcsStatus::TOB) &&
52  (*dcsStatus)[0].ready(DcsStatus::TECp) &&
53  (*dcsStatus)[0].ready(DcsStatus::TECm)) {
54  detectorOn_ = true;
56  } else detectorOn_ = false;
57  if ( verbose_ ) std::cout << " Total Events " << nEvents_
58  << " Selected Events " << nSelectedEvents_
59  << " DCS States : " << " TEC- " << (*dcsStatus)[0].ready(DcsStatus::TECm)
60  << " TEC+ " << (*dcsStatus)[0].ready(DcsStatus::TECp)
61  << " TIB/TID " << (*dcsStatus)[0].ready(DcsStatus::TIBTID)
62  << " TOB " << (*dcsStatus)[0].ready(DcsStatus::TOB)
63  << " Detector States " << detectorOn_<< std::endl;
64  }
65  } else {
66  edm::LogError("DetectorStatusFilter")<<"ERROR: DcsStatusCollection not found !";
67  }
68  } else {
69  detectorOn_ = true;
71  if ( verbose_ ) std::cout << "Total MC Events " << nEvents_
72  << " Selected Events " << nSelectedEvents_
73  << " Detector States " << detectorOn_<< std::endl;
74  }
75  return detectorOn_;
76 }
const std::string detectorType_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
bool isRealData() const
Definition: EventBase.h:64
const edm::EDGetTokenT< DcsStatusCollection > dcsStatusLabel_
bool isValid() const
Definition: HandleBase.h:75
tuple cout
Definition: gather_cfg.py:121
struct DcsStatusRaw_v4 dcsStatus
Definition: ScalersRaw.h:227

Member Data Documentation

const edm::EDGetTokenT<DcsStatusCollection> DetectorStateFilter::dcsStatusLabel_
private

Definition at line 20 of file DetectorStateFilter.h.

Referenced by filter().

bool DetectorStateFilter::detectorOn_
private

Definition at line 18 of file DetectorStateFilter.h.

Referenced by DetectorStateFilter(), and filter().

const std::string DetectorStateFilter::detectorType_
private

Definition at line 19 of file DetectorStateFilter.h.

Referenced by filter().

uint64_t DetectorStateFilter::nEvents_
private

Definition at line 17 of file DetectorStateFilter.h.

Referenced by DetectorStateFilter(), and filter().

uint64_t DetectorStateFilter::nSelectedEvents_
private

Definition at line 17 of file DetectorStateFilter.h.

Referenced by DetectorStateFilter(), and filter().

const bool DetectorStateFilter::verbose_
private

Definition at line 16 of file DetectorStateFilter.h.

Referenced by filter().