CMS 3D CMS Logo

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