#include <EventStreamSelector.h>
Public Member Functions | |
bool | acceptEvent (const I2OChain &) |
const EventStreamConfigurationInfo & | configInfo () const |
EventStreamSelector (const EventStreamConfigurationInfo &) | |
void | initialize (const InitMsgView &) |
bool | isInitialized () const |
bool | operator< (const EventStreamSelector &other) const |
unsigned int | outputModuleId () const |
~EventStreamSelector () | |
Private Attributes | |
const EventStreamConfigurationInfo | configInfo_ |
TriggerSelectorPtr | eventSelector_ |
bool | initialized_ |
unsigned int | outputModuleId_ |
Accepts or rejects an event based on the EventStreamConfigurationInfo
Definition at line 25 of file EventStreamSelector.h.
stor::EventStreamSelector::EventStreamSelector | ( | const EventStreamConfigurationInfo & | configInfo | ) |
Definition at line 18 of file EventStreamSelector.cc.
References cond::rpcobgas::time.
: initialized_( false ), outputModuleId_(0), configInfo_( configInfo ) { srand( time(0) ); }
stor::EventStreamSelector::~EventStreamSelector | ( | ) | [inline] |
Definition at line 34 of file EventStreamSelector.h.
{}
bool stor::EventStreamSelector::acceptEvent | ( | const I2OChain & | ioc | ) |
Definition at line 77 of file EventStreamSelector.cc.
References configInfo_, eventSelector_, stor::EventStreamConfigurationInfo::fractionToDisk(), stor::I2OChain::hltTriggerBits(), stor::I2OChain::hltTriggerCount(), initialized_, stor::I2OChain::outputModuleId(), and outputModuleId_.
{ if( !initialized_ ) return false; if ( configInfo_.fractionToDisk() == 0 ) return false; if( ioc.outputModuleId() != outputModuleId_ ) return false; std::vector<unsigned char> hlt_out; ioc.hltTriggerBits( hlt_out ); if ( ! eventSelector_->acceptEvent( &hlt_out[0], ioc.hltTriggerCount() ) ) return false; if ( configInfo_.fractionToDisk() < 1 ) { double rand = static_cast<double>(std::rand())/static_cast<double>(RAND_MAX); if ( rand > configInfo_.fractionToDisk() ) return false; } return true; }
const EventStreamConfigurationInfo& stor::EventStreamSelector::configInfo | ( | ) | const [inline] |
Definition at line 44 of file EventStreamSelector.h.
References configInfo_.
Referenced by operator<().
{ return configInfo_; }
void stor::EventStreamSelector::initialize | ( | const InitMsgView & | imv | ) |
Definition at line 27 of file EventStreamSelector.cc.
References edm::ParameterSet::addParameter(), configInfo_, alignCSCRings::e, stor::EventStreamConfigurationInfo::eventSelection(), eventSelector_, exception, InitMsgView::hltTriggerNames(), initialized_, InitMsgView::outputModuleId(), outputModuleId_, InitMsgView::outputModuleLabel(), stor::EventStreamConfigurationInfo::outputModuleLabel(), stor::EventStreamConfigurationInfo::streamLabel(), stor::EventStreamConfigurationInfo::triggerSelection(), and cms::Exception::what().
Referenced by stor::EventDistributor::tagCompleteEventForQueues().
{ if( initialized_ ) return; if( configInfo_.outputModuleLabel() != imv.outputModuleLabel() ) return; outputModuleId_ = imv.outputModuleId(); edm::ParameterSet pset; pset.addParameter<std::string>( "TriggerSelector", configInfo_.triggerSelection() ); pset.addParameter<Strings>( "SelectEvents", configInfo_.eventSelection() ); Strings tnames; imv.hltTriggerNames( tnames ); std::ostringstream errorMsg; errorMsg << "Cannot initialize edm::EventSelector for stream " << configInfo_.streamLabel() << " requesting output module ID" << outputModuleId_ << " with label " << configInfo_.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()); } initialized_ = true; }
bool stor::EventStreamSelector::isInitialized | ( | ) | const [inline] |
Definition at line 45 of file EventStreamSelector.h.
References initialized_.
{ return initialized_; }
bool stor::EventStreamSelector::operator< | ( | const EventStreamSelector & | other | ) | const [inline] |
Definition at line 48 of file EventStreamSelector.h.
References configInfo(), and configInfo_.
{ return ( configInfo_ < other.configInfo() ); }
unsigned int stor::EventStreamSelector::outputModuleId | ( | ) | const [inline] |
Definition at line 43 of file EventStreamSelector.h.
References outputModuleId_.
{ return outputModuleId_; }
const EventStreamConfigurationInfo stor::EventStreamSelector::configInfo_ [private] |
Definition at line 55 of file EventStreamSelector.h.
Referenced by acceptEvent(), configInfo(), initialize(), and operator<().
Definition at line 57 of file EventStreamSelector.h.
Referenced by acceptEvent(), and initialize().
bool stor::EventStreamSelector::initialized_ [private] |
Definition at line 53 of file EventStreamSelector.h.
Referenced by acceptEvent(), initialize(), and isInitialized().
unsigned int stor::EventStreamSelector::outputModuleId_ [private] |
Definition at line 54 of file EventStreamSelector.h.
Referenced by acceptEvent(), initialize(), and outputModuleId().