PandaTree
HLTObjectStore.h
1 #ifndef PandaTree_Objects_HLTObjectStore_h
2 #define PandaTree_Objects_HLTObjectStore_h
3 
4 #include "HLTObject.h"
5 
6 #include "TString.h"
7 
8 #include <map>
9 
10 namespace panda {
11 
13  public:
14  typedef std::vector<HLTObject const*> HLTObjectVector;
15 
16  HLTObjectStore(char const* name = "", UInt_t initialMax = 512) : HLTObjectCollection(name, initialMax) {}
18  ~HLTObjectStore() {}
19  HLTObjectStore& operator=(HLTObjectStore const&);
20 
22  void setFilterObjectKeys(std::vector<TString> const& filters);
23 
25  void makeMap();
26 
28 
32  void registerFilter(char const* filter) { registeredFilters_.emplace(filter); }
33 
35  void setIgnoreMissing(Bool_t b) { ignoreMissing_ = b; }
36 
38  HLTObjectVector const& filterObjects(char const* filter) const;
39 
40  protected:
41  Bool_t ignoreMissing_{false};
43  std::set<TString> registeredFilters_{};
45  std::map<TString, UInt_t> nameToSlot_{};
47  std::vector<Int_t> indexToSlot_{};
49  std::vector<HLTObjectVector> objectVectors_{};
51  static HLTObjectVector const emptyVector_;
52  };
53 
54 }
55 
56 #endif
std::set< TString > registeredFilters_
List of trigger object filter names to use.
Definition: HLTObjectStore.h:43
HLTObjectVector const & filterObjects(char const *filter) const
filterObjects_.at() with warnings. To be called by users.
Definition: HLTObjectStore.cc:93
std::map< TString, UInt_t > nameToSlot_
Map from filter name to the outer index of objectVectors.
Definition: HLTObjectStore.h:45
void registerFilter(char const *filter)
Use to declare a trigger filter name (key in the triggerObjects map) to be used in the analysis...
Definition: HLTObjectStore.h:32
void makeMap()
Fill the filterObjects map for each event. Not to be called by users.
Definition: HLTObjectStore.cc:75
std::vector< Int_t > indexToSlot_
Map from filter index to objectVectors slot.
Definition: HLTObjectStore.h:47
void setIgnoreMissing(Bool_t b)
If set to true, return an empty vector when non-existent filter is asked for.
Definition: HLTObjectStore.h:35
std::vector< HLTObjectVector > objectVectors_
Vector of vector of pointers to the objects. Outer index for filters.
Definition: HLTObjectStore.h:49
Template class for dynamic-size container implementations. Inherits from base_type::collection_type o...
Definition: Collection.h:19
Definition: HLTObjectStore.h:12
void setFilterObjectKeys(std::vector< TString > const &filters)
Reset the filterObjects map for each run. Not to be called by users.
Definition: HLTObjectStore.cc:38
Definition: Array.h:11
static HLTObjectVector const emptyVector_
Empty vector as a return value to filterObjects when ignoreMissing is true.
Definition: HLTObjectStore.h:51