test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerBitChecker.cc
Go to the documentation of this file.
2 
4 
5 namespace heppy {
6 
7 TriggerBitChecker::TriggerBitChecker(const std::string &path) : paths_(1,returnPathStruct(path)) { rmstar(); }
8 
9 TriggerBitChecker::TriggerBitChecker(const std::vector<std::string> &paths) : paths_(paths.size()) {
10  for(size_t i = 0; i < paths.size(); ++ i) paths_[i] = returnPathStruct(paths[i]);
11  rmstar();
12 }
13 
15  pathStruct newPathStruct(path);
16  if( path[0] > 48 /*'0'*/ && path[0] <= 57 /*'9'*/ ) {
17  newPathStruct.first = atoi(path.substr(0,path.find('-')).c_str());
18  newPathStruct.last = atoi(path.substr(path.find('-')+1,path.find(':')-path.find('-')-1).c_str());
19  newPathStruct.pathName = path.substr(path.find(':')+1);
20  }
21  return newPathStruct;
22 }
23 
25  if (result.parameterSetID() != lastID_) { syncIndices(event, result); lastID_ = result.parameterSetID(); }
26  for (std::vector<unsigned int>::const_iterator it = indices_.begin(), ed = indices_.end(); it != ed; ++it) {
27  if (result.accept(*it)) return true;
28  }
29  return false;
30 }
31 
33  if (result_tr.parameterSetID() != lastID_) { syncIndices(event, result_tr); lastID_ = result_tr.parameterSetID(); }
34  bool outcome = true;
35  for (std::vector<unsigned int>::const_iterator it = indices_.begin(), ed = indices_.end(); it != ed; ++it) {
36  if (result.getPrescaleForIndex(*it)!=1) {outcome = false; break;}
37  }
38  return outcome; // true only if all paths are unprescaled
39 }
40 
42  indices_.clear();
43  const edm::TriggerNames &names = event.triggerNames(result);
44  std::vector<pathStruct>::const_iterator itp, bgp = paths_.begin(), edp = paths_.end();
45  for (size_t i = 0, n = names.size(); i < n; ++i) {
46  const std::string &thispath = names.triggerName(i);
47  for (itp = bgp; itp != edp; ++itp) {
48  if (thispath.find(itp->pathName) == 0 && event.id().run() >= itp->first && event.id().run() <= itp->last) indices_.push_back(i);
49  }
50  }
51 }
52 
54  std::vector<pathStruct>::iterator itp, bgp = paths_.begin(), edp = paths_.end();
55  for (itp = bgp; itp != edp; ++itp) {
56  std::string::size_type idx = itp->pathName.find("*");
57  if (idx != std::string::npos) itp->pathName.erase(idx);
58  }
59 }
60 }
void rmstar()
executes a &#39;rm -rf *&#39; in current directory
int i
Definition: DBlmapReader.cc:9
bool check_unprescaled(const edm::EventBase &event, const edm::TriggerResults &result_tr, const pat::PackedTriggerPrescales &result) const
static const HistoName names[]
bool check(const edm::EventBase &event, const edm::TriggerResults &result) const
bool accept() const
Has at least one path accepted the event?
Strings::size_type size() const
Definition: TriggerNames.cc:39
uint16_t size_type
tuple result
Definition: query.py:137
std::vector< pathStruct > paths_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
TriggerBitChecker(const std::string &path="DUMMY")
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::vector< unsigned int > indices_
int getPrescaleForIndex(int index) const
edm::ParameterSetID lastID_
const ParameterSetID & parameterSetID() const
Get stored parameter set id.
tuple size
Write out results.
pathStruct returnPathStruct(const std::string &path) const
void syncIndices(const edm::EventBase &event, const edm::TriggerResults &result) const
sync indices with path names