ATLAS Offline Software
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 {
22 public:
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"),
44 {
45  m_clock->theclass=this;
46 }
47 
48 
49 //____________________________________________________________________
50 void 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 
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 //____________________________________________________________________
140 void VP1TriggerDecisionSystem::Clockwork::getInfo(const std::string& key,const std::string&/*type*/,std::ostringstream& os)
141 {
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 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
VP1TriggerDecisionSystem::Clockwork::m_trigDec
ToolHandle< Trig::TrigDecisionTool > m_trigDec
Definition: VP1TriggerDecisionSystem.cxx:26
LVL1CTP::Lvl1Item::isPassed
bool isPassed() const
Definition: Lvl1Item.h:53
VP1TriggerDecisionSystem::VP1TriggerDecisionSystem
VP1TriggerDecisionSystem()
Definition: VP1TriggerDecisionSystem.cxx:39
VP1TriggerDecisionSystem::getInfoForEntry
QStringList getInfoForEntry(QString key, QString type)
Definition: VP1TriggerDecisionSystem.cxx:122
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
VP1TriggerDecisionSystem::erase
void erase()
Definition: VP1TriggerDecisionSystem.cxx:115
TrigDecisionTool.h
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
VP1TriggerDecisionSystem::Clockwork::~Clockwork
~Clockwork()
LVL1CTP::Lvl1Item::name
std::string name() const
Definition: Lvl1Item.h:46
LVL1CTP::Lvl1Item::isVeto
bool isVeto() const
Definition: Lvl1Item.h:56
VP1TriggerDecisionSystem::Clockwork::theclass
VP1TriggerDecisionSystem * theclass
Definition: VP1TriggerDecisionSystem.cxx:30
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
VP1TriggerDecisionSystem::Clockwork::Clockwork
Clockwork()
Definition: VP1TriggerDecisionSystem.cxx:33
VP1TriggerDecisionSystem::Clockwork::getInfo
void getInfo(const std::string &key, const std::string &, std::ostringstream &os)
Definition: VP1TriggerDecisionSystem.cxx:140
Trig::FeatureContainer
Definition: FeatureContainer.h:54
Lvl1Result.h
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
LVL1CTP::Lvl1Item
Definition: Lvl1Item.h:37
IVP1System
Definition: IVP1System.h:36
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
VP1TriggerDecisionSystem::refresh
void refresh(StoreGateSvc *storegate)
Definition: VP1TriggerDecisionSystem.cxx:58
VP1TriggerDecisionSystem::create
void create(StoreGateSvc *detstore)
Definition: VP1TriggerDecisionSystem.cxx:50
Chain.h
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
ReadFromCoolCompare.os2
os2
Definition: ReadFromCoolCompare.py:249
Trig::FeatureContainer::get
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.
Definition: FeatureContainer.h:151
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
IVP1System::updateGUI
void updateGUI()
Definition: IVP1System.cxx:262
VP1TriggerDecisionSystem::m_clock
Clockwork * m_clock
Definition: VP1TriggerDecisionSystem.h:41
RoiDescriptor::phi
virtual double phi() const override final
Methods to retrieve data members.
Definition: RoiDescriptor.h:100
VP1TriggerDecisionSystem::entriesChanged
void entriesChanged(const QStringList &entry_key, const QStringList &entry_type)
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
VP1TriggerDecisionSystem
Definition: VP1TriggerDecisionSystem.h:22
VP1TriggerDecisionSystem.h
RoiDescriptor::eta
virtual double eta() const override final
Definition: RoiDescriptor.h:101
TrigRoiDescriptor.h
merge.status
status
Definition: merge.py:17
LVL1CTP::Lvl1Item::prescaleFactor
float prescaleFactor() const
Definition: Lvl1Item.h:58
LVL1CTP::Lvl1Item::isPrescaled
bool isPrescaled() const
Definition: Lvl1Item.h:55
IVP1System::message
void message(const QString &) const
Definition: IVP1System.cxx:336
VP1TriggerDecisionSystem::Clockwork
Definition: VP1TriggerDecisionSystem.cxx:21
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37