CMS 3D CMS Logo

TriggerEvent.cc
Go to the documentation of this file.
1 //
2 //
3 
5 
6 using namespace pat;
7 
8 // Constructors and Destructor
9 
10 // Default constructor
12  : nameL1Menu_(),
13  nameHltTable_(),
14  run_(),
15  accept_(),
16  error_(),
17  physDecl_(),
18  lhcFill_(),
19  beamMode_(),
20  beamMomentum_(),
21  intensityBeam1_(),
22  intensityBeam2_(),
23  bstMasterStatus_(),
24  turnCount_(),
25  bCurrentStart_(),
26  bCurrentStop_(),
27  bCurrentAvg_() {
28  objectMatchResults_.clear();
29 }
30 
31 // Constructor from values, HLT only
32 TriggerEvent::TriggerEvent(const std::string& nameHltTable, bool run, bool accept, bool error, bool physDecl)
33  : nameL1Menu_(),
34  nameHltTable_(nameHltTable),
35  run_(run),
36  accept_(accept),
37  error_(error),
38  physDecl_(physDecl),
39  lhcFill_(),
40  beamMode_(),
41  beamMomentum_(),
42  intensityBeam1_(),
43  intensityBeam2_(),
44  bstMasterStatus_(),
45  turnCount_(),
46  bCurrentStart_(),
47  bCurrentStop_(),
48  bCurrentAvg_() {
49  objectMatchResults_.clear();
50 }
51 
52 // Constructor from values, HLT and L1/GT
54  const std::string& nameL1Menu, const std::string& nameHltTable, bool run, bool accept, bool error, bool physDecl)
55  : nameL1Menu_(nameL1Menu),
56  nameHltTable_(nameHltTable),
57  run_(run),
58  accept_(accept),
59  error_(error),
60  physDecl_(physDecl),
61  lhcFill_(),
62  beamMode_(),
63  beamMomentum_(),
64  intensityBeam1_(),
65  intensityBeam2_(),
66  bstMasterStatus_(),
67  turnCount_(),
68  bCurrentStart_(),
69  bCurrentStop_(),
70  bCurrentAvg_() {
71  objectMatchResults_.clear();
72 }
73 
74 // Methods
75 
76 // Get a vector of references to all L1 algorithms
78  TriggerAlgorithmRefVector theAlgorithms;
79  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
80  ++iAlgorithm) {
81  const std::string nameAlgorithm(iAlgorithm->name());
83  theAlgorithms.push_back(algorithmRef);
84  }
85  return theAlgorithms;
86 }
87 
88 // Get a pointer to a certain L1 algorithm by name
89 const TriggerAlgorithm* TriggerEvent::algorithm(const std::string& nameAlgorithm) const {
90  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
91  ++iAlgorithm) {
92  if (nameAlgorithm == iAlgorithm->name())
93  return &*iAlgorithm;
94  }
95  return nullptr;
96 }
97 
98 // Get a reference to a certain L1 algorithm by name
99 const TriggerAlgorithmRef TriggerEvent::algorithmRef(const std::string& nameAlgorithm) const {
100  for (TriggerAlgorithmRefVector::const_iterator iAlgorithm = algorithmRefs().begin();
101  iAlgorithm != algorithmRefs().end();
102  ++iAlgorithm) {
103  if (nameAlgorithm == (*iAlgorithm)->name())
104  return *iAlgorithm;
105  }
106  return TriggerAlgorithmRef();
107 }
108 
109 // Get the name of a certain L1 algorithm in the event collection by bit number physics or technical algorithms,
110 std::string TriggerEvent::nameAlgorithm(const unsigned bitAlgorithm, const bool techAlgorithm) const {
111  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
112  ++iAlgorithm) {
113  if (bitAlgorithm == iAlgorithm->bit() && techAlgorithm == iAlgorithm->techTrigger())
114  return iAlgorithm->name();
115  }
116  return std::string("");
117 }
118 
119 // Get the index of a certain L1 algorithm in the event collection by name
120 unsigned TriggerEvent::indexAlgorithm(const std::string& nameAlgorithm) const {
121  unsigned iAlgorithm(0);
122  while (iAlgorithm < algorithms()->size() && algorithms()->at(iAlgorithm).name() != nameAlgorithm)
123  ++iAlgorithm;
124  return iAlgorithm;
125 }
126 
127 // Get a vector of references to all succeeding L1 algorithms
129  TriggerAlgorithmRefVector theAcceptedAlgorithms;
130  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
131  ++iAlgorithm) {
132  if (iAlgorithm->decision()) {
133  const std::string nameAlgorithm(iAlgorithm->name());
135  theAcceptedAlgorithms.push_back(algorithmRef);
136  }
137  }
138  return theAcceptedAlgorithms;
139 }
140 
141 // Get a vector of references to all L1 algorithms succeeding on the GTL board
143  TriggerAlgorithmRefVector theAcceptedAlgorithms;
144  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
145  ++iAlgorithm) {
146  if (iAlgorithm->gtlResult()) {
147  const std::string nameAlgorithm(iAlgorithm->name());
149  theAcceptedAlgorithms.push_back(algorithmRef);
150  }
151  }
152  return theAcceptedAlgorithms;
153 }
154 
155 // Get a vector of references to all technical L1 algorithms
157  TriggerAlgorithmRefVector theTechAlgorithms;
158  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
159  ++iAlgorithm) {
160  if (iAlgorithm->techTrigger()) {
161  const std::string nameAlgorithm(iAlgorithm->name());
163  theTechAlgorithms.push_back(algorithmRef);
164  }
165  }
166  return theTechAlgorithms;
167 }
168 
169 // Get a vector of references to all succeeding technical L1 algorithms
171  TriggerAlgorithmRefVector theAcceptedTechAlgorithms;
172  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
173  ++iAlgorithm) {
174  if (iAlgorithm->techTrigger() && iAlgorithm->decision()) {
175  const std::string nameAlgorithm(iAlgorithm->name());
177  theAcceptedTechAlgorithms.push_back(algorithmRef);
178  }
179  }
180  return theAcceptedTechAlgorithms;
181 }
182 
183 // Get a vector of references to all technical L1 algorithms succeeding on the GTL board
185  TriggerAlgorithmRefVector theAcceptedTechAlgorithms;
186  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
187  ++iAlgorithm) {
188  if (iAlgorithm->techTrigger() && iAlgorithm->gtlResult()) {
189  const std::string nameAlgorithm(iAlgorithm->name());
191  theAcceptedTechAlgorithms.push_back(algorithmRef);
192  }
193  }
194  return theAcceptedTechAlgorithms;
195 }
196 
197 // Get a vector of references to all physics L1 algorithms
199  TriggerAlgorithmRefVector thePhysAlgorithms;
200  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
201  ++iAlgorithm) {
202  if (!iAlgorithm->techTrigger()) {
203  const std::string nameAlgorithm(iAlgorithm->name());
205  thePhysAlgorithms.push_back(algorithmRef);
206  }
207  }
208  return thePhysAlgorithms;
209 }
210 
211 // Get a vector of references to all succeeding physics L1 algorithms
213  TriggerAlgorithmRefVector theAcceptedPhysAlgorithms;
214  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
215  ++iAlgorithm) {
216  if (!iAlgorithm->techTrigger() && iAlgorithm->decision()) {
217  const std::string nameAlgorithm(iAlgorithm->name());
219  theAcceptedPhysAlgorithms.push_back(algorithmRef);
220  }
221  }
222  return theAcceptedPhysAlgorithms;
223 }
224 
225 // Get a vector of references to all physics L1 algorithms succeeding on the GTL board
227  TriggerAlgorithmRefVector theAcceptedPhysAlgorithms;
228  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
229  ++iAlgorithm) {
230  if (!iAlgorithm->techTrigger() && iAlgorithm->gtlResult()) {
231  const std::string nameAlgorithm(iAlgorithm->name());
233  theAcceptedPhysAlgorithms.push_back(algorithmRef);
234  }
235  }
236  return theAcceptedPhysAlgorithms;
237 }
238 
239 // Get a vector of references to all L1 conditions
241  TriggerConditionRefVector theConditions;
242  for (TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end();
243  ++iCondition) {
244  const std::string nameCondition(iCondition->name());
246  theConditions.push_back(conditionRef);
247  }
248  return theConditions;
249 }
250 
251 // Get a pointer to a certain L1 condition by name
252 const TriggerCondition* TriggerEvent::condition(const std::string& nameCondition) const {
253  for (TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end();
254  ++iCondition) {
255  if (nameCondition == iCondition->name())
256  return &*iCondition;
257  }
258  return nullptr;
259 }
260 
261 // Get a reference to a certain L1 condition by name
262 const TriggerConditionRef TriggerEvent::conditionRef(const std::string& nameCondition) const {
263  for (TriggerConditionRefVector::const_iterator iCondition = conditionRefs().begin();
264  iCondition != conditionRefs().end();
265  ++iCondition) {
266  if (nameCondition == (*iCondition)->name())
267  return *iCondition;
268  }
269  return TriggerConditionRef();
270 }
271 
272 // Get the index of a certain L1 condition in the event collection by name
273 unsigned TriggerEvent::indexCondition(const std::string& nameCondition) const {
274  unsigned iCondition(0);
275  while (iCondition < conditions()->size() && conditions()->at(iCondition).name() != nameCondition)
276  ++iCondition;
277  return iCondition;
278 }
279 
280 // Get a vector of references to all succeeding L1 conditions
282  TriggerConditionRefVector theAcceptedConditions;
283  for (TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end();
284  ++iCondition) {
285  if (iCondition->wasAccept()) {
286  const std::string nameCondition(iCondition->name());
288  theAcceptedConditions.push_back(conditionRef);
289  }
290  }
291  return theAcceptedConditions;
292 }
293 
294 // Get a vector of references to all HLT paths
296  TriggerPathRefVector thePaths;
297  for (TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath) {
298  const std::string namePath(iPath->name());
299  const TriggerPathRef pathRef(paths_, indexPath(namePath));
300  thePaths.push_back(pathRef);
301  }
302  return thePaths;
303 }
304 
305 // Get a pointer to a certain HLT path by name
306 const TriggerPath* TriggerEvent::path(const std::string& namePath) const {
307  for (TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath) {
308  if (namePath == iPath->name())
309  return &*iPath;
310  }
311  return nullptr;
312 }
313 
314 // Get a reference to a certain HLT path by name
315 const TriggerPathRef TriggerEvent::pathRef(const std::string& namePath) const {
316  for (TriggerPathRefVector::const_iterator iPath = pathRefs().begin(); iPath != pathRefs().end(); ++iPath) {
317  if (namePath == (*iPath)->name())
318  return *iPath;
319  }
320  return TriggerPathRef();
321 }
322 
323 // Get the index of a certain HLT path in the event collection by name
324 unsigned TriggerEvent::indexPath(const std::string& namePath) const {
325  unsigned iPath(0);
326  while (iPath < paths()->size() && paths()->at(iPath).name() != namePath)
327  ++iPath;
328  return iPath;
329 }
330 
331 // Get a vector of references to all succeeding HLT paths
333  TriggerPathRefVector theAcceptedPaths;
334  for (TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath) {
335  if (iPath->wasAccept()) {
336  const std::string namePath(iPath->name());
337  const TriggerPathRef pathRef(paths_, indexPath(namePath));
338  theAcceptedPaths.push_back(pathRef);
339  }
340  }
341  return theAcceptedPaths;
342 }
343 
344 // Get a vector of references to all HLT filters
346  TriggerFilterRefVector theFilters;
347  for (TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter) {
348  const std::string labelFilter(iFilter->label());
349  const TriggerFilterRef filterRef(filters_, indexFilter(labelFilter));
350  theFilters.push_back(filterRef);
351  }
352  return theFilters;
353 }
354 
355 // Get a pointer to a certain HLT filter by label
356 const TriggerFilter* TriggerEvent::filter(const std::string& labelFilter) const {
357  for (TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter) {
358  if (labelFilter == iFilter->label())
359  return &*iFilter;
360  }
361  return nullptr;
362 }
363 
364 // Get a reference to a certain HLT filter by label
365 const TriggerFilterRef TriggerEvent::filterRef(const std::string& labelFilter) const {
366  for (TriggerFilterRefVector::const_iterator iFilter = filterRefs().begin(); iFilter != filterRefs().end();
367  ++iFilter) {
368  if (labelFilter == (*iFilter)->label())
369  return *iFilter;
370  }
371  return TriggerFilterRef();
372 }
373 
374 // Get the index of a certain HLT filter in the event collection by label
375 unsigned TriggerEvent::indexFilter(const std::string& labelFilter) const {
376  unsigned iFilter(0);
377  while (iFilter < filters()->size() && filters()->at(iFilter).label() != labelFilter)
378  ++iFilter;
379  return iFilter;
380 }
381 
382 // Get a vector of references to all succeeding HLT filters
384  TriggerFilterRefVector theAcceptedFilters;
385  for (TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter) {
386  if (iFilter->status() == 1) {
387  const std::string labelFilter(iFilter->label());
388  const TriggerFilterRef filterRef(filters_, indexFilter(labelFilter));
389  theAcceptedFilters.push_back(filterRef);
390  }
391  }
392  return theAcceptedFilters;
393 }
394 
395 // Get a vector of references to all trigger objects
397  TriggerObjectRefVector theObjects;
398  for (unsigned iObject = 0; iObject < objects()->size(); ++iObject) {
399  const TriggerObjectRef objectRef(objects_, iObject);
400  theObjects.push_back(objectRef);
401  }
402  return theObjects;
403 }
404 
405 // Get a vector of references to all trigger objects by trigger object type
407  TriggerObjectRefVector theObjects;
408  for (unsigned iObject = 0; iObject < objects()->size(); ++iObject) {
409  if (objects()->at(iObject).hasTriggerObjectType(triggerObjectType)) {
410  const TriggerObjectRef objectRef(objects_, iObject);
411  theObjects.push_back(objectRef);
412  }
413  }
414  return theObjects;
415 }
416 
417 // Get a vector of references to all conditions assigned to a certain algorithm given by name
419  TriggerConditionRefVector theAlgorithmConditions;
420  if (const TriggerAlgorithm* algorithmPtr = algorithm(nameAlgorithm)) {
421  for (unsigned iC = 0; iC < algorithmPtr->conditionKeys().size(); ++iC) {
422  const TriggerConditionRef conditionRef(conditions_, algorithmPtr->conditionKeys().at(iC));
423  theAlgorithmConditions.push_back(conditionRef);
424  }
425  }
426  return theAlgorithmConditions;
427 }
428 
429 // Checks, if a condition is assigned to a certain algorithm given by name
431  const std::string& nameAlgorithm) const {
433  for (TriggerConditionRefVectorIterator iCondition = theConditions.begin(); iCondition != theConditions.end();
434  ++iCondition) {
435  if (conditionRef == *iCondition)
436  return true;
437  }
438  return false;
439 }
440 
441 // Get a vector of references to all algorithms, which have a certain condition assigned
443  TriggerAlgorithmRefVector theConditionAlgorithms;
444  size_t cAlgorithms(0);
445  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
446  ++iAlgorithm) {
447  const std::string nameAlgorithm(iAlgorithm->name());
449  const TriggerAlgorithmRef algorithmRef(algorithms_, cAlgorithms);
450  theConditionAlgorithms.push_back(algorithmRef);
451  }
452  ++cAlgorithms;
453  }
454  return theConditionAlgorithms;
455 }
456 
457 // Get a list of all trigger object collections used in a certain condition given by name
458 std::vector<std::string> TriggerEvent::conditionCollections(const std::string& nameCondition) const {
459  std::vector<std::string> theConditionCollections;
460  if (const TriggerCondition* conditionPtr = condition(nameCondition)) {
461  for (unsigned iObject = 0; iObject < objects()->size(); ++iObject) {
462  if (conditionPtr->hasObjectKey(iObject)) {
463  bool found(false);
464  std::string objectCollection(objects()->at(iObject).collection());
465  for (std::vector<std::string>::const_iterator iC = theConditionCollections.begin();
466  iC != theConditionCollections.end();
467  ++iC) {
468  if (*iC == objectCollection) {
469  found = true;
470  break;
471  }
472  }
473  if (!found) {
474  theConditionCollections.push_back(objectCollection);
475  }
476  }
477  }
478  }
479  return theConditionCollections;
480 }
481 
482 // Get a vector of references to all objects, which were used in a certain condition given by name
484  TriggerObjectRefVector theConditionObjects;
485  if (const TriggerCondition* conditionPtr = condition(nameCondition)) {
486  for (unsigned iObject = 0; iObject < objects()->size(); ++iObject) {
487  if (conditionPtr->hasObjectKey(iObject)) {
488  const TriggerObjectRef objectRef(objects_, iObject);
489  theConditionObjects.push_back(objectRef);
490  }
491  }
492  }
493  return theConditionObjects;
494 }
495 
496 // Checks, if an object was used in a certain condition given by name
497 bool TriggerEvent::objectInCondition(const TriggerObjectRef& objectRef, const std::string& nameCondition) const {
498  if (const TriggerCondition* conditionPtr = condition(nameCondition))
499  return conditionPtr->hasObjectKey(objectRef.key());
500  return false;
501 }
502 
503 // Get a vector of references to all conditions, which have a certain object assigned
505  TriggerConditionRefVector theObjectConditions;
506  for (TriggerConditionCollection::const_iterator iCondition = conditions()->begin(); iCondition != conditions()->end();
507  ++iCondition) {
508  const std::string nameCondition(iCondition->name());
509  if (objectInCondition(objectRef, nameCondition)) {
511  theObjectConditions.push_back(conditionRef);
512  }
513  }
514  return theObjectConditions;
515 }
516 
517 // Get a vector of references to all objects, which were used in a certain algorithm given by name
519  TriggerObjectRefVector theAlgorithmObjects;
521  for (TriggerConditionRefVectorIterator iCondition = theConditions.begin(); iCondition != theConditions.end();
522  ++iCondition) {
523  const std::string nameCondition((*iCondition)->name());
524  TriggerObjectRefVector theObjects = conditionObjects(nameCondition);
525  for (TriggerObjectRefVectorIterator iObject = theObjects.begin(); iObject != theObjects.end(); ++iObject) {
526  theAlgorithmObjects.push_back(*iObject);
527  }
528  }
529  return theAlgorithmObjects;
530 }
531 
532 // Checks, if an object was used in a certain algorithm given by name
533 bool TriggerEvent::objectInAlgorithm(const TriggerObjectRef& objectRef, const std::string& nameAlgorithm) const {
535  for (TriggerConditionRefVectorIterator iCondition = theConditions.begin(); iCondition != theConditions.end();
536  ++iCondition) {
537  if (objectInCondition(objectRef, (*iCondition)->name()))
538  return true;
539  }
540  return false;
541 }
542 
543 // Get a vector of references to all algorithms, which have a certain object assigned
545  TriggerAlgorithmRefVector theObjectAlgorithms;
546  for (TriggerAlgorithmCollection::const_iterator iAlgorithm = algorithms()->begin(); iAlgorithm != algorithms()->end();
547  ++iAlgorithm) {
548  const std::string nameAlgorithm(iAlgorithm->name());
549  if (objectInAlgorithm(objectRef, nameAlgorithm)) {
551  theObjectAlgorithms.push_back(algorithmRef);
552  }
553  }
554  return theObjectAlgorithms;
555 }
556 
557 // Get a vector of references to all modules assigned to a certain path given by name
559  TriggerFilterRefVector thePathFilters;
560  if (const TriggerPath* pathPtr = path(namePath)) {
561  if (!pathPtr->modules().empty()) {
562  const unsigned onePastLastFilter = all ? pathPtr->modules().size() : pathPtr->lastActiveFilterSlot() + 1;
563  for (unsigned iM = 0; iM < onePastLastFilter; ++iM) {
564  const std::string labelFilter(pathPtr->modules().at(iM));
565  const TriggerFilterRef filterRef(filters_, indexFilter(labelFilter));
566  thePathFilters.push_back(filterRef);
567  }
568  }
569  }
570  return thePathFilters;
571 }
572 
573 // Get a vector of references to all active HLT filters assigned to a certain path given by name
574 TriggerFilterRefVector TriggerEvent::pathFilters(const std::string& namePath, bool firing) const {
575  TriggerFilterRefVector thePathFilters;
576  if (const TriggerPath* pathPtr = path(namePath)) {
577  for (unsigned iF = 0; iF < pathPtr->filterIndices().size(); ++iF) {
578  const TriggerFilterRef filterRef(filters_, pathPtr->filterIndices().at(iF));
579  if ((!firing) || filterRef->isFiring())
580  thePathFilters.push_back(filterRef);
581  }
582  }
583  return thePathFilters;
584 }
585 
586 // Checks, if a filter is assigned to and was run in a certain path given by name
587 bool TriggerEvent::filterInPath(const TriggerFilterRef& filterRef, const std::string& namePath, bool firing) const {
588  TriggerFilterRefVector theFilters = pathFilters(namePath, firing);
589  for (TriggerFilterRefVectorIterator iFilter = theFilters.begin(); iFilter != theFilters.end(); ++iFilter) {
590  if (filterRef == *iFilter)
591  return true;
592  }
593  return false;
594 }
595 
596 // Get a vector of references to all paths, which have a certain filter assigned
598  TriggerPathRefVector theFilterPaths;
599  size_t cPaths(0);
600  for (TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath) {
601  const std::string namePath(iPath->name());
602  if (filterInPath(filterRef, namePath, firing)) {
603  const TriggerPathRef pathRef(paths_, cPaths);
604  theFilterPaths.push_back(pathRef);
605  }
606  ++cPaths;
607  }
608  return theFilterPaths;
609 }
610 
611 // Get a list of all trigger object collections used in a certain filter given by name
612 std::vector<std::string> TriggerEvent::filterCollections(const std::string& labelFilter) const {
613  std::vector<std::string> theFilterCollections;
614  if (const TriggerFilter* filterPtr = filter(labelFilter)) {
615  for (unsigned iObject = 0; iObject < objects()->size(); ++iObject) {
616  if (filterPtr->hasObjectKey(iObject)) {
617  bool found(false);
618  const std::string objectCollection(objects()->at(iObject).collection());
619  for (std::vector<std::string>::const_iterator iC = theFilterCollections.begin();
620  iC != theFilterCollections.end();
621  ++iC) {
622  if (*iC == objectCollection) {
623  found = true;
624  break;
625  }
626  }
627  if (!found) {
628  theFilterCollections.push_back(objectCollection);
629  }
630  }
631  }
632  }
633  return theFilterCollections;
634 }
635 
636 // Get a vector of references to all objects, which were used in a certain filter given by name
638  TriggerObjectRefVector theFilterObjects;
639  if (const TriggerFilter* filterPtr = filter(labelFilter)) {
640  for (unsigned iObject = 0; iObject < objects()->size(); ++iObject) {
641  if (filterPtr->hasObjectKey(iObject)) {
642  const TriggerObjectRef objectRef(objects_, iObject);
643  theFilterObjects.push_back(objectRef);
644  }
645  }
646  }
647  return theFilterObjects;
648 }
649 
650 // Checks, if an object was used in a certain filter given by name
651 bool TriggerEvent::objectInFilter(const TriggerObjectRef& objectRef, const std::string& labelFilter) const {
652  if (const TriggerFilter* filterPtr = filter(labelFilter))
653  return filterPtr->hasObjectKey(objectRef.key());
654  return false;
655 }
656 
657 // Get a vector of references to all filters, which have a certain object assigned
659  TriggerFilterRefVector theObjectFilters;
660  for (TriggerFilterCollection::const_iterator iFilter = filters()->begin(); iFilter != filters()->end(); ++iFilter) {
661  const std::string labelFilter(iFilter->label());
662  if (objectInFilter(objectRef, labelFilter)) {
663  const TriggerFilterRef filterRef(filters_, indexFilter(labelFilter));
664  if ((!firing) || iFilter->isFiring())
665  theObjectFilters.push_back(filterRef);
666  }
667  }
668  return theObjectFilters;
669 }
670 
671 // Get a vector of references to all objects, which were used in a certain path given by name
672 TriggerObjectRefVector TriggerEvent::pathObjects(const std::string& namePath, bool firing) const {
673  TriggerObjectRefVector thePathObjects;
674  TriggerFilterRefVector theFilters = pathFilters(namePath, firing);
675  for (TriggerFilterRefVectorIterator iFilter = theFilters.begin(); iFilter != theFilters.end(); ++iFilter) {
676  const std::string labelFilter((*iFilter)->label());
677  TriggerObjectRefVector theObjects = filterObjects(labelFilter);
678  for (TriggerObjectRefVectorIterator iObject = theObjects.begin(); iObject != theObjects.end(); ++iObject) {
679  thePathObjects.push_back(*iObject);
680  }
681  }
682  return thePathObjects;
683 }
684 
685 // Checks, if an object was used in a certain path given by name
686 bool TriggerEvent::objectInPath(const TriggerObjectRef& objectRef, const std::string& namePath, bool firing) const {
687  TriggerFilterRefVector theFilters = pathFilters(namePath, firing);
688  for (TriggerFilterRefVectorIterator iFilter = theFilters.begin(); iFilter != theFilters.end(); ++iFilter) {
689  if (objectInFilter(objectRef, (*iFilter)->label()))
690  return true;
691  }
692  return false;
693 }
694 
695 // Get a vector of references to all paths, which have a certain object assigned
697  TriggerPathRefVector theObjectPaths;
698  for (TriggerPathCollection::const_iterator iPath = paths()->begin(); iPath != paths()->end(); ++iPath) {
699  const std::string namePath(iPath->name());
700  if (objectInPath(objectRef, namePath, firing)) {
701  const TriggerPathRef pathRef(paths_, indexPath(namePath));
702  theObjectPaths.push_back(pathRef);
703  }
704  }
705  return theObjectPaths;
706 }
707 
708 // Add a pat::TriggerObjectMatch association
709 bool TriggerEvent::addObjectMatchResult(const TriggerObjectMatchRefProd& trigMatches, const std::string& labelMatcher) {
710  if (triggerObjectMatchResults()->find(labelMatcher) == triggerObjectMatchResults()->end()) {
711  objectMatchResults_[labelMatcher] = trigMatches;
712  return true;
713  }
714  return false;
715 }
716 
717 // Get a list of all linked trigger matches
718 std::vector<std::string> TriggerEvent::triggerMatchers() const {
719  std::vector<std::string> theMatchers;
720  for (TriggerObjectMatchContainer::const_iterator iMatch = triggerObjectMatchResults()->begin();
721  iMatch != triggerObjectMatchResults()->end();
722  ++iMatch)
723  theMatchers.push_back(iMatch->first);
724  return theMatchers;
725 }
726 
727 // Get a pointer to a certain trigger match given by label
729  const TriggerObjectMatchContainer::const_iterator iMatch(triggerObjectMatchResults()->find(labelMatcher));
730  if (iMatch != triggerObjectMatchResults()->end())
731  return iMatch->second.get();
732  return nullptr;
733 }
size
Write out results.
const TriggerPath * path(const std::string &namePath) const
Analysis-level L1 trigger algorithm class.
TriggerAlgorithmRefVector acceptedAlgorithmsGtl() const
Get a vector of references to all L1 algorithms succeeding on the GTL board.
TriggerConditionRefProd conditions_
Reference to pat::TriggerConditionCollection in event.
Definition: TriggerEvent.h:81
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
bool objectInAlgorithm(const TriggerObjectRef &objectRef, const std::string &nameAlgorithm) const
Checks, if an object was used in a certain algorithm given by name.
edm::Ref< TriggerPathCollection > TriggerPathRef
Persistent reference to an item in a TriggerPathCollection.
Definition: TriggerPath.h:162
edm::Ref< TriggerAlgorithmCollection > TriggerAlgorithmRef
Persistent reference to an item in a TriggerAlgorithmCollection.
TriggerConditionRefVector acceptedConditions() const
Get a vector of references to all succeeding L1 condition.
const TriggerPathRefVector pathRefs() const
std::vector< std::string > filterCollections(const std::string &labelFilter) const
Get a list of all trigger object collections used in a certain filter given by name.
TriggerConditionRefVector algorithmConditions(const std::string &nameAlgorithm) const
TriggerAlgorithmRefVector objectAlgorithms(const TriggerObjectRef &objectRef) const
Get a vector of references to all algorithms, which have a certain object assigned.
bool conditionInAlgorithm(const TriggerConditionRef &conditionRef, const std::string &nameAlgorithm) const
Checks, if a condition is assigned to a certain algorithm given by name.
TriggerPathRefVector objectPaths(const TriggerObjectRef &objectRef, bool firing=true) const
Get a vector of references to all paths, which have a certain object assigned.
edm::Ref< TriggerConditionCollection > TriggerConditionRef
Persistent reference to an item in a TriggerConditionCollection.
unsigned indexCondition(const std::string &nameCondition) const
TriggerAlgorithmRefVector physAlgorithms() const
Get a vector of references to all physics L1 algorithms.
const TriggerCondition * condition(const std::string &nameCondition) const
TriggerConditionRefVector objectConditions(const TriggerObjectRef &objectRef) const
Get a vector of references to all conditions, which have a certain object assigned.
TriggerAlgorithmRefVector acceptedPhysAlgorithmsGtl() const
Get a vector of references to all physics L1 algorithms succeeding on the GTL board.
const TriggerObjectMatchContainer * triggerObjectMatchResults() const
Get all trigger matches.
Definition: TriggerEvent.h:364
TriggerEvent()
Constructors and Desctructor.
Definition: TriggerEvent.cc:11
TriggerPathRefProd paths_
Reference to pat::TriggerPathCollection in event.
Definition: TriggerEvent.h:83
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
bool filterInPath(const TriggerFilterRef &filterRef, const std::string &namePath, bool firing=true) const
Checks, if a filter is assigned to and was run in a certain path given by name.
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
unsigned indexFilter(const std::string &labelFilter) const
TriggerAlgorithmRefVector acceptedAlgorithms() const
Get a vector of references to all succeeding L1 algorithms.
key_type key() const
Accessor for product key.
Definition: Ref.h:250
const TriggerPathRef pathRef(const std::string &namePath) const
TriggerAlgorithmRefVector acceptedPhysAlgorithms() const
Get a vector of references to all succeeding physics L1 algorithms.
TriggerAlgorithmRefProd algorithms_
Definition: TriggerEvent.h:79
TriggerFilterRefVector acceptedFilters() const
Get a vector of references to all succeeding HLT filters.
std::vector< std::string > triggerMatchers() const
Get a list of all linked trigger matches.
Definition: HeavyIon.h:7
unsigned indexAlgorithm(const std::string &nameAlgorithm) const
const TriggerAlgorithmCollection * algorithms() const
Definition: TriggerEvent.h:185
TriggerAlgorithmRefVector acceptedTechAlgorithms() const
Get a vector of references to all succeeding technical L1 algorithms.
TriggerPathRefVector filterPaths(const TriggerFilterRef &filterRef, bool firing=true) const
Get a vector of references to all paths, which have a certain filter assigned.
TriggerObjectRefVector conditionObjects(const std::string &nameCondition) const
Get a vector of references to all objects, which were used in a certain condition given by name...
char const * label
Analysis-level HLTrigger filter class.
Definition: TriggerFilter.h:33
const TriggerObjectMatch * triggerObjectMatchResult(const std::string &labelMatcher) const
unsigned indexPath(const std::string &namePath) const
TriggerAlgorithmRefVector acceptedTechAlgorithmsGtl() const
Get a vector of references to all technical L1 algorithms succeeding on the GTL board.
Analysis-level L1 trigger condition class.
bool addObjectMatchResult(const TriggerObjectMatchRefProd &trigMatches, const std::string &labelMatcher)
TriggerFilterRefVector pathFilters(const std::string &namePath, bool firing=true) const
Get a vector of references to all active HLT filters assigned to a certain path given by name...
TriggerObjectRefVector algorithmObjects(const std::string &nameAlgorithm) const
Get a vector of references to all objects, which were used in a certain algorithm given by name...
std::vector< std::string > conditionCollections(const std::string &nameAlgorithm) const
Get a list of all trigger object collections used in a certain condition given by name...
TriggerFilterRefVector objectFilters(const TriggerObjectRef &objectRef, bool firing=true) const
Get a vector of references to all filters, which have a certain object assigned.
TriggerObjectRefVector pathObjects(const std::string &namePath, bool firing=true) const
Get a vector of references to all objects, which were used in a certain path given by name...
const TriggerFilter * filter(const std::string &labelFilter) const
TriggerFilterRefProd filters_
Reference to pat::TriggerAlgorithmCollection in event.
Definition: TriggerEvent.h:85
bool objectInFilter(const TriggerObjectRef &objectRef, const std::string &labelFilter) const
Checks, if an object was used in a certain filter given by name.
const TriggerObjectRefVector objectRefs() const
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
bool objectInCondition(const TriggerObjectRef &objectRef, const std::string &nameCondition) const
Checks, if an object was used in a certain condition given by name.
const TriggerFilterRef filterRef(const std::string &labelFilter) const
TriggerObjectRefVector filterObjects(const std::string &labelFilter) const
Get a vector of references to all objects, which were used in a certain filter given by name...
const TriggerConditionCollection * conditions() const
Definition: TriggerEvent.h:225
TriggerAlgorithmRefVector techAlgorithms() const
Get a vector of references to all technical L1 algorithms.
edm::Ref< TriggerFilterCollection > TriggerFilterRef
Persistent reference to an item in a TriggerFilterCollection.
TriggerPathRefVector acceptedPaths() const
Get a vector of references to all succeeding HLT paths.
std::string nameAlgorithm(const unsigned bitAlgorithm, const bool techAlgorithm=true) const
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
TriggerObjectRefProd objects_
Reference to pat::TriggerObjectCollection in event.
Definition: TriggerEvent.h:87
const TriggerAlgorithmRefVector algorithmRefs() const
Definition: TriggerEvent.cc:77
const TriggerConditionRef conditionRef(const std::string &nameCondition) const
TriggerObjectMatchContainer objectMatchResults_
Table of references to pat::TriggerObjectMatch associations in event.
Definition: TriggerEvent.h:89
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
bool objectInPath(const TriggerObjectRef &objectRef, const std::string &namePath, bool firing=true) const
Checks, if an object was used in a certain path given by name.
TriggerFilterRefVector pathModules(const std::string &namePath, bool all=true) const
const TriggerAlgorithm * algorithm(const std::string &nameAlgorithm) const
Definition: TriggerEvent.cc:89
const TriggerFilterCollection * filters() const
Definition: TriggerEvent.h:271
const TriggerObjectCollection * objects() const
Definition: TriggerEvent.h:294
const TriggerAlgorithmRef algorithmRef(const std::string &nameAlgorithm) const
Definition: TriggerEvent.cc:99
const TriggerPathCollection * paths() const
Definition: TriggerEvent.h:248
const TriggerConditionRefVector conditionRefs() const
const TriggerFilterRefVector filterRefs() const
TriggerAlgorithmRefVector conditionAlgorithms(const TriggerConditionRef &conditionRef) const
Get a vector of references to all algorithms, which have a certain condition assigned.