#include <EventConsumerSelector.h>
Public Member Functions | |
bool | acceptEvent (const I2OChain &) |
EventConsumerSelector (const EventConsRegPtr registrationInfo) | |
void | initialize (const InitMsgView &) |
bool | isInitialized () const |
bool | operator< (const EventConsumerSelector &other) const |
QueueID const | queueId () const |
~EventConsumerSelector () | |
Private Attributes | |
unsigned long | acceptedEvents_ |
TriggerSelectorPtr | eventSelector_ |
bool | initialized_ |
unsigned int | outputModuleId_ |
const EventConsRegPtr | registrationInfo_ |
Defines the common interface for event and DQM consumer registration info objects.
Definition at line 25 of file EventConsumerSelector.h.
stor::EventConsumerSelector::EventConsumerSelector | ( | const EventConsRegPtr | registrationInfo | ) | [inline] |
Constructs an EventConsumerSelector instance based on the specified registration information.
Definition at line 34 of file EventConsumerSelector.h.
: initialized_( false ), outputModuleId_( 0 ), registrationInfo_( registrationInfo ), acceptedEvents_( 0 ) {}
stor::EventConsumerSelector::~EventConsumerSelector | ( | ) | [inline] |
Destructs the EventConsumerSelector instance.
Definition at line 44 of file EventConsumerSelector.h.
{}
bool EventConsumerSelector::acceptEvent | ( | const I2OChain & | ioc | ) |
Tests whether the specified event is accepted by this selector - returns true if the event is accepted, false otherwise.
Definition at line 67 of file EventConsumerSelector.cc.
References acceptedEvents_, eventSelector_, stor::I2OChain::hltTriggerBits(), stor::I2OChain::hltTriggerCount(), initialized_, stor::I2OChain::outputModuleId(), outputModuleId_, and registrationInfo_.
{ if( !initialized_ ) return false; if( ioc.outputModuleId() != outputModuleId_ ) return false; std::vector<unsigned char> hlt_out; ioc.hltTriggerBits( hlt_out ); if ( eventSelector_->wantAll() || eventSelector_->acceptEvent( &hlt_out[0], ioc.hltTriggerCount() ) ) { if ( (++acceptedEvents_ % registrationInfo_->prescale()) == 0 ) return true; } return false; }
void EventConsumerSelector::initialize | ( | const InitMsgView & | imv | ) |
Initializes the selector instance from the specified INIT message. EventConsumerSelector instances need to be initialized before they will accept any events.
Definition at line 15 of file EventConsumerSelector.cc.
References acceptedEvents_, edm::ParameterSet::addParameter(), alignCSCRings::e, eventSelector_, exception, InitMsgView::hltTriggerNames(), initialized_, InitMsgView::outputModuleId(), outputModuleId_, InitMsgView::outputModuleLabel(), registrationInfo_, and cms::Exception::what().
Referenced by stor::EventDistributor::tagCompleteEventForQueues().
{ if( initialized_ ) return; if( registrationInfo_->outputModuleLabel() != imv.outputModuleLabel() ) return; outputModuleId_ = imv.outputModuleId(); edm::ParameterSet pset; pset.addParameter<std::string>( "TriggerSelector", registrationInfo_->triggerSelection() ); pset.addParameter<Strings>( "SelectEvents", registrationInfo_->eventSelection() ); Strings tnames; imv.hltTriggerNames( tnames ); std::ostringstream errorMsg; errorMsg << "Cannot initialize edm::EventSelector for consumer" << registrationInfo_->consumerName() << " running on " << registrationInfo_->remoteHost() << " requesting output module ID" << outputModuleId_ << " with label " << registrationInfo_->outputModuleLabel() << " and HLT trigger names"; boost::lambda::placeholder1_type arg1; std::for_each(tnames.begin(), tnames.end(), errorMsg << boost::lambda::constant(" ") << arg1); try { eventSelector_.reset( new TriggerSelector( pset, tnames ) ); } catch ( edm::Exception& e ) { errorMsg << e.what(); XCEPT_RAISE(stor::exception::InvalidEventSelection, errorMsg.str()); } catch( std::exception &e ) { errorMsg << e.what(); XCEPT_RAISE(stor::exception::InvalidEventSelection, errorMsg.str()); } catch(...) { errorMsg << "Unknown exception"; XCEPT_RAISE(stor::exception::InvalidEventSelection, errorMsg.str()); } acceptedEvents_ = 0; initialized_ = true; }
bool stor::EventConsumerSelector::isInitialized | ( | ) | const [inline] |
Tests whether this selector has been initialized.
Definition at line 67 of file EventConsumerSelector.h.
References initialized_.
{ return initialized_; }
bool EventConsumerSelector::operator< | ( | const EventConsumerSelector & | other | ) | const |
Comparison:
Definition at line 85 of file EventConsumerSelector.cc.
References queueId(), and registrationInfo_.
{ if ( queueId() != other.queueId() ) return ( queueId() < other.queueId() ); return ( *(registrationInfo_) < *(other.registrationInfo_) ); }
QueueID const stor::EventConsumerSelector::queueId | ( | ) | const [inline] |
Returns the ID of the queue corresponding to this selector.
Definition at line 62 of file EventConsumerSelector.h.
References registrationInfo_.
Referenced by operator<().
{ return registrationInfo_->queueId(); }
unsigned long stor::EventConsumerSelector::acceptedEvents_ [private] |
Definition at line 80 of file EventConsumerSelector.h.
Referenced by acceptEvent(), and initialize().
Definition at line 79 of file EventConsumerSelector.h.
Referenced by acceptEvent(), and initialize().
bool stor::EventConsumerSelector::initialized_ [private] |
Definition at line 76 of file EventConsumerSelector.h.
Referenced by acceptEvent(), initialize(), and isInitialized().
unsigned int stor::EventConsumerSelector::outputModuleId_ [private] |
Definition at line 77 of file EventConsumerSelector.h.
Referenced by acceptEvent(), and initialize().
const EventConsRegPtr stor::EventConsumerSelector::registrationInfo_ [private] |
Definition at line 78 of file EventConsumerSelector.h.
Referenced by acceptEvent(), initialize(), operator<(), and queueId().