ATLAS Offline Software
VP1TriggerSystem.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /***********************************************************************************
6  * @Package : VP1TriggerSystems
7  * @Class : VP1TriggerSystem
8  *
9  * @brief : Trigger Data System - access and store trigger data
10  *
11  * @author : Manuel Proissl <mproissl@cern.ch> - University of Edinburgh
12  ***********************************************************************************/
13 
14 //Local includes
16 
17 //L1 includes
18 
19 // check the include of the Chain.h file here below, maybe it's obsolete because it seems it's not used
20 #include "TrigSteeringEvent/Chain.h" // NEW include - Requested by Francesca Pastore, 13 Sep 2013
21 
28 
29 //L2 and EF includes
44 
45 //Other includes
46 #include <iostream>
47 #include <string>
48 #include <vector>
49 #include <map>
50 #include <stdio.h>
51 
52 //DEFs
53 const float ZERO_LIMIT = 0.00001;
54 
55 
56 //Trigger System Constructor
57 //_____________________________________________________________________________________________
59  : Logger("VP1TriggerSystem"),
60  m_trigDec("Trig::TrigDecisionTool/TrigDecisionTool"),
61  m_trigMatch("TrigMatchTool/TrigMatchTool") {log_verbose("constructor");}
62 
63 
64 //Trigger System Destructor
65 //_____________________________________________________________________________________________
66 VP1Trig::VP1TriggerSystem::~VP1TriggerSystem() {log_verbose("destructor");}
67 
68 
69 //Load Trigger Data from StoreGate (once new event loaded)
70 //_____________________________________________________________________________________________
72 {
73  log_verbose("loadTriggerHandles()");
74 
75  //Safety handle check
76  if(m_handleL1.size()!=0 || m_handleL2.size()!=0 || m_handleEF.size()!=0)
77  clearTriggerHandles();
78 
79 
80  if(triglvl.compare("ALL", Qt::CaseInsensitive)==0 || triglvl.compare("L1", Qt::CaseInsensitive)==0) {
81  //######################################## L1 ############################################### >
82  log_info("Retrieving L1 data via TrigDecisionTool: start");
83 
84  //VARs
85  std::string trigID;
86  int trigcount=0;
87 
88  //Try to retrieve the TrigDecisionTool
89  if(m_trigDec.retrieve().isFailure()) {
90  log_fatal("Could not retrieve TrigDecisionTool!");
91  return false; //ref: daqstatus
92  }
93  //Try to retrieve the TrigMatchTool
94  if(m_trigMatch.retrieve().isFailure()) {
95  log_fatal("Could not retrieve TrigMatchTool!");
96  return false; //ref: daqstatus
97  }
98 
99  //Loading entire ChainGroup information via TrigDecisionTool
100  const Trig::ChainGroup* allChains = m_trigDec->getChainGroup(".*"); //all triggers
101  if(!allChains) {
102  log_fatal("ChainGroup could not be loaded!");
103  return false; //ref: daqstatus
104  }
105 
106  //Retrieve list of valid triggers associated with ChainGroup
107  std::vector<std::string> trigList = allChains->getListOfTriggers();
108  std::vector<std::string>::iterator trigItr; //Iterator over trigList
109 
110  //Loop over list of triggers
111  for(trigItr=trigList.begin(); trigItr!=trigList.end(); ++trigItr) {
112 
113  //Safety Check: item not empty!
114  if((*trigItr).empty()) continue;
115 
116  //Process passed triggers
117  if(m_trigDec->isPassed((*trigItr))) {
118  ++trigcount;
119  trigID = std::string((*trigItr).c_str());
120  //std::cout << "INFO :: Processing trigger chain: " << trigger << "[" << trigcount << "] ";
121 
122  using namespace Trig;
123  Trig::FeatureContainer f = m_trigDec->features(trigID); //get trigger and its objects
124  //std::cout << "fsize: " << f.getCombinations().size() << std::endl;
125 
126  //Export to L1 handle
127  VP1TriggerHandleL1 handleL1(f, QString::fromStdString(trigID));
128  m_handleL1.push_back(handleL1);
129  }//END: passed triggers
130  }//END: loop over chain group items
131  log_verbose("Retrieving L1 data: complete");
132  }
133 
134 
135  if(triglvl.compare("ALL", Qt::CaseInsensitive)==0 || triglvl.compare("L2", Qt::CaseInsensitive)==0) {
136  //######################################## L2 ############################################### >
137  // Retrieve MuonFeatureDetailsContainer based on
138  /* MuFastMon.cxx
139  Authors: Akimasa Ishikawa (akimasa.ishikawa@cern.ch)
140  Kunihiro Nagano (nagano@mail.cern.ch) */
141  log_verbose("Retrieving L2 data: start");
142 
143  const DataHandle<MuonFeatureDetailsContainer> mfdContainer;
144  const DataHandle<MuonFeatureDetailsContainer> lastmfdContainer;
145  bool runL2=false;
146 
147  while(runL2==false) {
148  if(storeGate->retrieve(mfdContainer,lastmfdContainer).isSuccess())
149  log_verbose("MuonFeatureDetailsContainer retrieved");
150 
151  if(!mfdContainer) {
152  log_fatal("MuonFeatureDetailsContainer not retrieved!");
153  return false; //ref: daqstatus
154  }
155 
156  // -----------------------------
157  // Dump muonFeatureDetails info
158  // -----------------------------
159  std::vector<const MuonFeatureDetails*> vec_muonFeatureDetails;
160 
161  for(; mfdContainer!=lastmfdContainer; mfdContainer++) {
162  MuonFeatureDetailsContainer::const_iterator mfd = mfdContainer->begin();
163  MuonFeatureDetailsContainer::const_iterator lastmfd = mfdContainer->end();
164  for(; mfd != lastmfd; ++mfd) {
165  if((*mfd)==0) continue;
166  vec_muonFeatureDetails.push_back(*mfd);
167  }
168  }
169 
170  VP1TriggerHandleL2 handleL2(vec_muonFeatureDetails);
171  m_handleL2.push_back(handleL2);
172 
173  runL2=true;
174  } //END: looping MuonFetureDetails
175  log_verbose("Retrieving L2 data: complete");
176  }
177 
178 
179  if(triglvl.compare("ALL", Qt::CaseInsensitive)==0 || triglvl.compare("EF", Qt::CaseInsensitive)==0) {
180  //######################################## EF ############################################### >
181  //--- Note: Adapted from the code TrigEDMchecker.cxx, which was ---
182  //--- "Adapted from code by A.Hamilton to check trigger EDM; R.Goncalo 21/11/07" ---
183  log_verbose("Retrieving EF data: start");
184 
185  const DataHandle<TrigMuonEFInfoContainer> trigMuon;
186  const DataHandle<TrigMuonEFInfoContainer> lastTrigMuon;
187  unsigned int muonCounter=0;
188 
189  if(storeGate->retrieve(trigMuon,lastTrigMuon).isSuccess()) {
190  for(int i=0; trigMuon!=lastTrigMuon; ++trigMuon, ++i) {
191  TrigMuonEFInfoContainer::const_iterator MuonItr = trigMuon->begin(); //Iterators over top-level EDM
192  TrigMuonEFInfoContainer::const_iterator MuonItrE = trigMuon->end(); //objects (TrigMuonEFInfoContainer)
193 
194  for(int j=0; MuonItr!=MuonItrE; ++MuonItr, ++j ) { //looping over TrigMuonEFInfo objects
195  const TrigMuonEFInfo* muonInfo = (*MuonItr);
196  std::vector<std::string> chains = m_trigMatch->chainsPassedByObject<TrigMuonEFInfo>(muonInfo);
197  std::vector<std::string>::iterator itChain; //iterator over chains
198  QList<QString> chainIDs;
199 
200  for(itChain=chains.begin(); itChain!=chains.end(); ++itChain)
201  chainIDs << QString((*itChain).c_str());
202 
203  VP1TriggerHandleEF handleEF(muonInfo, QString("Muon No. ")+QString::number(++muonCounter), chainIDs);
204  m_handleEF.push_back(handleEF);
205  }
206  }//loop
207  } else {
208  log_fatal("Could not retrieve TrigMuonEF from StoreGate!");
209  return false; //ref: daqstatus
210  }
211  log_verbose("Retrieving EF data: complete");
212  }//END: EF
213 
214  return true; //ref: daqstatus
215 }
216 
217 
218 //Clear Trigger Handles (at governing system erase)
219 //_____________________________________________________________________________________________
221 {
222  log_verbose("Clearing trigger handles");
223  m_handleL1.clear();
224  m_handleL2.clear();
225  m_handleEF.clear();
226 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TileTrackMuFeatureContainer.h
VP1Trig::VP1TriggerHandleL1
Definition: VP1TriggerHandleL1.h:46
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
VP1Trig::Logger
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/VP1TriggerSystems/Logger.h:32
VP1Trig::VP1TriggerSystem::clearTriggerHandles
void clearTriggerHandles()
Definition: VP1TriggerSystem.cxx:220
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
FeatureContainer.h
TrigMuonEFIsolationContainer.h
TrigMuonEFInfoContainer.h
TrigMuonEFCbTrack.h
Feature.h
TrigDecisionTool.h
VP1Trig::VP1TriggerHandleL2
Definition: VP1TriggerHandleL2.h:29
TrigMuonEFTrack.h
ChainGroup.h
MuonFeatureDetailsContainer.h
TrigMuonEFInfoTrack.h
TDTUtilities.h
VP1Trig::Logger::log_verbose
void log_verbose(const QString &msg)
Definition: graphics/VP1/VP1Systems/VP1TriggerSystems/src/Logger.cxx:40
MuonFeature.h
Trig::FeatureContainer
Definition: FeatureContainer.h:54
CombinedMuonFeatureContainer.h
VP1Trig::VP1TriggerHandleEF
Definition: VP1TriggerHandleEF.h:31
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
TrigMuonEFInfo.h
VP1TriggerSystem.h
VP1Trig::VP1TriggerSystem::loadTriggerHandles
bool loadTriggerHandles(StoreGateSvc *m_storeGate, QString triglvl)
Definition: VP1TriggerSystem.cxx:71
lumiFormat.i
int i
Definition: lumiFormat.py:85
hist_file_dump.f
f
Definition: hist_file_dump.py:135
TileMuFeatureContainer.h
Chain.h
VP1Trig::VP1TriggerSystem::~VP1TriggerSystem
virtual ~VP1TriggerSystem()
Definition: VP1TriggerSystem.cxx:66
Trig::ChainGroup
Definition: ChainGroup.h:51
MuonFeatureContainer.h
python.selection.number
number
Definition: selection.py:20
VP1Trig::VP1TriggerSystem::VP1TriggerSystem
VP1TriggerSystem()
Definition: VP1TriggerSystem.cxx:58
python.copyTCTOutput.chains
chains
Definition: copyTCTOutput.py:81
TrigMuonEFInfoTrackContainer.h
TrigRoiDescriptor.h
Trig::ChainGroup::getListOfTriggers
std::vector< std::string > getListOfTriggers() const
Definition: ChainGroup.cxx:467
TrigMuonEFContainer.h
ZERO_LIMIT
const float ZERO_LIMIT
Definition: VP1TriggerSystem.cxx:53
TrigMuonEFInfo
Definition: TrigMuonEFInfo.h:24
python.PyKernel.storeGate
storeGate
Definition: PyKernel.py:40