00001 #pragma once
00002 #ifndef TrigSteeringEvent_TrigPassBits_h
00003 #define TrigSteeringEvent_TrigPassBits_h
00004
00005 #include <vector>
00006 #include <algorithm>
00007 #include <stdexcept>
00008
00009 #include "xAODCore/CLASS_DEF.h"
00010
00011
00012
00013 class TrigPassBits {
00014 public:
00015 TrigPassBits();
00016
00023 TrigPassBits(unsigned sz, const void *cont=0);
00024
00029 void markPassing( unsigned position, const void *cont=0 );
00030
00035 bool isPassing( unsigned position ) const;
00036
00040 unsigned int size() const { return m_decisions.size(); }
00041
00042 private:
00043 friend class TrigPassBitsCnv_p1;
00044 const void *m_container_ptr;
00045 std::vector<bool> m_decisions;
00046 };
00047
00048 CLASS_DEF( TrigPassBits , 188050889 , 1 )
00049
00050 namespace HLT {
00051
00052 template<class CONTAINER>
00053 TrigPassBits* makeTrigPassBits(const CONTAINER* cont) {
00054 return new TrigPassBits(cont->size(), (const void*)cont );
00055 }
00056
00057
00058
00064 template<class T, class CONTAINER>
00065 void markPassing (TrigPassBits *bits, const T* obj, const CONTAINER* container) {
00066 typename CONTAINER::const_iterator i = std::find(container->begin(), container->end(), obj);
00067 if ( i != container->end() )
00068 bits->markPassing(i-container->begin(), container);
00069 else
00070 throw std::runtime_error("When marking object as passing the trigger found object not from container");
00071 }
00072
00073
00077 template<class T, class CONTAINER>
00078 bool isPassing (const TrigPassBits *bits,const T* obj, const CONTAINER* container) {
00079 typename CONTAINER::const_iterator i = std::find(container->begin(), container->end(), obj);
00080 if ( i != container->end() )
00081 return bits->isPassing(i-container->begin());
00082 else
00083 throw std::runtime_error("When checking that object passed the trigger found object not from container");
00084 return false;
00085 }
00086 }
00087
00088 #include "TrigSteeringEvent/TrigPassBitsCollection.h"
00089
00090 #endif // TrigSteeringEvent_TrigPassBits_h
00091
00092
00093
00094