ATLAS Offline Software
Loading...
Searching...
No Matches
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
18public:
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
46private:
47 friend class TrigPassBitsCnv_p1;
48 const void *m_container_ptr;
49 std::vector<bool> m_decisions;
50};
51
52CLASS_DEF( TrigPassBits , 188050889 , 1 )
53
54namespace 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
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
File providing the different SG_BASE macros.
static Double_t sz
bool isPassing(unsigned position) const
Check the bit value a the position.
void markPassing(unsigned position, const void *cont=0)
Set the bit value a the position to true.
unsigned int size() const
gets size of the bits array
std::vector< bool > m_decisions
trainsient bits storage (STL docu assures that this is efficient)
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
TrigPassBits * makeTrigPassBits(const CONTAINER *cont)
bool isPassing(const TrigPassBits *bits, const T *obj, const CONTAINER *container)
Check the bit for the object in the associated bits object.
void markPassing(TrigPassBits *bits, const T *obj, const CONTAINER *container)
Set the bit for the object in the associated bits object.