ATLAS Offline Software
Loading...
Searching...
No Matches
VP1TriggerDecisionSystem.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7// TODO: check the include of the Chain.h file here below, maybe it's obsolete because it seems it's not used
8//#include "TrigSteering/Chain.h" // OLD include
9#include "TrigSteeringEvent/Chain.h" // NEW include - Requested by Trigger experts, 13 Sep 2013
10
14
15#include <string>
16#include <vector>
17#include <stdexcept>
18
19
21{
22public:
23 Clockwork();
25
26 ToolHandle<Trig::TrigDecisionTool> m_trigDec;
27
28 void getInfo(const std::string& key,const std::string&/*type*/,std::ostringstream& os);
29
31};
32
34 : m_trigDec("TrigDec::TrigDecisionTool",0), theclass{}
35{
36}
37
38//____________________________________________________________________
40 : IVP1System("TriggerDecison",
41 "System for browsing the Trigger Decison [unmaintained]",
42 "Weiyi Zhang, wyizhang@cern.ch, Riccardo.Maria.BIANCHI@cern.ch"),
43 m_clock(new Clockwork())
44{
45 m_clock->theclass=this;
46}
47
48
49//____________________________________________________________________
50void VP1TriggerDecisionSystem::create( StoreGateSvc* /*triggerDecisonTool*/ )
51{
52 StatusCode sc = m_clock->m_trigDec.retrieve();
53 if(sc.isFailure())
54 message("Error: retrieve TrigDecisionTool failed!");
55}
56
57//____________________________________________________________________
59{
60 QStringList entry_key;
61 QStringList entry_type;
62 QStringList entry_id;
63
64 std::vector<std::string> l1triggers = m_clock->m_trigDec->getListOfTriggers("L1_.*");
65 if(!l1triggers.empty()) {
66 for (std::vector<std::string>::const_iterator aItemName = l1triggers.begin(); aItemName != l1triggers.end(); ++aItemName) {
67 if((*aItemName!="") && (*aItemName!=" ")) {
68 std::ostringstream os1; os1 << *aItemName; entry_key << os1.str().c_str();
69 std::ostringstream os2; os2 << m_clock->m_trigDec->isPassed(*aItemName); entry_type << os2.str().c_str();
70 }
71 updateGUI();
72 }
73 entriesChanged(entry_key,entry_type);
74 }else{
75 message("WARNING:: The TriggerDecision Tool is not configured well for Level 1.");
76 message("WARNING:: You may need a configure file (usually 'LVL1Config.xml').");
77 message("WARNING:: Please refer to 'vp1 -h' for further instructions.");
78 }
79
80 std::vector<std::string> l2triggers = m_clock->m_trigDec->getListOfTriggers("L2_.*");
81 if(!l2triggers.empty()){
82 //const std::vector<HLT::Chain*>* allChains = m_clock->m_trigDec->getConfiguredChains(TrigDec::L2);
83 for (std::vector<std::string>::const_iterator aChainName = l2triggers.begin(); aChainName != l2triggers.end(); ++aChainName) {
84 if((*aChainName!=" ") && (*aChainName!="")) {
85 std::ostringstream os1; os1 << *aChainName; entry_key << os1.str().c_str();
86 std::ostringstream os2; os2 << m_clock->m_trigDec->isPassed(*aChainName) ; entry_type << os2.str().c_str();
87 }
88 updateGUI();
89 }
90 entriesChanged(entry_key,entry_type);
91 } else {
92 message("WARNING:: The TriggerDecision Tool is not configured well for Level 2.");
93 message("WARNING:: You may need a configure file (usually 'pureSteering_menu.xml').");
94 message("WARNING:: Please refer to 'vp1 -h' for further instructions.");
95 }
96
97 std::vector<std::string> eftriggers = m_clock->m_trigDec->getListOfTriggers("EF_.*");
98 if(!eftriggers.empty()) {
99 for (std::vector<std::string>::const_iterator aChainName = eftriggers.begin(); aChainName != eftriggers.end(); ++aChainName) {
100 if((*aChainName!=" ") && (*aChainName!="")) {
101 std::ostringstream os1; os1 << *aChainName; entry_key << os1.str().c_str();
102 std::ostringstream os2; os2 << m_clock->m_trigDec->isPassed(*aChainName); entry_type << os2.str().c_str();
103 }
104 updateGUI();
105 }
106 entriesChanged(entry_key,entry_type);
107 } else {
108 message("WARNING:: The TriggerDecision Tool is not configured well for Event Filter.");
109 message("WARNING:: You may need a configure file (usually 'pureSteering_menu.xml').");
110 message("WARNING:: Please refer to 'vp1 -h' for further instruction.");
111 }
112}
113
114//____________________________________________________________________
116{
117 entriesChanged(QStringList(),QStringList());
118}
119
120//____________________________________________________________________
121
122QStringList VP1TriggerDecisionSystem::getInfoForEntry(QString key,QString type)
123{
124 if(!m_clock->m_trigDec)
125 return QStringList();
126
127 std::ostringstream os;
128 try {
129 m_clock->getInfo(key.toStdString(),type.toStdString(),os);
130 }
131 catch (std::runtime_error &e) {
132 os << "Exception thrown when getting info for key="<<key.toStdString()<<" of type="<<type.toStdString();
133 os << "Exception: " << e.what() << std::endl;
134 }
135
136 return QString(os.str().c_str()).split("\n");
137}
138
139//____________________________________________________________________
140void VP1TriggerDecisionSystem::Clockwork::getInfo(const std::string& key,const std::string&/*type*/,std::ostringstream& os)
141{
142 StatusCode status;
143 os << " Trigger Information: " << std::endl;
144
145 // For LV1 ROI informations
146 if(key.find("L1",0)!= std::string::npos) {
147 os << " LV1: " << key << std::endl;
148 const LVL1CTP::Lvl1Item* l1iterm = m_trigDec->ExperimentalAndExpertMethods().getItemDetails(key);
149 if(l1iterm) {
150 os << " LV1 " << l1iterm->name() << " isPassed: " << l1iterm->isPassed() << std::endl;
151 os << " LV1 " << l1iterm->name() << " isPrescaled: " << l1iterm->isPrescaled()
152 << " : " << l1iterm->prescaleFactor() << std::endl;
153 os << " LV1 " << l1iterm->name() << " isVeto: " << l1iterm->isVeto() << std::endl;
154 }
155 }
156
157 if(key.find("L2",0)!= std::string::npos) {
158 Trig::FeatureContainer fc = m_trigDec->features(key);
159 std::vector<Trig::Feature<TrigRoiDescriptor> > roif = fc.get<TrigRoiDescriptor>();
160 if(!roif.empty()) {
161 os << " LV2: " << key << " VecSize: " << roif.size() << std::endl;
162 std::vector<Trig::Feature<TrigRoiDescriptor> >::iterator roiIt = roif.begin();
163 for ( ;roiIt != roif.end(); ++roiIt ) {
164 const TrigRoiDescriptor* roi = *roiIt;
165 if (!roi) {
166 theclass->message("ERROR: get roi failed");
167 continue;
168 }
169 os << " "<< roiIt->label() << " ROI: "
170 << "(" << roi->eta() << ", " << roi->phi() << ") " << std::endl;
171 }
172 }
173
174 }
175
176 // For EF ROI informations
177 if(key.find("EF",0)!= std::string::npos) {
178 Trig::FeatureContainer fc = m_trigDec->features(key);
179 std::vector<Trig::Feature<TrigRoiDescriptor> > roif = fc.get<TrigRoiDescriptor>();
180 if(!roif.empty()) {
181 os << " EF: " << key << " VecSize: " << roif.size() << std::endl;
182
183 std::vector<Trig::Feature<TrigRoiDescriptor> >::iterator roiIt = roif.begin();
184 for ( ;roiIt != roif.end(); ++roiIt ) {
185 const TrigRoiDescriptor* roi = *roiIt;
186 if (!roi) {
187 theclass->message("ERROR: get roi failed");
188 continue;
189 }
190
191 os << " "<< roiIt->label() << " ROI: "
192 << "(" << roi->eta() << ", " << roi->phi() << ") " << std::endl;
193 }
194 }
195 }
196
197}
198
199
static Double_t sc
void updateGUI()
IVP1System(const QString &name, const QString &information, const QString &contact_info)
void message(const QString &) const
bool isPassed() const
Definition Lvl1Item.h:53
float prescaleFactor() const
Definition Lvl1Item.h:58
const std::string & name() const
Definition Lvl1Item.h:46
bool isPrescaled() const
Definition Lvl1Item.h:55
bool isVeto() const
Definition Lvl1Item.h:56
virtual double phi() const override final
Methods to retrieve data members.
virtual double eta() const override final
The Athena Transient Store API.
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
const std::vector< Trig::Feature< T > > get(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
returns flattened vector of Features of given type This method is in fact sullied by 3 arguments.
void getInfo(const std::string &key, const std::string &, std::ostringstream &os)
ToolHandle< Trig::TrigDecisionTool > m_trigDec
void refresh(StoreGateSvc *storegate)
QStringList getInfoForEntry(QString key, QString type)
void entriesChanged(const QStringList &entry_key, const QStringList &entry_type)
void create(StoreGateSvc *detstore)