ATLAS Offline Software
Loading...
Searching...
No Matches
Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h
Go to the documentation of this file.
1// -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef TRIGGER_DECISION_TOOL_Combination_H
8#define TRIGGER_DECISION_TOOL_Combination_H
9
10/**********************************************************************************
11 * @Project:
12 * @Package: TrigDecision
13 * @class : TrigDecision
14 *
15 * @brief combination of TEs storage
16 *
17 * @author Nicolas Berger <Nicolas.Berger@cern.ch> - LAPP Annecy
18 *
19 ***********************************************************************************/
20
21
27#include <vector>
28
29#include "xAODBase/IParticle.h"
31
32#if !defined(XAOD_STANDALONE) && !defined(XAOD_ANALYSIS) // Full athena
34#endif
35
37
38#include "boost/container_hash/hash_fwd.hpp"
39
40class HltNaviChecker;
41
42namespace Trig {
43
45
55 {
56 public:
57
58 Combination() = default;
59
63 Combination(const std::vector<HLT::TriggerElement*>& tes, const Trig::CacheGlobalMemory* cgm);
64
65
70
71 std::vector<Trig::TypelessFeature> typelessGet(HLT::class_id_type clid, const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string & teName = "" ) const;
72
80 template<class T>
81 std::vector<Trig::Feature<T> > get(const std::string& label = "", unsigned int condition=TrigDefs::Physics, const std::string& teName = "") const;
82
83
84 template<typename CONTAINER> using ELEMENT_OF = typename CONTAINER::base_value_type;
85
90
91 std::vector<Trig::Feature<xAOD::IParticle> > getIParticle(HLT::class_id_type clid, const std::string& container_name, const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string & teName = "" ) const{
92 auto features = typelessGet(clid,label,condition,teName);
94 navigation(),
95 m_cgm->store(),
96 container_name);
97 }
98
102 template<typename CONTAINER>
103 std::vector<Feature<ELEMENT_OF<CONTAINER> > > elementFeature(const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string& teName = "") const{
104 auto features = typelessGet(ClassID_traits<ELEMENT_OF<CONTAINER> >::ID(),label,condition,teName);
106 }
107
111 template<typename CONTAINER>
112 std::vector<Feature<CONTAINER> > containerFeature(const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string& teName = "") const{
113 auto features = typelessGet(ClassID_traits<CONTAINER>::ID(),label,condition,teName);
115 }
116
120 template<typename CONTAINER>
121 std::vector<Feature<ELEMENT_OF<CONTAINER> > > flattenedContainerFeature(const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string& teName = "") const{
122 auto features = typelessGet(ClassID_traits<CONTAINER>::ID(),label,condition,teName);
123 return FeatureAccessImpl::typedGet<ELEMENT_OF<CONTAINER>,CONTAINER,CONTAINER>(features,navigation(),m_cgm->store());
124 }
125
129 unsigned int size() const { return m_tes.size(); }
130
135 bool active() const;
136
141 const std::vector<const HLT::TriggerElement*>& tes() const {return m_tes; }
142
147 template<class T>
148 void collect(const HLT::TriggerElement* te, std::vector<Trig::Feature<T> >& data,
149 const std::string& label, unsigned int condition, const std::string& teName) const;
150
151 bool operator==(const Combination& other) const { return m_tes == other.m_tes; }
152 bool operator<(const Combination& other) const { return m_tes < other.m_tes; }
153
154
155 private:
156 friend class ::HltNaviChecker;
157
158 // helper functionality for collect using traits class to determine how to access
159 // the navigation
160
161 const HLT::TrigNavStructure* navigation() const;
162
163 std::vector<const HLT::TriggerElement*> m_tes;
165 };
166} // EOF namespace Trig
167
168
169template <class T>
170std::vector<Trig::Feature<T> > Trig::Combination::get(const std::string& label, unsigned int condition, const std::string& teName) const
171{
172 std::vector<Feature<T> > data;
173
174#if !defined(XAOD_STANDALONE) && !defined(XAOD_ANALYSIS) // Full athena
175 for( const HLT::TriggerElement* te : m_tes )
176 FeatureAccessImpl::collect<T>(te, data, label, condition, teName, navigation());
177 for( Feature<T>& f : data ) {
178 if ( f.owned() ) {
179 m_cgm->deleteAtTheEndOfEvent( f.cptr() );
180 }
181 }
182#else
183 std::cerr << "WARNING: Trig::Combination::get is only available in Athena proper" << std::endl;
184 (void)label;
185 (void)condition;
186 (void)teName;
187#endif
188 return data;
189}
190
191namespace std {
193 template <>
194 struct hash<Trig::Combination>
195 {
196 std::size_t operator()(const Trig::Combination& comb) const {
197 return boost::hash_range(comb.tes().begin(), comb.tes().end());
198 }
199 };
200}
201
202MsgStream& operator<< ( MsgStream& m, const Trig::Combination& c );
203
204
205#endif
std::vector< Identifier > ID
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
This class provides a combination very quickly.
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
is a connector between chains and object It store single combination of trigger elements.
std::vector< Trig::Feature< xAOD::IParticle > > getIParticle(HLT::class_id_type clid, const std::string &container_name, const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
Experimental flattened get for IParticle types.
void collect(const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, const std::string &label, unsigned int condition, const std::string &teName) const
Method used to get objects.
std::vector< Feature< ELEMENT_OF< CONTAINER > > > elementFeature(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
get element type features (those attached to TE as single instance of a trigger type)
std::vector< Trig::Feature< T > > get(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
Method used to get objects.
Combination()=default
std::vector< Feature< ELEMENT_OF< CONTAINER > > > flattenedContainerFeature(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
get container type features flattened as Features (those attached to TE as container of a trigger typ...
const std::vector< const HLT::TriggerElement * > & tes() const
trigger elements in the combination can be used directly with ancestor method
std::vector< Trig::TypelessFeature > typelessGet(HLT::class_id_type clid, const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
Typeless version of get method.
bool active() const
Returns the state of the combination i.e.
std::vector< Feature< CONTAINER > > containerFeature(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
get container type features (those attached to TE as container of a trigger type)
is basic vehicle of object access in TDT
Definition Feature.h:112
std::string label(const std::string &format, int i)
Definition label.h:19
void collect(const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, const std::string &label, unsigned int condition, const std::string &teName, const HLT::TrigNavStructure *navstructure)
actual feature acceess implementation It has (thanks to the ClassTraits) functionality to flatten con...
std::vector< Trig::Feature< REQUESTED > > typedGet(const std::vector< TypelessFeature > &features, const HLT::TrigNavStructure *navigation, const asg::EventStoreType *store, const std::string &container_name=ClassID_traits< CONTAINER >::typeName())
The common trigger namespace for trigger analysis tools.
std::ostream & operator<<(std::ostream &, const Trig::TypelessFeature &)
STL namespace.
Default, invalid implementation of ClassID_traits.