#include <TriggerSelector.h>
Classes | |
class | TreeElement |
Public Types | |
typedef std::vector< std::string > | Strings |
Public Member Functions | |
bool | acceptEvent (edm::TriggerResults const &) const |
bool | acceptEvent (unsigned char const *, int) const |
bool | returnStatus (edm::HLTGlobalStatus const &trStatus) const |
TriggerSelector (Strings const &pathspecs, Strings const &names) | |
TriggerSelector (edm::ParameterSet const &pset, Strings const &triggernames, bool old_=false) | |
TriggerSelector (std::string const &expression, Strings const &triggernames) | |
bool | wantAll () const |
~TriggerSelector () | |
Static Public Member Functions | |
static std::vector< std::string > | getEventSelectionVString (edm::ParameterSet const &pset) |
static std::string | makeXMLString (std::string const &input) |
Private Member Functions | |
void | init (std::string const &path, Strings const &triggernames) |
Static Private Member Functions | |
static std::string | trim (std::string input) |
Private Attributes | |
bool | acceptAll_ |
boost::shared_ptr < edm::EventSelector > | eventSelector_ |
std::string | expression_ |
boost::shared_ptr< TreeElement > | masterElement_ |
bool | useOld_ |
Static Private Attributes | |
static const bool | debug_ = false |
Event selector allowing for and/not combination of triggers/paths
Definition at line 29 of file TriggerSelector.h.
typedef std::vector<std::string> stor::TriggerSelector::Strings |
Definition at line 33 of file TriggerSelector.h.
Obsolete: Initializes TriggerSelector to use edm::EventSelector for selection.
Definition at line 21 of file TriggerSelector.cc.
: useOld_(true) { acceptAll_=false; eventSelector_.reset( new edm::EventSelector(pathspecs,names)); }
stor::TriggerSelector::TriggerSelector | ( | edm::ParameterSet const & | pset, |
Strings const & | triggernames, | ||
bool | old_ = false |
||
) |
Takes ParameterSet wth TriggerSelector string or EventSelection list, and a list of triggers. if old_ is true, it is forced to use EventSelection.
Definition at line 32 of file TriggerSelector.cc.
References edm::ParameterSet::empty(), edm::ParameterSet::getParameter(), init, and EgammaValidation_cff::paths.
: useOld_(old_) { acceptAll_=false; if (old_) { //old mode forced eventSelector_.reset( new edm::EventSelector(config, triggernames)); return; } if (!config.empty()) { //let's see if non empty TriggerSelector is present try { std::string myPath = trim(config.getParameter<std::string>("TriggerSelector")); if (!myPath.empty()) { init(myPath, triggernames); return; } } catch(...) {} //now try with the SelectEvents try { Strings paths; paths = config.getParameter<Strings>("SelectEvents"); if (!paths.empty()) { useOld_=true; eventSelector_.reset( new edm::EventSelector(config, triggernames)); return; } } catch(...) {} } //if selection parameters aren't present, don't do selection //log acceptAll_=true; }
stor::TriggerSelector::TriggerSelector | ( | std::string const & | expression, |
Strings const & | triggernames | ||
) |
stor::TriggerSelector::~TriggerSelector | ( | ) | [inline] |
Definition at line 53 of file TriggerSelector.h.
{};
bool stor::TriggerSelector::acceptEvent | ( | edm::TriggerResults const & | tr | ) | const |
Evaluates if trigger results pass selection
Definition at line 123 of file TriggerSelector.cc.
References acceptAll_, eventSelector_, masterElement_, and useOld_.
{ if (useOld_) { return eventSelector_->acceptEvent(tr); } if (acceptAll_) return true; return masterElement_->returnStatus(tr); }
bool stor::TriggerSelector::acceptEvent | ( | unsigned char const * | array_of_trigger_results, |
int | number_of_trigger_paths | ||
) | const |
Definition at line 136 of file TriggerSelector.cc.
{ if (useOld_) return eventSelector_->acceptEvent(array_of_trigger_results,number_of_trigger_paths); if (acceptAll_) return true; // Form HLTGlobalStatus object to represent the array_of_trigger_results edm::HLTGlobalStatus tr(number_of_trigger_paths); int byteIndex = 0; int subIndex = 0; for (int pathIndex = 0; pathIndex < number_of_trigger_paths; ++pathIndex) { int state = array_of_trigger_results[byteIndex] >> (subIndex * 2); state &= 0x3; edm::HLTPathStatus pathStatus(static_cast<edm::hlt::HLTState>(state)); tr[pathIndex] = pathStatus; ++subIndex; if (subIndex == 4) { ++byteIndex; subIndex = 0; } } // Now make the decision, based on the HLTGlobalStatus tr, // which we have created from the supplied array of results return masterElement_->returnStatus(tr); }
std::vector< std::string > stor::TriggerSelector::getEventSelectionVString | ( | edm::ParameterSet const & | pset | ) | [static] |
Definition at line 118 of file TriggerSelector.cc.
{ return edm::EventSelector::getEventSelectionVString(pset); }
void stor::TriggerSelector::init | ( | std::string const & | path, |
Strings const & | triggernames | ||
) | [private] |
Definition at line 86 of file TriggerSelector.cc.
References groupFilesInBlocks::temp.
{ //debug_ = true; if (expression.empty()) { acceptAll_ = true; return; } if (expression.size()==1 && expression.at(0)=='*') acceptAll_=true; else acceptAll_=false; //replace all possible alternate operators (.AND. and .OR.) { using namespace boost; std::string temp; temp = regex_replace( expression , regex(".AND."), "&&"); expression_ = regex_replace( temp, regex(".and."), "&&"); temp = regex_replace( expression_, regex(".OR."), "||"); expression_ = regex_replace( temp, regex(".or."), "||"); } //build decision tree masterElement_.reset( new TreeElement(expression_,triggernames)); }
std::string stor::TriggerSelector::makeXMLString | ( | std::string const & | input | ) | [static] |
bool stor::TriggerSelector::returnStatus | ( | edm::HLTGlobalStatus const & | trStatus | ) | const [inline] |
Definition at line 77 of file TriggerSelector.h.
References masterElement_.
{ return masterElement_->returnStatus(trStatus); }
std::string stor::TriggerSelector::trim | ( | std::string | input | ) | [static, private] |
Definition at line 382 of file TriggerSelector.cc.
References LaserDQM_cfg::input, and pos.
bool stor::TriggerSelector::wantAll | ( | ) | const [inline] |
Returns status of always positive bit
Definition at line 58 of file TriggerSelector.h.
References acceptAll_.
{ //if (useOld_) return eventSelector_->wantAll(); return acceptAll_; }
bool stor::TriggerSelector::acceptAll_ [private] |
Definition at line 94 of file TriggerSelector.h.
Referenced by acceptEvent(), and wantAll().
const bool stor::TriggerSelector::debug_ = false [static, private] |
Definition at line 158 of file TriggerSelector.h.
boost::shared_ptr<edm::EventSelector> stor::TriggerSelector::eventSelector_ [private] |
Definition at line 155 of file TriggerSelector.h.
Referenced by acceptEvent().
std::string stor::TriggerSelector::expression_ [private] |
Definition at line 153 of file TriggerSelector.h.
boost::shared_ptr<TreeElement> stor::TriggerSelector::masterElement_ [private] |
Definition at line 150 of file TriggerSelector.h.
Referenced by acceptEvent(), and returnStatus().
bool stor::TriggerSelector::useOld_ [private] |
Definition at line 156 of file TriggerSelector.h.
Referenced by acceptEvent().