ATLAS Offline Software
Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/TrigPassBits.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #pragma once
6 #ifndef TrigSteeringEvent_TrigPassBits_h
7 #define TrigSteeringEvent_TrigPassBits_h
8 
9 #include <vector>
10 #include <algorithm>
11 #include <stdexcept>
12 
13 #include "xAODCore/CLASS_DEF.h"
14 // TrigPassBitsCollection is included at the end (required by Trigger EDM schema)
15 
16 
17 class TrigPassBits {
18 public:
19  TrigPassBits();
20 
27  TrigPassBits(unsigned sz, const void *cont=0);
28 
33  void markPassing( unsigned position, const void *cont=0 );
34 
39  bool isPassing( unsigned position ) const;
40 
44  unsigned int size() const { return m_decisions.size(); }
45 
46 private:
47  friend class TrigPassBitsCnv_p1;
48  const void *m_container_ptr;
49  std::vector<bool> m_decisions;
50 };
51 
52 CLASS_DEF( TrigPassBits , 188050889 , 1 )
53 
54 namespace HLT {
55 
56  template<class CONTAINER>
57  TrigPassBits* makeTrigPassBits(const CONTAINER* cont) {
58  return new TrigPassBits(cont->size(), (const void*)cont );
59  }
60 
61 
62 
68  template<class T, class CONTAINER>
69  void markPassing (TrigPassBits *bits, const T* obj, const CONTAINER* container) {
70  typename CONTAINER::const_iterator i = std::find(container->begin(), container->end(), obj);
71  if ( i != container->end() )
72  bits->markPassing(i-container->begin(), container);
73  else
74  throw std::runtime_error("When marking object as passing the trigger found object not from container");
75  }
76 
77 
81  template<class T, class CONTAINER>
82  bool isPassing (const TrigPassBits *bits,const T* obj, const CONTAINER* container) {
83  typename CONTAINER::const_iterator i = std::find(container->begin(), container->end(), obj);
84  if ( i != container->end() )
85  return bits->isPassing(i-container->begin());
86  else
87  throw std::runtime_error("When checking that object passed the trigger found object not from container");
88  return false;
89  }
90 } // eof HLT namespace
91 
93 
94 #endif // TrigSteeringEvent_TrigPassBits_h
95 
96 
97 
98 
TrigPassBitsCollection.h
TrigPassBits::TrigPassBits
TrigPassBits()
Definition: TrigPassBits.cxx:7
fitman.sz
sz
Definition: fitman.py:527
HLT::markPassing
void markPassing(TrigPassBits *bits, const T *obj, const CONTAINER *container)
Set the bit for the object in the associated bits object.
Definition: Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/TrigPassBits.h:69
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TrigPassBits::size
unsigned int size() const
gets size of the bits array
Definition: Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/TrigPassBits.h:44
xAOD::TrigPassBits
TrigPassBits_v1 TrigPassBits
Define the latest version of the trigger pass bits class.
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigPassBits.h:16
TrigPassBits::m_container_ptr
const void * m_container_ptr
Definition: Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/TrigPassBits.h:48
TrigPassBits::isPassing
bool isPassing(unsigned position) const
Check the bit value a the position.
Definition: TrigPassBits.cxx:23
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigPassBitsCnv_p1
Definition: TrigPassBitsCnv_p1.h:28
HLT::isPassing
bool isPassing(const TrigPassBits *bits, const T *obj, const CONTAINER *container)
Check the bit for the object in the associated bits object.
Definition: Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/TrigPassBits.h:82
HLT::makeTrigPassBits
TrigPassBits * makeTrigPassBits(const CONTAINER *cont)
Definition: Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/TrigPassBits.h:57
TrigPassBits
Definition: Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/TrigPassBits.h:17
CLASS_DEF.h
File providing the different SG_BASE macros.
TrigPassBits::m_decisions
std::vector< bool > m_decisions
trainsient bits storage (STL docu assures that this is efficient)
Definition: Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/TrigPassBits.h:49
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TrigPassBits::markPassing
void markPassing(unsigned position, const void *cont=0)
Set the bit value a the position to true.
Definition: TrigPassBits.cxx:13
python.PyAthena.obj
obj
Definition: PyAthena.py:132
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35