ATLAS Offline Software
Loading...
Searching...
No Matches
BSMonitoringAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4#include "BSMonitoringAlg.h"
5
6TrigT1CTMonitoring::BSMonitoringAlgorithm::BSMonitoringAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
7 : AthMonitorAlgorithm(name,pSvcLocator){}
8
10
11 ATH_MSG_INFO("Initializing " << name());
12 ATH_MSG_DEBUG("CTPmonitoring BSMonitorAlgorith::initialize");
13 ATH_MSG_DEBUG("Package Name "<< m_packageName);
14 // connect to RPC and TGC RoI tools
15 //is this NOT used at all??? check the old code about these tools! - then remove or reactivate
16 /*if ( m_processMuctpi ) {
17 ATH_CHECK( m_rpcRoiTool.retrieve() );
18 ATH_CHECK( m_tgcRoiTool.retrieve() );
19 }*/
20
21 ATH_MSG_DEBUG( "MUCTPI DQ DEBUG initialize BG key" );
22 ATH_CHECK( m_bgKey.initialize( true ) );
23
24 ATH_MSG_DEBUG( "MUCTPI DQ DEBUG isRun3?="<<m_isRun3);
27 //ATH_CHECK( m_MuCTPI_RIOKey.initialize(m_processMuctpi && m_processMuctpiRIO && ! m_runOnESD) );
28 ATH_CHECK( m_CTP_RDOKey.initialize(m_processCTP) );
34 ATH_CHECK( m_EventInfoKey.initialize() );
35
36 //COOL access
40
41 ATH_MSG_INFO("Printing the BSMonitoringAlgorithm Configuration: ");
42 ATH_MSG_INFO("InclusiveTriggerThresholds: " << m_inclusiveTriggerThresholds);
43 ATH_MSG_INFO("ProcessMuctpiData: " << m_processMuctpi);
44 ATH_MSG_INFO("ProcessMuctpiDataRIO: " << m_processMuctpiRIO);
45 ATH_MSG_INFO("RunOnESD: " << m_runOnESD);
46 ATH_MSG_INFO("CompareRerun: " << m_compareRerun);
47
48 ATH_MSG_INFO("ProcessCTPData: " << m_processCTP);
49 ATH_MSG_INFO("ProcessRoIBResult: " << m_processRoIB);
50 if (!m_isSim) ATH_MSG_INFO("Simulation or Data?: DATA");
51 else ATH_MSG_INFO("Simulation or Data?: SIMULATION");
52
54}
55
56StatusCode TrigT1CTMonitoring::BSMonitoringAlgorithm::fillHistograms( const EventContext& ctx ) const {
57 using namespace Monitored;
58 ATH_MSG_DEBUG("CTPmonitoring BSMonitorAlgorithm::fillHistograms");
59 try {
60 ATH_MSG_DEBUG( "begin fillHistograms()");
61
62 //BG key (used for MUCTPI Timing plot)
64 ATH_CHECK(bgkey.isValid());
65 std::vector<uint> bcidFirstInTrain={};//this is passed to the muctpi function later (need to do this every event, because BG changes in the run sometimes...)
66 const TrigConf::L1BunchGroupSet *l1bgs = *bgkey;
67 if (l1bgs)
68 {
69 for(uint i=0;i<l1bgs->size();i++)//loop over BGs
70 {
71 std::shared_ptr<TrigConf::L1BunchGroup> bg = l1bgs->getBunchGroup(i);
72 if(bg->name()=="FirstInTrain")
73 {
74 for(std::pair<size_t,size_t> pp: bg->trains())
75 bcidFirstInTrain.push_back(pp.first);
76 break;//no need to search more if found FirstInTrain
77 }
78 }
79 }
80 else
81 {
82 ATH_MSG_ERROR("Did not find L1BunchGroupSet in DetectorStore");
83 }
84
85 // Now see what exists in StoreGate...
86 const MuCTPI_RDO* theMuCTPI_RDO = 0;
87 const MuCTPI_Phase1_RDO* theMuCTPI_Phase1_RDO = 0;
88 //const MuCTPI_RIO* theMuCTPI_RIO = 0;
89 const CTP_RDO* theCTP_RDO = 0;
90 const CTP_RIO* theCTP_RIO = 0;
91 const ROIB::RoIBResult* roIBResult = 0;
92 const Muon::TgcCoinDataContainer* theTGCContainer = 0;
93 const RpcSectorLogicContainer* theRPCContainer = 0;
94
95 //bool validMuCTPI_RIO = true;
96 bool validMuCTPI_RDO = true;
97 bool validMuCTPI_Phase1_RDO = true;
98 bool validCTP_RIO = true;
99 bool validCTP_RDO = true;
100 bool validRoIBResult = true;
101 bool validTGCContainer = true;
102 bool validRPCContainer = true;
103
104 //ERROR histos
105 auto errorSummaryX = Monitored::Scalar<int>("errorSummaryX",0);
106 auto errorSummaryY = Monitored::Scalar<int>("errorSummaryY",0);
107 auto errorSummaryPerLumiBlockX = Monitored::Scalar<int>("errorSummaryPerLumiBlockX",0);
108 auto errorSummaryPerLumiBlockY = Monitored::Scalar<int>("errorSummaryPerLumiBlockY",0);
109 auto errorPerLumiBlockX = Monitored::Scalar<int>("errorPerLumiBlockX",0);
110 auto incompleteFragmentTypeX = Monitored::Scalar<int>("incompleteFragmentTypeX",0);
111 auto incompleteFragmentTypeY = Monitored::Scalar<int>("incompleteFragmentTypeY",0);
112
113 auto eventInfo = GetEventInfo(ctx);
114
115 if (m_processMuctpi) {
116 ATH_MSG_DEBUG( "CTPMON fillHistograms() m_processMuctpi");
117 if(m_isRun3)
118 {
119 theMuCTPI_Phase1_RDO = SG::get(m_MuCTPI_Phase1_RDOKey, ctx);
120 if (!theMuCTPI_Phase1_RDO) {
121 ATH_MSG_WARNING( "Could not find \"" << m_MuCTPI_Phase1_RDOKey.key() << "\" in StoreGate");
122 validMuCTPI_Phase1_RDO = false;
123 }
124 }
125 else
126 {
127 theMuCTPI_RDO = SG::get(m_MuCTPI_RDOKey, ctx);
128 if (!theMuCTPI_RDO) {
129 ATH_MSG_WARNING( "Could not find \"" << m_MuCTPI_RDOKey.key() << "\" in StoreGate");
130 validMuCTPI_RDO = false;
131 }
132 }
133 // now try to get RPC and TGC SL output for comparisons
134 theRPCContainer = SG::get(m_RPCContainerKey, ctx);
135 if (!theRPCContainer) {
136 ATH_MSG_WARNING( "Could not find RPC container in StoreGate");
137 validRPCContainer = false;
138 }
139 theTGCContainer = SG::get(m_TGCContainerKey, ctx);
140 if (!theTGCContainer) {
141 ATH_MSG_WARNING( "Could not find TGC container in StoreGate");
142 validTGCContainer = false;
143 }
144 }
145
146 if (m_processCTP) {
147 ATH_MSG_DEBUG( "CTPMON fillHistograms() m_processCTP");
148 theCTP_RDO = SG::get(m_CTP_RDOKey, ctx);
149 //ATH_MSG_INFO( "CTPMON theCTP_RDO->isValid()" << theCTP_RDO->isValid());
150 if (!theCTP_RDO) {
151 ATH_MSG_WARNING( "Could not find \"" << m_CTP_RDOKey.key() << "\" in StoreGate");
152 validCTP_RDO = false;
153 }
154 if (!m_runOnESD) {
155 theCTP_RIO = SG::get(m_CTP_RIOKey, ctx);
156 if (!theCTP_RIO) {
157 ATH_MSG_WARNING( "Could not find \"" << m_CTP_RIOKey.key() << "\" in StoreGate");
158 validCTP_RIO = false;
159 }
160 ATH_MSG_DEBUG( "validCTP_RIO: " << validCTP_RIO );
161 }
162 }
164 ATH_MSG_DEBUG( "CTPMON fillHistograms() m_processRoIB && m_processMuctpiRIO");
165 roIBResult = SG::get(m_RoIBResultKey, ctx);
166 if (!roIBResult) {
167 ATH_MSG_WARNING( "Could not find \"" << m_RoIBResultKey.key() << "\" in StoreGate");
168 validRoIBResult = false;
169 }
170 }
171
172 bool incompleteEvent = false;
173 int runNumber = 0;
174 unsigned int eventNumber = 0;
175 uint32_t currentLumiBlock = 0;
176
177 if (eventInfo->runNumber()) {
178 currentLumiBlock = eventInfo->lumiBlock();
179 runNumber = eventInfo->runNumber();
180 eventNumber = eventInfo->eventNumber();
181 //lumiBlockOfPreviousEvent = currentLumiBlock;
182 //currentLumiBlock = eventInfo->lumiBlock();
183 incompleteEvent = eventInfo->eventFlags(xAOD::EventInfo::Core) & 0x40000;
184 ATH_MSG_DEBUG( "Successfully retrieved EventInfo (run: " << runNumber << ", event: " << eventNumber << ")");
185 }
186 /*
187 else {
188 ATH_MSG_WARNING( "Could not retrieve EventInfo from StoreGate => run# = event# = 0, LB# = 99");
189 lumiBlockOfPreviousEvent = currentLumiBlock;
190 currentLumiBlock = 99; // dummy LB in case EventInfo is not available - prevents DQ defect flagging with LB# 0...
191 }
192 */
193 if ( incompleteEvent ) {
194 ATH_MSG_WARNING( "Incomplete event according to EventInfo flag");
195 incompleteFragmentTypeX = 4;
196 fill(m_packageName, incompleteFragmentTypeX);
197 }
198
199 //bool l1ctObjectMissingInStoreGate = ( !validCTP_RDO || !validCTP_RIO || !validMuCTPI_RDO || !validMuCTPI_RIO || !validRoIBResult );
200 bool l1ctObjectMissingInStoreGate;
201 if(m_isRun3)
202 l1ctObjectMissingInStoreGate = ( !validCTP_RDO || !validCTP_RIO || !validMuCTPI_Phase1_RDO || !validRoIBResult );
203 else
204 l1ctObjectMissingInStoreGate = ( !validCTP_RDO || !validCTP_RIO || !validMuCTPI_RDO || !validRoIBResult );
205 if ( l1ctObjectMissingInStoreGate ) {
206 ATH_MSG_WARNING( "At least one L1CT object is missing in SG");
207 }
208
209 //dumpData(theCTP_RDO, theCTP_RIO, theMuCTPI_RDO, theMuCTPI_RIO, roIBResult, ctx);
210
211 if(m_isRun3)
212 {
213 //todo
214 }
215 else
216 dumpData(theCTP_RDO, /*theCTP_RIO,*/ theMuCTPI_RDO, roIBResult, ctx);
217
218 if ( m_processCTP ) {
219 if ( validCTP_RDO ) {
220 const std::vector<uint32_t> &cDataWords = theCTP_RDO->getDataWords();
221 if ( cDataWords.size() == 0 ) {
222 ATH_MSG_WARNING( "CTP_RDO is empty, ignoring CTP");
223 validCTP_RDO = false;
224 }
225 }
226
227 if ( validCTP_RIO ) {
228 if ( !m_runOnESD && (theCTP_RIO->getDetectorEventType() & 0xffff) == 0 ) {//LB == 0 only if RIO is empty
229 ATH_MSG_WARNING( "CTP_RIO is not valid, ignoring CTP");
230 validCTP_RIO = false;
231 }
232 }
233 }
234
235 if ( m_processMuctpi && !m_isRun3) {
236 if ( validMuCTPI_RDO ) {
238 // consider the fragment incomplete if the number of data words is less than
239 // the reported number of candidates (zero words valid for muon-less events!)
240 if (theMuCTPI_RDO->dataWord().size() < multWord.getNCandidates()) {
241 //patrick ATH_MSG_INFO
242 ATH_MSG_DEBUG("MuCTPI_RDO reports " << multWord.getNCandidates()
243 //the following gives 0 for now - but why???
244 << " candidates, but there are only " << theMuCTPI_RDO->dataWord().size()
245 << " data words, ignoring MuCTPI");
246 validMuCTPI_RDO = false;
247 }
248 }
249 // Note: there's no simple way of checking the validity of the MUCTPI_RIO, so we don't for now.
250 }
251
252 // if at least one fragment is missing/incomplete, print out a summary
253 if (!validCTP_RDO || !validCTP_RIO || ( (!m_isRun3 && !validMuCTPI_RDO) || (m_isRun3 && !validMuCTPI_Phase1_RDO) ) || !validRoIBResult) {
254 ATH_MSG_WARNING( "At least one missing/invalid L1CT fragment detected");
255 ATH_MSG_WARNING( "CTP_RDO: " << validCTP_RDO << ", CTP_RIO: " << validCTP_RIO
256 //<< ", MuCTPI_RIO: " << validMuCTPI_RIO << ", MuCTPI_RDO: " << validMuCTPI_RDO
257 << ", RoIBResult: " << validRoIBResult);
258 //ATH_MSG_INFO( "Run number: " << eventInfo->runNumber() << ", Event: " << eventInfo->eventNumber() << ", LB: " << eventInfo->lumiBlock() );
259 if (validCTP_RIO) {
260 ATH_MSG_WARNING( "CTP_RIO says LB: " << (theCTP_RIO->getDetectorEventType() & 0xffff)
261 << ", L1ID: " << std::dec << theCTP_RIO->getLvl1Id()
262 << " (HEX: " << std::hex << theCTP_RIO->getLvl1Id() << ")" << std::dec
263 << ", BCID: " << theCTP_RIO->getBCID());
264 ATH_MSG_WARNING( "CTP_RIO says LB: " << (theCTP_RIO->getDetectorEventType() & 0xffff));
265 ATH_MSG_WARNING( "CTP_RIO says L1ID: " << std::dec << theCTP_RIO->getLvl1Id());
266 ATH_MSG_WARNING( "CTP_RIO says HEX: " << std::hex << theCTP_RIO->getLvl1Id() << ")" << std::dec);
267 ATH_MSG_WARNING( "CTP_RIO says BCID: " << theCTP_RIO->getBCID());
268 ATH_MSG_WARNING("in: validCTP_RIO - survived this? crashing now?");
269 }
270 else if (eventInfo->runNumber()) {
271 ATH_MSG_WARNING( "CTP_RIO missing, EventInfo says LB: " << eventInfo->lumiBlock()
272 << ", BCID: " << eventInfo->bcid());
273 }
274 else {
275 ATH_MSG_WARNING( "Not printing event details since both CTP_RIO and EventInfo objects are missing");
276 }
277
278 // only fill error-per-LB histograms if L1CT fragments are missing and global incomplete-event flag
279 // from EventInfo does not say that the event is incomplete
280 if ( !incompleteEvent ) {
281 errorSummaryPerLumiBlockX = currentLumiBlock;
282 errorSummaryPerLumiBlockY = 15;
283 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
284 errorPerLumiBlockX = currentLumiBlock;
285 fill(m_packageName, errorPerLumiBlockX);
286 }
287 errorSummaryX = 15;
288 errorSummaryY = 1;
289 fill(m_packageName, errorSummaryX, errorSummaryY);
290
291 if (!validCTP_RIO) {
292 incompleteFragmentTypeX = 0;
293 fill(m_packageName, incompleteFragmentTypeX);
294 }
295 if (!validCTP_RDO) {
296 incompleteFragmentTypeX = 1;
297 fill(m_packageName, incompleteFragmentTypeX);
298 }
299 /*
300 if (!validMuCTPI_RIO) {
301 incompleteFragmentTypeX = 2;
302 fill(m_packageName, incompleteFragmentTypeX);
303 }*/
304 if ( (!m_isRun3 && !validMuCTPI_RDO) || (m_isRun3 && !validMuCTPI_Phase1_RDO) ) {
305 incompleteFragmentTypeX = 2;
306 fill(m_packageName, incompleteFragmentTypeX);
307 }
308 if (!validRoIBResult) {
309 incompleteFragmentTypeX = 3;
310 fill(m_packageName, incompleteFragmentTypeX);
311 }
312 if (!validTGCContainer) {
313 incompleteFragmentTypeX = 4;
314 fill(m_packageName, incompleteFragmentTypeX);
315 }
316 if (!validRPCContainer) {
317 incompleteFragmentTypeX = 5;
318 fill(m_packageName, incompleteFragmentTypeX);
319 }
320 }
321 else { // since errorSummary holds error _rate_, also fill when there are no errors
322 errorSummaryX = 15;
323 fill(m_packageName, errorSummaryX);
324 }
325
326 // if the event is incomplete (missing L1CT objects or according to EventInfo), skip filling the rest of the histograms
327 if ( !validCTP_RDO || !validCTP_RIO || ( (!m_isRun3 && !validMuCTPI_RDO) || (m_isRun3 && !validMuCTPI_Phase1_RDO) ) || !validRoIBResult || incompleteEvent ) {
328 ATH_MSG_WARNING( "Event incomplete, will skip filling of all non-error histograms");
329 //comment patrick: why was this here if later the single validities are checked?
330 //bc of validCTP_RIO
331 //return StatusCode::SUCCESS;
332 }
333
334 /*
335 * Process and fill data
336 */
337 if (m_processCTP && validCTP_RDO && validCTP_RIO) {
338 ATH_MSG_DEBUG( "CTPMON before begin doCtp()");
339 doCtp(theCTP_RDO, theCTP_RIO, ctx);
340 }
341
342 if(!m_isRun3)
343 {
344 if (m_processMuctpi && m_processCTP && validCTP_RDO && validMuCTPI_RDO) {
345 ATH_MSG_DEBUG( "CTPMON before begin doCtpMuctpi()");
346 doCtpMuctpi(theCTP_RDO, theMuCTPI_RDO, ctx);
347 }
348 }
349 else
350 {
351 //todo doCtpMuctpi
352 }
353
354 if(!m_isRun3)
355 {
356 if (m_processMuctpi && validMuCTPI_RDO && validTGCContainer && validRPCContainer) {
357 ATH_MSG_DEBUG( "CTPMON before begin doMuctpi()");
358 doMuctpi(theMuCTPI_RDO, theRPCContainer, theTGCContainer, ctx);
360 ATH_MSG_DEBUG( "CTPMON before begin doMuonRoI()");
361 doMuonRoI(theMuCTPI_RDO, roIBResult, ctx);
362 }
363 }
364 }
365 else
366 {
367 if (m_processMuctpi && validMuCTPI_Phase1_RDO && validTGCContainer && validRPCContainer) {
368 ATH_MSG_DEBUG( "CTPMON before begin doMuctpi()");
369 doMuctpi(theMuCTPI_Phase1_RDO,bcidFirstInTrain, ctx);
370 }
371 }
372 ATH_MSG_DEBUG("end fillHistograms()");
373 return StatusCode::SUCCESS;
374 }
375 catch(const std::exception & e) {
376 std::cerr << "Caught standard C++ exception: " << e.what() << " from fillHistograms()" << std::endl;
377 return StatusCode::FAILURE;
378 }
379}
380
381
382void
384 const std::vector<uint>& bcidFirstInTrain,
385 //const RpcSectorLogicContainer* theRPCContainer,// to be re-included and compare
386 //const Muon::TgcCoinDataContainer* theTGCContainer,// to be re-included and compare
387 const EventContext& ctx) const
388{
389 ATH_MSG_DEBUG( "CTPMON begin doMuctpi()");
390 //ERROR vector - COMMON
391 auto errorPerLumiBlockX = Monitored::Scalar<int>("errorPerLumiBlockX",0);
392 //ERROR vectors - MUCTPI
393 auto errorSummaryMUCTPI = Monitored::Scalar<int>("errorSummaryMUCTPI",0);
394 auto errorSummaryPerLumiBlockMUCTPIX = Monitored::Scalar<int>("errorSummaryPerLumiBlockMUCTPIX",0);
395 auto errorSummaryPerLumiBlockMUCTPIY = Monitored::Scalar<int>("errorSummaryPerLumiBlockMUCTPIY",0);
396 auto statusDataWordMUCTPI = Monitored::Scalar<int>("statusDataWordMUCTPI",0);
397 auto statusDataWordPerLumiBlockMUCTPIX = Monitored::Scalar<int>("statusDataWordPerLumiBlockMUCTPIX",0);
398 auto statusDataWordPerLumiBlockMUCTPIY = Monitored::Scalar<int>("statusDataWordPerLumiBlockMUCTPIY",0);
399 // MUCTPI-specific
400 auto candCount = Monitored::Scalar<int>("candCount",0);
401 auto candCountVsLBX = Monitored::Scalar<int>("candCountVsLBX",0);
402 auto candCountVsLBY = Monitored::Scalar<int>("candCountVsLBY",0);
403 auto candPtBAX = Monitored::Scalar<int>("candPtBAX",0);
404 auto candPtECX = Monitored::Scalar<int>("candPtECX",0);
405 auto candPtFWX = Monitored::Scalar<int>("candPtFWX",0);
406 auto candSLVsLBBAX = Monitored::Scalar<int>("candSLVsLBBAX",0);
407 auto candSLVsLBBAY = Monitored::Scalar<int>("candSLVsLBBAY",0);
408 auto candSLVsLBECX = Monitored::Scalar<int>("candSLVsLBECX",0);
409 auto candSLVsLBECY = Monitored::Scalar<int>("candSLVsLBECY",0);
410 auto candSLVsLBFWX = Monitored::Scalar<int>("candSLVsLBFWX",0);
411 auto candSLVsLBFWY = Monitored::Scalar<int>("candSLVsLBFWY",0);
412 auto candVetoFlag_RoiVsSLBAX = Monitored::Scalar<int>("candVetoFlag_RoiVsSLBAX",0);
413 auto candVetoFlag_RoiVsSLBAY = Monitored::Scalar<int>("candVetoFlag_RoiVsSLBAY",0);
414 auto candVetoFlag_RoiVsSLECX = Monitored::Scalar<int>("candVetoFlag_RoiVsSLECX",0);
415 auto candVetoFlag_RoiVsSLECY = Monitored::Scalar<int>("candVetoFlag_RoiVsSLECY",0);
416 auto candVetoFlag_RoiVsSLFWX = Monitored::Scalar<int>("candVetoFlag_RoiVsSLFWX",0);
417 auto candVetoFlag_RoiVsSLFWY = Monitored::Scalar<int>("candVetoFlag_RoiVsSLFWY",0);
418 auto candVetoFlag_EtaPhiBAX = Monitored::Scalar<float>("candVetoFlag_EtaPhiBAX",0.);
419 auto candVetoFlag_EtaPhiBAY = Monitored::Scalar<float>("candVetoFlag_EtaPhiBAY",0.);
420 auto candVetoFlag_EtaPhiECX = Monitored::Scalar<float>("candVetoFlag_EtaPhiECX",0.);
421 auto candVetoFlag_EtaPhiECY = Monitored::Scalar<float>("candVetoFlag_EtaPhiECY",0.);
422 auto candVetoFlag_EtaPhiFWX = Monitored::Scalar<float>("candVetoFlag_EtaPhiFWX",0.);
423 auto candVetoFlag_EtaPhiFWY = Monitored::Scalar<float>("candVetoFlag_EtaPhiFWY",0.);
424 auto candRoiVsSLBACentralSliceX = Monitored::Scalar<int>("candRoiVsSLBACentralSliceX",0);
425 auto candRoiVsSLBACentralSliceY = Monitored::Scalar<int>("candRoiVsSLBACentralSliceY",0);
426 auto candRoiVsSLECCentralSliceX = Monitored::Scalar<int>("candRoiVsSLECCentralSliceX",0);
427 auto candRoiVsSLECCentralSliceY = Monitored::Scalar<int>("candRoiVsSLECCentralSliceY",0);
428 auto candRoiVsSLFWCentralSliceX = Monitored::Scalar<int>("candRoiVsSLFWCentralSliceX",0);
429 auto candRoiVsSLFWCentralSliceY = Monitored::Scalar<int>("candRoiVsSLFWCentralSliceY",0);
430 auto candRoiVsSLBAOtherSliceX = Monitored::Scalar<int>("candRoiVsSLBAOtherSliceX",0);
431 auto candRoiVsSLBAOtherSliceY = Monitored::Scalar<int>("candRoiVsSLBAOtherSliceY",0);
432 auto candRoiVsSLECOtherSliceX = Monitored::Scalar<int>("candRoiVsSLECOtherSliceX",0);
433 auto candRoiVsSLECOtherSliceY = Monitored::Scalar<int>("candRoiVsSLECOtherSliceY",0);
434 auto candRoiVsSLFWOtherSliceX = Monitored::Scalar<int>("candRoiVsSLFWOtherSliceX",0);
435 auto candRoiVsSLFWOtherSliceY = Monitored::Scalar<int>("candRoiVsSLFWOtherSliceY",0);
436 auto candCandFlagsVsSLBACentralSliceX = Monitored::Scalar<int>("candCandFlagsVsSLBACentralSliceX",0);
437 auto candCandFlagsVsSLBACentralSliceY = Monitored::Scalar<int>("candCandFlagsVsSLBACentralSliceY",0);
438 auto candCandFlagsVsSLECCentralSliceX = Monitored::Scalar<int>("candCandFlagsVsSLECCentralSliceX",0);
439 auto candCandFlagsVsSLECCentralSliceY = Monitored::Scalar<int>("candCandFlagsVsSLECCentralSliceY",0);
440 auto candCandFlagsVsSLFWCentralSliceX = Monitored::Scalar<int>("candCandFlagsVsSLFWCentralSliceX",0);
441 auto candCandFlagsVsSLFWCentralSliceY = Monitored::Scalar<int>("candCandFlagsVsSLFWCentralSliceY",0);
442 auto candErrorFlagVsSLBACentralSlicePerLBX = Monitored::Scalar<int>("candErrorFlagVsSLBACentralSlicePerLBX",0);
443 auto candErrorFlagVsSLBACentralSlicePerLBY = Monitored::Scalar<int>("candErrorFlagVsSLBACentralSlicePerLBY",0);
444 auto candErrorFlagVsSLECCentralSlicePerLBX = Monitored::Scalar<int>("candErrorFlagVsSLECCentralSlicePerLBX",0);
445 auto candErrorFlagVsSLECCentralSlicePerLBY = Monitored::Scalar<int>("candErrorFlagVsSLECCentralSlicePerLBY",0);
446 auto candErrorFlagVsSLFWCentralSlicePerLBX = Monitored::Scalar<int>("candErrorFlagVsSLFWCentralSlicePerLBX",0);
447 auto candErrorFlagVsSLFWCentralSlicePerLBY = Monitored::Scalar<int>("candErrorFlagVsSLFWCentralSlicePerLBY",0);
448 auto candSliceVsSLBAX = Monitored::Scalar<int>("candSliceVsSLBAX",0);
449 auto candSliceVsSLBAY = Monitored::Scalar<int>("candSliceVsSLBAY",0);
450 auto candSliceVsSLECX = Monitored::Scalar<int>("candSliceVsSLECX",0);
451 auto candSliceVsSLECY = Monitored::Scalar<int>("candSliceVsSLECY",0);
452 auto candSliceVsSLFWX = Monitored::Scalar<int>("candSliceVsSLFWX",0);
453 auto candSliceVsSLFWY = Monitored::Scalar<int>("candSliceVsSLFWY",0);
454 auto candSliceCandTobDifferenceX = Monitored::Scalar<int>("candSliceCandTobDifferenceX");
455 auto candSliceCandTobDifferenceY = Monitored::Scalar<int>("candSliceCandTobDifferenceY");
456 auto candEtaPhi_NSWMonFlagX_EC = Monitored::Scalar<float>("candEtaPhi_NSWMonFlagX_EC",0);
457 auto candEtaPhi_NSWMonFlagY_EC = Monitored::Scalar<float>("candEtaPhi_NSWMonFlagY_EC",0);
458 auto candEtaPhi_NSWMonFlagX_FW = Monitored::Scalar<float>("candEtaPhi_NSWMonFlagX_FW",0);
459 auto candEtaPhi_NSWMonFlagY_FW = Monitored::Scalar<float>("candEtaPhi_NSWMonFlagY_FW",0);
460 auto candEtaPhi_Gt1CandRoiX_BA = Monitored::Scalar<float>("candEtaPhi_Gt1CandRoiX_BA",0);
461 auto candEtaPhi_Gt1CandRoiY_BA = Monitored::Scalar<float>("candEtaPhi_Gt1CandRoiY_BA",0);
462 auto candEtaPhi_PhiOverlapX_BA = Monitored::Scalar<float>("candEtaPhi_PhiOverlapX_BA",0);
463 auto candEtaPhi_PhiOverlapY_BA = Monitored::Scalar<float>("candEtaPhi_PhiOverlapY_BA",0);
464 auto candEtaPhi_SectorFlagGtNX_BA = Monitored::Scalar<float>("candEtaPhi_SectorFlagGtNX_BA",0); // BA: N>2, EC,FW: N>4
465 auto candEtaPhi_SectorFlagGtNY_BA = Monitored::Scalar<float>("candEtaPhi_SectorFlagGtNY_BA",0);
466 auto candEtaPhi_SectorFlagGtNX_EC = Monitored::Scalar<float>("candEtaPhi_SectorFlagGtNX_EC",0);
467 auto candEtaPhi_SectorFlagGtNY_EC = Monitored::Scalar<float>("candEtaPhi_SectorFlagGtNY_EC",0);
468 auto candEtaPhi_SectorFlagGtNX_FW = Monitored::Scalar<float>("candEtaPhi_SectorFlagGtNX_FW",0);
469 auto candEtaPhi_SectorFlagGtNY_FW = Monitored::Scalar<float>("candEtaPhi_SectorFlagGtNY_FW",0);
470 auto candSliceVsSLBAFirstInTrainX = Monitored::Scalar<int>("candSliceVsSLBAFirstInTrainX",0);
471 auto candSliceVsSLBAFirstInTrainY = Monitored::Scalar<int>("candSliceVsSLBAFirstInTrainY",0);
472 auto candSliceVsSLECFirstInTrainX = Monitored::Scalar<int>("candSliceVsSLECFirstInTrainX",0);
473 auto candSliceVsSLECFirstInTrainY = Monitored::Scalar<int>("candSliceVsSLECFirstInTrainY",0);
474 auto candSliceVsSLFWFirstInTrainX = Monitored::Scalar<int>("candSliceVsSLFWFirstInTrainX",0);
475 auto candSliceVsSLFWFirstInTrainY = Monitored::Scalar<int>("candSliceVsSLFWFirstInTrainY",0);
476
477 //TOB
478 auto tobEtaPhiAX = Monitored::Scalar<int>("tobEtaPhiAX",0);
479 auto tobEtaPhiAY = Monitored::Scalar<int>("tobEtaPhiAY",0);
480 auto tobEtaPhiA_GoodMFX = Monitored::Scalar<int>("tobEtaPhiA_GoodMFX",0);
481 auto tobEtaPhiA_GoodMFY = Monitored::Scalar<int>("tobEtaPhiA_GoodMFY",0);
482 auto tobEtaPhiA_InnerCoinX = Monitored::Scalar<int>("tobEtaPhiA_InnerCoinX",0);
483 auto tobEtaPhiA_InnerCoinY = Monitored::Scalar<int>("tobEtaPhiA_InnerCoinY",0);
484 auto tobEtaPhiA_BW23X = Monitored::Scalar<int>("tobEtaPhiA_BW23X",0);
485 auto tobEtaPhiA_BW23Y = Monitored::Scalar<int>("tobEtaPhiA_BW23Y",0);
486 auto tobEtaPhiA_ChargeX = Monitored::Scalar<int>("tobEtaPhiA_ChargeX",0);
487 auto tobEtaPhiA_ChargeY = Monitored::Scalar<int>("tobEtaPhiA_ChargeY",0);
488 auto tobEtaPhiCX = Monitored::Scalar<int>("tobEtaPhiCX",0);
489 auto tobEtaPhiCY = Monitored::Scalar<int>("tobEtaPhiCY",0);
490 auto tobEtaPhiC_GoodMFX = Monitored::Scalar<int>("tobEtaPhiC_GoodMFX",0);
491 auto tobEtaPhiC_GoodMFY = Monitored::Scalar<int>("tobEtaPhiC_GoodMFY",0);
492 auto tobEtaPhiC_InnerCoinX = Monitored::Scalar<int>("tobEtaPhiC_InnerCoinX",0);
493 auto tobEtaPhiC_InnerCoinY = Monitored::Scalar<int>("tobEtaPhiC_InnerCoinY",0);
494 auto tobEtaPhiC_BW23X = Monitored::Scalar<int>("tobEtaPhiC_BW23X",0);
495 auto tobEtaPhiC_BW23Y = Monitored::Scalar<int>("tobEtaPhiC_BW23Y",0);
496 auto tobEtaPhiC_ChargeX = Monitored::Scalar<int>("tobEtaPhiC_ChargeX",0);
497 auto tobEtaPhiC_ChargeY = Monitored::Scalar<int>("tobEtaPhiC_ChargeY",0);
498 auto tobPtVsEtaAX = Monitored::Scalar<int>("tobPtVsEtaAX",0);
499 auto tobPtVsEtaAY = Monitored::Scalar<int>("tobPtVsEtaAY",0);
500 auto tobPtVsPhiAX = Monitored::Scalar<int>("tobPtVsPhiAX",0);
501 auto tobPtVsPhiAY = Monitored::Scalar<int>("tobPtVsPhiAY",0);
502 auto tobPtVsEtaCX = Monitored::Scalar<int>("tobPtVsEtaCX",0);
503 auto tobPtVsEtaCY = Monitored::Scalar<int>("tobPtVsEtaCY",0);
504 auto tobPtVsPhiCX = Monitored::Scalar<int>("tobPtVsPhiCX",0);
505 auto tobPtVsPhiCY = Monitored::Scalar<int>("tobPtVsPhiCY",0);
506 auto tobEtaPhiXdecoded_BA = Monitored::Scalar<float>("tobEtaPhiXdecoded_BA",0.);
507 auto tobEtaPhiXdecoded_EC = Monitored::Scalar<float>("tobEtaPhiXdecoded_EC",0.);
508 auto tobEtaPhiXdecoded_FW = Monitored::Scalar<float>("tobEtaPhiXdecoded_FW",0.);
509 auto tobEtaPhiYdecoded_BA = Monitored::Scalar<float>("tobEtaPhiYdecoded_BA",0.);
510 auto tobEtaPhiYdecoded_EC = Monitored::Scalar<float>("tobEtaPhiYdecoded_EC",0.);
511 auto tobEtaPhiYdecoded_FW = Monitored::Scalar<float>("tobEtaPhiYdecoded_FW",0.);
512 auto tobEtaPhi_GoodMFXdecoded_EC = Monitored::Scalar<float>("tobEtaPhi_GoodMFXdecoded_EC",0);
513 auto tobEtaPhi_GoodMFXdecoded_FW = Monitored::Scalar<float>("tobEtaPhi_GoodMFXdecoded_FW",0);
514 auto tobEtaPhi_GoodMFYdecoded_EC = Monitored::Scalar<float>("tobEtaPhi_GoodMFYdecoded_EC",0);
515 auto tobEtaPhi_GoodMFYdecoded_FW = Monitored::Scalar<float>("tobEtaPhi_GoodMFYdecoded_FW",0);
516 auto tobEtaPhi_InnerCoinXdecoded_EC = Monitored::Scalar<float>("tobEtaPhi_InnerCoinXdecoded_EC",0);
517 auto tobEtaPhi_InnerCoinXdecoded_FW = Monitored::Scalar<float>("tobEtaPhi_InnerCoinXdecoded_FW",0);
518 auto tobEtaPhi_InnerCoinYdecoded_EC = Monitored::Scalar<float>("tobEtaPhi_InnerCoinYdecoded_EC",0);
519 auto tobEtaPhi_InnerCoinYdecoded_FW = Monitored::Scalar<float>("tobEtaPhi_InnerCoinYdecoded_FW",0);
520 auto tobEtaPhi_BW23Xdecoded_EC = Monitored::Scalar<float>("tobEtaPhi_BW23Xdecoded_EC",0);
521 auto tobEtaPhi_BW23Xdecoded_FW = Monitored::Scalar<float>("tobEtaPhi_BW23Xdecoded_FW",0);
522 auto tobEtaPhi_BW23Ydecoded_EC = Monitored::Scalar<float>("tobEtaPhi_BW23Ydecoded_EC",0);
523 auto tobEtaPhi_BW23Ydecoded_FW = Monitored::Scalar<float>("tobEtaPhi_BW23Ydecoded_FW",0);
524 auto tobEtaPhi_ChargeXdecoded_EC = Monitored::Scalar<float>("tobEtaPhi_ChargeXdecoded_EC",0);
525 auto tobEtaPhi_ChargeXdecoded_FW = Monitored::Scalar<float>("tobEtaPhi_ChargeXdecoded_FW",0);
526 auto tobEtaPhi_ChargeYdecoded_EC = Monitored::Scalar<float>("tobEtaPhi_ChargeYdecoded_EC",0);
527 auto tobEtaPhi_ChargeYdecoded_FW = Monitored::Scalar<float>("tobEtaPhi_ChargeYdecoded_FW",0);
528 auto tobPtVsEtaXdecoded_BA = Monitored::Scalar<float>("tobPtVsEtaXdecoded_BA",0);
529 auto tobPtVsEtaXdecoded_EC = Monitored::Scalar<float>("tobPtVsEtaXdecoded_EC",0);
530 auto tobPtVsEtaXdecoded_FW = Monitored::Scalar<float>("tobPtVsEtaXdecoded_FW",0);
531 auto tobPtVsEtaYdecoded_BA = Monitored::Scalar<float>("tobPtVsEtaYdecoded_BA",0);
532 auto tobPtVsEtaYdecoded_EC = Monitored::Scalar<float>("tobPtVsEtaYdecoded_EC",0);
533 auto tobPtVsEtaYdecoded_FW = Monitored::Scalar<float>("tobPtVsEtaYdecoded_FW",0);
534 auto tobPtVsPhiXdecoded_BA = Monitored::Scalar<float>("tobPtVsPhiXdecoded_BA",0);
535 auto tobPtVsPhiXdecoded_EC = Monitored::Scalar<float>("tobPtVsPhiXdecoded_EC",0);
536 auto tobPtVsPhiXdecoded_FW = Monitored::Scalar<float>("tobPtVsPhiXdecoded_FW",0);
537 auto tobPtVsPhiYdecoded_BA = Monitored::Scalar<float>("tobPtVsPhiYdecoded_BA",0);
538 auto tobPtVsPhiYdecoded_EC = Monitored::Scalar<float>("tobPtVsPhiYdecoded_EC",0);
539 auto tobPtVsPhiYdecoded_FW = Monitored::Scalar<float>("tobPtVsPhiYdecoded_FW",0);
540 auto tobCount = Monitored::Scalar<int>("tobCount");
541
542 //mlt
543 auto multThrX = Monitored::Scalar<int>("multThrX",0);
544 auto multBitsX = Monitored::Scalar<int>("multBitsX",0);
545 auto multThrVsLBX = Monitored::Scalar<int>("multThrVsLBX",0);
546 auto multThrVsLBY = Monitored::Scalar<int>("multThrVsLBY",0);
547 auto multBitsVsLBX = Monitored::Scalar<int>("multBitsVsLBX",0);
548 auto multBitsVsLBY = Monitored::Scalar<int>("multBitsVsLBY",0);
549
550 //get event info
551 auto eventInfo = GetEventInfo(ctx);
552 uint32_t currentLumiBlock = eventInfo->lumiBlock();
553 uint32_t currentBCID = eventInfo->bcid();
554
555 //get muctpi fragment data in the form of a vector of timeslices
556 const std::vector<LVL1::MuCTPIBits::Slice> &slices = theMuCTPI_Phase1_RDO->slices();
557
558 //count veto'd candidates, to be able to adjust the comparison between candidates and TOBs later
559 uint n_cand_veto,n_cand_A,n_cand_C;
560
561 //https://gitlab.cern.ch/atlas/athena/-/blob/master/Trigger/TrigT1/TrigT1Result/src/MuCTPI_DataWord_Decoder.cxx
562 //https://gitlab.cern.ch/atlas/athena/-/blob/master/Trigger/TrigT1/TrigT1Result/TrigT1Result/MuCTPI_DataWord_Decoder.h
563
564 //data is grouped in slices:
565 uint nSlices=theMuCTPI_Phase1_RDO->slices().size();
566 for(uint iSlice=0;iSlice<nSlices;iSlice++)
567 {
568
569 ATH_MSG_DEBUG( "MUCTPI DQ DEBUG: iSlice = "<<iSlice);
570
571 //assuming only 1,3,5,7 possible slices:
572 bool isCentralSlice=false;
573 if(nSlices==1)
574 isCentralSlice=true;
575 else
576 isCentralSlice = (nSlices-1)/2 == iSlice;
577
578 //-------------------------------------------------
579 // HEADER
580 //-------------------------------------------------
581 //uint header_bcid = slices[iSlice].bcid; //may be used later for comparison with RPC/TGC containers
582 uint header_tobCount = slices[iSlice].nTOB; //check during cand/topo section below
583 uint header_candCount = slices[iSlice].nCand;//check during cand/topo section below
584
586 //actually skipping this, since it is checked online by HLT (MUCTPI_BCIDOffsetsWrtROB)
587
588 //-------------------------------------------------
589 // MULTIPLICITY
590 //-------------------------------------------------
591
596
597 //decoded thresholds
598 for(uint iThr=0;iThr<slices[iSlice].mlt.cnt.size();iThr++)
599 {
600 bool thr = slices[iSlice].mlt.cnt[iThr];//this is a counter value [1-7], but only keeping whether it fired at all
601 if(thr)
602 {
603 multThrX = iThr;
604 fill(m_packageName, multThrX);
605 multThrVsLBX = currentLumiBlock;
606 multThrVsLBY = iThr;
607 fill(m_packageName, multThrVsLBX, multThrVsLBY);
608 }
609 }
610
611 //(still) encoded individual bits
612 for(uint iBit=0;iBit<64;iBit++)
613 {
614 bool bit = ( slices[iSlice].mlt.bits >> iBit ) & 0x1;
615 if(bit)
616 {
617 multBitsX = iBit;
618 fill(m_packageName, multBitsX);
619 multBitsVsLBX = currentLumiBlock;
620 multBitsVsLBY = iBit;
621 fill(m_packageName, multBitsVsLBX, multBitsVsLBY);
622 }
623 }
624
625 //-------------------------------------------------
626 // CANDIDATES
627 //-------------------------------------------------
628
629 if(header_candCount != slices[iSlice].cand.size())
630 {
631 errorSummaryMUCTPI=2;
632 fill(m_packageName, errorSummaryMUCTPI);
633 errorSummaryPerLumiBlockMUCTPIY=2;
634 errorSummaryPerLumiBlockMUCTPIX=currentLumiBlock;
635 fill(m_packageName, errorSummaryPerLumiBlockMUCTPIX, errorSummaryPerLumiBlockMUCTPIY);
636 }
637
638 // Fill the histogram of distribution of candidates count
639 // with info from central time slice
640 if(isCentralSlice)
641 {
642 candCount = header_candCount;
643 fill(m_packageName,candCount);
644
645 candCountVsLBY = header_candCount;
646 candCountVsLBX = currentLumiBlock;
647 fill(m_packageName,candCountVsLBX,candCountVsLBY);
648 }
649
650 n_cand_veto=0;
651 n_cand_A=0;
652 n_cand_C=0;
653
654 for(uint iCand=0;iCand<slices[iSlice].cand.size();iCand++)
655 {
657
660
664
666
668
669 ATH_MSG_DEBUG( "MUCTPI DQ DEBUG: iCand="<<iCand << " type="<<(int)slices[iSlice].cand[iCand].type<< " num="<<(int)slices[iSlice].cand[iCand].num<< " pt="<<slices[iSlice].cand[iCand].pt);
670
671 float candEta = slices[iSlice].cand[iCand].eta;
672 float candPhi = slices[iSlice].cand[iCand].phi;
673 bool vetoFlag = slices[iSlice].cand[iCand].vetoFlag;
674 bool side = slices[iSlice].cand[iCand].side;
675 if(side) n_cand_A++; else n_cand_C++;//only needed to make sure we have less than 16 cands/side for later check against TOB words
676
677 if(vetoFlag)
678 n_cand_veto++;
679
680 if(slices[iSlice].cand[iCand].type==LVL1::MuCTPIBits::SubsysID::Barrel)
681 {
682 uint num = slices[iSlice].cand[iCand].num + 32*(1-slices[iSlice].cand[iCand].side);//offset side C;
683 candPtBAX = slices[iSlice].cand[iCand].pt;
684 fill(m_packageName, candPtBAX);
685
686 candSLVsLBBAX = currentLumiBlock;
687 candSLVsLBBAY = num;
688 fill(m_packageName, candSLVsLBBAX, candSLVsLBBAY);
689
690 if(vetoFlag)
691 {
692 candVetoFlag_RoiVsSLBAX = num;
693 candVetoFlag_RoiVsSLBAY = slices[iSlice].cand[iCand].roi;
694 fill(m_packageName, candVetoFlag_RoiVsSLBAX, candVetoFlag_RoiVsSLBAY);
695
696 candVetoFlag_EtaPhiBAX = candEta;
697 candVetoFlag_EtaPhiBAY = candPhi;
698 fill(m_packageName, candVetoFlag_EtaPhiBAX, candVetoFlag_EtaPhiBAY);
699 }
700
701 if(slices[iSlice].cand[iCand].candFlag_phiOverlap)
702 {
703 candEtaPhi_PhiOverlapX_BA = candEta;
704 candEtaPhi_PhiOverlapY_BA = candPhi;
705 fill(m_packageName, candEtaPhi_PhiOverlapX_BA, candEtaPhi_PhiOverlapY_BA);
706 }
707
708 if(slices[iSlice].cand[iCand].candFlag_gt1CandRoi)
709 {
710 candEtaPhi_Gt1CandRoiX_BA = candEta;
711 candEtaPhi_Gt1CandRoiY_BA = candPhi;
712 fill(m_packageName,candEtaPhi_Gt1CandRoiX_BA,candEtaPhi_Gt1CandRoiY_BA);
713 }
714
715 if(slices[iSlice].cand[iCand].sectorFlag_gtN)
716 {
717 candEtaPhi_SectorFlagGtNX_BA = candEta;
718 candEtaPhi_SectorFlagGtNY_BA = candPhi;
719 fill(m_packageName,candEtaPhi_SectorFlagGtNX_BA,candEtaPhi_SectorFlagGtNY_BA);
720 }
721
722 candSliceVsSLBAX = num;
723 uint sliceIndex;
724 if(nSlices==7) sliceIndex = iSlice; //aligning the iSlice index for the 7-bin histo
725 else if(nSlices==5) sliceIndex = iSlice+1; //aligning the iSlice index for the 7-bin histo
726 else if(nSlices==3) sliceIndex = iSlice+2; //aligning the iSlice index for the 7-bin histo
727 else sliceIndex = 3; //central bin in a 7-bin histo
728 candSliceVsSLBAY=sliceIndex;
729 fill(m_packageName, candSliceVsSLBAX, candSliceVsSLBAY);
730
731 //same but checking BG match
732 //if currentBCID is in vector: bcidFirstInTrain, then fill histo
733 if(std::find(bcidFirstInTrain.begin(), bcidFirstInTrain.end(), currentBCID) != bcidFirstInTrain.end())
734 {
735 candSliceVsSLBAFirstInTrainX=num;
736 candSliceVsSLBAFirstInTrainY=sliceIndex;
737 fill(m_packageName, candSliceVsSLBAFirstInTrainX, candSliceVsSLBAFirstInTrainY);
738 }
739
740 if(isCentralSlice)
741 {
742 candRoiVsSLBACentralSliceX = num;
743 candRoiVsSLBACentralSliceY = slices[iSlice].cand[iCand].roi;
744 fill(m_packageName, candRoiVsSLBACentralSliceX, candRoiVsSLBACentralSliceY);
745
746 candCandFlagsVsSLBACentralSliceX = num;
747 candCandFlagsVsSLBACentralSliceY = 0;
748 if(slices[iSlice].cand[iCand].candFlag_gt1CandRoi)
749 fill(m_packageName, candCandFlagsVsSLBACentralSliceX, candCandFlagsVsSLBACentralSliceY);
750
751 candCandFlagsVsSLBACentralSliceY = 1;
752 if(slices[iSlice].cand[iCand].candFlag_phiOverlap)
753 fill(m_packageName, candCandFlagsVsSLBACentralSliceX, candCandFlagsVsSLBACentralSliceY);
754
755 candErrorFlagVsSLBACentralSlicePerLBX = currentLumiBlock;
756 candErrorFlagVsSLBACentralSlicePerLBY = num;
757 if(slices[iSlice].cand[iCand].errorFlag)
758 fill(m_packageName, candErrorFlagVsSLBACentralSlicePerLBX, candErrorFlagVsSLBACentralSlicePerLBY);
759 }
760 else
761 {
762 candRoiVsSLBAOtherSliceX = slices[iSlice].cand[iCand].num + 32*(1-slices[iSlice].cand[iCand].side);//offset side C
763 candRoiVsSLBAOtherSliceY = slices[iSlice].cand[iCand].roi;
764 fill(m_packageName, candRoiVsSLBAOtherSliceX, candRoiVsSLBAOtherSliceY);
765 }
766 } // if barrel end
767 else if(slices[iSlice].cand[iCand].type==LVL1::MuCTPIBits::SubsysID::Endcap)
768 {
769 uint num = slices[iSlice].cand[iCand].num + 48*(1-slices[iSlice].cand[iCand].side);//offset side C;
770
771 candPtECX = slices[iSlice].cand[iCand].pt;
772 fill(m_packageName, candPtECX);
773
774 candSLVsLBECX = currentLumiBlock;
775 candSLVsLBECY = num;
776 fill(m_packageName, candSLVsLBECX, candSLVsLBECY);
777
778 bool vetoFlag = slices[iSlice].cand[iCand].vetoFlag;
779 if(vetoFlag)
780 {
781 candVetoFlag_RoiVsSLECX = num;
782 candVetoFlag_RoiVsSLECY = slices[iSlice].cand[iCand].roi;
783 fill(m_packageName, candVetoFlag_RoiVsSLECX, candVetoFlag_RoiVsSLECY);
784
785 candVetoFlag_EtaPhiECX = candEta;
786 candVetoFlag_EtaPhiECY = candPhi;
787 fill(m_packageName, candVetoFlag_EtaPhiECX, candVetoFlag_EtaPhiECY);
788 }
789
790 if(slices[iSlice].cand[iCand].sectorFlag_nswMon)
791 {
792 candEtaPhi_NSWMonFlagX_EC = candEta;
793 candEtaPhi_NSWMonFlagY_EC = candPhi;
794 fill(m_packageName,candEtaPhi_NSWMonFlagX_EC,candEtaPhi_NSWMonFlagY_EC);
795 }
796
797 if(slices[iSlice].cand[iCand].sectorFlag_gtN)
798 {
799 candEtaPhi_SectorFlagGtNX_EC = candEta;
800 candEtaPhi_SectorFlagGtNY_EC = candPhi;
801 fill(m_packageName,candEtaPhi_SectorFlagGtNX_EC,candEtaPhi_SectorFlagGtNY_EC);
802 }
803
804 candSliceVsSLECX = num;
805 uint sliceIndex;
806 if(nSlices==7) sliceIndex = iSlice; //aligning the iSlice index for the 7-bin histo
807 else if(nSlices==5) sliceIndex = iSlice+1; //aligning the iSlice index for the 7-bin histo
808 else if(nSlices==3) sliceIndex = iSlice+2; //aligning the iSlice index for the 7-bin histo
809 else sliceIndex = 3; //central bin in a 7-bin histo
810 candSliceVsSLECY=sliceIndex;
811 fill(m_packageName, candSliceVsSLECX, candSliceVsSLECY);
812
813 //same but checking BG match
814 //if currentBCID is in vector: bcidFirstInTrain, then fill histo
815 if(std::find(bcidFirstInTrain.begin(), bcidFirstInTrain.end(), currentBCID) != bcidFirstInTrain.end())
816 {
817 candSliceVsSLECFirstInTrainX=num;
818 candSliceVsSLECFirstInTrainY=sliceIndex;
819 fill(m_packageName, candSliceVsSLECFirstInTrainX, candSliceVsSLECFirstInTrainY);
820 }
821
822 if(isCentralSlice)
823 {
824 candRoiVsSLECCentralSliceX = num;
825 candRoiVsSLECCentralSliceY = slices[iSlice].cand[iCand].roi;
826 fill(m_packageName, candRoiVsSLECCentralSliceX,candRoiVsSLECCentralSliceY);
827
828 candCandFlagsVsSLECCentralSliceX = num;
829 candCandFlagsVsSLECCentralSliceY = 0;
830 if(slices[iSlice].cand[iCand].candFlag_Charge)
831 fill(m_packageName, candCandFlagsVsSLECCentralSliceX, candCandFlagsVsSLECCentralSliceY);
832
833 candCandFlagsVsSLECCentralSliceY = 1;
834 if(slices[iSlice].cand[iCand].candFlag_BW23)
835 fill(m_packageName, candCandFlagsVsSLECCentralSliceX, candCandFlagsVsSLECCentralSliceY);
836
837 candCandFlagsVsSLECCentralSliceY = 2;
838 if(slices[iSlice].cand[iCand].candFlag_InnerCoin)
839 fill(m_packageName, candCandFlagsVsSLECCentralSliceX, candCandFlagsVsSLECCentralSliceY);
840
841 candCandFlagsVsSLECCentralSliceY = 3;
842 if(slices[iSlice].cand[iCand].candFlag_GoodMF)
843 fill(m_packageName, candCandFlagsVsSLECCentralSliceX, candCandFlagsVsSLECCentralSliceY);
844
845 candErrorFlagVsSLECCentralSlicePerLBX = currentLumiBlock;
846 candErrorFlagVsSLECCentralSlicePerLBY = num;
847 if(slices[iSlice].cand[iCand].errorFlag)
848 fill(m_packageName, candErrorFlagVsSLECCentralSlicePerLBX, candErrorFlagVsSLECCentralSlicePerLBY);
849 }
850 else
851 {
852 candRoiVsSLECOtherSliceX = num;//offset side C
853 candRoiVsSLECOtherSliceY = slices[iSlice].cand[iCand].roi;
854 fill(m_packageName, candRoiVsSLECOtherSliceX, candRoiVsSLECOtherSliceY);
855 }
856 } // if endcap end
857 else if(slices[iSlice].cand[iCand].type==LVL1::MuCTPIBits::SubsysID::Forward)
858 {
859 uint num = slices[iSlice].cand[iCand].num + 24*(1-slices[iSlice].cand[iCand].side);//offset side C;
860 candPtFWX = slices[iSlice].cand[iCand].pt;
861 fill(m_packageName, candPtFWX);
862
863 candSLVsLBFWX = currentLumiBlock;
864 candSLVsLBFWY = num;
865 fill(m_packageName, candSLVsLBFWX, candSLVsLBFWY);
866
867 bool vetoFlag = slices[iSlice].cand[iCand].vetoFlag;
868 if(vetoFlag)
869 {
870 candVetoFlag_RoiVsSLFWX = num;
871 candVetoFlag_RoiVsSLFWY = slices[iSlice].cand[iCand].roi;
872 fill(m_packageName, candVetoFlag_RoiVsSLFWX, candVetoFlag_RoiVsSLFWY);
873
874 candVetoFlag_EtaPhiFWX = candEta;
875 candVetoFlag_EtaPhiFWY = candPhi;
876 fill(m_packageName, candVetoFlag_EtaPhiFWX, candVetoFlag_EtaPhiFWY);
877 }
878
879 if(slices[iSlice].cand[iCand].sectorFlag_nswMon)
880 {
881 candEtaPhi_NSWMonFlagX_FW = candEta;
882 candEtaPhi_NSWMonFlagY_FW = candPhi;
883 fill(m_packageName,candEtaPhi_NSWMonFlagX_FW,candEtaPhi_NSWMonFlagY_FW);
884 }
885
886 if(slices[iSlice].cand[iCand].sectorFlag_gtN)
887 {
888 candEtaPhi_SectorFlagGtNX_FW = candEta;
889 candEtaPhi_SectorFlagGtNY_FW = candPhi;
890 fill(m_packageName,candEtaPhi_SectorFlagGtNX_FW,candEtaPhi_SectorFlagGtNY_FW);
891 }
892
893 candSliceVsSLFWX = num;
894 uint sliceIndex;
895 if(nSlices==7) sliceIndex = iSlice; //aligning the iSlice index for the 7-bin histo
896 else if(nSlices==5) sliceIndex = iSlice+1; //aligning the iSlice index for the 7-bin histo
897 else if(nSlices==3) sliceIndex = iSlice+2; //aligning the iSlice index for the 7-bin histo
898 else sliceIndex = 3; //central bin in a 7-bin histo
899 candSliceVsSLFWY=sliceIndex;
900 fill(m_packageName, candSliceVsSLFWX, candSliceVsSLFWY);
901
902 //same but checking BG match
903 //if currentBCID is in vector: bcidFirstInTrain, then fill histo
904 if(std::find(bcidFirstInTrain.begin(), bcidFirstInTrain.end(), currentBCID) != bcidFirstInTrain.end())
905 {
906 candSliceVsSLFWFirstInTrainX=num;
907 candSliceVsSLFWFirstInTrainY=sliceIndex;
908 fill(m_packageName, candSliceVsSLFWFirstInTrainX, candSliceVsSLFWFirstInTrainY);
909 }
910
911 if(isCentralSlice)
912 {
913 candRoiVsSLFWCentralSliceX = num;
914 candRoiVsSLFWCentralSliceY = slices[iSlice].cand[iCand].roi;
915 fill(m_packageName, candRoiVsSLFWCentralSliceX, candRoiVsSLFWCentralSliceY);
916
917 candCandFlagsVsSLFWCentralSliceX = num;
918 candCandFlagsVsSLFWCentralSliceY = 0;
919 if(slices[iSlice].cand[iCand].candFlag_Charge)
920 fill(m_packageName, candCandFlagsVsSLFWCentralSliceX, candCandFlagsVsSLFWCentralSliceY);
921
922 candCandFlagsVsSLFWCentralSliceY = 1;
923 if(slices[iSlice].cand[iCand].candFlag_BW23)
924 fill(m_packageName, candCandFlagsVsSLFWCentralSliceX, candCandFlagsVsSLFWCentralSliceY);
925
926 candCandFlagsVsSLFWCentralSliceY = 2;
927 if(slices[iSlice].cand[iCand].candFlag_InnerCoin)
928 fill(m_packageName, candCandFlagsVsSLFWCentralSliceX, candCandFlagsVsSLFWCentralSliceY);
929
930 candCandFlagsVsSLFWCentralSliceY = 3;
931 if(slices[iSlice].cand[iCand].candFlag_GoodMF)
932 fill(m_packageName, candCandFlagsVsSLFWCentralSliceX, candCandFlagsVsSLFWCentralSliceY);
933
934 candErrorFlagVsSLFWCentralSlicePerLBX = currentLumiBlock;
935 candErrorFlagVsSLFWCentralSlicePerLBY = num;
936 if(slices[iSlice].cand[iCand].errorFlag)
937 fill(m_packageName, candErrorFlagVsSLFWCentralSlicePerLBX, candErrorFlagVsSLFWCentralSlicePerLBY);
938 }
939 else
940 {
941 candRoiVsSLFWOtherSliceX = slices[iSlice].cand[iCand].num + 24*(1-slices[iSlice].cand[iCand].side);//offset side C
942 candRoiVsSLFWOtherSliceY = slices[iSlice].cand[iCand].roi;
943 fill(m_packageName, candRoiVsSLFWOtherSliceX, candRoiVsSLFWOtherSliceY);
944 }
945 } // if forward end
946 } // for cand loop end
947
948 //-------------------------------------------------
949 //TOBs
950 //-------------------------------------------------
951
955
960
963
965 if(header_tobCount != slices[iSlice].tob.size())
966 {
967 errorSummaryMUCTPI=3;
968 fill(m_packageName, errorSummaryMUCTPI);
969 errorSummaryPerLumiBlockMUCTPIY=3;
970 errorSummaryPerLumiBlockMUCTPIX=currentLumiBlock;
971 fill(m_packageName, errorSummaryPerLumiBlockMUCTPIX, errorSummaryPerLumiBlockMUCTPIY);
972 }
973
974 //Fill histogram of distribution of TOBs
975 //with information from central time slice
976 if(isCentralSlice)
977 {
978 tobCount = slices[iSlice].tob.size();
979 fill(m_packageName,tobCount);
980
981 if(slices[iSlice].bcid != currentBCID)
982 {
983 errorSummaryMUCTPI=1;
984 fill(m_packageName, errorSummaryMUCTPI);
985 errorSummaryPerLumiBlockMUCTPIY=1;
986 errorSummaryPerLumiBlockMUCTPIX=currentLumiBlock;
987 fill(m_packageName, errorSummaryPerLumiBlockMUCTPIX, errorSummaryPerLumiBlockMUCTPIY);
988 }
989 }
990
991 for(uint iTOB=0;iTOB<slices[iSlice].tob.size();iTOB++)
992 {
993
994 uint eta = slices[iSlice].tob[iTOB].etaRaw;
995 uint phi = slices[iSlice].tob[iTOB].phiRaw;
996 uint pt = slices[iSlice].tob[iTOB].pt;
997 float etaDecoded = slices[iSlice].tob[iTOB].etaDecoded;
998 float phiDecoded = slices[iSlice].tob[iTOB].phiDecoded;
999
1000 if(slices[iSlice].tob[iTOB].side==1)//A
1001 {
1002 // Filling the histogram without decoding
1003 tobEtaPhiAX = eta;
1004 tobEtaPhiAY = phi;
1005 fill(m_packageName, tobEtaPhiAX, tobEtaPhiAY);
1006
1007 tobPtVsEtaAX = eta;
1008 tobPtVsEtaAY = pt;
1009 fill(m_packageName, tobPtVsEtaAX, tobPtVsEtaAY);
1010
1011 tobPtVsPhiAX = phi;
1012 tobPtVsPhiAY = pt;
1013 fill(m_packageName, tobPtVsPhiAX, tobPtVsPhiAY);
1014
1015 if(slices[iSlice].tob[iTOB].candFlag_GoodMF) {
1016 tobEtaPhiA_GoodMFX = eta;
1017 tobEtaPhiA_GoodMFY = phi;
1018 fill(m_packageName, tobEtaPhiA_GoodMFX, tobEtaPhiA_GoodMFY);
1019 }
1020
1021 if(slices[iSlice].tob[iTOB].candFlag_InnerCoin) {
1022 tobEtaPhiA_InnerCoinX = eta;
1023 tobEtaPhiA_InnerCoinY = phi;
1024 fill(m_packageName, tobEtaPhiA_InnerCoinX, tobEtaPhiA_InnerCoinY);
1025 }
1026
1027 if(slices[iSlice].tob[iTOB].candFlag_BW23) {
1028 tobEtaPhiA_BW23X = eta;
1029 tobEtaPhiA_BW23Y = phi;
1030 fill(m_packageName, tobEtaPhiA_BW23X, tobEtaPhiA_BW23Y);
1031 }
1032
1033 if(slices[iSlice].tob[iTOB].candFlag_Charge) {
1034 tobEtaPhiA_ChargeX = eta;
1035 tobEtaPhiA_ChargeY = phi;
1036 fill(m_packageName, tobEtaPhiA_ChargeX, tobEtaPhiA_ChargeY);
1037 }
1038
1039 // Filling the histogram with decoded eta/phi
1040 switch(slices[iSlice].tob[iTOB].det)
1041 {
1042 case 0: // BA
1043 {
1044 tobEtaPhiXdecoded_BA = etaDecoded;
1045 tobEtaPhiYdecoded_BA = phiDecoded;
1046 fill(m_packageName, tobEtaPhiXdecoded_BA, tobEtaPhiYdecoded_BA);
1047
1048 tobPtVsEtaXdecoded_BA = etaDecoded;
1049 tobPtVsEtaYdecoded_BA = pt;
1050 fill(m_packageName, tobPtVsEtaXdecoded_BA, tobPtVsEtaYdecoded_BA);
1051
1052 tobPtVsPhiXdecoded_BA = phiDecoded;
1053 tobPtVsPhiYdecoded_BA = pt;
1054 fill(m_packageName, tobPtVsPhiXdecoded_BA, tobPtVsPhiYdecoded_BA);
1055
1056 break;
1057 }
1058 case 1: // FW
1059 {
1060 tobEtaPhiXdecoded_FW = etaDecoded;
1061 tobEtaPhiYdecoded_FW = phiDecoded;
1062 fill(m_packageName, tobEtaPhiXdecoded_FW, tobEtaPhiYdecoded_FW);
1063
1064 tobPtVsEtaXdecoded_FW = etaDecoded;
1065 tobPtVsEtaYdecoded_FW = pt;
1066 fill(m_packageName, tobPtVsEtaXdecoded_FW, tobPtVsEtaYdecoded_FW);
1067
1068 tobPtVsPhiXdecoded_FW = phiDecoded;
1069 tobPtVsPhiYdecoded_FW = pt;
1070 fill(m_packageName, tobPtVsPhiXdecoded_FW, tobPtVsPhiYdecoded_FW);
1071
1072 if(slices[iSlice].tob[iTOB].candFlag_GoodMF) {
1073 tobEtaPhi_GoodMFXdecoded_FW = etaDecoded;
1074 tobEtaPhi_GoodMFYdecoded_FW = phiDecoded;
1075 fill(m_packageName, tobEtaPhi_GoodMFXdecoded_FW, tobEtaPhi_GoodMFYdecoded_FW);
1076 }
1077
1078 if(slices[iSlice].tob[iTOB].candFlag_InnerCoin) {
1079 tobEtaPhi_InnerCoinXdecoded_FW = etaDecoded;
1080 tobEtaPhi_InnerCoinYdecoded_FW = phiDecoded;
1081 fill(m_packageName, tobEtaPhi_InnerCoinXdecoded_FW, tobEtaPhi_InnerCoinYdecoded_FW);
1082 }
1083
1084 if(slices[iSlice].tob[iTOB].candFlag_BW23) {
1085 tobEtaPhi_BW23Xdecoded_FW = etaDecoded;
1086 tobEtaPhi_BW23Ydecoded_FW = phiDecoded;
1087 fill(m_packageName, tobEtaPhi_BW23Xdecoded_FW, tobEtaPhi_BW23Ydecoded_FW);
1088 }
1089
1090 if(slices[iSlice].tob[iTOB].candFlag_Charge) {
1091 tobEtaPhi_ChargeXdecoded_FW = etaDecoded;
1092 tobEtaPhi_ChargeYdecoded_FW = phiDecoded;
1093 fill(m_packageName, tobEtaPhi_ChargeXdecoded_FW, tobEtaPhi_ChargeYdecoded_FW);
1094 }
1095
1096 break;
1097 }
1098 case 2: // EC
1099 {
1100 tobEtaPhiXdecoded_EC = etaDecoded;
1101 tobEtaPhiYdecoded_EC = phiDecoded;
1102 fill(m_packageName, tobEtaPhiXdecoded_EC, tobEtaPhiYdecoded_EC);
1103
1104 tobPtVsEtaXdecoded_EC = etaDecoded;
1105 tobPtVsEtaYdecoded_EC = pt;
1106 fill(m_packageName, tobPtVsEtaXdecoded_EC, tobPtVsEtaYdecoded_EC);
1107
1108 tobPtVsPhiXdecoded_EC = phiDecoded;
1109 tobPtVsPhiYdecoded_EC = pt;
1110 fill(m_packageName, tobPtVsPhiXdecoded_EC, tobPtVsPhiYdecoded_EC);
1111
1112 if(slices[iSlice].tob[iTOB].candFlag_GoodMF) {
1113 tobEtaPhi_GoodMFXdecoded_EC = etaDecoded;
1114 tobEtaPhi_GoodMFYdecoded_EC = phiDecoded;
1115 fill(m_packageName, tobEtaPhi_GoodMFXdecoded_EC, tobEtaPhi_GoodMFYdecoded_EC);
1116 }
1117
1118 if(slices[iSlice].tob[iTOB].candFlag_InnerCoin) {
1119 tobEtaPhi_InnerCoinXdecoded_EC = etaDecoded;
1120 tobEtaPhi_InnerCoinYdecoded_EC = phiDecoded;
1121 fill(m_packageName, tobEtaPhi_InnerCoinXdecoded_EC, tobEtaPhi_InnerCoinYdecoded_EC);
1122 }
1123
1124 if(slices[iSlice].tob[iTOB].candFlag_BW23) {
1125 tobEtaPhi_BW23Xdecoded_EC = etaDecoded;
1126 tobEtaPhi_BW23Ydecoded_EC = phiDecoded;
1127 fill(m_packageName, tobEtaPhi_BW23Xdecoded_EC, tobEtaPhi_BW23Ydecoded_EC);
1128 }
1129
1130 if(slices[iSlice].tob[iTOB].candFlag_Charge) {
1131 tobEtaPhi_ChargeXdecoded_EC = etaDecoded;
1132 tobEtaPhi_ChargeYdecoded_EC = phiDecoded;
1133 fill(m_packageName, tobEtaPhi_ChargeXdecoded_EC, tobEtaPhi_ChargeYdecoded_EC);
1134 }
1135 break;
1136 }
1137 }
1138 }//side A
1139 else
1140 {
1141 tobEtaPhiCX = eta;
1142 tobEtaPhiCY = phi;
1143 fill(m_packageName, tobEtaPhiCX, tobEtaPhiCY);
1144
1145 tobPtVsEtaCX = eta;
1146 tobPtVsEtaCY = pt;
1147 fill(m_packageName, tobPtVsEtaCX, tobPtVsEtaCY);
1148
1149 tobPtVsPhiCX = phi;
1150 tobPtVsPhiCY = pt;
1151 fill(m_packageName, tobPtVsPhiCX, tobPtVsPhiCY);
1152
1153 if(slices[iSlice].tob[iTOB].candFlag_GoodMF) {
1154 tobEtaPhiC_GoodMFX = eta;
1155 tobEtaPhiC_GoodMFY = phi;
1156 fill(m_packageName, tobEtaPhiC_GoodMFX, tobEtaPhiC_GoodMFY);
1157 }
1158
1159 if(slices[iSlice].tob[iTOB].candFlag_InnerCoin) {
1160 tobEtaPhiC_InnerCoinX = eta;
1161 tobEtaPhiC_InnerCoinY = phi;
1162 fill(m_packageName, tobEtaPhiC_InnerCoinX, tobEtaPhiC_InnerCoinY);
1163 }
1164
1165 if(slices[iSlice].tob[iTOB].candFlag_BW23) {
1166 tobEtaPhiC_BW23X = eta;
1167 tobEtaPhiC_BW23Y = phi;
1168 fill(m_packageName, tobEtaPhiC_BW23X, tobEtaPhiC_BW23Y);
1169 }
1170
1171 if(slices[iSlice].tob[iTOB].candFlag_Charge) {
1172 tobEtaPhiC_ChargeX = eta;
1173 tobEtaPhiC_ChargeY = phi;
1174 fill(m_packageName, tobEtaPhiC_ChargeX, tobEtaPhiC_ChargeY);
1175 }
1176
1177 // filling histograms with decoded values of eta/phi
1178 switch(slices[iSlice].tob[iTOB].det)
1179 {
1180 // BA
1181 case 0:
1182 {
1183 tobEtaPhiXdecoded_BA = etaDecoded;
1184 tobEtaPhiYdecoded_BA = phiDecoded;
1185 fill(m_packageName, tobEtaPhiXdecoded_BA, tobEtaPhiYdecoded_BA);
1186
1187 tobPtVsEtaXdecoded_BA = etaDecoded;
1188 tobPtVsEtaYdecoded_BA = pt;
1189 fill(m_packageName, tobPtVsEtaXdecoded_BA, tobPtVsEtaYdecoded_BA);
1190
1191 tobPtVsPhiXdecoded_BA = phiDecoded;
1192 tobPtVsPhiYdecoded_BA = pt;
1193 fill(m_packageName, tobPtVsPhiXdecoded_BA, tobPtVsPhiYdecoded_BA);
1194
1195 break;
1196 }
1197
1198 // FW
1199 case 1:
1200 {
1201 tobEtaPhiXdecoded_FW = etaDecoded;
1202 tobEtaPhiYdecoded_FW = phiDecoded;
1203 fill(m_packageName, tobEtaPhiXdecoded_FW, tobEtaPhiYdecoded_FW);
1204
1205 tobPtVsEtaXdecoded_FW = etaDecoded;
1206 tobPtVsEtaYdecoded_FW = pt;
1207 fill(m_packageName, tobPtVsEtaXdecoded_FW, tobPtVsEtaYdecoded_FW);
1208
1209 tobPtVsPhiXdecoded_FW = phiDecoded;
1210 tobPtVsPhiYdecoded_FW = pt;
1211 fill(m_packageName, tobPtVsPhiXdecoded_FW, tobPtVsPhiYdecoded_FW);
1212
1213 if(slices[iSlice].tob[iTOB].candFlag_GoodMF) {
1214 tobEtaPhi_GoodMFXdecoded_FW = etaDecoded;
1215 tobEtaPhi_GoodMFYdecoded_FW = phiDecoded;
1216 fill(m_packageName, tobEtaPhi_GoodMFXdecoded_FW, tobEtaPhi_GoodMFYdecoded_FW);
1217 }
1218
1219 if(slices[iSlice].tob[iTOB].candFlag_InnerCoin) {
1220 tobEtaPhi_InnerCoinXdecoded_FW = etaDecoded;
1221 tobEtaPhi_InnerCoinYdecoded_FW = phiDecoded;
1222 fill(m_packageName, tobEtaPhi_InnerCoinXdecoded_FW, tobEtaPhi_InnerCoinYdecoded_FW);
1223 }
1224
1225 if(slices[iSlice].tob[iTOB].candFlag_BW23) {
1226 tobEtaPhi_BW23Xdecoded_FW = etaDecoded;
1227 tobEtaPhi_BW23Ydecoded_FW = phiDecoded;
1228 fill(m_packageName, tobEtaPhi_BW23Xdecoded_FW, tobEtaPhi_BW23Ydecoded_FW);
1229 }
1230
1231 if(slices[iSlice].tob[iTOB].candFlag_Charge) {
1232 tobEtaPhi_ChargeXdecoded_FW = etaDecoded;
1233 tobEtaPhi_ChargeYdecoded_FW = phiDecoded;
1234 fill(m_packageName, tobEtaPhi_ChargeXdecoded_FW, tobEtaPhi_ChargeYdecoded_FW);
1235 }
1236
1237 break;
1238 }
1239
1240 // EC
1241 case 2:
1242 {
1243 tobEtaPhiXdecoded_EC = etaDecoded;
1244 tobEtaPhiYdecoded_EC = phiDecoded;
1245 fill(m_packageName, tobEtaPhiXdecoded_EC, tobEtaPhiYdecoded_EC);
1246
1247 tobPtVsEtaXdecoded_EC = etaDecoded;
1248 tobPtVsEtaYdecoded_EC = pt;
1249 fill(m_packageName, tobPtVsEtaXdecoded_EC, tobPtVsEtaYdecoded_EC);
1250
1251 tobPtVsPhiXdecoded_EC = phiDecoded;
1252 tobPtVsPhiYdecoded_EC = pt;
1253 fill(m_packageName, tobPtVsPhiXdecoded_EC, tobPtVsPhiYdecoded_EC);
1254
1255 if(slices[iSlice].tob[iTOB].candFlag_GoodMF) {
1256 tobEtaPhi_GoodMFXdecoded_EC = etaDecoded;
1257 tobEtaPhi_GoodMFYdecoded_EC = phiDecoded;
1258 fill(m_packageName, tobEtaPhi_GoodMFXdecoded_EC, tobEtaPhi_GoodMFYdecoded_EC);
1259 }
1260
1261 if(slices[iSlice].tob[iTOB].candFlag_InnerCoin) {
1262 tobEtaPhi_InnerCoinXdecoded_EC = etaDecoded;
1263 tobEtaPhi_InnerCoinYdecoded_EC = phiDecoded;
1264 fill(m_packageName, tobEtaPhi_InnerCoinXdecoded_EC, tobEtaPhi_InnerCoinYdecoded_EC);
1265 }
1266
1267 if(slices[iSlice].tob[iTOB].candFlag_BW23) {
1268 tobEtaPhi_BW23Xdecoded_EC = etaDecoded;
1269 tobEtaPhi_BW23Ydecoded_EC = phiDecoded;
1270 fill(m_packageName, tobEtaPhi_BW23Xdecoded_EC, tobEtaPhi_BW23Ydecoded_EC);
1271 }
1272
1273 if(slices[iSlice].tob[iTOB].candFlag_Charge) {
1274 tobEtaPhi_ChargeXdecoded_EC = etaDecoded;
1275 tobEtaPhi_ChargeYdecoded_EC = phiDecoded;
1276 fill(m_packageName, tobEtaPhi_ChargeXdecoded_EC, tobEtaPhi_ChargeYdecoded_EC);
1277 }
1278
1279 break;
1280 }
1281 }
1282 }//side C
1283
1284 bool found_match{false};//used at the end of every cand iteration, to notify in case TOB equivalent not found
1285 // We loop over the list of candidates to search a match with the TOB
1286 for(uint j=0; j<slices[iSlice].cand.size(); ++j)
1287 {
1288 //skip candidate if veto'd (if veto'd => there is no corresponding TOB)
1289 if(slices[iSlice].cand[j].vetoFlag)
1290 continue;
1291
1292 if( slices[iSlice].tob[iTOB].side == slices[iSlice].cand[j].side &&
1293 slices[iSlice].tob[iTOB].subsystem == slices[iSlice].cand[j].subsystem &&
1294 slices[iSlice].tob[iTOB].sec == slices[iSlice].cand[j].num &&
1295 slices[iSlice].tob[iTOB].pt == slices[iSlice].cand[j].mappedPt &&
1296 slices[iSlice].tob[iTOB].etaDecoded == slices[iSlice].cand[j].eta &&
1297 slices[iSlice].tob[iTOB].phiDecoded == slices[iSlice].cand[j].phi )
1298 {
1299 found_match = true;
1300 ATH_MSG_DEBUG("Found the correspondence tob/cand in the same ROI");
1301 break;
1302 }
1303 }//cand loop
1304
1305 //if didn't exceed 16 cand/side, then topo should match cand words and should always have a match
1306 //(otherwise, there will be cand words without TOB word equivalent)
1307 if(n_cand_A<=16 && n_cand_C<=16)
1308 if(!found_match)
1309 {
1310 ATH_MSG_WARNING("Mismatch tob/cand words");
1311 errorSummaryMUCTPI=5;
1312 fill(m_packageName, errorSummaryMUCTPI);
1313 errorSummaryPerLumiBlockMUCTPIX=currentLumiBlock;
1314 errorSummaryPerLumiBlockMUCTPIY=5;
1315 fill(m_packageName, errorSummaryPerLumiBlockMUCTPIX, errorSummaryPerLumiBlockMUCTPIY);
1316 }
1317 }//TOB for loop
1318
1319 //-------------------------------------------------
1320 //combined
1321 //-------------------------------------------------
1322 if(n_cand_A<=16 && n_cand_C<=16)
1323 {
1324 if(slices[iSlice].cand.size()-n_cand_veto!=slices[iSlice].tob.size())
1325 {
1326 ATH_MSG_INFO("MUCTPI DQ INFO: Cand & TOB #words not equal. LB="
1327 <<std::dec<<currentLumiBlock
1328 <<". Cand.size="<<slices[iSlice].cand.size()
1329 <<" n_cand_veto="<<n_cand_veto
1330 <<" tob.size="<<slices[iSlice].tob.size());
1331 errorSummaryMUCTPI=4;
1332 fill(m_packageName, errorSummaryMUCTPI);
1333 errorSummaryPerLumiBlockMUCTPIY=4;
1334 errorSummaryPerLumiBlockMUCTPIX=currentLumiBlock;
1335 fill(m_packageName, errorSummaryPerLumiBlockMUCTPIX, errorSummaryPerLumiBlockMUCTPIY);
1336 }
1337 }
1338
1339 // Check if Muon candidate count in the Timeslice header matches
1340 // the number of candidate words.
1341 // The same check is done also for TOBs.
1342 if(slices[iSlice].nCand != slices[iSlice].cand.size())
1343 {
1344 errorSummaryMUCTPI = 2;
1345 fill(m_packageName,errorSummaryMUCTPI);
1346 errorSummaryPerLumiBlockMUCTPIY=2;
1347 errorSummaryPerLumiBlockMUCTPIX=currentLumiBlock;
1348 fill(m_packageName, errorSummaryPerLumiBlockMUCTPIX, errorSummaryPerLumiBlockMUCTPIY);
1349 }
1350
1351 if(slices[iSlice].nTOB != slices[iSlice].tob.size())
1352 {
1353 errorSummaryMUCTPI = 3;
1354 fill(m_packageName,errorSummaryMUCTPI);
1355 errorSummaryPerLumiBlockMUCTPIY=3;
1356 errorSummaryPerLumiBlockMUCTPIX=currentLumiBlock;
1357 fill(m_packageName, errorSummaryPerLumiBlockMUCTPIX, errorSummaryPerLumiBlockMUCTPIY);
1358 }
1359
1360
1361 }// slice for loop
1362
1363
1364 //-------------------------------------------------
1365 //status data word (last word in data words)
1366 //-------------------------------------------------
1367
1370
1371 //get muctpi fragment data in the form of a vector of timeslices
1372 const std::vector< size_t > &errorBits = theMuCTPI_Phase1_RDO->errorBits();
1373
1374 for(uint iBit=0;iBit<errorBits.size();iBit++)
1375 {
1376 if(errorBits[iBit])
1377 {
1378 statusDataWordMUCTPI=iBit;
1379 fill(m_packageName, statusDataWordMUCTPI);
1380 statusDataWordPerLumiBlockMUCTPIX=iBit;
1381 statusDataWordPerLumiBlockMUCTPIY=currentLumiBlock;
1382 fill(m_packageName, statusDataWordPerLumiBlockMUCTPIX, statusDataWordPerLumiBlockMUCTPIY);
1383 }
1384 }
1385
1386}
1387
1388
1389void
1391 const RpcSectorLogicContainer* theRPCContainer,
1392 const Muon::TgcCoinDataContainer* theTGCContainer,
1393 const EventContext& ctx) const
1394{
1395 ATH_MSG_DEBUG( "CTPMON begin doMuctpi()");
1396 //ERROR histos
1397 auto errorSummaryX = Monitored::Scalar<int>("errorSummaryX",0);
1398 auto errorSummaryY = Monitored::Scalar<int>("errorSummaryY",0);
1399 auto errorSummaryPerLumiBlockX = Monitored::Scalar<int>("errorSummaryPerLumiBlockX",0);
1400 auto errorSummaryPerLumiBlockY = Monitored::Scalar<int>("errorSummaryPerLumiBlockY",0);
1401 auto errorPerLumiBlockX = Monitored::Scalar<int>("errorPerLumiBlockX",0);
1402 //MUCTPI
1403 auto nCandidatesX = Monitored::Scalar<int>("nCandidatesX",0);
1404 auto nCandidatesDataWordX = Monitored::Scalar<int>("nCandidatesDataWordX",0);
1405 auto ptX = Monitored::Scalar<int>("ptX",0);
1406 auto nCandidatesPtX = Monitored::Scalar<int>("nCandidatesPtX",0);
1407 auto nCandidatesPtY = Monitored::Scalar<int>("nCandidatesPtY",0);
1408 auto nCandidatesDataWordPtX = Monitored::Scalar<int>("nCandidatesDataWordPtX",0);
1409 auto nCandidatesDataWordPtY = Monitored::Scalar<int>("nCandidatesDataWordPtY",0);
1410 auto nCandidatesMictpMioctX = Monitored::Scalar<int>("nCandidatesMictpMioctX",0);
1411 auto bcidMictpMioctX = Monitored::Scalar<int>("bcidMictpMioctX",0);
1412 //auto bcidMictpHeaderX = Monitored::Scalar<int>("bcidMictpHeaderX",0);
1413 //auto muctpiStatus1X = Monitored::Scalar<int>("muctpiStatus1X",0);
1414 //auto muctpiStatus2X = Monitored::Scalar<int>("muctpiStatus2X",0);
1415 auto barrelRoiSectorIDX = Monitored::Scalar<int>("barrelRoiSectorIDX",0);
1416 auto barrelRoiSectorIDY = Monitored::Scalar<int>("barrelRoiSectorIDY",0);
1417 auto endcapRoiSectorIDX = Monitored::Scalar<int>("endcapRoiSectorIDX",0);
1418 auto endcapRoiSectorIDY = Monitored::Scalar<int>("endcapRoiSectorIDY",0);
1419 auto forwardRoiSectorIDX = Monitored::Scalar<int>("forwardRoiSectorIDX",0);
1420 auto forwardRoiSectorIDY = Monitored::Scalar<int>("forwardRoiSectorIDY",0);
1421 auto barrelRoiSectorIDAllX = Monitored::Scalar<int>("barrelRoiSectorIDAllX",0);
1422 auto barrelRoiSectorIDAllY = Monitored::Scalar<int>("barrelRoiSectorIDAllY",0);
1423 auto endcapRoiSectorIDAllX = Monitored::Scalar<int>("endcapRoiSectorIDAllX",0);
1424 auto endcapRoiSectorIDAllY = Monitored::Scalar<int>("endcapRoiSectorIDAllY",0);
1425 auto forwardRoiSectorIDAllX = Monitored::Scalar<int>("forwardRoiSectorIDAllX",0);
1426 auto forwardRoiSectorIDAllY = Monitored::Scalar<int>("forwardRoiSectorIDAllY",0);
1427 auto barrelNCandSectorIDX = Monitored::Scalar<int>("barrelNCandSectorIDX",0);
1428 auto barrelNCandSectorIDY = Monitored::Scalar<int>("barrelNCandSectorIDY",0);
1429 auto endcapNCandSectorIDX = Monitored::Scalar<int>("endcapNCandSectorIDX",0);
1430 auto endcapNCandSectorIDY = Monitored::Scalar<int>("endcapNCandSectorIDY",0);
1431 auto forwardNCandSectorIDX = Monitored::Scalar<int>("forwardNCandSectorIDX",0);
1432 auto forwardNCandSectorIDY = Monitored::Scalar<int>("forwardNCandSectorIDY",0);
1433 auto barrelSectorIDOverlapBitsX = Monitored::Scalar<int>("barrelSectorIDOverlapBitsX",0);
1434 auto barrelSectorIDOverlapBitsY = Monitored::Scalar<int>("barrelSectorIDOverlapBitsY",0);
1435 auto endcapSectorIDOverlapBitX = Monitored::Scalar<int>("endcapSectorIDOverlapBitX",0);
1436 auto endcapSectorIDOverlapBitY = Monitored::Scalar<int>("endcapSectorIDOverlapBitY",0);
1437 auto barrelSectorIDX = Monitored::Scalar<int>("barrelSectorIDX",0);
1438 auto barrelSectorIDY = Monitored::Scalar<int>("barrelSectorIDY",0);
1439 auto endcapSectorIDX = Monitored::Scalar<int>("endcapSectorIDX",0);
1440 auto endcapSectorIDY = Monitored::Scalar<int>("endcapSectorIDY",0);
1441 auto forwardSectorIDX = Monitored::Scalar<int>("forwardSectorIDX",0);
1442 auto forwardSectorIDY = Monitored::Scalar<int>("forwardSectorIDY",0);
1443 auto barrelSectorIDAllX = Monitored::Scalar<int>("barrelSectorIDAllX",0);
1444 auto endcapSectorIDAllX = Monitored::Scalar<int>("endcapSectorIDAllX",0);
1445 auto forwardSectorIDAllX = Monitored::Scalar<int>("forwardSectorIDAllX",0);
1446 auto barrelPtX = Monitored::Scalar<int>("barrelPtX",0);
1447 auto endcapPtX = Monitored::Scalar<int>("endcapPtX",0);
1448 auto forwardPtX = Monitored::Scalar<int>("forwardPtX",0);
1449
1450 auto muctpiNoRPCCandfoundX = Monitored::Scalar<int>("muctpiNoRPCCandfoundX",0);
1451 auto muctpiNoRPCCandfoundY = Monitored::Scalar<int>("muctpiNoRPCCandfoundY",0);
1452 auto rpcNoMuCTPICandfoundX = Monitored::Scalar<int>("rpcNoMuCTPICandfoundX",0);
1453 auto rpcNoMuCTPICandfoundY = Monitored::Scalar<int>("rpcNoMuCTPICandfoundY",0);
1454 auto muctpiNoTGCecCandfoundX = Monitored::Scalar<int>("muctpiNoTGCecCandfoundX",0);
1455 auto muctpiNoTGCecCandfoundY = Monitored::Scalar<int>("muctpiNoTGCecCandfoundY",0);
1456 auto tgcecNoMuCTPICandfoundX = Monitored::Scalar<int>("tgcecNoMuCTPICandfoundX",0);
1457 auto tgcecNoMuCTPICandfoundY = Monitored::Scalar<int>("tgcecNoMuCTPICandfoundY",0);
1458 auto muctpiNoTGCfwCandfoundX = Monitored::Scalar<int>("muctpiNoTGCfwCandfoundX",0);
1459 auto muctpiNoTGCfwCandfoundY = Monitored::Scalar<int>("muctpiNoTGCfwCandfoundY",0);
1460 auto tgcfwNoMuCTPICandfoundX = Monitored::Scalar<int>("tgcfwNoMuCTPICandfoundX",0);
1461 auto tgcfwNoMuCTPICandfoundY = Monitored::Scalar<int>("tgcfwNoMuCTPICandfoundY",0);
1462
1463 // maps for comapring MuCTPI and RPC/TGC candidates
1464 std::map <std::string,MuCTPI_DataWord_Decoder> muctpiCandidates;
1465 std::map <std::string, const RpcSLTriggerHit* > rpcCandidates;
1466 std::map <std::string, const Muon::TgcCoinData* > tgcCandidates;
1467
1468 // Get the data
1470 MuCTPI_DataWord_Decoder dataWord(0);
1471 const std::vector<uint32_t> &vDataWords = theMuCTPI_RDO->dataWord();
1472 auto eventInfo = GetEventInfo(ctx);
1473
1474 /*
1475 * Number of muon candidates
1476 */
1477 uint16_t numberCandidates = multWord.getNCandidates();
1478 //if (numberCandidates > 0) ++m_filledEventCount;
1479 nCandidatesX = numberCandidates;
1480 fill(m_packageName, nCandidatesX);
1481
1482 for ( unsigned int i(0); i < LVL1::MuCTPIBits::MULT_THRESH_NUM; ++i ) {
1483 nCandidatesPtX = i+1u;
1484 nCandidatesPtY = multWord.getMultiplicity(i);
1485 fill(m_packageName, nCandidatesPtX, nCandidatesPtY);
1486 }
1487 /*
1488 * Consistency check: number of MICTP candidates vs. no of MIOCT
1489 * candidate words
1490 */
1491 int numberDataWords = 0;
1492 int ncand[3][96] = {}; //count number of candidates per event (0 barrel, 1 endcap, 2 forward)
1493 /* for ( int x = 0; x < 3; x++ ) {
1494 for ( int y = 0; y < 96; y++ ) {
1495 ncand[x][y]=0;
1496 }
1497 }*/
1498
1499 // because of overlap removal (and saturation) the number of data words may be different
1500 // from the reported candidate multiplicity => also check data words!
1501 // bookkeeping array to count per pT threshold
1502 int nCandsPerPtThreshold[6] = {0, 0, 0, 0, 0, 0};
1503
1504 for ( auto it = vDataWords.begin(); it != vDataWords.end(); ++it ) {
1505 dataWord.setWord(*it);
1506 std::ostringstream keystring;
1507
1508 //count all candidates for sector multiplicities
1509 if (dataWord.getSectorLocation() == MuCTPI_RDO::BARREL) {
1510 ++ncand[0][dataWord.getSectorID(1)+32*dataWord.getHemisphere()];
1511 keystring << "BA" << dataWord.getSectorID(1)+32*dataWord.getHemisphere() <<"-RoI" << dataWord.getRoiNumber()
1512 << "-Pt" << dataWord.getPt();
1513 }
1514 else if (dataWord.getSectorLocation() == MuCTPI_RDO::ENDCAP) {
1515 ++ncand[1][dataWord.getSectorID()+48*dataWord.getHemisphere()];
1516 keystring << "EC" << dataWord.getSectorID()+48*dataWord.getHemisphere() <<"-RoI" << dataWord.getRoiNumber()
1517 << "-Pt" << dataWord.getPt();
1518 }
1519 else if (dataWord.getSectorLocation() == MuCTPI_RDO::FORWARD) {
1520 ++ncand[2][dataWord.getSectorID()+24*dataWord.getHemisphere()];
1521 keystring << "FW" << dataWord.getSectorID()+24*dataWord.getHemisphere() <<"-RoI" << dataWord.getRoiNumber()
1522 << "-Pt" << dataWord.getPt();
1523 }
1524 }
1525
1526 for ( int y = 0; y < 96; y++ ) {
1527 if ( y < 64 ) {
1528 barrelNCandSectorIDX = y;
1529 barrelNCandSectorIDY = ncand[0][y];
1530 fill(m_packageName, barrelNCandSectorIDX, barrelNCandSectorIDY);
1531 }
1532 endcapNCandSectorIDX = y;
1533 endcapNCandSectorIDY = ncand[1][y];
1534 fill(m_packageName, endcapNCandSectorIDX, endcapNCandSectorIDY);
1535 if ( y < 48 ){
1536 forwardNCandSectorIDX = y;
1537 forwardNCandSectorIDY = ncand[2][y];
1538 fill(m_packageName, forwardNCandSectorIDX, forwardNCandSectorIDY);
1539 }
1540 }
1541
1542 // multiplicities based on the data words
1543 nCandidatesDataWordX = numberDataWords;
1544 fill(m_packageName, nCandidatesDataWordX);
1545
1546 for (int i = 0; i < 6; ++i) {
1547 nCandidatesDataWordPtX = i+1;
1548 nCandidatesDataWordPtY = nCandsPerPtThreshold[i];
1549 fill(m_packageName, nCandidatesDataWordPtX, nCandidatesDataWordPtY);
1550 }
1551
1552 if (m_inclusiveTriggerThresholds && (numberDataWords > 7)) numberDataWords = 7;
1553
1554 int diffNCandidates = (static_cast<int>(numberCandidates) - numberDataWords);
1555 uint32_t currentLumiBlock = eventInfo->lumiBlock();
1556
1557 if (diffNCandidates != 0) {
1558 //patrick ATH_MSG_WARNING
1559 ATH_MSG_DEBUG( "Number of candidates in multiplicity word " << numberCandidates
1560 << " != number of candidates " << numberDataWords << " from " << vDataWords.size() << " data words");
1561 // dump multiplicity and data words (DEBUG level)
1562 multWord.dumpData();
1563 for ( std::vector<uint32_t>::const_iterator it = vDataWords.begin(); it != vDataWords.end(); ++it ) {
1564 dataWord.setWord(*it);
1565 dataWord.dumpData();
1566 }
1567 errorSummaryX = 4;
1568 errorSummaryY = 1;
1569 fill(m_packageName, errorSummaryX, errorSummaryY);
1570 errorSummaryPerLumiBlockX = currentLumiBlock;
1571 errorSummaryPerLumiBlockY = 4;
1572 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
1573 errorPerLumiBlockX = currentLumiBlock;
1574 fill(m_packageName, errorPerLumiBlockX);
1575 }
1576 else {
1577 errorSummaryX = 4;
1578 errorSummaryY = 0;
1579 fill(m_packageName, errorSummaryX, errorSummaryY);
1580 }
1581 nCandidatesMictpMioctX = diffNCandidates;
1582 fill(m_packageName, nCandidatesMictpMioctX);
1583
1584 /*
1585 * BCIDs
1586 */
1587 //uint16_t mictpBcid = multWord.getBCID();
1588 //uint16_t candidateBcid = 0;
1589 //uint16_t headerBcid =
1590 // (theMuCTPI_RIO) ? theMuCTPI_RIO->getHeaderBCID() : 0;
1591 //bcidMictpHeaderX = mictpBcid - (headerBcid & 7);
1592 //fill(m_packageName, bcidMictpHeaderX);
1593
1594 /*
1595 * pT thresholds of the MIOCT candidate words
1596 */
1597 std::vector<Int_t> MioctPtCount(LVL1::MuCTPIBits::MULT_THRESH_NUM, 0);
1598 std::vector<uint32_t>::const_iterator it = vDataWords.begin();
1599 std::vector<uint32_t>::const_iterator end = vDataWords.end();
1600
1601 for ( ; it != end; ++it ) {
1602 dataWord.setWord(*it);
1603 //dataWord.dumpData();
1604 //Fill sector occupancy for all candidates
1605 if (dataWord.getSectorLocation() == MuCTPI_RDO::BARREL) {
1606 barrelSectorIDAllX = dataWord.getSectorID(1)+32*dataWord.getHemisphere();
1607 fill(m_packageName, barrelSectorIDAllX);
1608 barrelRoiSectorIDAllX = dataWord.getSectorID(1)+32*dataWord.getHemisphere();
1609 barrelRoiSectorIDAllY = dataWord.getRoiNumber();
1610 fill(m_packageName, barrelRoiSectorIDAllX, barrelRoiSectorIDAllY);
1611 }
1612 else if (dataWord.getSectorLocation() == MuCTPI_RDO::ENDCAP) {
1613 endcapSectorIDAllX = dataWord.getSectorID()+48*dataWord.getHemisphere();
1614 fill(m_packageName, barrelSectorIDAllX);
1615 endcapRoiSectorIDAllX = dataWord.getSectorID()+48*dataWord.getHemisphere();
1616 endcapRoiSectorIDAllY = dataWord.getRoiNumber();
1617 fill(m_packageName, endcapRoiSectorIDAllX, endcapRoiSectorIDAllY);
1618 }
1619 else if (dataWord.getSectorLocation() == MuCTPI_RDO::FORWARD) {
1620 forwardSectorIDAllX = dataWord.getSectorID()+24*dataWord.getHemisphere();
1621 fill(m_packageName, forwardSectorIDAllX);
1622 forwardRoiSectorIDAllX = dataWord.getSectorID()+24*dataWord.getHemisphere();
1623 forwardRoiSectorIDAllY = dataWord.getRoiNumber();
1624 fill(m_packageName, forwardRoiSectorIDAllX, forwardRoiSectorIDAllY);
1625 }
1626
1627 // Use only non-vetoed candidates from the same BCID for multiplicity calculation
1628 if ( ! dataWord.getVetoed() ) {
1629 uint16_t candPt = dataWord.getPt();
1630 ptX = candPt;
1631 fill(m_packageName, ptX);
1632 if (0 < candPt && candPt <= LVL1::MuCTPIBits::MULT_THRESH_NUM) {
1634 for ( uint16_t i(0); i < candPt; ++i )
1635 if (MioctPtCount[i] < 7) {
1636 MioctPtCount[i] += 1;
1637 }
1638 } else {
1639 if (MioctPtCount[candPt - 1] < 7) {
1640 MioctPtCount[candPt - 1] += 1;
1641 }
1642 }
1643 }
1644 if (dataWord.getSectorLocation() == MuCTPI_RDO::BARREL) {
1645 barrelSectorIDX = dataWord.getSectorID(1)+32*dataWord.getHemisphere();
1646 fill(m_packageName, barrelSectorIDX);
1647 barrelRoiSectorIDX = dataWord.getSectorID(1)+32*dataWord.getHemisphere();
1648 barrelRoiSectorIDY = dataWord.getRoiNumber();
1649 fill(m_packageName, barrelRoiSectorIDX, barrelRoiSectorIDY);
1650 }
1651 else if (dataWord.getSectorLocation() == MuCTPI_RDO::ENDCAP) {
1652 endcapSectorIDX = dataWord.getSectorID()+48*dataWord.getHemisphere();
1653 fill(m_packageName, endcapSectorIDX);
1654 endcapRoiSectorIDX = dataWord.getSectorID()+48*dataWord.getHemisphere();
1655 endcapRoiSectorIDY = dataWord.getRoiNumber();
1656 fill(m_packageName, endcapRoiSectorIDX, endcapRoiSectorIDY);
1657 }
1658 else if (dataWord.getSectorLocation() == MuCTPI_RDO::FORWARD) {
1659 forwardSectorIDX = dataWord.getSectorID()+24*dataWord.getHemisphere();
1660 fill(m_packageName, forwardSectorIDX);
1661 forwardRoiSectorIDX = dataWord.getSectorID()+24*dataWord.getHemisphere();
1662 forwardRoiSectorIDY = dataWord.getRoiNumber();
1663 fill(m_packageName, forwardRoiSectorIDX, forwardRoiSectorIDY);
1664 }
1665 }
1666 if (dataWord.getSectorLocation() == MuCTPI_RDO::BARREL) {
1667 barrelPtX = dataWord.getPt();
1668 fill(m_packageName, barrelPtX);
1669 }
1670 else if (dataWord.getSectorLocation() == MuCTPI_RDO::ENDCAP) {
1671 endcapPtX = dataWord.getPt();
1672 fill(m_packageName, endcapPtX);
1673 }
1674 else if (dataWord.getSectorLocation() == MuCTPI_RDO::FORWARD) {
1675 forwardPtX = dataWord.getPt();
1676 fill(m_packageName, forwardPtX);
1677 }
1678 }
1679
1680 /*
1681 * Consistency check: MICTP vs MIOCT multiplicity
1682 */
1683 bool anyMismatch = false;
1684 for ( uint16_t i = 0; i < LVL1::MuCTPIBits::MULT_THRESH_NUM; ++i ) {
1685 if ( multWord.getMultiplicity(i) != MioctPtCount[i] ) {
1686 anyMismatch = true;
1687 //patrick ATH_MSG_WARNING
1688 ATH_MSG_DEBUG( "pT threshold " << i+1 << ": MICTP multiplicity (" << multWord.getMultiplicity(i)
1689 << ") not equal MIOCT multiplicity (" << MioctPtCount[i] << ")");
1690 errorSummaryX = 5;
1691 errorSummaryY = 1;
1692 fill(m_packageName, errorSummaryX, errorSummaryY);
1693 errorSummaryPerLumiBlockX = currentLumiBlock;
1694 errorSummaryPerLumiBlockY = 5;
1695 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
1696 errorPerLumiBlockX = currentLumiBlock;
1697 fill(m_packageName, errorPerLumiBlockX);
1698 }
1699 }
1700 if ( !anyMismatch ) {
1701 errorSummaryX = 5;
1702 errorSummaryY = 0;
1703 fill(m_packageName, errorSummaryX, errorSummaryY);
1704 }
1705 // dump multiplicity and data words (DEBUG level)
1706 multWord.dumpData();
1707 for ( std::vector<uint32_t>::const_iterator it = vDataWords.begin(); it != vDataWords.end(); ++it ) {
1708 dataWord.setWord(*it);
1709 dataWord.dumpData();
1710 }
1711
1712 /*
1713 * Check the error status words of the ROD Header
1714 */
1715 /*
1716 if (theMuCTPI_RIO) {
1717 uint32_t num = theMuCTPI_RIO->getHeaderNumberStatusWords();
1718 std::vector<uint32_t> vStatus = theMuCTPI_RIO->getHeaderStatusWords();
1719 for ( uint32_t i = 0; i < num; ++i ) {
1720 if (vStatus[i] == 0) continue;
1721 int Status = -1;
1722 if (i == 0) {
1723 ATH_MSG_DEBUG( "MuCTPI error status word #" << i << ": 0x" << MSG::hex << vStatus[i] << MSG::dec);
1724 Status = 1;
1725 } else if (i == 1) {
1726 Status = 2;
1727 } else {
1728 continue;
1729 }
1730 for ( int bit = 0; bit < 24; ++bit ) {
1731 if (vStatus[i] & (1 << bit)) {
1732 if (Status == 1) {
1733 muctpiStatus1X = bit;
1734 fill(m_packageName, muctpiStatus1X);
1735 }
1736 else if (Status == 2) {
1737 muctpiStatus2X = bit;
1738 fill(m_packageName, muctpiStatus2X);
1739 }
1740 }
1741 }
1742 }
1743 }
1744 */
1745 // Get candidates from TGC and RPC SLs for comparisons
1746 RpcSectorLogicContainer::const_iterator it_rpc = theRPCContainer->begin();
1747 for ( ; it_rpc !=theRPCContainer->end() ; ++it_rpc )
1748 {
1749 // Loop over the trigger hits of each sector
1750 RpcSectorLogic::const_iterator it_rpc_hit = (*it_rpc) -> begin();
1751 for ( ; it_rpc_hit != (*it_rpc) -> end() ; ++it_rpc_hit )
1752 {
1753 if (!(*it_rpc_hit) -> isInput() && (*it_rpc_hit) -> rowinBcid() == 1) {
1754 std::ostringstream rpckey;
1755 rpckey << "BA" << (*it_rpc)->sectorId() <<"-RoI" << (*it_rpc_hit) -> roi()
1756 << "-Pt" << (*it_rpc_hit) -> ptId();
1757 rpcCandidates.insert (std::pair<std::string, const RpcSLTriggerHit* >(rpckey.str(),(*it_rpc_hit)));
1758 }
1759 }
1760 }
1761
1762 for (const Muon::TgcCoinDataCollection* tgc_coll : *theTGCContainer) {
1763 for (const Muon::TgcCoinData* tgc_coin : *tgc_coll) {
1764 if (tgc_coin->pt() != 0 ) {
1765 std::ostringstream tgckey;
1766 if (tgc_coin->isForward()) { // Forward sector, account for different numbering scheme in SL readout
1767 int secID = tgc_coin->phi();
1768 if (secID == 24) secID = 0;
1769 tgckey << "FW" << secID+(24*tgc_coin->isAside()) <<"-RoI" << tgc_coin->roi()
1770 << "-Pt" << tgc_coin->pt();
1771 } else { // Endcap sector, account for different numbering scheme in SL readout
1772 int secID = tgc_coin->phi()+1;
1773 if (secID == 48 ) secID = 0;
1774 else if (secID == 49 ) secID = 1;
1775 tgckey << "EC" << secID + (48*tgc_coin->isAside()) <<"-RoI" << tgc_coin->roi()
1776 << "-Pt" << tgc_coin->pt();
1777 }
1778 tgcCandidates.emplace(tgckey.str(), tgc_coin);
1779 }
1780 }
1781 }
1782 // Now loop over MuCTPI/RPC/TGC maps and try to find matching keys, and plot candidates where no match is found
1783 // loop over MUCTPI candidates and try to find match in RPC/TGC maps
1784
1785 bool miRPCmismatch = false;
1786 bool miTGCmismatch = false;
1787 for (std::map<std::string,MuCTPI_DataWord_Decoder>::const_iterator it_mui = muctpiCandidates.begin();
1788 it_mui != muctpiCandidates.end(); ++it_mui) {
1789 int tgcnum = tgcCandidates.count(it_mui->first);
1790 int rpcnum = rpcCandidates.count(it_mui->first);
1791 if (tgcnum > 0 || rpcnum > 0 ) {
1792 ATH_MSG_DEBUG( "MuCTPI to RPC/TGC match found: MuCTPI key/ MuCTPI BCID / #TGC matches / #RPC matches: "
1793 << it_mui->first << " / " << /*it_mui->second.getBCID() <<*/ " / "
1794 << tgcnum << " / " << rpcnum);
1795 } else {
1796 std::string det = (it_mui->first).substr(0,2);
1797 if ( det == "BA" ) {
1798 int baSecID = (it_mui->second).getSectorID(1)+32*(it_mui->second).getHemisphere();
1799 int baRoIID = (it_mui->second).getRoiNumber();
1800 muctpiNoRPCCandfoundX = baRoIID;
1801 muctpiNoRPCCandfoundY = baSecID;
1802 fill(m_packageName, muctpiNoRPCCandfoundX, muctpiNoRPCCandfoundY);
1803 miRPCmismatch = true;
1804 } else if ( det == "EC" ) {
1805 int ecSecID = (it_mui->second).getSectorID()+48*(it_mui->second).getHemisphere();
1806 int ecRoIID = (it_mui->second).getRoiNumber();
1807 muctpiNoTGCecCandfoundX = ecRoIID;
1808 muctpiNoTGCecCandfoundY = ecSecID;
1809 fill(m_packageName, muctpiNoTGCecCandfoundX, muctpiNoTGCecCandfoundY);
1810 miTGCmismatch= true;
1811 }else if ( det == "FW" ) {
1812 int fwSecID = (it_mui->second).getSectorID()+24*(it_mui->second).getHemisphere();
1813 int fwRoIID = (it_mui->second).getRoiNumber();
1814 muctpiNoTGCfwCandfoundX = fwRoIID;
1815 muctpiNoTGCfwCandfoundY = fwSecID;
1816 fill(m_packageName, muctpiNoTGCfwCandfoundX, muctpiNoTGCfwCandfoundY);
1817 miTGCmismatch= true;
1818 } else {
1819 ATH_MSG_WARNING( "Invalid string label in MuCTPI to RPC/TGC map: " << det);
1820 }
1821 ATH_MSG_WARNING( "No Muctpi to RPC/TGC match found: MuCTPI key / MuCTPI BCID: " << it_mui->first << " / ");
1822 }
1823 }
1824 if (miRPCmismatch) {
1825 errorSummaryX = 17;
1826 errorSummaryY = 1;
1827 fill(m_packageName, errorSummaryX, errorSummaryY);
1828 errorSummaryPerLumiBlockX = currentLumiBlock;
1829 errorSummaryPerLumiBlockY = 17;
1830 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
1831 errorPerLumiBlockX = currentLumiBlock;
1832 fill(m_packageName, errorPerLumiBlockX);
1833 } else {
1834 errorSummaryX = 17;
1835 errorSummaryY = 0;
1836 fill(m_packageName, errorSummaryX, errorSummaryY);
1837 }
1838 if (miTGCmismatch) {
1839 errorSummaryX = 18;
1840 errorSummaryY = 1;
1841 fill(m_packageName, errorSummaryX, errorSummaryY);
1842 errorSummaryPerLumiBlockX = currentLumiBlock;
1843 errorSummaryPerLumiBlockY = 18;
1844 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
1845 errorPerLumiBlockX = currentLumiBlock;
1846 fill(m_packageName, errorPerLumiBlockX);
1847 } else {
1848 errorSummaryX = 18;
1849 errorSummaryY = 0;
1850 fill(m_packageName, errorSummaryX, errorSummaryY);
1851 }
1852
1853
1854 bool rpcMImismatch = false;
1855 // loop over RPC candidates and try to find match in Muctpi map
1856 for (std::map<std::string, const RpcSLTriggerHit*>::const_iterator it_rpc = rpcCandidates.begin();
1857 it_rpc != rpcCandidates.end(); ++it_rpc) {
1858 int muinum = muctpiCandidates.count(it_rpc->first);
1859 if (muinum > 0) {
1860 ATH_MSG_DEBUG( " RPC to Muctpi match found: RPC key / RPC BCID / # matches: "
1861 << it_rpc->first << " / " << it_rpc->second->rowinBcid() << " / "
1862 << muinum);
1863 } else {
1864 int idEnd = (it_rpc->first).find("-RoI");
1865 int secID = std::stoi((it_rpc->first).substr(2,idEnd-2));
1866 int roiID = (it_rpc->second)->roi();
1867 rpcNoMuCTPICandfoundX = roiID;
1868 rpcNoMuCTPICandfoundY = secID;
1869 fill(m_packageName, rpcNoMuCTPICandfoundX, rpcNoMuCTPICandfoundY);
1870 //patrick ATH_MSG_WARNING
1871 ATH_MSG_DEBUG( "No RPC to Muctpi match found: RPC key / RPC BCID: "
1872 << it_rpc->first << " / " << it_rpc->second->rowinBcid());
1873 rpcMImismatch =true;
1874 }
1875 }
1876 if (rpcMImismatch) {
1877 errorSummaryX = 19;
1878 errorSummaryY = 1;
1879 fill(m_packageName, errorSummaryX, errorSummaryY);
1880 errorSummaryPerLumiBlockX = currentLumiBlock;
1881 errorSummaryPerLumiBlockY = 19;
1882 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
1883 errorPerLumiBlockX = currentLumiBlock;
1884 fill(m_packageName, errorPerLumiBlockX);
1885 } else {
1886 errorSummaryX = 19;
1887 errorSummaryY = 0;
1888 fill(m_packageName, errorSummaryX, errorSummaryY);
1889 }
1890 bool tgcMImismatch = false;
1891 // loop over TGC candidates and try to find match in Muctpi map
1892 for (std::map<std::string, const Muon::TgcCoinData* >::const_iterator it_tgc = tgcCandidates.begin();
1893 it_tgc != tgcCandidates.end(); ++it_tgc) {
1894 int muinum = muctpiCandidates.count(it_tgc->first);
1895 if (muinum > 0) {
1896 ATH_MSG_DEBUG( "TGC to Muctpi match found: TGC key / TGC BCID / # matches: "
1897 << it_tgc->first << " / " << (int)TgcDigit::BC_CURRENT << muinum);
1898 } else {
1899 int idEnd = (it_tgc->first).find("-RoI");
1900 int secID = std::stoi((it_tgc->first).substr(2,idEnd-2));
1901 std::string det = (it_tgc->first).substr(0,2);
1902 if ( det == "EC" ) {
1903 int ecRoIID = (it_tgc->second)->roi();
1904 tgcecNoMuCTPICandfoundX = ecRoIID;
1905 tgcecNoMuCTPICandfoundY = secID;
1906 fill(m_packageName, tgcecNoMuCTPICandfoundX, tgcecNoMuCTPICandfoundY);
1907 }else if ( det == "FW" ) {
1908 int fwRoIID = (it_tgc->second)->roi();
1909 tgcfwNoMuCTPICandfoundX = fwRoIID;
1910 tgcfwNoMuCTPICandfoundY = secID;
1911 fill(m_packageName, tgcfwNoMuCTPICandfoundX, tgcfwNoMuCTPICandfoundY);
1912 } else {
1913 ATH_MSG_WARNING( "Invalid string label in TGC to MuCTPI map: "
1914 << det );
1915 }
1916 ATH_MSG_WARNING( "No TGC to Muctpi match found: TGC key: " << it_tgc->first);
1917 tgcMImismatch =true;
1918 }
1919 }
1920 if (tgcMImismatch) {
1921 errorSummaryX = 20;
1922 errorSummaryY = 1;
1923 fill(m_packageName, errorSummaryX, errorSummaryY);
1924 errorSummaryPerLumiBlockX = currentLumiBlock;
1925 errorSummaryPerLumiBlockY = 20;
1926 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
1927 errorPerLumiBlockX = currentLumiBlock;
1928 fill(m_packageName, errorPerLumiBlockX);
1929 } else {
1930 errorSummaryX = 20;
1931 errorSummaryY = 0;
1932 fill(m_packageName, errorSummaryX, errorSummaryY);
1933 }
1934 }
1935
1936void
1938 const CTP_RIO* theCTP_RIO,
1939 const EventContext& ctx) const
1940{
1941 ATH_MSG_DEBUG( "CTPMON begin doCtp()");
1942 //ERROR histos
1943 auto errorSummaryX = Monitored::Scalar<int>("errorSummaryX",0);
1944 auto errorSummaryY = Monitored::Scalar<int>("errorSummaryY",0);
1945 auto errorSummaryPerLumiBlockX = Monitored::Scalar<int>("errorSummaryPerLumiBlockX",0);
1946 auto errorSummaryPerLumiBlockY = Monitored::Scalar<int>("errorSummaryPerLumiBlockY",0);
1947 auto errorPerLumiBlockX = Monitored::Scalar<int>("errorPerLumiBlockX",0);
1948 //CTP
1949 auto deltaBcidX = Monitored::Scalar<int>("deltaBcidX",0);
1950 auto triggerTypeX = Monitored::Scalar<int>("triggerTypeX",0);
1951 auto timeSinceLBStartX = Monitored::Scalar<int>("timeSinceLBStartX",0);
1952 auto timeUntilLBEndX = Monitored::Scalar<int>("timeUntilLBEndX",0);
1953 auto timeSinceL1AX = Monitored::Scalar<int>("timeSinceL1AX",0);
1954 auto turnCounterTimeErrorX = Monitored::Scalar<int>("turnCounterTimeErrorX",0);
1955 auto turnCounterTimeErrorVsLbX = Monitored::Scalar<int>("turnCounterTimeErrorVsLbX",0);
1956 auto turnCounterTimeErrorVsLbY = Monitored::Scalar<int>("turnCounterTimeErrorVsLbY",0);
1957 auto pitBCX = Monitored::Scalar<int>("pitBCX",0);
1958 auto pitBCY = Monitored::Scalar<int>("pitBCY",0);
1959 auto pitFirstBCX = Monitored::Scalar<int>("pitFirstBCX",0);
1960 auto pitFirstBCY = Monitored::Scalar<int>("pitFirstBCY",0);
1961 auto tavX = Monitored::Scalar<int>("tavX",0);
1962 auto tavY = Monitored::Scalar<int>("tavY",0);
1963 auto ctpStatus1X = Monitored::Scalar<int>("ctpStatus1X",0);
1964 auto ctpStatus2X = Monitored::Scalar<int>("ctpStatus2X",0);
1965
1966 auto eventInfo = GetEventInfo(ctx);
1967
1968 //get the cool data here:
1969 uint64_t lb_stime = 0;
1970 uint64_t lb_etime = 0;
1971 bool retrievedLumiBlockTimes = false;
1972 if (!m_isSim) {
1974 const AthenaAttributeList* lblbattrList{*lblb};
1975 if (lblbattrList==nullptr) {
1976 ATH_MSG_WARNING("Failed to retrieve /TRIGGER/LUMI/LBLB " << m_LBLBFolderInputKey.key() << " not found");
1977 }
1978 else {
1979 retrievedLumiBlockTimes = true;
1980 auto lb_stime_loc = (*lblbattrList)["StartTime"].data<cool::UInt63>();
1981 auto lb_etime_loc = (*lblbattrList)["EndTime"].data<cool::UInt63>();
1982 lb_stime = lb_stime_loc;
1983 lb_etime = lb_etime_loc;
1984 ATH_MSG_DEBUG("lb_stime: " << lb_stime << " lb_etime: " << lb_etime );
1985 }
1986 }
1987
1988 //currentBeamMode
1989 std::string currentBeamMode = "sorry: not available!";
1990 if (!m_isSim){
1992 const CondAttrListCollection* fillstateattrListColl { *fillstate };
1993 if ( fillstateattrListColl == nullptr ) {
1994 ATH_MSG_WARNING("/LHC/DCS/FILLSTATE " << m_FILLSTATEFolderInputKey.key() << " not found");
1995 }
1996 else{
1998 for (itrcoll = fillstateattrListColl->begin(); itrcoll != fillstateattrListColl->end(); ++itrcoll) {
1999 const coral::AttributeList &atr = itrcoll->second;
2000 currentBeamMode = *(static_cast<const std::string *>((atr["BeamMode"]).addressOfData()));
2001 }
2002 }
2003 }
2004 ATH_MSG_DEBUG("BeamMode: " << currentBeamMode );
2005
2006 //DataTakingMode
2007 int readyForPhysics = -1;
2008 if (!m_isSim){
2010 const AthenaAttributeList* datatakingmodeattrList{*datatakingmode};
2011 if (datatakingmodeattrList==nullptr) {
2012 ATH_MSG_WARNING( "Failed to retrieve /TDAQ/RunCtrl/DataTakingMode with key " << m_DataTakingModeFolderInputKey.key());
2013 }
2014 else{
2015 auto readyForPhysics_loc = (*datatakingmodeattrList)["ReadyForPhysics"].data<uint32_t>();
2016 readyForPhysics = readyForPhysics_loc;
2017 ATH_MSG_DEBUG( "readyForPhysics: " << readyForPhysics);
2018 }
2019 }
2020 uint32_t evId = 0;
2021 uint32_t headerBcid = 0;
2022 int ttype=0;
2023
2024 CTP_Decoder ctp;
2025 ctp.setRDO(theCTP_RDO);
2026
2027 if (theCTP_RIO) {
2028 evId = theCTP_RIO->getLvl1Id();
2029 ttype = theCTP_RIO->getLvl1TriggerType();
2030 triggerTypeX = ttype;
2031 fill(m_packageName, triggerTypeX);
2032
2033 headerBcid = (theCTP_RIO->getBCID() & 0xf);
2034
2035 uint32_t currentLumiBlock = eventInfo->lumiBlock();
2036 // check that the LB number is the same in the EventInfo and the CTP_RIO. TODO: add error for this?
2037 if (currentLumiBlock != (theCTP_RIO->getDetectorEventType() & 0xffff)) {
2038 ATH_MSG_WARNING( "LB number in EventInfo (" << currentLumiBlock
2039 << ") does not match the one in the CTP_RIO object ("
2040 << (theCTP_RIO->getDetectorEventType() & 0xffff) << ")");
2041 }
2042 ATH_MSG_DEBUG( "Run number: " << eventInfo->runNumber() << ", Event: " << eventInfo->eventNumber() << ", LB: " << eventInfo->lumiBlock() );
2043
2044 //if (currentLumiBlock > m_maxLumiBlock) m_maxLumiBlock = currentLumiBlock;
2045 if (currentLumiBlock < 1 ) //||
2046 // (retrievedLumiBlockTimes && (find(m_lumiBlocks.begin(), m_lumiBlocks.end(), currentLumiBlock) == m_lumiBlocks.end()))) {
2047 //patrick check this
2048 {
2049 ATH_MSG_WARNING( "Invalid lumi block: " << currentLumiBlock);
2050 errorSummaryX = 9;
2051 errorSummaryY = 1;
2052 fill(m_packageName, errorSummaryX, errorSummaryY);
2053 errorSummaryPerLumiBlockX = currentLumiBlock;
2054 errorSummaryPerLumiBlockY = 9;
2055 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2056 errorPerLumiBlockX = currentLumiBlock;
2057 fill(m_packageName, errorPerLumiBlockX);
2058 }
2059 else {
2060 errorSummaryX = 9;
2061 errorSummaryY = 0;
2062 fill(m_packageName, errorSummaryX, errorSummaryY);
2063 if (retrievedLumiBlockTimes) {
2064 uint64_t eventTime = static_cast<uint64_t>(theCTP_RDO->getTimeSec()*1e09 + theCTP_RDO->getTimeNanoSec());
2065 if (eventTime < lb_stime || eventTime > lb_etime) {
2066 ATH_MSG_WARNING( "Event time (" << eventTime
2067 << ") not within time interval for current lumi block (LB: " << currentLumiBlock
2068 << ", start: " << lb_stime
2069 << ", stop: " << lb_etime << ")");
2070 errorSummaryX = 10;
2071 errorSummaryY = 1;
2072 fill(m_packageName, errorSummaryX, errorSummaryY);
2073 errorSummaryPerLumiBlockX = currentLumiBlock;
2074 errorSummaryPerLumiBlockY = 10;
2075 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2076 errorPerLumiBlockX = currentLumiBlock;
2077 fill(m_packageName, errorPerLumiBlockX);
2078 }
2079 else {
2080 errorSummaryX = 10;
2081 errorSummaryY = 0;
2082 fill(m_packageName, errorSummaryX, errorSummaryY);
2083 timeSinceLBStartX = (eventTime-lb_stime)/1e06;
2084 fill(m_packageName, timeSinceLBStartX);
2085 timeUntilLBEndX = (lb_etime-eventTime)/1e06;
2086 fill(m_packageName, timeUntilLBEndX);
2087 }
2088
2089 // turn counter monitoring - first store turn counter, bcid and times for the first processed event
2090
2091 // use the best available bunch-crossing interval
2092 double bcDurationInNs = m_defaultBcIntervalInNs;
2093 double freqFromCool = -1.0; //getFrequencyMeasurement(eventTime);
2094 if (freqFromCool > 40.078e6 && freqFromCool < 40.079e6) { // f prop. to beta, ok from HI injection to pp @ sqrt(s) = 14 TeV
2095 // use average frequency since start of LB
2096 // patrick
2097 double lbStartFreqFromCool = -1.0; //getFrequencyMeasurement(lb_stime);
2098 //double lbStartFreqFromCool = getFrequencyMeasurement(m_lbStartTimes[currentLumiBlock]);
2099 if (lbStartFreqFromCool > 40.078e6 && lbStartFreqFromCool < 40.079e6) {
2100 bcDurationInNs = 2./(freqFromCool+lbStartFreqFromCool)*1e9;
2101 }
2102 // or simply use the measurement closest to the event time
2103 else {
2104 bcDurationInNs = 1./freqFromCool*1e9;
2105 }
2106 ATH_MSG_DEBUG( "Will use BC interval calculated from frequency measurement(s) in COOL: f = "
2107 << freqFromCool << " Hz => t_BC = " << bcDurationInNs << " ns");
2108 }
2109 else {
2110 ATH_MSG_DEBUG( "No valid frequency measurements found in COOL, will use hardcoded BC interval: t_BC = " << bcDurationInNs << " ns");
2111 }
2112
2113 uint32_t lumiBlockOfPreviousEvent = eventInfo->lumiBlock() -1 ;
2114 //patrick fix this!!! - first event!
2115 uint64_t firstEventTime = 0;
2116 int64_t firstEventBcid = 0;
2117 int64_t firstEventTC = 0;
2118 // set the reference variables for the turn counter monitoring if this is the first processed event of the run/LB
2119 if ( (lumiBlockOfPreviousEvent != 0 && lumiBlockOfPreviousEvent != currentLumiBlock) ) {
2120 //if ( !m_eventCount || (lumiBlockOfPreviousEvent != 0 && lumiBlockOfPreviousEvent != currentLumiBlock) ) {
2121 firstEventTime = eventTime;
2122 firstEventBcid = static_cast<int64_t>(theCTP_RIO->getBCID());
2123 firstEventTC = static_cast<int64_t>(theCTP_RDO->getTurnCounter());
2124 }
2125
2126 // calculate the time passed since the first processed event, based on GPS clock and turn counter+bcid
2127 int64_t timeDiff_GPS = eventTime - firstEventTime;
2128 int64_t firstEventTimeInBc_TC = firstEventTC*m_bcsPerTurn+firstEventBcid;
2129 int64_t eventTimeInBc_TC = static_cast<int64_t>(theCTP_RDO->getTurnCounter())*m_bcsPerTurn+theCTP_RIO->getBCID();
2130 int64_t timeDiffInBc_TC = eventTimeInBc_TC-firstEventTimeInBc_TC;
2131
2132 // fill turn counter monitoring plots if at least one of first and current turn-counter values are non-zero
2133 if ( !(firstEventTC == 0 && theCTP_RDO->getTurnCounter() == 0) ) {
2134 std::string bm = currentBeamMode;
2135 double tDiffInNs = timeDiffInBc_TC*bcDurationInNs-timeDiff_GPS;
2136 // flag an error if the offset for the timestamp calculated from TC+BCID is off by > half an LHC turn
2137 // (if we're in STABLE BEAMS and did not just transition to ATLAS_READY in this LB)
2138 if ( (bm == "STABLEBEAMS" || bm == "STABLE BEAMS") &&
2139 //patrick: do we need this condition?
2141 (readyForPhysics == 1) &&
2142 (std::abs(tDiffInNs) > 45000) ) {
2143 ATH_MSG_WARNING( "Turn-counter based time off by " << tDiffInNs
2144 << " ns (> 0.5 LHC turn) during stable beams - missing orbit pulse?");
2145 errorSummaryX = 16;
2146 errorSummaryY = 1;
2147 fill(m_packageName, errorSummaryX, errorSummaryY);
2148 errorSummaryPerLumiBlockX = currentLumiBlock;
2149 errorSummaryPerLumiBlockY = 16;
2150 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2151 errorPerLumiBlockX = currentLumiBlock;
2152 fill(m_packageName, errorPerLumiBlockX);
2153 }
2154 else {
2155 errorSummaryX = 16;
2156 errorSummaryY = 0;
2157 fill(m_packageName, errorSummaryX, errorSummaryY);
2158 }
2159 turnCounterTimeErrorX = tDiffInNs/1e03;
2160 fill(m_packageName, turnCounterTimeErrorX);
2161 turnCounterTimeErrorVsLbX = currentLumiBlock;
2162 turnCounterTimeErrorVsLbY = tDiffInNs/1e03;
2163 fill(m_packageName, turnCounterTimeErrorVsLbX, turnCounterTimeErrorVsLbY);
2164 }
2165 else {
2166 ATH_MSG_DEBUG( "Turn counter = 0 for both first processed and current event, not filling TC histograms");
2167 }
2168 }
2169 }
2170 }
2171 uint32_t currentLumiBlock = eventInfo->lumiBlock();
2172 if (theCTP_RDO->getTimeNanoSec() > 1e09) {
2173 ATH_MSG_WARNING( "Nanosecond timestamp too large: " << theCTP_RDO->getTimeNanoSec());
2174 errorSummaryX = 11;
2175 errorSummaryY = 1;
2176 fill(m_packageName, errorSummaryX, errorSummaryY);
2177 errorSummaryPerLumiBlockX = currentLumiBlock;
2178 errorSummaryPerLumiBlockY = 11;
2179 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2180 errorPerLumiBlockX = currentLumiBlock;
2181 fill(m_packageName, errorPerLumiBlockX);
2182 } else {
2183 errorSummaryX = 11;
2184 errorSummaryY = 0;
2185 fill(m_packageName, errorSummaryX, errorSummaryY);
2186 }
2187
2188 std::vector<uint32_t> vec=theCTP_RDO->getEXTRAWords();
2189 timeSinceL1AX = theCTP_RDO->getTimeSinceLastL1A()*25*10E-6;
2190 fill(m_packageName, timeSinceL1AX);
2191
2192 uint32_t numberBC = theCTP_RDO->getNumberOfBunches();
2193 if (numberBC > 0) {
2194 unsigned int storeBunch = theCTP_RDO->getL1AcceptBunchPosition();
2195 const std::vector<CTP_BC> &BCs = ctp.getBunchCrossings();
2196 const CTP_BC & bunch = BCs[storeBunch];
2197 unsigned int bcid = bunch.getBCID();
2198
2199 double bcid_offset = (static_cast < int >((bcid)&0xf) - static_cast < int >(headerBcid));
2200 deltaBcidX = bcid_offset;
2201 fill(m_packageName, deltaBcidX);
2202 if (bcid_offset != 0) {
2203 if (!m_runOnESD) {
2204 ATH_MSG_WARNING( "Found BCID offset of "<< bcid_offset << " between ROD Header ("
2205 << headerBcid << ") and data (" << (bcid&0xf) << ")");
2206 errorSummaryX = 1;
2207 errorSummaryY = 1;
2208 fill(m_packageName, errorSummaryX, errorSummaryY);
2209 errorSummaryPerLumiBlockX = currentLumiBlock;
2210 errorSummaryPerLumiBlockY = 1;
2211 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2212 errorPerLumiBlockX = currentLumiBlock;
2213 fill(m_packageName, errorPerLumiBlockX);
2214 }
2215 }
2216 else {
2217 errorSummaryX = 1;
2218 errorSummaryY = 0;
2219 fill(m_packageName, errorSummaryX, errorSummaryY);
2220 }
2221 /*
2222 * TIP,TBP,TAP,TAV
2223 */
2224 short bunchIndex = -storeBunch;
2225 std::bitset<512> TIPfirst;
2226 std::bitset<512> TBPfirst;
2227 std::bitset<512> TAPfirst;
2228 TIPfirst.set();
2229 TBPfirst.set();
2230 TAPfirst.set();
2231
2232 //Vectors of TBP/TAP/TAB
2233 std::vector<int> tbpItems;
2234 std::vector<int> tapItems;
2235 std::vector<int> tavItems;
2236 std::vector<int> tbpBC;
2237 std::vector<int> tapBC;
2238 std::vector<int> tavBC;
2239 //int minbc=bunchIndex;
2240 for ( std::vector<CTP_BC>::const_iterator it = BCs.begin();
2241 it != BCs.end(); ++it, ++bunchIndex ) {
2242 bcid = it->getBCID();
2243
2244 if ( (!bunchIndex) && (m_compareRerun) ) {//gives position of L1A
2245 StatusCode sc = compareRerun(*it, ctx);
2246 if ( sc.isFailure() ) {
2247 ATH_MSG_WARNING( "compareRerun() returned failure");
2248 }
2249 }
2250
2251 const std::bitset<512> currentTIP(it->getTIP());
2252 if (currentTIP.any()) {
2253 for ( size_t tipNum = 0; tipNum < currentTIP.size(); ++tipNum ) {
2254 if (currentTIP.test(tipNum)) {
2255 pitBCX = tipNum;
2256 pitBCY = bunchIndex;
2257 fill(m_packageName, pitBCX, pitBCY);
2258 if (TIPfirst.test(tipNum)) {
2259 TIPfirst.set(tipNum,0);
2260 pitFirstBCX = tipNum;
2261 pitFirstBCY = bunchIndex;
2262 fill(m_packageName, pitFirstBCX, pitFirstBCY);
2263 }
2264 }
2265 }
2266 }
2267
2268 const std::bitset<512> currentTBP(it->getTBP());
2269 if (currentTBP.any()) {
2270 for ( size_t item = 0; item < currentTBP.size(); ++item ) {
2271 if (currentTBP.test(item)) {
2272 tbpItems.push_back(item);
2273 tbpBC.push_back(bunchIndex);
2274 if (TBPfirst.test(item)) {
2275 TBPfirst.set(item,0);
2276 }
2277 }
2278 }
2279 }
2280
2281 const std::bitset<512> currentTAP(it->getTAP());
2282 if (currentTAP.any()) {
2283 for ( size_t item = 0; item < currentTAP.size(); ++item ) {
2284 if (currentTAP.test(item)) {
2285 tapItems.push_back(item);
2286 tapBC.push_back(bunchIndex);
2287 if (TAPfirst.test(item)) {
2288 TAPfirst.set(item,0);
2289 }
2290 }
2291 }
2292 }
2293
2294 const std::bitset<512> currentTAV(it->getTAV());
2295
2296 if (currentTAV.any()) {
2297 for ( size_t item = 0; item < currentTAV.size(); ++item ) {
2298 if (currentTAV.test(item)) {
2299 tavX = item;
2300 fill(m_packageName, tavX);
2301 tavItems.push_back(item);
2302 tavBC.push_back(bunchIndex);
2303 }
2304 }
2305 }
2306 }
2307 //int maxbc=bunchIndex-1;
2308
2309 bool allTAPFine=true;
2310 bool allTAVFine=true;
2311 for ( unsigned int i=0; i<tapItems.size(); i++ ) {
2312 ATH_MSG_DEBUG( tapItems.at(i) << " TAP fired at BC " << tapBC.at(i));
2313 bool isTBP=false;
2314 for ( unsigned int j=0; j<tbpItems.size() && isTBP==false; j++ ) {
2315 if ( tbpItems.at(j)==tapItems.at(i) && tbpBC.at(j)==tapBC.at(i) ) isTBP=true;
2316 }
2317 if ( isTBP==false ) {
2318 allTAPFine=false;
2319 ATH_MSG_WARNING( "TAP item " << tapItems.at(i) << " at BC " << tapBC.at(i) << " not found in TBP");
2320 }
2321 }
2322 for ( unsigned int i=0; i<tavItems.size(); i++ ) {
2323 ATH_MSG_DEBUG( tavItems.at(i) << " TAV fired at BC " << tavBC.at(i));
2324 bool isTAP=false;
2325 for ( unsigned int j=0; j<tapItems.size() && isTAP==false; j++ ) {
2326 if ( tapItems.at(j)==tavItems.at(i) && tapBC.at(j)==tavBC.at(i) ) isTAP=true;
2327 }
2328 if ( isTAP==false ) {
2329 allTAVFine=false;
2330 ATH_MSG_WARNING( "TAV item " << tavItems.at(i) << " at BC " << tavBC.at(i) << " not found in TAP");
2331 }
2332 }
2333
2334 //Fill Error Hist
2335 if (allTAPFine==false) {
2336 errorSummaryX = 12;
2337 errorSummaryY = 1;
2338 fill(m_packageName, errorSummaryX, errorSummaryY);
2339 errorSummaryPerLumiBlockX = currentLumiBlock;
2340 errorSummaryPerLumiBlockY = 12;
2341 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2342 errorPerLumiBlockX = currentLumiBlock;
2343 fill(m_packageName, errorPerLumiBlockX);
2344 }
2345 else {
2346 errorSummaryX = 12;
2347 errorSummaryY = 0;
2348 fill(m_packageName, errorSummaryX, errorSummaryY);
2349 }
2350 if (allTAVFine==false) {
2351 errorSummaryX = 13;
2352 errorSummaryY = 1;
2353 fill(m_packageName, errorSummaryX, errorSummaryY);
2354 errorSummaryPerLumiBlockX = currentLumiBlock;
2355 errorSummaryPerLumiBlockY = 13;
2356 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2357 errorPerLumiBlockX = currentLumiBlock;
2358 fill(m_packageName, errorPerLumiBlockX);
2359 }
2360 else {
2361 errorSummaryX = 13;
2362 errorSummaryY = 0;
2363 fill(m_packageName, errorSummaryX, errorSummaryY);
2364 }
2365 //m_lastminbc=minbc;
2366 //m_lastmaxbc=maxbc;
2367
2368 // TODO: is this really the check we want to do? Doesn't offline in general have more resources..? /CO
2369 //if (m_environment==AthenaMonManager::online)
2370 // updateRangeUser();//Triggers LW->ROOT conversion so should certainly not be done offline
2371
2372 errorSummaryX = 2;
2373 errorSummaryY = 0;
2374 fill(m_packageName, errorSummaryX, errorSummaryY);
2375
2376 if (msgLvl(MSG::DEBUG)) {
2377 std::vector<unsigned int> triggersFired = ctp.getAllTriggers(storeBunch);
2378 std::stringstream str;
2379 //for ( unsigned int i = 0; i < triggersFired.size(); ++i ) {
2380 for (auto i : triggersFired ) {
2381 str << i << " ";
2382 }
2383 ATH_MSG_DEBUG( triggersFired.size() << " trigger items fired: " << str.str());
2384 }
2385 }
2386 else {
2387 if (!m_runOnESD) {
2388 ATH_MSG_WARNING( "Zero bunches in CTP data for ext. LVL1 ID 0x" << MSG::hex << evId << MSG::dec);
2389 errorSummaryX = 2;
2390 errorSummaryY = 1;
2391 fill(m_packageName, errorSummaryX, errorSummaryY);
2392 errorSummaryPerLumiBlockX = currentLumiBlock;
2393 errorSummaryPerLumiBlockY = 2;
2394 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2395 errorPerLumiBlockX = currentLumiBlock;
2396 fill(m_packageName, errorPerLumiBlockX);
2397 }
2398 }
2399
2400 /*
2401 * Check the error status words of the ROD Header
2402 */
2403 if (theCTP_RIO) {
2404 uint32_t num = theCTP_RIO->getNumberStatusWords();
2405 std::vector<uint32_t> vStatus = theCTP_RIO->getStatusWords();
2406 for ( uint32_t i = 0; i < num; ++i ) {
2407 if (vStatus[i] != 0) {
2408 int Status = -1;
2409 if (i == 0) {
2410 ATH_MSG_DEBUG( "CTP error status word #" << i << ": 0x" << MSG::hex << vStatus[i] << MSG::dec);
2411 Status = 1;
2412 } else if (i == 1) {
2413 Status = 2;
2414 } else {
2415 continue;
2416 }
2417 for ( int bit = 0; bit < 24; ++bit ) {
2418 if (vStatus[i] & (1 << bit)){
2419 if (Status == 1) {
2420 ctpStatus1X = bit;
2421 fill(m_packageName, ctpStatus1X);
2422 }
2423 else if (Status == 2) {
2424 ctpStatus2X = bit;
2425 fill(m_packageName, ctpStatus2X);
2426 }
2427 }
2428 }
2429 }
2430 }
2431 }
2432}
2433
2434
2435void
2437 //const CTP_RIO* theCTP_RIO,
2438 const MuCTPI_RDO* theMuCTPI_RDO,
2439 //const MuCTPI_RIO* theMuCTPI_RIO,
2440 const EventContext& ctx) const
2441{
2442 ATH_MSG_DEBUG( "CTPMON begin doCtpMuctpi()");
2443 //ERROR histos
2444 auto errorSummaryX = Monitored::Scalar<int>("errorSummaryX",0);
2445 auto errorSummaryY = Monitored::Scalar<int>("errorSummaryY",0);
2446 auto errorSummaryPerLumiBlockX = Monitored::Scalar<int>("errorSummaryPerLumiBlockX",0);
2447 auto errorSummaryPerLumiBlockY = Monitored::Scalar<int>("errorSummaryPerLumiBlockY",0);
2448 auto errorPerLumiBlockX = Monitored::Scalar<int>("errorPerLumiBlockX",0);
2449 //CTPMUCTPI
2450 auto headerL1IdDifferenceX = Monitored::Scalar<int>("headerL1IdDifferenceX",0);
2451 auto headerBCIDDifferenceX = Monitored::Scalar<int>("headerBCIDDifferenceX",0);
2452 auto bcidDifferenceX = Monitored::Scalar<int>("bcidDifferenceX",0);
2453
2454 auto eventInfo = GetEventInfo(ctx);
2455
2456
2457 /*
2458 if (theCTP_RIO && theMuCTPI_RIO) {
2459 uint32_t ctp_evid = theCTP_RIO->getLvl1Id();
2460 uint32_t ctp_bcid = (theCTP_RIO->getBCID() & 0xf);
2461 uint32_t muctpi_evid = theMuCTPI_RIO->getHeaderLVL1ID();
2462 uint32_t muctpi_bcid = theMuCTPI_RIO->getHeaderBCID();
2463 int diffValBcid = (static_cast < int >(ctp_bcid) -
2464 static_cast < int >((muctpi_bcid)&0xf));
2465 int diffValEvid = static_cast < int >(ctp_evid) -
2466 static_cast < int >(muctpi_evid);
2467 headerL1IdDifferenceX = diffValEvid;
2468 fill(m_packageName, headerL1IdDifferenceX);
2469 headerBCIDDifferenceX = diffValBcid;
2470 fill(m_packageName, headerBCIDDifferenceX);
2471 uint32_t currentLumiBlock = eventInfo->lumiBlock();
2472 if (diffValBcid!=0) {
2473 ATH_MSG_WARNING( "BCID mismatch between CTP and MuCTPI RIOs, filling error histograms");
2474 errorSummaryX = 3;
2475 errorSummaryY = 1;
2476 fill(m_packageName, errorSummaryX, errorSummaryY);
2477 errorSummaryPerLumiBlockX = currentLumiBlock;
2478 errorSummaryPerLumiBlockY = 3;
2479 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2480 errorPerLumiBlockX = currentLumiBlock;
2481 fill(m_packageName, errorPerLumiBlockX);
2482 }
2483 else {
2484 errorSummaryX = 3;
2485 errorSummaryY = 0;
2486 fill(m_packageName, errorSummaryX, errorSummaryY);
2487 }
2488 if (diffValBcid < -200.5
2489 || diffValBcid > 200.5) {
2490 ATH_MSG_WARNING( "BCID difference out of range. CTP_RODHeader_BCID: " << ctp_bcid << " MuCTPI_RODHeader_BCID: " << (muctpi_bcid));
2491 }
2492
2493 }
2494*/
2496 MuCTPI_DataWord_Decoder dataWord(0);
2497
2498 CTP_Decoder ctp;
2499 ctp.setRDO(theCTP_RDO);
2500 uint32_t numberBC = theCTP_RDO->getNumberOfBunches();
2501 if (numberBC > 0) {
2502 unsigned int storeBunch = theCTP_RDO->getL1AcceptBunchPosition();
2503 const std::vector<CTP_BC> &BCs = ctp.getBunchCrossings();
2504 const CTP_BC & bunch = BCs[storeBunch];
2505 uint16_t mictp_bcid = multWord.getBCID();
2506 bcidDifferenceX = static_cast < int >(mictp_bcid) -
2507 static_cast < int >(bunch.getBCID() & 7);
2508 fill(m_packageName, bcidDifferenceX);
2509 }
2510
2511
2512}
2513
2514void
2516 //const MuCTPI_RIO* theMuCTPI_RIO,
2517 const ROIB::RoIBResult* roib,
2518 const EventContext& ctx) const
2519{
2520 ATH_MSG_DEBUG( "CTPMON begin doMuonRoI()");
2521 //ERROR histos
2522 auto errorSummaryX = Monitored::Scalar<int>("errorSummaryX",0);
2523 auto errorSummaryY = Monitored::Scalar<int>("errorSummaryY",0);
2524 auto errorSummaryPerLumiBlockX = Monitored::Scalar<int>("errorSummaryPerLumiBlockX",0);
2525 auto errorSummaryPerLumiBlockY = Monitored::Scalar<int>("errorSummaryPerLumiBlockY",0);
2526 auto errorPerLumiBlockX = Monitored::Scalar<int>("errorPerLumiBlockX",0);
2527 //ROI
2528 auto nCandidates_secLocX = Monitored::Scalar<int>("nCandidates_secLocX",0);
2529 // auto roiEtaPhiX = Monitored::Scalar<int>("roiEtaPhiX",0);
2531 // auto roiEtaX = Monitored::Scalar<int>("roiEtaX",0);
2532 // auto roiPhiX = Monitored::Scalar<int>("roiPhiX",0);
2533 auto barrelSectorIDRoiX = Monitored::Scalar<int>("barrelSectorIDRoiX",0);
2534 auto barrelSectorIDRoiY = Monitored::Scalar<int>("barrelSectorIDRoiY",0);
2535 auto endcapSectorIDRoiX = Monitored::Scalar<int>("endcapSectorIDRoiX",0);
2536 auto endcapSectorIDRoiY = Monitored::Scalar<int>("endcapSectorIDRoiY",0);
2537 auto forwardSectorIDRoiX = Monitored::Scalar<int>("forwardSectorIDRoiX",0);
2538 auto forwardSectorIDRoiY = Monitored::Scalar<int>("forwardSectorIDRoiY",0);
2539 auto barrelSectorIDRoiEtaX = Monitored::Scalar<int>("barrelSectorIDRoiEtaX",0);
2540 // auto barrelSectorIDRoiEtaY = Monitored::Scalar<int>("barrelSectorIDRoiEtaY",0);
2541 auto endcapSectorIDRoiEtaX = Monitored::Scalar<int>("endcapSectorIDRoiEtaX",0);
2542 // auto endcapSectorIDRoiEtaY = Monitored::Scalar<int>("endcapSectorIDRoiEtaY",0);
2543 auto forwardSectorIDRoiEtaX = Monitored::Scalar<int>("forwardSectorIDRoiEtaX",0);
2544 // auto forwardSectorIDRoiEtaY = Monitored::Scalar<int>("forwardSectorIDRoiEtaY",0);
2545 auto barrelSectorIDRoiPhiX = Monitored::Scalar<int>("barrelSectorIDRoiPhiX",0);
2546 // auto barrelSectorIDRoiPhiY = Monitored::Scalar<int>("barrelSectorIDRoiPhiY",0);
2547 auto endcapSectorIDRoiPhiX = Monitored::Scalar<int>("endcapSectorIDRoiPhiX",0);
2548 // auto endcapSectorIDRoiPhiY = Monitored::Scalar<int>("endcapSectorIDRoiPhiY",0);
2549 auto forwardSectorIDRoiPhiX = Monitored::Scalar<int>("forwardSectorIDRoiPhiX",0);
2550 // auto forwardSectorIDRoiPhiY = Monitored::Scalar<int>("forwardSectorIDRoiPhiY",0);
2551
2552 auto eventInfo = GetEventInfo(ctx);
2553
2554 const std::vector<ROIB::MuCTPIRoI> roiVec = roib->muCTPIResult().roIVec();
2555 //int bcidMismatch = 0;
2556 //uint16_t bcId;
2557 //uint16_t pTval;
2558 //uint16_t pTnum;
2559 //double eta;
2560 //double phi;
2561 uint16_t secID;
2562 //uint16_t sysID;
2563 uint16_t hemisphere;
2564 uint16_t roInum;
2565 //bool accepted;
2566 //bool first;
2567 //bool duplicatedRoI;
2568 //bool duplicatedSector;
2569 //int candNum=0;
2570 /*
2571 if (theMuCTPI_RIO) {
2572 for ( int i = 0; i < theMuCTPI_RIO->getNRoI(); i++ ) {
2573 if (!theMuCTPI_RIO->getRoI(i, bcId, pTval, pTnum, eta, phi, secID, sysID, hemisphere,
2574 roInum, accepted, first, duplicatedRoI, duplicatedSector)) {
2575 ATH_MSG_WARNING( "RoI with index " << i << " not found, skipping this RoI");
2576 continue;
2577 }
2578 roiEtaPhiX = eta;
2579 roiEtaPhiY = phi;
2580 fill(m_packageName, roiEtaPhiX, roiEtaPhiY);
2581 roiEtaX = eta;
2582 fill(m_packageName, roiEtaX);
2583 roiPhiX = phi;
2584 fill(m_packageName, roiPhiX);
2585 if (theMuCTPI_RIO->getBCID() != bcId) bcidMismatch++;
2586 }
2587 */
2588 //uint32_t currentLumiBlock = eventInfo->lumiBlock();
2589 for ( unsigned int j = 0; j < roiVec.size(); j++ ) {
2590 //bool isCand = false;
2591 /*
2592 int cnt = 0;
2593 for(auto it=0; it != theMuCTPI_RIO->getNRoI() && cnt < theMuCTPI_RIO->getNRoI() ; ++it,++cnt) {
2594 ATH_MSG_WARNING("test: " << it << " cnt: " << cnt);
2595 }
2596 for ( int i = 0; i < theMuCTPI_RIO->getNRoI(); i++ ) {
2597 theMuCTPI_RIO->getRoI(i, bcId, pTval, pTnum, eta, phi, secID, sysID, hemisphere,
2598 roInum, accepted, first, duplicatedRoI, duplicatedSector);
2599 if ((roiVec[j].getRoiNumber() == roInum) &&
2600 (roiVec[j].pt() == pTnum) &&
2601 (roiVec[j].getSectorID() == secID) &&
2602 (roiVec[j].getSectorLocation() == sysID) &&
2603 (roiVec[j].getHemisphere() == hemisphere) &&
2604 (theMuCTPI_RIO->getBCID() == bcId)) {
2605 isCand=true;
2606 candNum=i;
2607 }
2608 }
2609 if (isCand == false) {
2610 ATH_MSG_WARNING( "No DAQ muon for RoI number "
2611 << roiVec[j].getRoiNumber() << ", pT " << roiVec[j].pt() << ", and sector ID "
2612 << roiVec[j].getSectorID());
2613 errorSummaryX = 7;
2614 errorSummaryY = 1;
2615 fill(m_packageName, errorSummaryX, errorSummaryY);
2616 errorSummaryPerLumiBlockX = currentLumiBlock;
2617 errorSummaryPerLumiBlockY = 7;
2618 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2619 errorPerLumiBlockX = currentLumiBlock;
2620 fill(m_packageName, errorPerLumiBlockX);
2621 }
2622 else {
2623 errorSummaryX = 7;
2624 errorSummaryY = 0;
2625 fill(m_packageName, errorSummaryX, errorSummaryY);
2626 theMuCTPI_RIO->getRoI(candNum, bcId, pTval, pTnum, eta, phi, secID, sysID, hemisphere,
2627 roInum, accepted, first, duplicatedRoI, duplicatedSector);
2628 */
2629 if (theMuCTPI_RDO) {// go back to data words to check sector locations
2630 MuCTPI_DataWord_Decoder dataWord(0);
2631 const std::vector<uint32_t> &vDataWords = theMuCTPI_RDO->dataWord();
2632 for ( std::vector<uint32_t>::const_iterator it = vDataWords.begin(); it != vDataWords.end(); ++it ) {
2633 dataWord.setWord(*it);
2634
2635 // MuCTPI_DataWord_Decoder only corrects sector ID for hemisphere if candidate is barrel
2636 // correct back for this by providing an argument to getSectorID
2637 //uint16_t sectorID = dataWord.getSectorID();
2638 //if (dataWord.getSectorLocation() == MuCTPI_RDO::BARREL) sectorID=dataWord.getSectorID(1);
2639
2640 /*
2641 if ((sectorID == secID)
2642 && (dataWord.getRoiNumber() == roInum)
2643 && (dataWord.getSectorLocation() == sysID)
2644 && (dataWord.getHemisphere() == hemisphere)) {
2645 */
2646
2647 //sysID = dataWord.getSectorLocation();
2648 roInum = dataWord.getRoiNumber();
2649 hemisphere = dataWord.getHemisphere();
2650 secID = dataWord.getSectorID();
2651
2652 nCandidates_secLocX = dataWord.getSectorLocation();
2653 fill(m_packageName, nCandidates_secLocX);
2654
2655 if (dataWord.getSectorLocation() == MuCTPI_RDO::BARREL) {
2656 uint16_t secID1;
2657 secID1 = dataWord.getSectorID(1);
2658 barrelSectorIDRoiX = secID1+32*hemisphere;
2659 barrelSectorIDRoiY = roInum;
2660 fill(m_packageName, barrelSectorIDRoiX, barrelSectorIDRoiY);
2661 barrelSectorIDRoiEtaX = secID1+32*hemisphere;
2662 fill(m_packageName, barrelSectorIDRoiEtaX);
2663 barrelSectorIDRoiPhiX = secID1+32*hemisphere;
2664 fill(m_packageName, barrelSectorIDRoiPhiX);
2665 }
2666 else if (dataWord.getSectorLocation() == MuCTPI_RDO::ENDCAP) {
2667 endcapSectorIDRoiX = secID+48*hemisphere;
2668 endcapSectorIDRoiY = roInum;
2669 fill(m_packageName, endcapSectorIDRoiX, endcapSectorIDRoiY);
2670 endcapSectorIDRoiEtaX = secID+48*hemisphere;
2671 fill(m_packageName, endcapSectorIDRoiEtaX);
2672 endcapSectorIDRoiPhiX = secID+48*hemisphere;
2673 fill(m_packageName, endcapSectorIDRoiPhiX);
2674 }
2675 else if (dataWord.getSectorLocation() == MuCTPI_RDO::FORWARD) {
2676 forwardSectorIDRoiX = secID+24*hemisphere;
2677 forwardSectorIDRoiY = roInum;
2678 fill(m_packageName, forwardSectorIDRoiX, forwardSectorIDRoiY);
2679 forwardSectorIDRoiEtaX = secID+24*hemisphere;
2680 fill(m_packageName, forwardSectorIDRoiEtaX);
2681 forwardSectorIDRoiPhiX = secID+24*hemisphere;
2682 fill(m_packageName, forwardSectorIDRoiPhiX);
2683 }
2684 }
2685 }
2686 }
2687 //}
2688 //}
2689 /*
2690 int lvl2Expected = static_cast<int>(theMuCTPI_RIO->getNRoI()) - bcidMismatch;
2691 if (lvl2Expected != static_cast<int>(roiVec.size()) && lvl2Expected <= 14) {
2692 //patrick ATH_MSG_WARNING
2693 ATH_MSG_DEBUG( "Expected " << lvl2Expected
2694 << " LVL2 RoIs, but found " << roiVec.size()
2695 << "!");
2696 errorSummaryX = 6;
2697 errorSummaryY = 1;
2698 fill(m_packageName, errorSummaryX, errorSummaryY);
2699 errorSummaryPerLumiBlockX = currentLumiBlock;
2700 errorSummaryPerLumiBlockY = 6;
2701 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2702 errorPerLumiBlockX = currentLumiBlock;
2703 fill(m_packageName, errorPerLumiBlockX);
2704 }
2705 else if (static_cast<int>(roiVec.size()) != 14 && lvl2Expected >= 14) {
2706 //patrick ATH_MSG_WARNING
2707 ATH_MSG_DEBUG( "Expected 14 RoI's from " << lvl2Expected
2708 << " MuCTPI RoI's, but found " << roiVec.size()
2709 << "!");
2710
2711 errorSummaryX = 6;
2712 errorSummaryY = 1;
2713 fill(m_packageName, errorSummaryX, errorSummaryY);
2714 errorSummaryPerLumiBlockX = currentLumiBlock;
2715 errorSummaryPerLumiBlockY = 6;
2716 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2717 errorPerLumiBlockX = currentLumiBlock;
2718 fill(m_packageName, errorPerLumiBlockX);
2719 }
2720 else {
2721 errorSummaryX = 6;
2722 errorSummaryY = 0;
2723 fill(m_packageName, errorSummaryX, errorSummaryY);
2724 }
2725 */
2726}
2727//}
2728
2729StatusCode
2731 const EventContext& ctx) const
2732{
2733 bool itemMismatch{false};
2734 //ERROR histos
2735 auto errorSummaryX = Monitored::Scalar<int>("errorSummaryX",0);
2736 auto errorSummaryY = Monitored::Scalar<int>("errorSummaryY",0);
2737 auto errorSummaryPerLumiBlockX = Monitored::Scalar<int>("errorSummaryPerLumiBlockX",0);
2738 auto errorSummaryPerLumiBlockY = Monitored::Scalar<int>("errorSummaryPerLumiBlockY",0);
2739 auto errorPerLumiBlockX = Monitored::Scalar<int>("errorPerLumiBlockX",0);
2740 //compareRerun
2741 auto l1ItemsBPSimMismatchX = Monitored::Scalar<int>("l1ItemsBPSimMismatchX",0);
2742 auto l1ItemsBPSimMismatchY = Monitored::Scalar<int>("l1ItemsBPSimMismatchY",0);
2743 //the following is char - correctly filled?
2744 auto l1ItemsBPSimMismatchItemsX = Monitored::Scalar<std::string>("l1ItemsBPSimMismatchItemsX","");
2745 auto l1ItemsBPSimMismatchItemsY = Monitored::Scalar<int>("l1ItemsBPSimMismatchItemsY",0);
2746
2747 auto eventInfo = GetEventInfo(ctx);
2748
2749 const CTP_RDO* theCTP_RDO_Rerun = nullptr;
2750 ATH_MSG_DEBUG( "Retrieving CTP_RDO from SG with key CTP_RDO_Rerun");
2751 //ATH_MSG_INFO( "Retrieving CTP_RDO from SG with key CTP_RDO_Rerun");
2752 CHECK( (theCTP_RDO_Rerun = SG::get(m_CTP_RDO_RerunKey, ctx)) != nullptr );
2753 //https://gitlab.cern.ch/atlas/athena/-/blob/master/Trigger/TrigT1/TrigT1Result/src/CTP_RDO.cxx#L19
2754 // as I see: https://gitlab.cern.ch/atlas/athena/-/blob/master/Trigger/TrigT1/TrigT1Result/src/CTP_RDO.cxx#L51
2755 // CTPVersion has not been set, no information about data format available, please fix your code
2756 //CTP_RDO::CTP_RDO(unsigned int ctpVersionNumber, const uint32_t nBCs, uint32_t nExtraWords)
2757 //const uint32_t nBCs = 0;
2758 //uint32_t nExtraWords = 0;
2759 //CHECK( (theCTP_RDO_Rerun = SG::get(m_CTP_RDO_RerunKey, ctx)) != nullptr );
2760 //CHECK( (theCTP_RDO_Rerun = SG::get(m_CTP_RDO_RerunKey, 4, nBCs, nExtraWords, ctx)) != nullptr );
2761 //ATH_MSG_WARNING( "theCTP_RDO_Rerun->getCTPVersionNumber " << theCTP_RDO_Rerun->getCTPVersionNumber());
2762 //CTP_RDO* theCTP_RDO_Rerun2 = (CTP_RDO*)theCTP_RDO_Rerun;
2763 //theCTP_RDO_Rerun2->setCTPVersionNumber(4);
2764 //theCTP_RDO_Rerun->setCTPVersionNumber(4);
2765 //ATH_MSG_WARNING( "theCTP_RDO_Rerun2->getCTPVersionNumber " << theCTP_RDO_Rerun2->getCTPVersionNumber());
2766
2767 CTP_Decoder ctp_rerun;
2768 ctp_rerun.setRDO(theCTP_RDO_Rerun);
2769
2770 const std::vector<CTP_BC> ctp_bc_rerun=ctp_rerun.getBunchCrossings();
2771 if (ctp_bc_rerun.size() != 1) {
2772 ATH_MSG_ERROR( "Rerun simulation has non unity number of bunch crossings ");
2773 return StatusCode::FAILURE;
2774 }
2775
2776 ATH_MSG_DEBUG( "In compareRerun: dumping data for BC " << bunchCrossing.getBCID());
2777 bunchCrossing.dumpData(msg());
2778
2779 ATH_MSG_DEBUG( "In compareRerun: dumping rerun data for BC 0");
2780 ctp_bc_rerun.at(0).dumpData(msg());
2781
2782 ATH_MSG_DEBUG( "Comparing TBP from CTP_RDO objects with keys CTP_RDO (from data) and CTP_RDO_Rerun (from simulation)");
2783
2784 const std::bitset<512> currentTBP(bunchCrossing.getTBP());
2785 const std::bitset<512> currentTBP_rerun(ctp_bc_rerun.at(0).getTBP());
2786
2787 if ( currentTBP != currentTBP_rerun ) {
2788 const TrigConf::L1Menu * l1menu = nullptr;
2789 ATH_CHECK(detStore()->retrieve(l1menu));
2790 for(const TrigConf::L1Item & item : *l1menu) {
2791
2792 //do not include random and non-simulated triggers in this test (can be configured)
2793 bool skip = item.definition().find("RNDM") != std::string::npos;
2794 for(const std::string & p : m_ignorePatterns) {
2795 if(item.name().find(p) != std::string::npos) {
2796 skip = true;
2797 break;
2798 }
2799 }
2800 if( skip ) continue;
2801
2802 bool tbp = currentTBP.test( item.ctpId() );
2803 bool tbp_rerun = currentTBP_rerun.test( item.ctpId() );
2804 if ( tbp != tbp_rerun) {
2805 ATH_MSG_WARNING( "CTPSimulation TBP / TPB_rerun mismatch!! For L1Item '" << item.name()
2806 << "' (CTP ID " << item.ctpId() << "): data="
2807 << (tbp?"pass":"fail") << " != simulation=" << (tbp_rerun?"pass":"fail"));
2808 itemMismatch=true;
2809 l1ItemsBPSimMismatchX = item.ctpId();
2810 l1ItemsBPSimMismatchY = 1;
2811 fill(m_packageName, l1ItemsBPSimMismatchX, l1ItemsBPSimMismatchY);
2812 l1ItemsBPSimMismatchItemsX = (item.name()).c_str();
2813 l1ItemsBPSimMismatchItemsY = 1;
2814 fill(m_packageName, l1ItemsBPSimMismatchItemsX, l1ItemsBPSimMismatchItemsY);
2815 }
2816 }
2817 }
2818 uint32_t currentLumiBlock = eventInfo->lumiBlock();
2819 if (itemMismatch) {
2820 ATH_MSG_WARNING( "Mismatch between CTP data and simulation in BC " << bunchCrossing.getBCID());
2821 errorSummaryX = 14;
2822 errorSummaryY = 1;
2823 fill(m_packageName, errorSummaryX, errorSummaryY);
2824 errorSummaryPerLumiBlockX = currentLumiBlock;
2825 errorSummaryPerLumiBlockY = 14;
2826 fill(m_packageName, errorSummaryPerLumiBlockX, errorSummaryPerLumiBlockY);
2827 errorPerLumiBlockX = currentLumiBlock;
2828 fill(m_packageName, errorPerLumiBlockX);
2829 } else {
2830 errorSummaryX = 14;
2831 errorSummaryY = 0;
2832 fill(m_packageName, errorSummaryX, errorSummaryY);
2833 }
2834 return StatusCode::SUCCESS;
2835}
2836
2837void
2839 //const CTP_RIO* theCTP_RIO,
2840 const MuCTPI_RDO* theMuCTPI_RDO,
2841 //const MuCTPI_RIO* theMuCTPI_RIO,
2842 const ROIB::RoIBResult* roib,
2843 const EventContext& ctx) const
2844{
2845
2846 auto eventInfo = GetEventInfo(ctx);
2847
2848 if ( !msgLvl(MSG::DEBUG) )
2849 return;
2850 ATH_MSG_DEBUG( "Run number: " << eventInfo->runNumber() << ", Event: " << eventInfo->eventNumber() << ", LB: " << eventInfo->lumiBlock() );
2851 if ( m_processMuctpi ) {
2852 // MuCTPI Multiplicity data
2853 MuCTPI_MultiplicityWord_Decoder multWord(theMuCTPI_RDO->
2854 candidateMultiplicity(),
2856 ATH_MSG_DEBUG("MuCTPI_Multiplicity data :");
2857 multWord.dumpData();
2858 // MuCTPI candidate data
2859 MuCTPI_DataWord_Decoder dataWord(0);
2860 ATH_MSG_DEBUG( "MIOCT candidate data :");
2861 std::vector<uint32_t>::const_iterator it = theMuCTPI_RDO->dataWord().begin();
2862 int count = 1;
2863 for ( ; it != theMuCTPI_RDO->dataWord().end(); ++it ) {
2864 ATH_MSG_DEBUG( "Candidate " << count);
2865 ATH_MSG_DEBUG("datawordold: " <<*it);
2866 dataWord.setWord(*it);
2867 dataWord.dumpData();
2868 ++count;
2869 }
2870 }
2871
2872 if ( m_processCTP ) {
2873 // CTP information
2874 CTP_Decoder ctp;
2875 ctp.setRDO(theCTP_RDO);
2876 ATH_MSG_DEBUG("CTP data from CTP_RDO:");
2877 ctp.dumpData();
2878
2879 //Misc. information
2880 //if ( theCTP_RIO )
2881 // theCTP_RIO->dumpData();
2882 //if ( theMuCTPI_RIO )
2883 // theMuCTPI_RIO->dumpData();
2884 }
2885
2886 if ( roib )
2887 roib->dumpData();
2888}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::vector< size_t > vec
#define CHECK(...)
Evaluate an expression and check for errors.
unsigned int uint
static Double_t sc
#define y
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
virtual StatusCode initialize() override
initialize
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
Key for retrieving EventInfo from StoreGate.
An AttributeList represents a logical row of attributes in a metadata table.
uint32_t getBCID() const
Get BCID as unsigned integer.
void dumpData(MsgStream &) const
Helper class to decode the CTP data for one bunch-crossing.
const std::bitset< 512 > & getTBP() const
get bitset of TBP words
Definition CTP_Decoder.h:92
const std::vector< CTP_BC > & getBunchCrossings()
Get vector reference of bunch-crossing data of the current event.
void setRDO(const CTP_RDO *rdo)
Set RDO and fill internal variables from the data object.
const std::vector< uint32_t > & getDataWords() const
Definition CTP_RDO.h:39
uint32_t getTimeSec() const
Definition CTP_RDO.cxx:77
uint32_t getTimeNanoSec() const
Definition CTP_RDO.cxx:83
uint32_t getTimeSinceLastL1A() const
Definition CTP_RDO.cxx:99
std::vector< uint32_t > getEXTRAWords() const
Definition CTP_RDO.cxx:221
uint32_t getTurnCounter() const
Definition CTP_RDO.cxx:106
uint32_t getNumberOfBunches() const
Definition CTP_RDO.cxx:89
uint32_t getL1AcceptBunchPosition() const
Definition CTP_RDO.cxx:94
uint32_t getNumberStatusWords() const
Definition CTP_RIO.h:35
uint32_t getBCID() const
Definition CTP_RIO.h:31
const std::vector< uint32_t > & getStatusWords() const
Definition CTP_RIO.h:36
uint32_t getLvl1Id() const
Definition CTP_RIO.h:30
uint32_t getLvl1TriggerType() const
Definition CTP_RIO.h:32
uint32_t getDetectorEventType() const
Definition CTP_RIO.h:33
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Declare a monitored scalar variable.
Class helping to decode the MuCTPI data words.
uint16_t getVetoed() const
Flag showing if the candidate was vetoed in the multiplicity sum.
void dumpData() const
Function dumping the stored information to the message stream.
uint16_t getSectorID(bool newScheme=0) const
Number of the sector that detected the candidate.
void setWord(uint32_t word)
Function setting the MuCTPI data word.
MuCTPI_RDO::SectorLocation getSectorLocation() const
The system that detected the muon candidate.
uint16_t getHemisphere() const
The hemisphere in which the candidate was detected.
uint16_t getRoiNumber() const
RoI number (sub-sector in which the candidate was detected)
uint16_t getPt() const
3-bit pT threshold of the candidate
Class helping to decode the MuCTPI multiplicity words.
void dumpData() const
Function dumping the stored information to the message stream.
uint16_t getBCID() const
Function returning the 3-bit BCID fragment in the multiplicity word.
uint16_t getMultiplicity(const uint16_t candidateNumber) const
Function returning the 3-bit candidate multiplicity for the specified threshold.
uint16_t getNCandidates() const
Function returning the total number of muon candidates.
Class representing the readout data of the MuCTPI hardware and simulation.
const std::vector< LVL1::MuCTPIBits::Slice > & slices() const
Function returning the timeslice data words.
const std::vector< size_t > & errorBits() const
Function returning the fragment error bits vector.
Class representing the readout data of the MuCTPI hardware and simulation.
Definition MuCTPI_RDO.h:41
const std::vector< uint32_t > & dataWord() const
Function returning the muon candidate data words.
Definition MuCTPI_RDO.h:141
uint32_t candidateMultiplicity() const
Function returning the candidate multiplicity for the triggered bunch crossing.
Definition MuCTPI_RDO.h:106
const std::vector< MuCTPIRoI > & roIVec() const
Member function returning the RoI vector.
Class holding the LVL1 RoIB result build by the RoIBuilder.
Definition RoIBResult.h:47
void dumpData() const
print object content to default message stream
const MuCTPIResult & muCTPIResult() const
Gets the MuCTPI part of the L1 RDO.
@ BC_CURRENT
Definition TgcDigit.h:37
L1 board configuration.
std::size_t size() const
Accessor to the number of defined bunchgroups.
const std::shared_ptr< L1BunchGroup > & getBunchGroup(const std::string &name) const
Accessor to the bunchgroup by name.
L1 threshold configuration.
Definition L1Item.h:18
L1 menu configuration.
Definition L1Menu.h:28
SG::ReadHandleKey< CTP_RIO > m_CTP_RIOKey
Gaudi::Property< double > m_defaultBcIntervalInNs
SG::ReadHandleKey< CTP_RDO > m_CTP_RDOKey
void doMuctpi(const MuCTPI_RDO *theMuCTPI_RDO, const RpcSectorLogicContainer *theRPCContainer, const Muon::TgcCoinDataContainer *theTGCContainer, const EventContext &ctx) const
StatusCode compareRerun(const CTP_BC &bunchCrossing, const EventContext &ctx) const
SG::ReadHandleKey< RpcSectorLogicContainer > m_RPCContainerKey
Gaudi::Property< std::vector< std::string > > m_ignorePatterns
SG::ReadCondHandleKey< AthenaAttributeList > m_LBLBFolderInputKey
SG::ReadHandleKey< Muon::TgcCoinDataContainer > m_TGCContainerKey
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
SG::ReadHandleKey< ROIB::RoIBResult > m_RoIBResultKey
SG::ReadCondHandleKey< AthenaAttributeList > m_DataTakingModeFolderInputKey
SG::ReadHandleKey< MuCTPI_RDO > m_MuCTPI_RDOKey
void doCtp(const CTP_RDO *theCTP_RDO, const CTP_RIO *theCTP_RIO, const EventContext &ctx) const
virtual StatusCode initialize() override
initialize
Gaudi::Property< bool > m_inclusiveTriggerThresholds
SG::ReadHandleKey< MuCTPI_Phase1_RDO > m_MuCTPI_Phase1_RDOKey
SG::ReadCondHandleKey< TrigConf::L1BunchGroupSet > m_bgKey
BSMonitoringAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
void doCtpMuctpi(const CTP_RDO *theCTP_RDO, const MuCTPI_RDO *theMuCTPI_RDO, const EventContext &ctx) const
SG::ReadCondHandleKey< CondAttrListCollection > m_FILLSTATEFolderInputKey
SG::ReadHandleKey< CTP_RDO > m_CTP_RDO_RerunKey
void dumpData(const CTP_RDO *theCTP_RDO, const MuCTPI_RDO *theMuCTPI_RDO, const ROIB::RoIBResult *roib, const EventContext &ctx) const
void doMuonRoI(const MuCTPI_RDO *theMuCTPI_RDO, const ROIB::RoIBResult *roib, const EventContext &ctx) const
@ Core
Core flags describing the event.
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
static constexpr uint32_t MULT_THRESH_NUM
Definition MuCTPI_Bits.h:19
Generic monitoring tool for athena components.
MuonCoinDataCollection< TgcCoinData > TgcCoinDataCollection
MuonCoinDataContainer< TgcCoinDataCollection > TgcCoinDataContainer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
void fill(H5::Group &out_file, size_t iterations)
MsgStream & msg
Definition testRead.cxx:32