ATLAS Offline Software
Loading...
Searching...
No Matches
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
53const 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//_____________________________________________________________________________________________
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)
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
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
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}
const float ZERO_LIMIT
an iterator over instances of a given type in StoreGateSvc.
Definition DataHandle.h:43
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
The Athena Transient Store API.
std::vector< std::string > getListOfTriggers() const
std::vector< VP1Trig::VP1TriggerHandleL1 > m_handleL1
ToolHandle< TrigMatchTool > m_trigMatch
std::vector< VP1Trig::VP1TriggerHandleEF > m_handleEF
std::vector< VP1Trig::VP1TriggerHandleL2 > m_handleL2
bool loadTriggerHandles(StoreGateSvc *m_storeGate, QString triglvl)
ToolHandle< Trig::TrigDecisionTool > m_trigDec
The common trigger namespace for trigger analysis tools.