00001
00002 #ifndef TRIGGER_DECISION_TOOL_DecisionAccess_H
00003 #define TRIGGER_DECISION_TOOL_DecisionAccess_H
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <string>
00018 #include <boost/algorithm/string/predicate.hpp>
00019
00020 #include "TrigNavStructure/TriggerElement.h"
00021 #include "TrigDecisionTool/Logger.h"
00022 #include "TrigDecisionTool/Conditions.h"
00023 #include "TrigDecisionTool/Combination.h"
00024 #include "TrigDecisionTool/Feature.h"
00025 #include "TrigDecisionTool/FeatureContainer.h"
00026 #include "TrigDecisionTool/ChainGroup.h"
00027
00028 namespace HLT {
00029 class Chain;
00030 }
00031 namespace TrigConf {
00032 class HLTChain;
00033 class HLTTriggerElement;
00034 }
00035
00036 class LVL1_ROI;
00037
00038 namespace Trig {
00039
00040 class CacheGlobalMemory;
00041
00042 class DecisionAccess : public virtual Logger {
00043 public:
00044
00045 DecisionAccess();
00046 virtual ~DecisionAccess();
00047
00053 bool isPassed(const Trig::ChainGroup* chaingroup,
00054 unsigned int condition = TrigDefs::Physics) const;
00060 bool isPassed(const std::string& chain,
00061 unsigned int condition) const;
00062
00063 bool isPassed(const std::string& chain) const;
00081 unsigned int isPassedBits(const Trig::ChainGroup* chaingroup) const;
00082 unsigned int isPassedBits(const std::string& chain) const;
00083
00089 char getBGCode() const;
00090
00094 FeatureContainer features(const ChainGroup* group,
00095 unsigned int condition = TrigDefs::Physics) const;
00096
00100 FeatureContainer features(const std::string& chainName = "EF_.*",
00101 unsigned int condition = TrigDefs::Physics) const;
00102
00108 template<class T>
00109 const Feature<T> ancestor(const HLT::TriggerElement* te, std::string label = "") const;
00110
00117 template<class T>
00118 const std::vector<Trig::Feature<T> > ancestors(const HLT::TriggerElement* te, std::string label = "", unsigned int condition=TrigDefs::Physics, const std::string& teName = "") const;
00119
00120 protected:
00121
00122 friend class Combination;
00123
00124
00125 private:
00126
00127 virtual Trig::CacheGlobalMemory* cgm() const =0;
00128
00129
00130
00131
00132
00133
00134
00135 };
00136 }
00137
00138
00139
00140
00141
00142
00143 #if defined(ASGTOOL_ATHENA) && !defined(XAOD_ANALYSIS)
00144 template<class T>
00145 const Trig::Feature<T> Trig::DecisionAccess::ancestor(const HLT::TriggerElement* te, std::string label) const {
00146 Trig::Feature<T> f;
00147 std::vector<Trig::Feature<T> > data;
00148 FeatureAccessImpl::collect<T>(te, data, label, TrigDefs::alsoDeactivateTEs, "", const_cast<HLT::TrigNavStructure*>(cgm()->navigation()));
00149
00150 BOOST_FOREACH( Feature<T>& f, data ) {
00151 if ( f.owned() ) {
00152 cgm()->deleteAtTheEndOfEvent( const_cast<T*>( f.cptr() ) );
00153 }
00154 }
00155
00156 if (data.size() == 1)
00157 f = data[0];
00158 return f;
00159 }
00160
00161
00162 template<class T>
00163 const std::vector<Trig::Feature<T> > Trig::DecisionAccess::ancestors(const HLT::TriggerElement* te, std::string label, unsigned int condition, const std::string& teName) const {
00164 std::vector<Trig::Feature<T> > data;
00165 FeatureAccessImpl::collect<T>(te, data, label, condition, teName, const_cast<HLT::TrigNavStructure*>(cgm()->navigation()));
00166 BOOST_FOREACH( Feature<T>& f, data ) {
00167 if ( f.owned() ) {
00168 cgm()->deleteAtTheEndOfEvent(const_cast<T*>( f.cptr() ));
00169 }
00170 }
00171 return data;
00172 }
00173 #else
00174 template<class T>
00175 const Trig::Feature<T> Trig::DecisionAccess::ancestor(const HLT::TriggerElement* , std::string ) const {
00176 ATH_MSG_WARNING("DecisionAccess::ancestor not implemented in Standalone mode, since it needs compile-time type information. Returning empty Feature");
00177 return Trig::Feature<T>();
00178 }
00179 template<class T>
00180 const std::vector<Trig::Feature<T> > Trig::DecisionAccess::ancestors(const HLT::TriggerElement* , std::string , unsigned int , const std::string& ) const {
00181 ATH_MSG_WARNING("DecisionAccess::ancestor not implemented in Standalone mode, since it needs compile-time type information. Returning empty vector");
00182 return std::vector<Trig::Feature<T> >();
00183 }
00184
00185 #endif
00186
00187
00188 #endif