ATLAS Offline Software
CpmSimMonitorAlgorithm.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 
9 CpmSimMonitorAlgorithm::CpmSimMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
10  : AthMonitorAlgorithm(name,pSvcLocator),
11  m_overlapPresent(true), //fill histograms is a const - this variable is read only anyhow
12  m_cpCmxTool("LVL1::L1CPCMXTools/L1CPCMXTools"),
13  m_cpmTool("LVL1::L1CPMTools/L1CPMTools"),
14  m_errorTool("LVL1::TrigT1CaloMonErrorTool/TrigT1CaloMonErrorTool")
15 {
16 }
17 
19 
20  ATH_MSG_DEBUG("CpmSimMonitorAlgorith::initialize");
21  ATH_MSG_DEBUG("Package Name "<< m_packageName);
22 
23  // Container names
24  ATH_MSG_DEBUG("m_TriggerTowerLocation"<< m_triggerTowerLocation);
25  ATH_MSG_DEBUG("m_cpmTowerLocation"<< m_cpmTowerLocation);
26  ATH_MSG_DEBUG("m_cpmTowerLocationOverlap"<< m_cpmTowerLocationOverlap);
27  ATH_MSG_DEBUG("m_cpmTobRoiLocation"<< m_cpmTobRoiLocation);
28 
29  // Initialise all the readhandles that are needed
30  ATH_CHECK(m_triggerTowerLocation.initialize());
31  ATH_CHECK(m_cpmTowerLocation.initialize());
33  ATH_CHECK(m_cpmTobRoiLocation.initialize());
34  ATH_CHECK(m_rodHeaderLocation.initialize());
35  ATH_CHECK(m_cmxCpTobLocation.initialize());
36  ATH_CHECK(m_cmxCpHitsLocation.initialize());
37 
39 
41  renounce(m_L1MenuKey); // Detector Store data - hide this Data Dependency from the MT Scheduler
42 
43  // retrieve any tools if needed
44  ATH_CHECK(m_cpCmxTool.retrieve());
45  ATH_CHECK(m_cpmTool.retrieve());
46  ATH_CHECK(m_errorTool.retrieve());
47 
48  // steering parameters
49  ATH_MSG_DEBUG("m_crates"<<m_crates );
50  ATH_MSG_DEBUG("m_modules"<<m_modules );
51  ATH_MSG_DEBUG("m_maxSlices"<<m_maxSlices );
52  ATH_MSG_DEBUG("m_cmxs"<<m_cmxs );
53  ATH_MSG_DEBUG("m_legacyCpHadInputsDisabled"<<m_legacyCpHadInputsDisabled );
54 
55 
57 }
58 
59 StatusCode CpmSimMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const {
60 
61 
62  ATH_MSG_DEBUG("CpmSimMonitorAlgorithm::fillHistograms");
63 
64  std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> variables;
65 
66  // to deal with trigger menu
67  if (not m_configSvc.empty()) {
68  ATH_CHECK(m_configSvc.retrieve());
69  }
70 
71  //Retrieve Trigger Towers from SG
73  ATH_CHECK(triggerTowerTES.isValid());
74 
75  // Retrieve Core CPM Towers from SG
77  ATH_CHECK(cpmTowerTES.isValid());
78 
79  // Retrieve Overlap CPM Towers from SG
81  ATH_CHECK(cpmTowerOvTES.isValid());
82 
83  // Retrieve CPM TOB RoIs from SG
85  ATH_CHECK(cpmRoiTES.isValid());
86 
87  // Retrieve ROD Headers from SG
89  ATH_CHECK(rodTES.isValid());
90 
91  // Retrieve CMX-CP TOBs from SG
93  ATH_CHECK(cmxCpTobTES.isValid());
94 
95  // Retrieve CMX-CP Hits from SG
97  ATH_CHECK(cmxCpHitsTES.isValid());
98 
99  // Maps to simplify comparisons
100  TriggerTowerMapEm ttMapEm;
101  TriggerTowerMapEm ttMapHad;
102  CpmTowerMap cpMap;
103  CpmTowerMap ovMap;
104  CpmTobRoiMap crMap;
105  CmxCpTobMap cbMap;
106  CmxCpHitsMap cmMap;
107 
108  const xAOD::TriggerTowerContainer* triggerTowerTESptr = triggerTowerTES.cptr();
109  ATH_CHECK(setupMap(triggerTowerTESptr, ttMapEm, ttMapHad));
110 
111  const xAOD::CPMTowerContainer* cpmTowerTESptr = cpmTowerTES.cptr();
112  ATH_CHECK(setupMap(cpmTowerTESptr, cpMap));
113 
114  const xAOD::CPMTowerContainer* cpmTowerOvTESptr = cpmTowerOvTES.cptr();
115  ATH_CHECK(setupMap(cpmTowerOvTESptr, ovMap));
116 
117  const xAOD::CPMTobRoIContainer* cpmRoiTESptr = cpmRoiTES.cptr();
118  ATH_CHECK(setupMap(cpmRoiTESptr, crMap));
119  std::vector<int> parityMap(m_crates * m_cmxs * m_modules);
120 
121  const xAOD::CMXCPTobContainer* cmxCpTobTESptr=cmxCpTobTES.cptr();
122  ATH_CHECK(setupMap(cmxCpTobTESptr, cbMap, &parityMap));
123 
124  const xAOD::CMXCPHitsContainer* cmxCpHitsTESptr=cmxCpHitsTES.cptr();
125  ATH_CHECK(setupMap(cmxCpHitsTESptr, cmMap));
126 
127  // Vectors for error overview bits;
128  const int vecsizeCpm = 2 * m_crates * m_modules;
129  const int vecsizeCmx = 2 * m_crates * m_cmxs;
130  ErrorVector errorsCPM(vecsizeCpm);
131  ErrorVector errorsCMX(vecsizeCmx);
132 
133  // Compare Trigger Towers and CPM Towers from data
134  bool overlap = false;
135  bool mismatchCoreEm = false;
136  bool mismatchCoreHad = false;
137  bool mismatchOverlapEm = false;
138  bool mismatchOverlapHad = false;
139 
140  mismatchCoreEm = compareEm(ttMapEm, cpMap, errorsCPM, overlap);
141  mismatchCoreHad = compareHad(ttMapHad, cpMap, errorsCPM, overlap);
142  if (m_overlapPresent) {
143  overlap = true;
144  mismatchOverlapEm = compareEm(ttMapEm, ovMap, errorsCPM, overlap);
145  mismatchOverlapHad = compareHad(ttMapHad, ovMap, errorsCPM, overlap);
146  }
147 
148  // Compare RoIs simulated from CPM Towers with CPM RoIs from data
149 
150 
151  std::unique_ptr<xAOD::CPMTobRoIContainer> cpmRoiSIM = std::make_unique<xAOD::CPMTobRoIContainer>();
152  std::unique_ptr<xAOD::CPMTobRoIAuxContainer> cpmRoiSIMAux = std::make_unique<xAOD::CPMTobRoIAuxContainer>();
153 
154  cpmRoiSIM.get()->setStore(cpmRoiSIMAux.get());
155  if (mismatchCoreEm || mismatchCoreHad || mismatchOverlapEm ||
156  mismatchOverlapHad) {
157  simulate(&cpMap, &ovMap, cpmRoiSIM.get(), ctx);
158  } else {
159  simulate(&cpMap, cpmRoiSIM.get(), ctx);
160  }
161 
162  CpmTobRoiMap crSimMap;
163  ATH_CHECK(setupMap(cpmRoiSIM.get(), crSimMap));
164  const xAOD::RODHeaderContainer* rodTESptr = rodTES.cptr();
165  compare(crSimMap, crMap, errorsCPM, rodTESptr);
166  crSimMap.clear();
167 
168  // Compare CMX-CP TOBs simulated from CPM RoIs with CMX-CP TOBs from data
169 
170  std::unique_ptr<xAOD::CMXCPTobContainer> cmxCpTobSIM = std::make_unique<xAOD::CMXCPTobContainer>();
171  std::unique_ptr<xAOD::CMXCPTobAuxContainer> cmxCpTobSIMAux = std::make_unique<xAOD::CMXCPTobAuxContainer>();
172 
173  cmxCpTobSIM.get()->setStore(cmxCpTobSIMAux.get());
174  simulate(cpmRoiTESptr, cmxCpTobSIM.get());
175 
176  CmxCpTobMap cbSimMap;
177  ATH_CHECK(setupMap(cmxCpTobSIM.get(), cbSimMap));
178  compare(cbSimMap, cbMap, parityMap, errorsCPM, errorsCMX, rodTESptr);
179  cbSimMap.clear();
180 
181  // Compare Local sums simulated from CMX-CP TOBs with Local sums from data
182 
183  std::unique_ptr<xAOD::CMXCPHitsContainer> cmxLocalSIM = std::make_unique<xAOD::CMXCPHitsContainer>();
184  std::unique_ptr<xAOD::CMXCPHitsAuxContainer> cmxLocalSIMAux = std::make_unique<xAOD::CMXCPHitsAuxContainer>();
185  cmxLocalSIM.get()->setStore(cmxLocalSIMAux.get());
186  simulate(cmxCpTobTESptr, cmxLocalSIM.get(), xAOD::CMXCPHits::LOCAL,ctx);
187 
188  CmxCpHitsMap cmxLocalSimMap;
189  ATH_CHECK(setupMap(cmxLocalSIM.get(), cmxLocalSimMap));
190  compare(cmxLocalSimMap, cmMap, errorsCMX, xAOD::CMXCPHits::LOCAL);
191  cmxLocalSimMap.clear();
192 
193  // Compare Local sums with Remote sums from data
194 
195  compare(cmMap, cmMap, errorsCMX, xAOD::CMXCPHits::REMOTE_0);
196 
197  // Compare Total sums simulated from Remote sums with Total sums from data
198 
199 
200  std::unique_ptr<xAOD::CMXCPHitsContainer> cmxTotalSIM = std::make_unique<xAOD::CMXCPHitsContainer>();
201  std::unique_ptr<xAOD::CMXCPHitsAuxContainer> cmxTotalSIMAux = std::make_unique<xAOD::CMXCPHitsAuxContainer>();
202 
203  cmxTotalSIM->setStore(cmxTotalSIMAux.get());
204  simulate(cmxCpHitsTESptr, cmxTotalSIM.get());
205 
206  CmxCpHitsMap cmxTotalSimMap;
207  ATH_CHECK(setupMap(cmxTotalSIM.get(), cmxTotalSimMap));
208  compare(cmxTotalSimMap, cmMap, errorsCMX, xAOD::CMXCPHits::TOTAL);
209  cmxTotalSimMap.clear();
210 
211  // Compare Topo output information simulated from CMX-CP TOBs with Topo info
212  // from data
213 
214  std::unique_ptr<xAOD::CMXCPHitsContainer> cmxTopoSIM = std::make_unique<xAOD::CMXCPHitsContainer>();
215  std::unique_ptr<xAOD::CMXCPHitsAuxContainer> cmxTopoSIMAux = std::make_unique<xAOD::CMXCPHitsAuxContainer>();
216  cmxTopoSIM.get()->setStore(cmxTopoSIMAux.get());
217  simulate(cmxCpTobTESptr, cmxTopoSIM.get(), xAOD::CMXCPHits::TOPO_CHECKSUM, ctx);
218 
219  CmxCpHitsMap cmxTopoSimMap;
220  ATH_CHECK(setupMap(cmxTopoSIM.get(), cmxTopoSimMap));
221  compare(cmxTopoSimMap, cmMap, errorsCMX, xAOD::CMXCPHits::TOPO_CHECKSUM);
222  cmxTopoSimMap.clear();
223 
224  // Update error summary plots
225  Monitored::Scalar<int> cpmErrorLoc = Monitored::Scalar<int>("cpmErrorLoc", 0);
226  Monitored::Scalar<int> cpmError = Monitored::Scalar<int>("cpmError", 0);
227  Monitored::Scalar<int> cpmErrorLoc_SimNeData = Monitored::Scalar<int>("cpmErrorLoc_SimNeData", 0);
228  Monitored::Scalar<int> cpmError_SimNeData = Monitored::Scalar<int>("cpmError_SimNeData", 0);
229  Monitored::Scalar<int> cpmErrorSummary = Monitored::Scalar<int>("cpmErrorSummary", 0);
230  // event numbers
231  Monitored::Scalar<int> em_tt_y = Monitored::Scalar<int>("em_tt_y", 0);
232  Monitored::Scalar<int> had_tt_y = Monitored::Scalar<int>("had_tt_y", 0);
233  Monitored::Scalar<int> em_roi_y = Monitored::Scalar<int>("em_roi_y", 0);
234  Monitored::Scalar<int> tau_roi_y = Monitored::Scalar<int>("tau_roi_y", 0);
235  Monitored::Scalar<int> cmx_tob_left_y = Monitored::Scalar<int>("cmx_tob_left_y", 0);
236  Monitored::Scalar<int> cmx_tob_right_y = Monitored::Scalar<int>("cmx_tob_right_y", 0);
237  Monitored::Scalar<int> cmx_thresh_y = Monitored::Scalar<int>("cmx_thresh_y", 0);
238 
239  // set maximum number of error events per lumiblock(per type) to avoid histograms with many x-bins
240  const int maxErrorsPerLB=10;
241  bool error_tt{false}, error_roi{false}, error_tob{false}, error_thresh{false};
242  auto lb = GetEventInfo(ctx)->lumiBlock();
243  //
244  ErrorVector crateErr(m_crates);
245  const int cpmBins = m_crates * m_modules;
246  const int cmxBins = m_crates * m_cmxs;
247 
248  for (int err = 0; err < NumberOfSummaryBins; ++err) {
249  int error = 0;
250  for (int loc = 0; loc < cpmBins; ++loc) {
251  if ((errorsCPM[loc] >> err) & 0x1) {
252  cpmErrorLoc=loc;
253  cpmError=err;
254  fill(m_packageName,cpmErrorLoc,cpmError);
255  }
256  const long long eventNumber = ctx.eventID().event_number();
257  if ((errorsCPM[loc + cpmBins] >> err) & 0x1) {
258  cpmErrorLoc_SimNeData=loc;
259  cpmError_SimNeData=err;
260  fill(m_packageName,cpmErrorLoc_SimNeData,cpmError_SimNeData);
261  error = 1;
262  crateErr[loc / m_modules] |= (1 << err);
263  if (err<7) {
264  if (err==0 || err==1) {
265  // scope for mutable error event per lumi block tt counter
266  {
267  std::lock_guard<std::mutex> lock(m_mutex);
268  if (!error_tt) {
269  m_errorLB_tt_counter[lb]+=1;
270  error_tt = true;
271  }
272  if (m_errorLB_tt_counter[lb]<=maxErrorsPerLB) {
273  if (err==0) {
274  auto em_tt_evtstr = Monitored::Scalar<std::string>("em_tt_evtstr", std::to_string(eventNumber));
275  em_tt_y=loc;
276  fill(m_packageName,em_tt_evtstr,em_tt_y);
277  } else {
278  auto had_tt_evtstr = Monitored::Scalar<std::string>("had_tt_evtstr", std::to_string(eventNumber));
279  had_tt_y=loc;
280  fill(m_packageName,had_tt_evtstr,had_tt_y);
281  }
282  }
283  }
284  } else if (err==2 || err==3) {
285  // scope for mutable error event per lumi block roi counter
286  {
287  std::lock_guard<std::mutex> lock(m_mutex);
288  if (!error_roi) {
289  m_errorLB_roi_counter[lb]+=1;
290  error_roi = true;
291  }
292  if (m_errorLB_roi_counter[lb]<=maxErrorsPerLB) {
293  if (err==2) {
294  auto em_roi_evtstr = Monitored::Scalar<std::string>("em_roi_evtstr", std::to_string(eventNumber));
295  em_roi_y=loc;
296  fill(m_packageName,em_roi_evtstr,em_roi_y);
297  } else {
298  auto tau_roi_evtstr = Monitored::Scalar<std::string>("tau_roi_evtstr", std::to_string(eventNumber));
299  tau_roi_y=loc;
300  fill(m_packageName,tau_roi_evtstr,tau_roi_y);
301  }
302  }
303  }
304  } else if (err==4 || err==5) {
305  // scope for mutable error event per lumi block tob counter
306  {
307  std::lock_guard<std::mutex> lock(m_mutex);
308  if (!error_tob) {
309  m_errorLB_tob_counter[lb]+=1;
310  error_tob = true;
311  }
312  if(m_errorLB_tob_counter[lb]<=maxErrorsPerLB) {
313  if (err==4) {
314  auto cmx_tob_left_evtstr = Monitored::Scalar<std::string>("cmx_tob_left_evtstr", std::to_string(eventNumber));
315  cmx_tob_left_y=loc;
316  fill(m_packageName,cmx_tob_left_evtstr,cmx_tob_left_y);
317  } else {
318  auto cmx_tob_right_evtstr = Monitored::Scalar<std::string>("cmx_tob_right_evtstr", std::to_string(eventNumber));
319  cmx_tob_right_y=loc;
320  fill(m_packageName,cmx_tob_right_evtstr,cmx_tob_right_y);
321  }
322  }
323  }
324  }
325  } // err<7
326  }
327  if (loc < cmxBins) {
328  if ((errorsCMX[loc] >> err) & 0x1) {
329  cpmErrorLoc=loc+cpmBins;
330  cpmError=err;
331  fill(m_packageName,cpmErrorLoc,cpmError);
332  }
333  if ((errorsCMX[loc + cmxBins] >> err) & 0x1) {
334  cpmErrorLoc_SimNeData=loc+cpmBins;
335  cpmError_SimNeData=err;
336  fill(m_packageName,cpmErrorLoc_SimNeData,cpmError_SimNeData);
337  //
338  error = 1;
339  crateErr[loc / m_cmxs] |= (1 << err);
340  int offset = 0;
342  offset = 8;
343  else if (err == TopoMismatch) {
344  offset = 16;
345  }
346 
347  // scope for mutable error event per lumi block threshold counter
348  {
349  std::lock_guard<std::mutex> lock(m_mutex);
350  if (!error_thresh) {
351  m_errorLB_thresh_counter[lb]+=1;
352  error_thresh = true;
353  }
354  if(m_errorLB_thresh_counter[lb]<=maxErrorsPerLB) {
355  auto cmx_thresh_evtstr = Monitored::Scalar<std::string>("cmx_thresh_evtstr", std::to_string(eventNumber));
356  cmx_thresh_y=loc+offset;
357  fill(m_packageName,cmx_thresh_evtstr,cmx_thresh_y);
358  }
359  }
360  }
361  }
362  }
363  if (error) {
364  cpmErrorSummary=err;
365  fill(m_packageName,cpmErrorSummary);
366  }
367  } // summary bins
368 
369  //
370  // Save error vector for global summary
371  {
372  auto save = std::make_unique<ErrorVector>(crateErr);
373  auto* result = SG::makeHandle(m_errorLocation, ctx).put(std::move(save));
374  if (!result) {
375  ATH_MSG_ERROR("Error recording CPM mismatch vector in TES");
376  return StatusCode::FAILURE;
377  }
378  }
379 
380 
382  variables.clear();
383 
384  return StatusCode::SUCCESS;
385 }
386 
388  const CpmTowerMap &cpMap, ErrorVector &errors,
389  bool overlap) const {
390 
391  ATH_MSG_DEBUG("Compare Trigger Towers and CPM Towers");
392 
393  Monitored::Scalar<float> eta_em_PpmEqCor = Monitored::Scalar<float>("eta_em_PpmEqCor", 0.);
394  Monitored::Scalar<float> phi_em_PpmEqCor = Monitored::Scalar<float>("phi_em_PpmEqCor", 0.);
395 
396  Monitored::Scalar<float> eta_em_PpmNeCor = Monitored::Scalar<float>("eta_em_PpmNeCor", 0.);
397  Monitored::Scalar<float> phi_em_PpmNeCor = Monitored::Scalar<float>("phi_em_PpmNeCor", 0.);
398 
399  Monitored::Scalar<float> eta_em_PpmNoCor = Monitored::Scalar<float>("eta_em_PpmNoCor", 0.);
400  Monitored::Scalar<float> phi_em_PpmNoCor = Monitored::Scalar<float>("phi_em_PpmNoCor", 0.);
401 
402  Monitored::Scalar<float> eta_em_CoreNoPpm = Monitored::Scalar<float>("eta_em_CoreNoPpm", 0.);
403  Monitored::Scalar<float> phi_em_CoreNoPpm = Monitored::Scalar<float>("phi_em_CoreNoPpm", 0.);
404 
405  //
406  Monitored::Scalar<float> eta_em_PpmEqOverlap = Monitored::Scalar<float>("eta_em_PpmEqOverlap", 0.);
407  Monitored::Scalar<float> phi_em_PpmEqOverlap = Monitored::Scalar<float>("phi_em_PpmEqOverlap", 0.);
408 
409  Monitored::Scalar<float> eta_em_PpmNeOverlap = Monitored::Scalar<float>("eta_em_PpmNeOverlap", 0.);
410  Monitored::Scalar<float> phi_em_PpmNeOverlap = Monitored::Scalar<float>("phi_em_PpmNeOverlap", 0.);
411 
412  Monitored::Scalar<float> eta_em_PpmNoOverlap = Monitored::Scalar<float>("eta_em_PpmNoOverlap", 0.);
413  Monitored::Scalar<float> phi_em_PpmNoOverlap = Monitored::Scalar<float>("phi_em_PpmNoOverlap", 0.);
414 
415  Monitored::Scalar<float> eta_em_OverlapNoPpm = Monitored::Scalar<float>("eta_em_OverlapNoPpm", 0.);
416  Monitored::Scalar<float> phi_em_OverlapNoPpm = Monitored::Scalar<float>("phi_em_OverlapNoPpm", 0.);
417 
418  //
419  Monitored::Scalar<int> loc_PpmEqCpmFpga = Monitored::Scalar<int>("loc_PpmEqCpmFpga", 0.);
420  Monitored::Scalar<int> loc_fpga_PpmEqCpmFpga = Monitored::Scalar<int>("loc_fpga_PpmEqCpmFpga", 0.);
421 
422  Monitored::Scalar<int> loc_PpmNeCpmFpga = Monitored::Scalar<int>("loc_PpmNeCpmFpga", 0.);
423  Monitored::Scalar<int> loc_fpga_PpmNeCpmFpga = Monitored::Scalar<int>("loc_fpga_PpmNeCpmFpga", 0.);
424 
425  Monitored::Scalar<int> loc_PpmNoCpmFpga = Monitored::Scalar<int>("loc_PpmNoCpmFpga", 0.);
426  Monitored::Scalar<int> loc_fpga_PpmNoCpmFpga = Monitored::Scalar<int>("loc_fpga_PpmNoCpmFpga", 0.);
427 
428  Monitored::Scalar<int> loc_CpmNoPpmFpga = Monitored::Scalar<int>("loc_CpmNoPpmFpga", 0.);
429  Monitored::Scalar<int> loc_fpga_CpmNoPpmFpga = Monitored::Scalar<int>("loc_fpga_CpmNoPpmFpga", 0.);
430 
431  bool mismatch = false;
432  LVL1::CoordToHardware converter;
433  TriggerTowerMapEm::const_iterator ttMapIter = ttMap.begin();
434  TriggerTowerMapEm::const_iterator ttMapIterEnd = ttMap.end();
435  CpmTowerMap::const_iterator cpMapIter = cpMap.begin();
436  CpmTowerMap::const_iterator cpMapIterEnd = cpMap.end();
437 
438  while (ttMapIter != ttMapIterEnd || cpMapIter != cpMapIterEnd) {
439 
440  int ttKey = 0;
441  int cpKey = 0;
442  int ttEm = 0;
443  int cpEm = 0;
444  double eta = 0.;
445  double phi = 0.;
446  int key = 0;
447 
448  if (ttMapIter != ttMapIterEnd)
449  ttKey = ttMapIter->first;
450  if (cpMapIter != cpMapIterEnd)
451  cpKey = cpMapIter->first;
452 
453  if ((cpMapIter == cpMapIterEnd) ||
454  ((ttMapIter != ttMapIterEnd) && (cpKey > ttKey))) {
455 
456  // TriggerTower but no CPMTower
457 
458  const xAOD::TriggerTower *tt = ttMapIter->second;
459  ++ttMapIter;
460  const int layer = tt->layer();
461  eta = tt->eta();
462  phi = tt->phi();
463  if (overlap) { // skip non-overlap TTs
464  const LVL1::Coordinate coord(phi, eta);
465  const int crate = converter.cpCrateOverlap(coord);
466  if (crate >= m_crates)
467  continue;
468  }
469  // check if the TriggerTower is in EM or HAD layer
470  if (layer == 0) { // EM
471  ttEm = tt->cpET();
472  }
473  key = ttKey;
474 
475  } else if ((ttMapIter == ttMapIterEnd) ||
476  ((cpMapIter != cpMapIterEnd) && (ttKey > cpKey))) {
477 
478  // CPMTower but no TriggerTower
479 
480  const xAOD::CPMTower *cp = cpMapIter->second;
481  ++cpMapIter;
482  eta = cp->eta();
483  phi = cp->phi();
484  cpEm = cp->emEnergy();
485  key = cpKey;
486 
487  } else {
488 
489  // Have both
490 
491  const xAOD::TriggerTower *tt = ttMapIter->second;
492  const xAOD::CPMTower *cp = cpMapIter->second;
493  ++ttMapIter;
494  ++cpMapIter;
495  const int layer = tt->layer();
496  eta = tt->eta();
497  phi = tt->phi();
498  // check if the TriggerTower is in EM or HAD layer
499  if (layer == 0) { // EM
500  ttEm = tt->cpET();
501  ;
502  }
503  cpEm = cp->emEnergy();
504  key = ttKey;
505  }
506 
507  if (!ttEm && !cpEm)
508  continue;
509 
510  // Fill in error plots
511  const LVL1::Coordinate coord(phi, eta);
512  const int crate =
513  (overlap) ? converter.cpCrateOverlap(coord) : converter.cpCrate(coord);
514  const int cpm = (overlap) ? converter.cpModuleOverlap(coord)
515  : converter.cpModule(coord);
516  if (crate >= m_crates || cpm > m_modules)
517  continue;
518  const int loc = crate * m_modules + cpm - 1;
519  const int cpmBins = m_crates * m_modules;
520  const int bitEm = (1 << EMTowerMismatch);
521  double phiFPGA = phi;
522  if (overlap) {
523  const double twoPi = 2. * M_PI;
524  const double piByFour = M_PI / 4.;
525  if (phi > 7. * piByFour)
526  phiFPGA -= twoPi;
527  else if (phi < piByFour)
528  phiFPGA += twoPi;
529  }
530  const int loc2 = fpga(crate, phiFPGA);
531 
532  const double phiMod = phi * (32./M_PI);
533 
534  if (ttEm && ttEm == cpEm) { // non-zero match
535  errors[loc] |= bitEm;
536  if (overlap) {
537  eta_em_PpmEqOverlap=eta;
538  phi_em_PpmEqOverlap=phiMod;
539  fill(m_packageName,eta_em_PpmEqOverlap,phi_em_PpmEqOverlap);
540  } else {
541  eta_em_PpmEqCor=eta;
542  phi_em_PpmEqCor=phiMod;
543  fill(m_packageName,eta_em_PpmEqCor,phi_em_PpmEqCor);
544  }
545  loc_PpmEqCpmFpga=loc;
546  loc_fpga_PpmEqCpmFpga=loc2;
547  fill(m_packageName,loc_PpmEqCpmFpga,loc_fpga_PpmEqCpmFpga);
548 
549  } else if (ttEm != cpEm) { // mis-match
550  mismatch = true;
551  errors[loc + cpmBins] |= bitEm;
552  if (ttEm && cpEm) { // non-zero mis-match
553  if (overlap) {
554  eta_em_PpmNeOverlap=eta;
555  phi_em_PpmNeOverlap=phiMod;
556  fill(m_packageName,eta_em_PpmNeOverlap,phi_em_PpmNeOverlap);
557  } else {
558  eta_em_PpmNeCor=eta;
559  phi_em_PpmNeCor=phiMod;
560  fill(m_packageName,eta_em_PpmNeCor,phi_em_PpmNeCor);
561  }
562  loc_PpmNeCpmFpga=loc;
563  loc_fpga_PpmNeCpmFpga=loc2;
564  fill(m_packageName,loc_PpmNeCpmFpga,loc_fpga_PpmNeCpmFpga);
565 
566  } else if (!cpEm) { // no cp
567  if (overlap) {
568  eta_em_PpmNoOverlap=eta;
569  phi_em_PpmNoOverlap=phiMod;
570  fill(m_packageName,eta_em_PpmNoOverlap,phi_em_PpmNoOverlap);
571  } else {
572  eta_em_PpmNoCor=eta;
573  phi_em_PpmNoCor=phiMod;
574  fill(m_packageName,eta_em_PpmNoCor,phi_em_PpmNoCor);
575  }
576  loc_PpmNoCpmFpga=loc;
577  loc_fpga_PpmNoCpmFpga=loc2;
578  fill(m_packageName,loc_PpmNoCpmFpga,loc_fpga_PpmNoCpmFpga);
579 
580  } else { // no tt
581  if (overlap) {
582  //
583  eta_em_OverlapNoPpm=eta;
584  phi_em_OverlapNoPpm=phiMod;
585  fill(m_packageName,eta_em_OverlapNoPpm,phi_em_OverlapNoPpm);
586  } else {
587  eta_em_OverlapNoPpm=eta;
588  phi_em_OverlapNoPpm=phiMod;
589  fill(m_packageName,eta_em_OverlapNoPpm,phi_em_OverlapNoPpm);
590  }
591  loc_CpmNoPpmFpga=loc;
592  loc_fpga_CpmNoPpmFpga=loc2;
593  fill(m_packageName,loc_CpmNoPpmFpga,loc_fpga_CpmNoPpmFpga);
594 
595  }
596  ATH_MSG_DEBUG(" EMTowerMismatch key/eta/phi/crate/cpm/tt/cp: "
597  << key << "/" << eta << "/" << phi << "/" << crate
598  << "/" << cpm << "/" << ttEm << "/" << cpEm);
599  }
600  }
601 
602  return mismatch;
603 }
604 
606  const CpmTowerMap &cpMap, ErrorVector &errors,
607  bool overlap) const {
608 
609  ATH_MSG_DEBUG("Compare Trigger Towers and CPM Towers");
610 
611 
612  //
613  Monitored::Scalar<float> eta_had_PpmEqCor = Monitored::Scalar<float>("eta_had_PpmEqCor", 0.);
614  Monitored::Scalar<float> phi_had_PpmEqCor = Monitored::Scalar<float>("phi_had_PpmEqCor", 0.);
615 
616  Monitored::Scalar<float> eta_had_PpmNeCor = Monitored::Scalar<float>("eta_had_PpmNeCor", 0.);
617  Monitored::Scalar<float> phi_had_PpmNeCor = Monitored::Scalar<float>("phi_had_PpmNeCor", 0.);
618 
619  Monitored::Scalar<float> eta_had_PpmNoCor = Monitored::Scalar<float>("eta_had_PpmNoCor", 0.);
620  Monitored::Scalar<float> phi_had_PpmNoCor = Monitored::Scalar<float>("phi_had_PpmNoCor", 0.);
621 
622  Monitored::Scalar<float> eta_had_CoreNoPpm = Monitored::Scalar<float>("eta_had_CoreNoPpm", 0.);
623  Monitored::Scalar<float> phi_had_CoreNoPpm = Monitored::Scalar<float>("phi_had_CoreNoPpm", 0.);
624 
625  //
626  Monitored::Scalar<float> eta_had_PpmEqOverlap = Monitored::Scalar<float>("eta_had_PpmEqOverlap", 0.);
627  Monitored::Scalar<float> phi_had_PpmEqOverlap = Monitored::Scalar<float>("phi_had_PpmEqOverlap", 0.);
628 
629  Monitored::Scalar<float> eta_had_PpmNeOverlap = Monitored::Scalar<float>("eta_had_PpmNeOverlap", 0.);
630  Monitored::Scalar<float> phi_had_PpmNeOverlap = Monitored::Scalar<float>("phi_had_PpmNeOverlap", 0.);
631 
632  Monitored::Scalar<float> eta_had_PpmNoOverlap = Monitored::Scalar<float>("eta_had_PpmNoOverlap", 0.);
633  Monitored::Scalar<float> phi_had_PpmNoOverlap = Monitored::Scalar<float>("phi_had_PpmNoOverlap", 0.);
634 
635  Monitored::Scalar<float> eta_had_OverlapNoPpm = Monitored::Scalar<float>("eta_had_OverlapNoPpm", 0.);
636  Monitored::Scalar<float> phi_had_OverlapNoPpm = Monitored::Scalar<float>("phi_had_OverlapNoPpm", 0.);
637 
638  //
639  Monitored::Scalar<int> loc_PpmEqCpmFpga = Monitored::Scalar<int>("loc_PpmEqCpmFpga", 0.);
640  Monitored::Scalar<int> loc_fpga_PpmEqCpmFpga = Monitored::Scalar<int>("loc_fpga_PpmEqCpmFpga", 0.);
641 
642  Monitored::Scalar<int> loc_PpmNeCpmFpga = Monitored::Scalar<int>("loc_PpmNeCpmFpga", 0.);
643  Monitored::Scalar<int> loc_fpga_PpmNeCpmFpga = Monitored::Scalar<int>("loc_fpga_PpmNeCpmFpga", 0.);
644 
645  Monitored::Scalar<int> loc_PpmNoCpmFpga = Monitored::Scalar<int>("loc_PpmNoCpmFpga", 0.);
646  Monitored::Scalar<int> loc_fpga_PpmNoCpmFpga = Monitored::Scalar<int>("loc_fpga_PpmNoCpmFpga", 0.);
647 
648  Monitored::Scalar<int> loc_CpmNoPpmFpga = Monitored::Scalar<int>("loc_CpmNoPpmFpga", 0.);
649  Monitored::Scalar<int> loc_fpga_CpmNoPpmFpga = Monitored::Scalar<int>("loc_fpga_CpmNoPpmFpga", 0.);
650 
651  bool mismatch = false;
652  LVL1::CoordToHardware converter;
653  TriggerTowerMapHad::const_iterator ttMapIter = ttMap.begin();
654  TriggerTowerMapHad::const_iterator ttMapIterEnd = ttMap.end();
655  CpmTowerMap::const_iterator cpMapIter = cpMap.begin();
656  CpmTowerMap::const_iterator cpMapIterEnd = cpMap.end();
657 
658  while (ttMapIter != ttMapIterEnd || cpMapIter != cpMapIterEnd) {
659 
660  int ttKey = 0;
661  int cpKey = 0;
662  int ttHad = 0;
663  int cpHad = 0;
664  double eta = 0.;
665  double phi = 0.;
666  int key = 0;
667 
668  if (ttMapIter != ttMapIterEnd)
669  ttKey = ttMapIter->first;
670  if (cpMapIter != cpMapIterEnd)
671  cpKey = cpMapIter->first;
672 
673  if ((cpMapIter == cpMapIterEnd) ||
674  ((ttMapIter != ttMapIterEnd) && (cpKey > ttKey))) {
675 
676  // TriggerTower but no CPMTower
677 
678  const xAOD::TriggerTower *tt = ttMapIter->second;
679  ++ttMapIter;
680  const int layer = tt->layer();
681  eta = tt->eta();
682  phi = tt->phi();
683  if (overlap) { // skip non-overlap TTs
684  const LVL1::Coordinate coord(phi, eta);
685  const int crate = converter.cpCrateOverlap(coord);
686  if (crate >= m_crates)
687  continue;
688  }
689  // check if the TriggerTower is in EM or HAD layer
690  if (layer == 1) { // HAD
692  ttHad = 0;
693  }else{
694  ttHad = tt->cpET();
695  }
696  }
697  key = ttKey;
698 
699  } else if ((ttMapIter == ttMapIterEnd) ||
700  ((cpMapIter != cpMapIterEnd) && (ttKey > cpKey))) {
701 
702  // CPMTower but no TriggerTower
703 
704  const xAOD::CPMTower *cp = cpMapIter->second;
705  ++cpMapIter;
706  eta = cp->eta();
707  phi = cp->phi();
708  cpHad = cp->hadEnergy();
709  key = cpKey;
710 
711  } else {
712 
713  // Have both
714 
715  const xAOD::TriggerTower *tt = ttMapIter->second;
716  const xAOD::CPMTower *cp = cpMapIter->second;
717  ++ttMapIter;
718  ++cpMapIter;
719  const int layer = tt->layer();
720  eta = tt->eta();
721  phi = tt->phi();
722  // check if the TriggerTower is in EM or HAD layer
723  if (layer == 1) { // HAD
725  ttHad = 0;
726  }else{
727  ttHad = tt->cpET();
728  }
729  }
730  cpHad = cp->hadEnergy();
731  key = ttKey;
732  }
733 
734  if (!ttHad && !cpHad)
735  continue;
736 
737  // Fill in error plots
738  const LVL1::Coordinate coord(phi, eta);
739  const int crate =
740  (overlap) ? converter.cpCrateOverlap(coord) : converter.cpCrate(coord);
741  const int cpm = (overlap) ? converter.cpModuleOverlap(coord)
742  : converter.cpModule(coord);
743  if (crate >= m_crates || cpm > m_modules)
744  continue;
745  const int loc = crate * m_modules + cpm - 1;
746  const int cpmBins = m_crates * m_modules;
747  const int bitHad = (1 << HadTowerMismatch);
748  double phiFPGA = phi;
749  if (overlap) {
750  const double twoPi = 2. * M_PI;
751  const double piByFour = M_PI / 4.;
752  if (phi > 7. * piByFour)
753  phiFPGA -= twoPi;
754  else if (phi < piByFour)
755  phiFPGA += twoPi;
756  }
757  const int loc2 = fpga(crate, phiFPGA);
758  const int loc2Mod = loc2+1;
759 
760  const double phiMod = phi * (32./M_PI);
761  if (ttHad && ttHad == cpHad) { // non-zero match
762  errors[loc] |= bitHad;
763  if (overlap) {
764  eta_had_PpmEqOverlap=eta;
765  phi_had_PpmEqOverlap=phiMod;
766  fill(m_packageName,eta_had_PpmEqOverlap,phi_had_PpmEqOverlap);
767  } else {
768  eta_had_PpmEqCor=eta;
769  phi_had_PpmEqCor=phiMod;
770  fill(m_packageName,eta_had_PpmEqCor,phi_had_PpmEqCor);
771  }
772  loc_PpmEqCpmFpga=loc;
773  loc_fpga_PpmEqCpmFpga=loc2Mod;
774  fill(m_packageName,loc_PpmEqCpmFpga,loc_fpga_PpmEqCpmFpga);
775 
776 
777  } else if (ttHad != cpHad) { // mis-match
778  mismatch = true;
779  errors[loc + cpmBins] |= bitHad;
780  if (ttHad && cpHad) { // non-zero mis-match
781  if (overlap) {
782  eta_had_PpmNeOverlap=eta;
783  phi_had_PpmNeOverlap=phiMod;
784  fill(m_packageName,eta_had_PpmNeOverlap,phi_had_PpmNeOverlap);
785  } else {
786  eta_had_PpmNeCor=eta;
787  phi_had_PpmNeCor=phiMod;
788  fill(m_packageName,eta_had_PpmNeCor,phi_had_PpmNeCor);
789  }
790  loc_PpmNeCpmFpga=loc;
791  loc_fpga_PpmNeCpmFpga=loc2Mod;
792  fill(m_packageName,loc_PpmNeCpmFpga,loc_fpga_PpmNeCpmFpga);
793  } else if (!cpHad) { // no cp
794  if (overlap) {
795  eta_had_PpmNoOverlap=eta;
796  phi_had_PpmNoOverlap=phiMod;
797  fill(m_packageName,eta_had_PpmNoOverlap,phi_had_PpmNoOverlap);
798  } else {
799  eta_had_PpmNoCor=eta;
800  phi_had_PpmNoCor=phiMod;
801  fill(m_packageName,eta_had_PpmNoCor,phi_had_PpmNoCor);
802  }
803  loc_PpmNoCpmFpga=loc;
804  loc_fpga_PpmNoCpmFpga=loc2Mod;
805  fill(m_packageName,loc_PpmNoCpmFpga,loc_fpga_PpmNoCpmFpga);
806 
807  } else { // no tt
808  if (overlap) {
809  eta_had_OverlapNoPpm=eta;
810  phi_had_OverlapNoPpm=phiMod;
811  fill(m_packageName,eta_had_OverlapNoPpm,phi_had_OverlapNoPpm);
812  } else {
813  eta_had_OverlapNoPpm=eta;
814  phi_had_OverlapNoPpm=phiMod;
815  fill(m_packageName,eta_had_OverlapNoPpm,phi_had_OverlapNoPpm);
816  }
817  loc_CpmNoPpmFpga=loc;
818  loc_fpga_CpmNoPpmFpga=loc2Mod;
819  fill(m_packageName,loc_CpmNoPpmFpga,loc_fpga_CpmNoPpmFpga);
820  }
821 
822  ATH_MSG_DEBUG(" HadTowerMismatch key/eta/phi/crate/cpm/tt/cp: "
823  << key << "/" << eta << "/" << phi << "/" << crate
824  << "/" << cpm << "/" << ttHad << "/" << cpHad);
825 
826  }
827  }
828 
829  return mismatch;
830 }
831 
832 // Compare Simulated RoIs with data
833 
835  const CpmTobRoiMap &roiMap, ErrorVector &errors,
836  const xAOD::RODHeaderContainer *rodTES) const {
837 
838  ATH_MSG_DEBUG("Compare Simulated RoIs with data");
839 
841  CpmTobRoiMap::const_iterator simMapIter = roiSimMap.begin();
842  CpmTobRoiMap::const_iterator simMapIterEnd = roiSimMap.end();
843  CpmTobRoiMap::const_iterator datMapIter = roiMap.begin();
844  CpmTobRoiMap::const_iterator datMapIterEnd = roiMap.end();
845 
846  // scalars to fill bitwise histograms directly
847  Monitored::Scalar<int> emEnerSimEqDataLocX = Monitored::Scalar<int>("emEnerSimEqDataLocX", 0);
848  Monitored::Scalar<int> emEnerSimEqDataLocY = Monitored::Scalar<int>("emEnerSimEqDataLocY", 0);
849  Monitored::Scalar<int> tauEnerSimEqDataLocX = Monitored::Scalar<int>("tauEnerSimEqDataLocX", 0);
850  Monitored::Scalar<int> tauEnerSimEqDataLocY = Monitored::Scalar<int>("tauEnerSimEqDataLocY", 0);
851 
852  Monitored::Scalar<int> emEnerSimNeDataLocX = Monitored::Scalar<int>("emEnerSimNeDataLocX", 0);
853  Monitored::Scalar<int> emEnerSimNeDataLocY = Monitored::Scalar<int>("emEnerSimNeDataLocY", 0);
854  Monitored::Scalar<int> tauEnerSimNeDataLocX = Monitored::Scalar<int>("tauEnerSimNeDataLocX", 0);
855  Monitored::Scalar<int> tauEnerSimNeDataLocY = Monitored::Scalar<int>("tauEnerSimNeDataLocY", 0);
856 
857  Monitored::Scalar<int> emEnerDataNoSimLocX = Monitored::Scalar<int>("emEnerDataNoSimLocX", 0);
858  Monitored::Scalar<int> emEnerDataNoSimLocY = Monitored::Scalar<int>("emEnerDataNoSimLocY", 0);
859  Monitored::Scalar<int> tauEnerDataNoSimLocX = Monitored::Scalar<int>("tauEnerDataNoSimLocX", 0);
860  Monitored::Scalar<int> tauEnerDataNoSimLocY = Monitored::Scalar<int>("tauEnerDataNoSimLocY", 0);
861 
862  Monitored::Scalar<int> emEnerSimNoDataLocX = Monitored::Scalar<int>("emEnerSimNoDataLocX", 0);
863  Monitored::Scalar<int> emEnerSimNoDataLocY = Monitored::Scalar<int>("emEnerSimNoDataLocY", 0);
864  Monitored::Scalar<int> tauEnerSimNoDataLocX = Monitored::Scalar<int>("tauEnerSimNoDataLocX", 0);
865  Monitored::Scalar<int> tauEnerSimNoDataLocY = Monitored::Scalar<int>("tauEnerSimNoDataLocY", 0);
866 
867  Monitored::Scalar<int> emIsolSimEqDataLocX = Monitored::Scalar<int>("emIsolSimEqDataLocX", 0);
868  Monitored::Scalar<int> emIsolSimEqDataLocY = Monitored::Scalar<int>("emIsolSimEqDataLocY", 0);
869  Monitored::Scalar<int> tauIsolSimEqDataLocX = Monitored::Scalar<int>("tauIsolSimEqDataLocX", 0);
870  Monitored::Scalar<int> tauIsolSimEqDataLocY = Monitored::Scalar<int>("tauIsolSimEqDataLocY", 0);
871 
872  Monitored::Scalar<int> emIsolSimNeDataLocX = Monitored::Scalar<int>("emIsolSimNeDataLocX", 0);
873  Monitored::Scalar<int> emIsolSimNeDataLocY = Monitored::Scalar<int>("emIsolSimNeDataLocY", 0);
874  Monitored::Scalar<int> tauIsolSimNeDataLocX = Monitored::Scalar<int>("tauIsolSimNeDataLocX", 0);
875  Monitored::Scalar<int> tauIsolSimNeDataLocY = Monitored::Scalar<int>("tauIsolSimNeDataLocY", 0);
876 
877  Monitored::Scalar<int> emIsolDataNoSimLocX = Monitored::Scalar<int>("emIsolDataNoSimLocX", 0);
878  Monitored::Scalar<int> emIsolDataNoSimLocY = Monitored::Scalar<int>("emIsolDataNoSimLocY", 0);
879  Monitored::Scalar<int> tauIsolDataNoSimLocX = Monitored::Scalar<int>("tauIsolDataNoSimLocX", 0);
880  Monitored::Scalar<int> tauIsolDataNoSimLocY = Monitored::Scalar<int>("tauIsolDataNoSimLocY", 0);
881 
882  Monitored::Scalar<int> emIsolSimNoDataLocX = Monitored::Scalar<int>("emIsolSimNoDataLocX", 0);
883  Monitored::Scalar<int> emIsolSimNoDataLocY = Monitored::Scalar<int>("emIsolSimNoDataLocY", 0);
884  Monitored::Scalar<int> tauIsolSimNoDataLocX = Monitored::Scalar<int>("tauIsolSimNoDataLocX", 0);
885  Monitored::Scalar<int> tauIsolSimNoDataLocY = Monitored::Scalar<int>("tauIsolSimNoDataLocY", 0);
886 
887  Monitored::Scalar<float> roiEtaSimEqData = Monitored::Scalar<float>("roiEtaSimEqData", 0.);
888  Monitored::Scalar<float> roiPhiSimEqData = Monitored::Scalar<float>("roiPhiSimEqData", 0.);
889 
890  Monitored::Scalar<float> roiEtaSimNeData = Monitored::Scalar<float>("roiEtaSimNeData", 0.);
891  Monitored::Scalar<float> roiPhiSimNeData = Monitored::Scalar<float>("roiPhiSimNeData", 0.);
892 
893  Monitored::Scalar<float> roiEtaDataNoSim = Monitored::Scalar<float>("roiEtaDataNoSim", 0.);
894  Monitored::Scalar<float> roiPhiDataNoSim = Monitored::Scalar<float>("roiPhiDataNoSim", 0.);
895 
896  Monitored::Scalar<float> roiEtaSimNoData = Monitored::Scalar<float>("roiEtaSimNoData", 0.);
897  Monitored::Scalar<float> roiPhiSimNoData = Monitored::Scalar<float>("roiPhiSimNoData", 0.);
898 
899  while (simMapIter != simMapIterEnd || datMapIter != datMapIterEnd) {
900 
901  int simKey = 0;
902  int datKey = 0;
903  unsigned int simEnergy = 0;
904  unsigned int datEnergy = 0;
905  unsigned int simIsol = 0;
906  unsigned int datIsol = 0;
907  const xAOD::CPMTobRoI *roi = 0;
908 
909  if (simMapIter != simMapIterEnd)
910  simKey = simMapIter->first;
911  if (datMapIter != datMapIterEnd)
912  datKey = datMapIter->first;
913 
914  if ((datMapIter == datMapIterEnd) ||
915  ((simMapIter != simMapIterEnd) && (datKey > simKey))) {
916 
917  // Simulated RoI but no data RoI
918 
919  roi = simMapIter->second;
920  simEnergy = roi->energy();
921  simIsol = roi->isolation();
922  ++simMapIter;
923 
924  } else if ((simMapIter == simMapIterEnd) ||
925  ((datMapIter != datMapIterEnd) && (simKey > datKey))) {
926 
927  // Data RoI but no simulated RoI
928 
929  roi = datMapIter->second;
930  datEnergy = roi->energy();
931  datIsol = roi->isolation();
932  ++datMapIter;
933 
934  } else {
935 
936  // Have both
937 
938  const xAOD::CPMTobRoI *roiS = simMapIter->second;
939  roi = datMapIter->second;
940  simEnergy = roiS->energy();
941  simIsol = roiS->isolation();
942  datEnergy = roi->energy();
943  datIsol = roi->isolation();
944  ++simMapIter;
945  ++datMapIter;
946  }
947 
948  if (!simEnergy && !simIsol && !datEnergy && !datIsol)
949  continue;
950 
951  // Check LimitedRoISet bit
952 
953  const int crate = roi->crate();
954  if (!datEnergy && !datIsol && limitedRoiSet(crate,rodTES))
955  continue;
956 
957  // Fill in error plots
958 
959  const int cpm = roi->cpm();
960  const int chip = roi->chip();
961  const int local = roi->location();
962  const int type = roi->type();
963  const int locX = crate * m_modules + cpm - 1;
964  const int locY = chip * 8 + local;
965  const int cpmBins = m_crates * m_modules;
966  const int bit = (1 << ((type) ? TauRoIMismatch : EMRoIMismatch));
968  decoder.coordinate((roi->roiWord()))
969  ); // hack till updated
970  const double eta = coord.eta();
971  const double phi = coord.phi();
972 
973  if (simEnergy || datEnergy) {
974  if (simEnergy == datEnergy) {
975  errors[locX] |= bit;
976  if (type) {
977  tauEnerSimEqDataLocX=locX;
978  tauEnerSimEqDataLocY=locY;
979  fill(m_packageName,tauEnerSimEqDataLocX,tauEnerSimEqDataLocY);
980  } else {
981  emEnerSimEqDataLocX=locX;
982  emEnerSimEqDataLocY=locY;
983  fill(m_packageName,emEnerSimEqDataLocX,emEnerSimEqDataLocY);
984  }
985  } else {
986  errors[locX + cpmBins] |= bit;
987  if (simEnergy && datEnergy) {
988  if (type) {
989  tauEnerSimNeDataLocX=locX;
990  tauEnerSimNeDataLocY=locY;
991  fill(m_packageName,tauEnerSimNeDataLocX,tauEnerSimNeDataLocY);
992  } else {
993  emEnerSimNeDataLocX=locX;
994  emEnerSimNeDataLocY=locY;
995  fill(m_packageName,emEnerSimNeDataLocX,emEnerSimNeDataLocY);
996  }
997  } else if (simEnergy && !datEnergy) {
998  if (type) {
999  tauEnerSimNoDataLocX=locX;
1000  tauEnerSimNoDataLocY=locY;
1001  fill(m_packageName,tauEnerSimNoDataLocX,tauEnerSimNoDataLocY);
1002  } else {
1003  emEnerSimNoDataLocX=locX;
1004  emEnerSimNoDataLocY=locY;
1005  fill(m_packageName,emEnerSimNoDataLocX,emEnerSimNoDataLocY);
1006  }
1007  } else {
1008  if (type) {
1009  tauEnerDataNoSimLocX=locX;
1010  tauEnerDataNoSimLocY=locY;
1011  fill(m_packageName,tauEnerDataNoSimLocX,tauEnerDataNoSimLocY);
1012  } else {
1013  emEnerDataNoSimLocX=locX;
1014  emEnerDataNoSimLocY=locY;
1015  fill(m_packageName,emEnerDataNoSimLocX,emEnerDataNoSimLocY);
1016  }
1017  }
1018  }
1019  }
1020  if (simIsol || datIsol) {
1021  if (simIsol == datIsol) {
1022  errors[locX] |= bit;
1023  if (type) {
1024  tauIsolSimEqDataLocX=locX;
1025  tauIsolSimEqDataLocY=locY;
1026  fill(m_packageName,tauIsolSimEqDataLocX,tauIsolSimEqDataLocY);
1027  } else {
1028  emIsolSimEqDataLocX=locX;
1029  emIsolSimEqDataLocY=locY;
1030  fill(m_packageName,emIsolSimEqDataLocX,emIsolSimEqDataLocY);
1031  }
1032 
1033  } else {
1034  errors[locX + cpmBins] |= bit;
1035  if (simIsol && datIsol) {
1036  if (type) {
1037  tauIsolSimNeDataLocX=locX;
1038  tauIsolSimNeDataLocY=locY;
1039  fill(m_packageName,tauIsolSimNeDataLocX,tauIsolSimNeDataLocY);
1040  } else {
1041  emIsolSimNeDataLocX=locX;
1042  emIsolSimNeDataLocY=locY;
1043  fill(m_packageName,emIsolSimNeDataLocX,emIsolSimNeDataLocY);
1044  }
1045  } else if (simIsol && !datIsol) {
1046  if (type) {
1047  tauIsolSimNoDataLocX=locX;
1048  tauIsolSimNoDataLocY=locY;
1049  fill(m_packageName,tauIsolSimNoDataLocX,tauIsolSimNoDataLocY);
1050  } else {
1051  emIsolSimNoDataLocX=locX;
1052  emIsolSimNoDataLocY=locY;
1053  fill(m_packageName,emIsolSimNoDataLocX,emIsolSimNoDataLocY);
1054  }
1055  } else {
1056  if (type) {
1057  tauIsolDataNoSimLocX=locX;
1058  tauIsolDataNoSimLocY=locY;
1059  fill(m_packageName,tauIsolDataNoSimLocX,tauIsolDataNoSimLocY);
1060  } else {
1061  emIsolDataNoSimLocX=locX;
1062  emIsolDataNoSimLocY=locY;
1063  fill(m_packageName,emIsolDataNoSimLocX,emIsolDataNoSimLocY);
1064  }
1065  }
1066  }
1067  }
1068  const double phiMod = (phi * (32./M_PI)) - 0.5;
1069  double etaMod = eta - 0.05;
1070  if (simEnergy == datEnergy && simIsol == datIsol) {
1071  roiEtaSimEqData=etaMod;
1072  roiPhiSimEqData=phiMod;
1073  fill(m_packageName,roiEtaSimEqData,roiPhiSimEqData);
1074  } else {
1075  if ((simEnergy || simIsol) && (datEnergy || datIsol)) {
1076  roiEtaSimNeData=etaMod;
1077  roiPhiSimNeData=phiMod;
1078  fill(m_packageName,roiEtaSimNeData,roiPhiSimNeData);
1079  } else if (!datEnergy && !datIsol) {
1080  roiEtaSimNoData=etaMod;
1081  roiPhiSimNoData=phiMod;
1082  fill(m_packageName,roiEtaSimNoData,roiPhiSimNoData);
1083  } else {
1084  roiEtaDataNoSim=etaMod;
1085  roiPhiDataNoSim=phiMod;
1086  fill(m_packageName,roiEtaDataNoSim,roiPhiDataNoSim);
1087  }
1088  }
1089  } // end of iteration
1090 }
1091 
1092 // Compare simulated CMX TOBs with data
1093 
1094 void CpmSimMonitorAlgorithm::compare(const CmxCpTobMap &simMap, const CmxCpTobMap &datMap,
1095  const std::vector<int> & parityMap, ErrorVector &errorsCPM,
1096  ErrorVector &errorsCMX,
1097  const xAOD::RODHeaderContainer *rodTES) const {
1098 
1099  ATH_MSG_DEBUG("Compare simulated CMX TOBs with data");
1100 
1101  //
1102  Monitored::Scalar<int> cmxLeftEnerSimEqDataLocX = Monitored::Scalar<int>("cmxLeftEnerSimEqDataLocX", 0);
1103  Monitored::Scalar<int> cmxLeftEnerSimEqDataLocY = Monitored::Scalar<int>("cmxLeftEnerSimEqDataLocY", 0);
1104  Monitored::Scalar<int> cmxRightEnerSimEqDataLocX = Monitored::Scalar<int>("cmxRightEnerSimEqDataLocX", 0);
1105  Monitored::Scalar<int> cmxRightEnerSimEqDataLocY = Monitored::Scalar<int>("cmxRightEnerSimEqDataLocY", 0);
1106 
1107  Monitored::Scalar<int> cmxLeftEnerSimNeDataLocX = Monitored::Scalar<int>("cmxLeftEnerSimNeDataLocX", 0);
1108  Monitored::Scalar<int> cmxLeftEnerSimNeDataLocY = Monitored::Scalar<int>("cmxLeftEnerSimNeDataLocY", 0);
1109  Monitored::Scalar<int> cmxRightEnerSimNeDataLocX = Monitored::Scalar<int>("cmxRightEnerSimNeDataLocX", 0);
1110  Monitored::Scalar<int> cmxRightEnerSimNeDataLocY = Monitored::Scalar<int>("cmxRightEnerSimNeDataLocY", 0);
1111 
1112  Monitored::Scalar<int> cmxLeftEnerSimNoDataLocX = Monitored::Scalar<int>("cmxLeftEnerSimNoDataLocX", 0);
1113  Monitored::Scalar<int> cmxLeftEnerSimNoDataLocY = Monitored::Scalar<int>("cmxLeftEnerSimNoDataLocY", 0);
1114  Monitored::Scalar<int> cmxRightEnerSimNoDataLocX = Monitored::Scalar<int>("cmxRightEnerSimNoDataLocX", 0);
1115  Monitored::Scalar<int> cmxRightEnerSimNoDataLocY = Monitored::Scalar<int>("cmxRightEnerSimNoDataLocY", 0);
1116 
1117  Monitored::Scalar<int> cmxLeftEnerDataNoSimLocX = Monitored::Scalar<int>("cmxLeftEnerDataNoSimLocX", 0);
1118  Monitored::Scalar<int> cmxLeftEnerDataNoSimLocY = Monitored::Scalar<int>("cmxLeftEnerDataNoSimLocY", 0);
1119  Monitored::Scalar<int> cmxRightEnerDataNoSimLocX = Monitored::Scalar<int>("cmxRightEnerDataNoSimLocX", 0);
1120  Monitored::Scalar<int> cmxRightEnerDataNoSimLocY = Monitored::Scalar<int>("cmxRightEnerDataNoSimLocY", 0);
1121 
1122  Monitored::Scalar<int> cmxLeftIsolSimEqDataLocX = Monitored::Scalar<int>("cmxLeftIsolSimEqDataLocX", 0);
1123  Monitored::Scalar<int> cmxLeftIsolSimEqDataLocY = Monitored::Scalar<int>("cmxLeftIsolSimEqDataLocY", 0);
1124  Monitored::Scalar<int> cmxRightIsolSimEqDataLocX = Monitored::Scalar<int>("cmxRightIsolSimEqDataLocX", 0);
1125  Monitored::Scalar<int> cmxRightIsolSimEqDataLocY = Monitored::Scalar<int>("cmxRightIsolSimEqDataLocY", 0);
1126 
1127  Monitored::Scalar<int> cmxLeftIsolSimNeDataLocX = Monitored::Scalar<int>("cmxLeftIsolSimNeDataLocX", 0);
1128  Monitored::Scalar<int> cmxLeftIsolSimNeDataLocY = Monitored::Scalar<int>("cmxLeftIsolSimNeDataLocY", 0);
1129  Monitored::Scalar<int> cmxRightIsolSimNeDataLocX = Monitored::Scalar<int>("cmxRightIsolSimNeDataLocX", 0);
1130  Monitored::Scalar<int> cmxRightIsolSimNeDataLocY = Monitored::Scalar<int>("cmxRightIsolSimNeDataLocY", 0);
1131 
1132  Monitored::Scalar<int> cmxLeftIsolSimNoDataLocX = Monitored::Scalar<int>("cmxLeftIsolSimNoDataLocX", 0);
1133  Monitored::Scalar<int> cmxLeftIsolSimNoDataLocY = Monitored::Scalar<int>("cmxLeftIsolSimNoDataLocY", 0);
1134  Monitored::Scalar<int> cmxRightIsolSimNoDataLocX = Monitored::Scalar<int>("cmxRightIsolSimNoDataLocX", 0);
1135  Monitored::Scalar<int> cmxRightIsolSimNoDataLocY = Monitored::Scalar<int>("cmxRightIsolSimNoDataLocY", 0);
1136 
1137  Monitored::Scalar<int> cmxLeftIsolDataNoSimLocX = Monitored::Scalar<int>("cmxLeftIsolDataNoSimLocX", 0);
1138  Monitored::Scalar<int> cmxLeftIsolDataNoSimLocY = Monitored::Scalar<int>("cmxLeftIsolDataNoSimLocY", 0);
1139  Monitored::Scalar<int> cmxRightIsolDataNoSimLocX = Monitored::Scalar<int>("cmxRightIsolDataNoSimLocX", 0);
1140  Monitored::Scalar<int> cmxRightIsolDataNoSimLocY = Monitored::Scalar<int>("cmxRightIsolDataNoSimLocY", 0);
1141 
1142  Monitored::Scalar<float> cmxEtaSimEqData = Monitored::Scalar<float>("cmxEtaSimEqData", 0.);
1143  Monitored::Scalar<float> cmxPhiSimEqData = Monitored::Scalar<float>("cmxPhiSimEqData", 0.);
1144 
1145  Monitored::Scalar<float> cmxEtaSimNeData = Monitored::Scalar<float>("cmxEtaSimNeData", 0.);
1146  Monitored::Scalar<float> cmxPhiSimNeData = Monitored::Scalar<float>("cmxPhiSimNeData", 0.);
1147 
1148  Monitored::Scalar<float> cmxEtaDataNoSim = Monitored::Scalar<float>("cmxEtaDataNoSim", 0.);
1149  Monitored::Scalar<float> cmxPhiDataNoSim = Monitored::Scalar<float>("cmxPhiDataNoSim", 0.);
1150 
1151  Monitored::Scalar<float> cmxEtaSimNoData = Monitored::Scalar<float>("cmxEtaSimNoData", 0.);
1152  Monitored::Scalar<float> cmxPhiSimNoData = Monitored::Scalar<float>("cmxPhiSimNoData", 0.);
1153 
1154  Monitored::Scalar<int> cmxOverLocXSimEqData = Monitored::Scalar<int>("cmxOverLocXSimEqData", 0);
1155  Monitored::Scalar<int> cmxOverCmxSimEqData = Monitored::Scalar<int>("cmxOverCmxSimEqData", 0);
1156 
1157  Monitored::Scalar<int> cmxOverLocXSimNeData = Monitored::Scalar<int>("cmxOverLocXSimNeData", 0);
1158  Monitored::Scalar<int> cmxOverCmxSimNeData = Monitored::Scalar<int>("cmxOverCmxSimNeData", 0);
1159 
1160 
1162  CmxCpTobMap::const_iterator simMapIter = simMap.begin();
1163  CmxCpTobMap::const_iterator simMapIterEnd = simMap.end();
1164  CmxCpTobMap::const_iterator datMapIter = datMap.begin();
1165  CmxCpTobMap::const_iterator datMapIterEnd = datMap.end();
1166 
1167  while (simMapIter != simMapIterEnd || datMapIter != datMapIterEnd) {
1168 
1169  int simKey = 0;
1170  int datKey = 0;
1171  int simEnergy = 0;
1172  int simIsol = 0;
1173  int simOvf = 0;
1174  int datEnergy = 0;
1175  int datIsol = 0;
1176  int datOvf = 0;
1177 
1178  const xAOD::CMXCPTob *tob = 0;
1179  if (simMapIter != simMapIterEnd)
1180  simKey = simMapIter->first;
1181  if (datMapIter != datMapIterEnd)
1182  datKey = datMapIter->first;
1183 
1184  if ((datMapIter == datMapIterEnd) ||
1185  ((simMapIter != simMapIterEnd) && (datKey > simKey))) {
1186 
1187  // Simulated TOB but no data TOB
1188 
1189  tob = simMapIter->second;
1190  simEnergy = tob->energy();
1191  simIsol = tob->isolation();
1192  simOvf = (LVL1::DataError(tob->error())).get(LVL1::DataError::Overflow);
1193  ++simMapIter;
1194 
1195  } else if ((simMapIter == simMapIterEnd) ||
1196  ((datMapIter != datMapIterEnd) && (simKey > datKey))) {
1197 
1198  // Data TOB but no simulated TOB
1199 
1200  tob = datMapIter->second;
1201  datEnergy = tob->energy();
1202  datIsol = tob->isolation();
1203  datOvf = (LVL1::DataError(tob->error())).get(LVL1::DataError::Overflow);
1204  ++datMapIter;
1205 
1206  } else {
1207 
1208  // Have both
1209 
1210  const xAOD::CMXCPTob *tobS = simMapIter->second;
1211  tob = datMapIter->second;
1212  simEnergy = tobS->energy();
1213  simIsol = tobS->isolation();
1214  simOvf = (LVL1::DataError(tobS->error())).get(LVL1::DataError::Overflow);
1215  datEnergy = tob->energy();
1216  datIsol = tob->isolation();
1217  datOvf = (LVL1::DataError(tob->error())).get(LVL1::DataError::Overflow);
1218  ++simMapIter;
1219  ++datMapIter;
1220  }
1221 
1222  if (!simEnergy && !simIsol && !datEnergy && !datIsol)
1223  continue;
1224 
1225  // Check LimitedRoISet bit and ParityMerge bit
1226 
1227  const int crate = tob->crate();
1228  if (!simEnergy && !simIsol && limitedRoiSet(crate, rodTES))
1229  continue;
1230  const int cpm = tob->cpm();
1231  const int cmx = tob->cmx();
1232  if (!datEnergy && !datIsol) {
1233  const int index = (crate * m_cmxs + cmx) * m_modules + cpm - 1;
1234  if (parityMap[index])
1235  continue;
1236  }
1237 
1238  // Fill in error plots
1239 
1240  const int chip = tob->chip();
1241  const int loc = tob->location();
1242  const int locX = crate * m_modules + cpm - 1;
1243  const int locY = chip * 4 + loc;
1244  const int loc2 = crate * m_cmxs + cmx;
1245  const int cpmBins = m_crates * m_modules;
1246  const int cmxBins = m_crates * m_cmxs;
1247  const int bit = (1 << ((cmx) ? RightCMXTobMismatch : LeftCMXTobMismatch));
1248  const uint32_t roiWord = ((((((crate << 4) + cpm) << 4) + chip) << 2) + loc)
1249  << 18;
1251  decoder.coordinate(roiWord)); // hack till updated
1252  const double eta = coord.eta();
1253  const double phi = coord.phi();
1254 
1255  if (simEnergy || datEnergy) {
1256  if (simEnergy == datEnergy) {
1257  errorsCPM[locX] |= bit;
1258  errorsCMX[loc2] |= bit;
1259  if (cmx) {
1260  cmxRightEnerSimEqDataLocX=locX;
1261  cmxRightEnerSimEqDataLocY=locY;
1262  fill(m_packageName,cmxRightEnerSimEqDataLocX,cmxRightEnerSimEqDataLocY);
1263  } else {
1264  cmxLeftEnerSimEqDataLocX=locX;
1265  cmxLeftEnerSimEqDataLocY=locY;
1266  fill(m_packageName,cmxLeftEnerSimEqDataLocX,cmxLeftEnerSimEqDataLocY);
1267  }
1268  } else {
1269  errorsCPM[locX + cpmBins] |= bit;
1270  errorsCMX[loc2 + cmxBins] |= bit;
1271  if (simEnergy && datEnergy) {
1272  if (cmx) {
1273  cmxRightEnerSimNeDataLocX=locX;
1274  cmxRightEnerSimNeDataLocY=locY;
1275  fill(m_packageName,cmxRightEnerSimNeDataLocX,cmxRightEnerSimNeDataLocY);
1276  } else {
1277  cmxLeftEnerSimNeDataLocX=locX;
1278  cmxLeftEnerSimNeDataLocY=locY;
1279  fill(m_packageName,cmxLeftEnerSimNeDataLocX,cmxLeftEnerSimNeDataLocY);
1280  }
1281  } else if (simEnergy && !datEnergy) {
1282  if (cmx) {
1283  cmxRightEnerSimNoDataLocX=locX;
1284  cmxRightEnerSimNoDataLocY=locY;
1285  fill(m_packageName,cmxRightEnerSimNoDataLocX,cmxRightEnerSimNoDataLocY);
1286  } else {
1287  cmxLeftEnerSimNoDataLocX=locX;
1288  cmxLeftEnerSimNoDataLocY=locY;
1289  fill(m_packageName,cmxLeftEnerSimNoDataLocX,cmxLeftEnerSimNoDataLocY);
1290  }
1291  } else {
1292  if (cmx) {
1293  cmxRightEnerDataNoSimLocX=locX;
1294  cmxRightEnerDataNoSimLocY=locY;
1295  fill(m_packageName,cmxRightEnerDataNoSimLocX,cmxRightEnerDataNoSimLocY);
1296  } else {
1297  cmxLeftEnerDataNoSimLocX=locX;
1298  cmxLeftEnerDataNoSimLocY=locY;
1299  fill(m_packageName,cmxLeftEnerDataNoSimLocX,cmxLeftEnerDataNoSimLocY);
1300  }
1301  }
1302  }
1303  }
1304  if (simIsol || datIsol) {
1305  if (simIsol == datIsol) {
1306  errorsCPM[locX] |= bit;
1307  errorsCMX[loc2] |= bit;
1308  if (cmx) {
1309  cmxRightIsolSimEqDataLocX=locX;
1310  cmxRightIsolSimEqDataLocY=locY;
1311  fill(m_packageName,cmxRightIsolSimEqDataLocX,cmxRightIsolSimEqDataLocY);
1312  } else {
1313  cmxLeftIsolSimEqDataLocX=locX;
1314  cmxLeftIsolSimEqDataLocY=locY;
1315  fill(m_packageName,cmxLeftIsolSimEqDataLocX,cmxLeftIsolSimEqDataLocY);
1316  }
1317  } else {
1318  errorsCPM[locX + cpmBins] |= bit;
1319  errorsCMX[loc2 + cmxBins] |= bit;
1320  if (simIsol && datIsol) {
1321  if (cmx) {
1322  cmxRightIsolSimNeDataLocX=locX;
1323  cmxRightIsolSimNeDataLocY=locY;
1324  fill(m_packageName,cmxRightIsolSimNeDataLocX,cmxRightIsolSimNeDataLocY);
1325  } else {
1326  cmxLeftIsolSimNeDataLocX=locX;
1327  cmxLeftIsolSimNeDataLocY=locY;
1328  fill(m_packageName,cmxLeftIsolSimNeDataLocX,cmxLeftIsolSimNeDataLocY);
1329  }
1330  } else if (simIsol && !datIsol) {
1331  if (cmx) {
1332  cmxRightIsolSimNoDataLocX=locX;
1333  cmxRightIsolSimNoDataLocY=locY;
1334  fill(m_packageName,cmxRightIsolSimNoDataLocX,cmxRightIsolSimNoDataLocY);
1335  } else {
1336  cmxLeftIsolSimNoDataLocX=locX;
1337  cmxLeftIsolSimNoDataLocY=locY;
1338  fill(m_packageName,cmxLeftIsolSimNoDataLocX,cmxLeftIsolSimNoDataLocY);
1339  }
1340  } else {
1341  if (cmx) {
1342  cmxRightIsolDataNoSimLocX=locX;
1343  cmxRightIsolDataNoSimLocY=locY;
1344  fill(m_packageName,cmxRightIsolDataNoSimLocX,cmxRightIsolDataNoSimLocY);
1345  } else {
1346  cmxLeftIsolDataNoSimLocX=locX;
1347  cmxLeftIsolDataNoSimLocY=locY;
1348  fill(m_packageName,cmxLeftIsolDataNoSimLocX,cmxLeftIsolDataNoSimLocY);
1349  }
1350  }
1351  }
1352  }
1353  if (simOvf || datOvf) {
1354  if (simOvf == datOvf) {
1355  errorsCPM[locX] |= bit;
1356  errorsCMX[loc2] |= bit;
1357  cmxOverLocXSimEqData = locX;
1358  cmxOverCmxSimEqData = cmx;
1359  fill(m_packageName,cmxOverLocXSimEqData,cmxOverCmxSimEqData);
1360  } else {
1361  errorsCPM[locX + cpmBins] |= bit;
1362  errorsCMX[loc2 + cmxBins] |= bit;
1363  cmxOverLocXSimNeData = locX;
1364  cmxOverCmxSimNeData = cmx;
1365  fill(m_packageName,cmxOverLocXSimNeData,cmxOverCmxSimNeData);
1366  }
1367  }
1368  const double phiMod = phi * (32./M_PI) - 0.5;
1369  double etaMod = eta - 0.05;
1370  if (simEnergy == datEnergy && simIsol == datIsol) {
1371  cmxEtaSimEqData=etaMod;
1372  cmxPhiSimEqData=phiMod;
1373  fill(m_packageName,cmxEtaSimEqData,cmxPhiSimEqData);
1374  } else {
1375  if ((simEnergy || simIsol) && (datEnergy || datIsol)) {
1376  cmxEtaSimNeData=etaMod;
1377  cmxPhiSimNeData=phiMod;
1378  fill(m_packageName,cmxEtaSimNeData,cmxPhiSimNeData);
1379  } else if (!datEnergy && !datIsol) {
1380  cmxEtaSimNoData=etaMod;
1381  cmxPhiSimNoData=phiMod;
1382  fill(m_packageName,cmxEtaSimNoData,cmxPhiSimNoData);
1383  } else {
1384  cmxEtaDataNoSim=etaMod;
1385  cmxPhiDataNoSim=phiMod;
1386  fill(m_packageName,cmxEtaDataNoSim,cmxPhiDataNoSim);
1387  }
1388  }
1389  //
1390  }
1391 }
1392 
1393 // Compare Simulated CMX Hit Sums and Data CMX Hit Sums
1394 
1396  const CmxCpHitsMap &cmxMap, ErrorVector &errors,
1397  int selection) const {
1398 
1399  ATH_MSG_DEBUG("Compare Simulated CMX Hit Sums and Data CMX Hit Sums");
1400 
1401  const bool local = (selection == xAOD::CMXCPHits::LOCAL);
1402  const bool remote = (selection == xAOD::CMXCPHits::REMOTE_0);
1403  const bool total = (selection == xAOD::CMXCPHits::TOTAL);
1404  const bool topo = (selection == xAOD::CMXCPHits::TOPO_CHECKSUM);
1405 
1406  if (!local && !remote && !total /* && !topo*/)
1407  return;
1408 
1409  Monitored::Scalar<int> cmx_sum_loc_SimEqData = Monitored::Scalar<int>("cmx_sum_loc_SimEqData", 0);
1410  Monitored::Scalar<int> cmx_sum_loc_SimNeData = Monitored::Scalar<int>("cmx_sum_loc_SimNeData", 0);
1411  Monitored::Scalar<int> cmx_sum_loc_SimNoData = Monitored::Scalar<int>("cmx_sum_loc_SimNoData", 0);
1412  Monitored::Scalar<int> cmx_sum_loc_DataNoSim = Monitored::Scalar<int>("cmx_sum_loc_DataNoSim", 0);
1413 
1414  //
1415  Monitored::Scalar<int> cmxTopoLocXSimEqData = Monitored::Scalar<int>("cmxTopoLocXSimEqData", 0);
1416  Monitored::Scalar<int> cmxTopoLocYSimEqData = Monitored::Scalar<int>("cmxTopoLocYSimEqData", 0);
1417  Monitored::Scalar<int> cmxTopoLocXSimNeData = Monitored::Scalar<int>("cmxTopoLocXSimNeData", 0);
1418  Monitored::Scalar<int> cmxTopoLocYSimNeData = Monitored::Scalar<int>("cmxTopoLocYSimNeData", 0);
1419  Monitored::Scalar<int> cmxTopoLocXSimNoData = Monitored::Scalar<int>("cmxTopoLocXSimNoData", 0);
1420  Monitored::Scalar<int> cmxTopoLocYSimNoData = Monitored::Scalar<int>("cmxTopoLocYSimNoData", 0);
1421  Monitored::Scalar<int> cmxTopoLocXDataNoSim = Monitored::Scalar<int>("cmxTopoLocXDataNoSim", 0);
1422  Monitored::Scalar<int> cmxTopoLocYDataNoSim = Monitored::Scalar<int>("cmxTopoLocYDataNoSim", 0);
1423 
1424  //
1425  Monitored::Scalar<int> cmx_x_leftsums_SimEqData = Monitored::Scalar<int>("cmx_x_leftsums_SimEqData", 0);
1426  Monitored::Scalar<int> cmx_y_leftsums_SimEqData = Monitored::Scalar<int>("cmx_y_leftsums_SimEqData", 0);
1427  Monitored::Scalar<int> cmx_w_leftsums_SimEqData = Monitored::Scalar<int>("cmx_w_leftsums_SimEqData", 0);
1428  Monitored::Scalar<int> cmx_x_rightsums_SimEqData = Monitored::Scalar<int>("cmx_x_rightsums_SimEqData", 0);
1429  Monitored::Scalar<int> cmx_y_rightsums_SimEqData = Monitored::Scalar<int>("cmx_y_rightsums_SimEqData", 0);
1430  Monitored::Scalar<int> cmx_w_rightsums_SimEqData = Monitored::Scalar<int>("cmx_w_rightsums_SimEqData", 0);
1431 
1432  Monitored::Scalar<int> cmx_x_leftsums_SimNeData = Monitored::Scalar<int>("cmx_x_leftsums_SimNeData", 0);
1433  Monitored::Scalar<int> cmx_y_leftsums_SimNeData = Monitored::Scalar<int>("cmx_y_leftsums_SimNeData", 0);
1434  Monitored::Scalar<int> cmx_w_leftsums_SimNeData = Monitored::Scalar<int>("cmx_w_leftsums_SimNeData", 0);
1435  Monitored::Scalar<int> cmx_x_rightsums_SimNeData = Monitored::Scalar<int>("cmx_x_rightsums_SimNeData", 0);
1436  Monitored::Scalar<int> cmx_y_rightsums_SimNeData = Monitored::Scalar<int>("cmx_y_rightsums_SimNeData", 0);
1437  Monitored::Scalar<int> cmx_w_rightsums_SimNeData = Monitored::Scalar<int>("cmx_w_rightsums_SimNeData", 0);
1438 
1439 
1440  std::vector<unsigned int> hits0Sim(m_crates * m_cmxs);
1441  std::vector<unsigned int> hits1Sim(m_crates * m_cmxs);
1442  std::vector<unsigned int> hits0(m_crates * m_cmxs);
1443  std::vector<unsigned int> hits1(m_crates * m_cmxs);
1444  CmxCpHitsMap::const_iterator cmxSimMapIter = cmxSimMap.begin();
1445  CmxCpHitsMap::const_iterator cmxSimMapIterEnd = cmxSimMap.end();
1446  CmxCpHitsMap::const_iterator cmxMapIter = cmxMap.begin();
1447  CmxCpHitsMap::const_iterator cmxMapIterEnd = cmxMap.end();
1448 
1449  while (cmxSimMapIter != cmxSimMapIterEnd || cmxMapIter != cmxMapIterEnd) {
1450 
1451  int cmxSimKey = 0;
1452  int cmxKey = 0;
1453  unsigned int cmxSimHits0 = 0;
1454  unsigned int cmxSimHits1 = 0;
1455  unsigned int cmxHits0 = 0;
1456  unsigned int cmxHits1 = 0;
1457  int crate = 0;
1458  int cmx = 0;
1459  int source = 0;
1460 
1461  if (cmxSimMapIter != cmxSimMapIterEnd)
1462  cmxSimKey = cmxSimMapIter->first;
1463  if (cmxMapIter != cmxMapIterEnd)
1464  cmxKey = cmxMapIter->first;
1465 
1466  if ((cmxMapIter == cmxMapIterEnd) ||
1467  ((cmxSimMapIter != cmxSimMapIterEnd) && (cmxKey > cmxSimKey))) {
1468 
1469  // Sim CMX Hits but no Data CMX Hits
1470 
1471  const xAOD::CMXCPHits *cmxS = cmxSimMapIter->second;
1472  ++cmxSimMapIter;
1473  source = cmxS->sourceComponent();
1475  continue;
1477  continue;
1478  if (total && source != xAOD::CMXCPHits::TOTAL)
1479  continue;
1480  if (topo && source != xAOD::CMXCPHits::TOPO_CHECKSUM &&
1483  continue;
1484  cmxSimHits0 = cmxS->hits0();
1485  cmxSimHits1 = cmxS->hits1();
1486  crate = cmxS->crate();
1487  cmx = cmxS->cmx();
1488 
1489  } else if ((cmxSimMapIter == cmxSimMapIterEnd) ||
1490  ((cmxMapIter != cmxMapIterEnd) && (cmxSimKey > cmxKey))) {
1491 
1492  // Data CMX Hits but no Sim CMX Hits
1493 
1494  const xAOD::CMXCPHits *cmxD = cmxMapIter->second;
1495  ++cmxMapIter;
1496  source = cmxD->sourceComponent();
1498  continue;
1502  continue;
1503  if (total && source != xAOD::CMXCPHits::TOTAL)
1504  continue;
1505  if (topo && source != xAOD::CMXCPHits::TOPO_CHECKSUM &&
1508  continue;
1509  cmxHits0 = cmxD->hits0();
1510  cmxHits1 = cmxD->hits1();
1511  crate = cmxD->crate();
1512  cmx = cmxD->cmx();
1513 
1514  } else {
1515 
1516  // Have both
1517 
1518  const xAOD::CMXCPHits *cmxS = cmxSimMapIter->second;
1519  const xAOD::CMXCPHits *cmxD = cmxMapIter->second;
1520  ++cmxSimMapIter;
1521  ++cmxMapIter;
1522  source = cmxS->sourceComponent();
1524  continue;
1525  if (remote && source != xAOD::CMXCPHits::LOCAL &&
1529  continue;
1530  if (total && source != xAOD::CMXCPHits::TOTAL)
1531  continue;
1532  if (topo && source != xAOD::CMXCPHits::TOPO_CHECKSUM &&
1535  continue;
1536  cmxSimHits0 = cmxS->hits0();
1537  cmxSimHits1 = cmxS->hits1();
1538  cmxHits0 = cmxD->hits0();
1539  cmxHits1 = cmxD->hits1();
1540  crate = cmxS->crate();
1541  cmx = cmxS->cmx();
1542  }
1543 
1544  if (!cmxSimHits0 && !cmxSimHits1 && !cmxHits0 && !cmxHits1)
1545  continue;
1546 
1547  // Fill in error plots
1548 
1549  if (local || total) {
1550  int loc = crate * m_cmxs + cmx;
1551  const int cmxBins = m_crates * m_cmxs;
1552  const int bit =
1553  (local) ? (1 << LocalSumMismatch) : (1 << TotalSumMismatch);
1554  // loc for the histogram filling
1555  int loc_fill = (local) ? loc : 14 + cmx;
1556  if (cmxSimHits0 == cmxHits0 && cmxSimHits1 == cmxHits1) {
1557  errors[loc] |= bit;
1558  cmx_sum_loc_SimEqData=loc_fill;
1559  fill(m_packageName,cmx_sum_loc_SimEqData);
1560  } else {
1561  errors[loc + cmxBins] |= bit;
1562  if ((cmxSimHits0 || cmxSimHits1) && (cmxHits0 || cmxHits1)) {
1563  cmx_sum_loc_SimNeData=loc_fill;
1564  fill(m_packageName,cmx_sum_loc_SimNeData);
1565  } else if (!cmxHits0 && !cmxHits1) {
1566  cmx_sum_loc_SimNoData=loc_fill;
1567  fill(m_packageName,cmx_sum_loc_SimNoData);
1568  } else {
1569  cmx_sum_loc_DataNoSim=loc_fill;
1570  fill(m_packageName,cmx_sum_loc_SimEqData);
1571  }
1572  }
1573  // the loc used for filling histograms
1574  loc = (local) ? loc : 14 + cmx;
1575  // now divide it by 2
1576  loc /= 2;
1577  const int nThresh = 8;
1578  const int thrLen = 3;
1579  int same0 = thresholdsSame(cmxHits0, cmxSimHits0, nThresh, thrLen);
1580  int diff0 = thresholdsDiff(cmxHits0, cmxSimHits0, nThresh, thrLen);
1581  int same1 = thresholdsSame(cmxHits1, cmxSimHits1, nThresh, thrLen);
1582  int diff1 = thresholdsDiff(cmxHits1, cmxSimHits1, nThresh, thrLen);
1583  if (cmx) {
1584  fillXVsThresholds(cmx_x_rightsums_SimEqData,cmx_y_rightsums_SimEqData,cmx_w_rightsums_SimEqData,
1585  loc, same0, nThresh, 1);
1586  fillXVsThresholds(cmx_x_rightsums_SimNeData,cmx_y_rightsums_SimNeData,cmx_w_rightsums_SimNeData,
1587  loc, diff0, nThresh, 1);
1588  const int offset = nThresh;
1589  fillXVsThresholds(cmx_x_rightsums_SimEqData,cmx_y_rightsums_SimEqData,cmx_w_rightsums_SimEqData,
1590  loc, same1, nThresh, 1, offset);
1591  fillXVsThresholds(cmx_x_rightsums_SimNeData,cmx_y_rightsums_SimNeData,cmx_w_rightsums_SimNeData,
1592  loc, diff1, nThresh, 1, offset);
1593  } else {
1594  fillXVsThresholds(cmx_x_leftsums_SimEqData,cmx_y_leftsums_SimEqData,cmx_w_leftsums_SimEqData,
1595  loc, same0, nThresh, 1);
1596  fillXVsThresholds(cmx_x_leftsums_SimNeData,cmx_y_leftsums_SimNeData,cmx_w_leftsums_SimNeData,
1597  loc, diff0, nThresh, 1);
1598  const int offset = nThresh;
1599  fillXVsThresholds(cmx_x_leftsums_SimEqData,cmx_y_leftsums_SimEqData,cmx_w_leftsums_SimEqData,
1600  loc, same1, nThresh, 1, offset);
1601  fillXVsThresholds(cmx_x_leftsums_SimNeData,cmx_y_leftsums_SimNeData,cmx_w_leftsums_SimNeData,
1602  loc, diff1, nThresh, 1, offset);
1603  }
1604  } else if (remote) {
1605  if (source == xAOD::CMXCPHits::LOCAL) {
1606  if (crate != m_crates - 1) {
1607  hits0Sim[crate * m_cmxs + cmx] = cmxSimHits0;
1608  hits1Sim[crate * m_cmxs + cmx] = cmxSimHits1;
1609  }
1610  } else {
1611  const int remCrate = source - xAOD::CMXCPHits::REMOTE_0;
1612  hits0[remCrate * m_cmxs + cmx] = cmxHits0;
1613  hits1[remCrate * m_cmxs + cmx] = cmxHits1;
1614  }
1615  } else {
1616  const int locX = crate * m_cmxs + cmx;
1618  const int cmxBins = m_crates * m_cmxs;
1619  const int bit = (1 << TopoMismatch);
1620  if (cmxSimHits0 == cmxHits0 && cmxSimHits1 == cmxHits1) {
1621  errors[locX] |= bit;
1622  cmxTopoLocXSimEqData=locX;
1623  cmxTopoLocYSimEqData=locY;
1624  fill(m_packageName,cmxTopoLocXSimEqData,cmxTopoLocYSimEqData);
1625  } else {
1626  errors[locX + cmxBins] |= bit;
1627  if ((cmxSimHits0 || cmxSimHits1) && (cmxHits0 || cmxHits1)) {
1628  cmxTopoLocXSimNeData=locX;
1629  cmxTopoLocYSimNeData=locY;
1630  fill(m_packageName,cmxTopoLocXSimNeData,cmxTopoLocYSimNeData);
1631  } else if (!cmxHits0 && !cmxHits1) {
1632  cmxTopoLocXSimNoData=locX;
1633  cmxTopoLocYSimNoData=locY;
1634  fill(m_packageName,cmxTopoLocXSimNoData,cmxTopoLocYSimNoData);
1635  } else {
1636  cmxTopoLocXDataNoSim=locX;
1637  cmxTopoLocYDataNoSim=locY;
1638  fill(m_packageName,cmxTopoLocXDataNoSim,cmxTopoLocYDataNoSim);
1639  }
1640  }
1641  }
1642  }
1643  if (remote) {
1644  for (int crate = 0; crate < m_crates - 1; ++crate) {
1645  for (int cmx = 0; cmx < m_cmxs; ++cmx) {
1646  int loc = crate * m_cmxs + cmx;
1647  const int cmxBins = m_crates * m_cmxs;
1648  const int bit = (1 << RemoteSumMismatch);
1649  const unsigned int hd0 = hits0[loc];
1650  const unsigned int hd1 = hits1[loc];
1651  const unsigned int hs0 = hits0Sim[loc];
1652  const unsigned int hs1 = hits1Sim[loc];
1653 
1654  if (!hd0 && !hd1 && !hs0 && !hs1)
1655  continue;
1656 
1657  int loc_fill = loc + 8;
1658  if (hs0 == hd0 && hs1 == hd1) {
1659  errors[loc] |= bit;
1660  cmx_sum_loc_SimEqData=loc_fill;
1661  fill(m_packageName,cmx_sum_loc_SimEqData);
1662  } else {
1663  errors[loc + cmxBins] |= bit;
1664  if ((hs0 || hs1) && (hd0 || hd1)) {
1665  cmx_sum_loc_SimNeData=loc_fill;
1666  fill(m_packageName,cmx_sum_loc_SimNeData);
1667  } else if (!hd0 && !hd1) {
1668  cmx_sum_loc_SimNoData=loc_fill;
1669  fill(m_packageName,cmx_sum_loc_SimNoData);
1670  } else {
1671  cmx_sum_loc_DataNoSim=loc_fill;
1672  fill(m_packageName,cmx_sum_loc_DataNoSim);
1673  }
1674  }
1675  // this is the loc used for filling
1676  loc = loc_fill;
1677  // and to be used for the rest of the filling
1678  loc /= 2;
1679  const int nThresh = 8;
1680  const int thrLen = 3;
1681  int same0 = thresholdsSame(hd0, hs0, nThresh, thrLen);
1682  int diff0 = thresholdsDiff(hd0, hs0, nThresh, thrLen);
1683  int same1 = thresholdsSame(hd1, hs1, nThresh, thrLen);
1684  int diff1 = thresholdsDiff(hd1, hs1, nThresh, thrLen);
1685  if (cmx) {
1686  fillXVsThresholds(cmx_x_rightsums_SimEqData,cmx_y_rightsums_SimEqData,cmx_w_rightsums_SimEqData,
1687  loc, same0, nThresh, 1);
1688  fillXVsThresholds(cmx_x_rightsums_SimNeData,cmx_y_rightsums_SimNeData,cmx_w_rightsums_SimNeData,
1689  loc, diff0, nThresh, 1);
1690  const int offset = nThresh;
1691  fillXVsThresholds(cmx_x_rightsums_SimEqData,cmx_y_rightsums_SimEqData,cmx_w_rightsums_SimEqData,
1692  loc, same1, nThresh, 1, offset);
1693  fillXVsThresholds(cmx_x_rightsums_SimNeData,cmx_y_rightsums_SimNeData,cmx_w_rightsums_SimNeData,
1694  loc, diff1, nThresh, 1, offset);
1695  } else {
1696  fillXVsThresholds(cmx_x_leftsums_SimEqData,cmx_y_leftsums_SimEqData,cmx_w_leftsums_SimEqData,
1697  loc, same0, nThresh, 1);
1698  fillXVsThresholds(cmx_x_leftsums_SimNeData,cmx_y_leftsums_SimNeData,cmx_w_leftsums_SimNeData,
1699  loc, diff0, nThresh, 1);
1700  const int offset = nThresh;
1701  fillXVsThresholds(cmx_x_leftsums_SimEqData,cmx_y_leftsums_SimEqData,cmx_w_leftsums_SimEqData,
1702  loc, same1, nThresh, 1, offset);
1703  fillXVsThresholds(cmx_x_leftsums_SimNeData,cmx_y_leftsums_SimNeData,cmx_w_leftsums_SimNeData,
1704  loc, diff1, nThresh, 1, offset);
1705  }
1706  }
1707  }
1708  }
1709 }
1710 
1711 
1712 // Fill weighted thresholds 2D, Y axis
1713 
1715  Monitored::Scalar<int> &yitem,
1716  Monitored::Scalar<int> &witem,
1717  int x,int val, int nThresh, int nBits, int offset) const
1718 {
1719  if (val) {
1720  const int mask = (1 << nBits) - 1;
1721  for (int thr = 0; thr < nThresh; ++thr) {
1722  const int hit = (val >> (nBits*thr)) & mask;
1723  if (hit) {
1724  xitem=x;
1725  yitem=thr+offset;
1726  witem=hit;
1727  fill(m_packageName, xitem, yitem, witem);
1728  }
1729  }
1730  }
1731 }
1732 
1733 // Flag which threshold hit values are non-zero and the same
1734 
1736  int nThresh, int nBits) const
1737 {
1738  int result = 0;
1739  const int mask = (1 << nBits) - 1;
1740  for (int thr = 0; thr < nThresh; ++thr) {
1741  const int hit1 = (val1 >> (nBits*thr)) & mask;
1742  const int hit2 = (val2 >> (nBits*thr)) & mask;
1743  if (hit1 && (hit1 == hit2)) result |= (1 << thr);
1744  }
1745  return result;
1746 }
1747 
1748 // Flag which threshold hit values are different
1749 
1751  int nThresh, int nBits) const
1752 {
1753  int result = 0;
1754  const int mask = (1 << nBits) - 1;
1755  for (int thr = 0; thr < nThresh; ++thr) {
1756  const int hit1 = (val1 >> (nBits*thr)) & mask;
1757  const int hit2 = (val2 >> (nBits*thr)) & mask;
1758  if (hit1 != hit2) result |= (1 << thr);
1759  }
1760  return result;
1761 }
1762 
1763 
1764 
1765 // Set up TriggerTower map
1766 
1768  TriggerTowerMapEm &mapEm,
1769  TriggerTowerMapHad &mapHad) const {
1770 
1771  LVL1::TriggerTowerKey towerKey;
1774  int emE = 0;
1775  int hadE = 0;
1776  for (; pos != posE; ++pos) {
1777  const xAOD::TriggerTower *tt = (*pos);
1778  const int layer = (*pos)->layer();
1779  if (layer == 0)
1780  emE = (*pos)->cpET();
1781  ;
1782  if (layer == 1)
1783  hadE = (*pos)->cpET();
1784  ;
1785  const double eta = (*pos)->eta();
1786  if (eta > -2.5 && eta < 2.5 && (emE > 0 || hadE > 0)) {
1787  const double phi = (*pos)->phi();
1788  const int key = towerKey.ttKey(phi, eta);
1789  if (emE > 0)
1790  mapEm.insert(std::make_pair(key, tt));
1791  if (hadE > 0)
1792  mapHad.insert(std::make_pair(key, tt));
1793  }
1794  }
1795 
1796  return StatusCode::SUCCESS;
1797 }
1798 
1799 
1800 // Set up CpmTower map
1801 
1803 
1804  LVL1::TriggerTowerKey towerKey;
1807  for (; pos != posE; ++pos) {
1808  CpmTowerMap::mapped_type cp = (*pos);
1809  const double eta = (*pos)->eta();
1810  const double phi = (*pos)->phi();
1811  const int key = towerKey.ttKey(phi, eta);
1812  map.insert(std::make_pair(key, cp));
1813  }
1814  return StatusCode::SUCCESS;
1815 }
1816 
1817 // Set up CpmTobRoi map
1818 
1820  CpmTobRoiMap &map) const {
1821  if (coll) {
1824  for (; pos != posE; ++pos) {
1825  const int crate = (*pos)->crate();
1826  const int cpm = (*pos)->cpm();
1827  const int chip = (*pos)->chip();
1828  const int loc = (*pos)->location();
1829  const int type = (*pos)->type();
1830  const int key =
1831  (((((((type << 2) | crate) << 4) | cpm) << 3) | chip) << 3) | loc;
1832  map.insert(std::make_pair(key, *pos));
1833  }
1834  }
1835  return StatusCode::SUCCESS;
1836 }
1837 
1838 // Set up CmxCpTob map
1839 
1841  std::vector<int> *parityMap) const {
1842 
1845  for (; pos != posE; ++pos) {
1846  const int crate = (*pos)->crate();
1847  const int cpm = (*pos)->cpm();
1848  const int cmx = (*pos)->cmx();
1849  const int chip = (*pos)->chip();
1850  const int loc = (*pos)->location();
1851  const int key =
1852  (((((((crate << 1) | cmx) << 4) | cpm) << 4) | chip) << 2) | loc;
1853  map.insert(std::make_pair(key, *pos));
1854  if (parityMap) {
1855  LVL1::DataError err((*pos)->error());
1856  const int parity = err.get(LVL1::DataError::ParityMerge);
1857  if (parity) {
1858  const int index = (crate * m_cmxs + cmx) * m_modules + cpm - 1;
1859  (*parityMap)[index] = parity;
1860  }
1861  }
1862  }
1863  return StatusCode::SUCCESS;
1864 }
1865 
1866 // Set up CmxCpHits map
1867 
1869  CmxCpHitsMap &map) const {
1872  for (; pos != posE; ++pos) {
1873  const int crate = (*pos)->crate();
1874  const int cmx = (*pos)->cmx();
1875  const int source = (*pos)->sourceComponent();
1876  const int key = (crate * 2 + cmx) * 8 + source;
1877  map.insert(std::make_pair(key, *pos));
1878  }
1879  return StatusCode::SUCCESS;
1880 }
1881 
1882 // Simulate CPM RoIs from CPM Towers
1883 
1885  xAOD::CPMTobRoIContainer *rois, const EventContext& ctx) const {
1886 
1887  ATH_MSG_DEBUG("Simulate CPM TOB RoIs from CPM Towers");
1888 
1889  // Process a crate at a time to use overlap data
1890  std::vector<CpmTowerMap> crateMaps(m_crates);
1891  LVL1::CoordToHardware converter;
1892  std::unique_ptr<xAOD::CPMTowerContainer> tempColl = std::make_unique<xAOD::CPMTowerContainer>();
1893  std::unique_ptr<xAOD::CPMTowerAuxContainer> tempCollAux = std::make_unique<xAOD::CPMTowerAuxContainer>();
1894 
1895  tempColl.get()->setStore(tempCollAux.get());
1896  for (const auto& iter : *towers) {
1897  CpmTowerMap::mapped_type tt = ttCheck(iter.second, tempColl.get());
1898  const LVL1::Coordinate coord(tt->phi(), tt->eta());
1899  const int crate = converter.cpCrate(coord);
1900  if (crate >= m_crates)
1901  continue;
1902  crateMaps[crate].insert(std::make_pair(iter.first, tt));
1903  }
1904  // If overlap data not present take from core data
1905  for (const auto& iter : ((m_overlapPresent) ? *towersOv : *towers)) {
1906  CpmTowerMap::mapped_type tt = ttCheck(iter.second, tempColl.get());
1907  const LVL1::Coordinate coord(tt->phi(), tt->eta());
1908  const int crate = converter.cpCrateOverlap(coord);
1909  if (crate >= m_crates)
1910  continue;
1911  crateMaps[crate].insert(std::make_pair(iter.first, tt));
1912  }
1913 
1914  for (int crate = 0; crate < m_crates; ++crate) {
1915  xAOD::CPMTobRoIContainer *roiTemp =
1917 
1918  m_cpmTool->findCPMTobRoIs(getL1Menu(ctx), towers, roiTemp, 1);
1919 
1920  xAOD::CPMTobRoIContainer::iterator roiIter = roiTemp->begin();
1921  xAOD::CPMTobRoIContainer::iterator roiIterE = roiTemp->end();
1922  for (; roiIter != roiIterE; ++roiIter) {
1923  if ((*roiIter)->crate() == crate) {
1924  rois->push_back(*roiIter);
1925  }
1926  }
1927  delete roiTemp;
1928  }
1929 }
1930 
1931 // Simulate CPM RoIs from CPM Towers quick version
1932 
1934  xAOD::CPMTobRoIContainer *rois, const EventContext& ctx) const {
1935 
1936  ATH_MSG_DEBUG("Simulate CPM TOB RoIs from CPM Towers");
1937 
1938  m_cpmTool->findCPMTobRoIs(getL1Menu(ctx), towers, rois, 1);
1939 }
1940 
1941 // Simulate CMX-CP TOBs from CPM RoIs
1942 
1944  xAOD::CMXCPTobContainer *tobs) const {
1945 
1946  ATH_MSG_DEBUG("Simulate CMX TOBs from CPM TOB RoIs");
1947 
1948  m_cpCmxTool->formCMXCPTob(rois, tobs);
1949 }
1950 
1951 // Simulate CMX Hit sums from CMX TOBs
1952 
1955  int selection,
1956  const EventContext& ctx) const {
1957 
1958  ATH_MSG_DEBUG("Simulate CMX Hit sums from CMX TOBs");
1959 
1960 
1962  m_cpCmxTool->formCMXCPHitsCrate(getL1Menu(ctx), tobs, hits);
1963  } else if (selection == xAOD::CMXCPHits::TOPO_CHECKSUM) {
1964  m_cpCmxTool->formCMXCPHitsTopo(tobs, hits);
1965  }
1966 
1967 }
1968 
1969 // Simulate CMX Total Hit sums from Remote/Local
1970 
1972  xAOD::CMXCPHitsContainer *hitsOut) const {
1973 
1974  ATH_MSG_DEBUG("Simulate CMX Total Hit sums from Remote/Local");
1975 
1976  m_cpCmxTool->formCMXCPHitsSystem(hitsIn, hitsOut);
1977 }
1978 
1979 
1980 int CpmSimMonitorAlgorithm::fpga(int crate, double phi) const {
1981  const double phiGran = M_PI / 32.;
1982  const double phiBase = M_PI / 2. * double(crate);
1983  const int phiBin = int(floor((phi - phiBase) / phiGran)) + 2;
1984  return 2 * (phiBin / 2);
1985 }
1986 
1987 
1988 // Return a tower with zero energy if parity bit is set
1989 
1990 CpmSimMonitorAlgorithm::CpmTowerMap::mapped_type
1991 CpmSimMonitorAlgorithm::ttCheck( CpmTowerMap::mapped_type tt, xAOD::CPMTowerContainer* coll) const
1992 {
1993  const LVL1::DataError emError(tt->emError());
1994  const LVL1::DataError hadError(tt->hadError());
1995  const int emParity = emError.get(LVL1::DataError::Parity);
1996  const int hadParity = hadError.get(LVL1::DataError::Parity);
1997  if ((emParity && tt->emEnergy()) || (hadParity && tt->hadEnergy())) {
1998  const int peak = tt->peak();
1999  std::vector<uint8_t> emEnergyVec(tt->emEnergyVec());
2000  std::vector<uint8_t> hadEnergyVec(tt->hadEnergyVec());
2001  std::vector<uint32_t> emErrorVec(tt->emErrorVec());
2002  std::vector<uint32_t> hadErrorVec(tt->hadErrorVec());
2003  if (emParity)
2004  emEnergyVec[peak] = 0;
2005  if (hadParity)
2006  hadEnergyVec[peak] = 0;
2007  xAOD::CPMTower *ct = new xAOD::CPMTower();
2008  ct->makePrivateStore();
2009  ct->initialize(tt->eta(), tt->phi(), emEnergyVec, hadEnergyVec, emErrorVec,
2010  hadErrorVec, peak);
2011  coll->push_back(ct);
2012  return ct;
2013  }
2014  return tt;
2015 }
2016 
2018 
2019  int limitedRoi = 0;
2020  xAOD::RODHeaderContainer::const_iterator rodIter = rodTES->begin();
2021  xAOD::RODHeaderContainer::const_iterator rodIterE = rodTES->end();
2022  for (; rodIter != rodIterE; ++rodIter) {
2023  const xAOD::RODHeader *rod = *rodIter;
2024  const int rodCrate = rod->crate() - 8;
2025  if (rodCrate >= 0 && rodCrate < m_crates && rod->dataType() == 1 &&
2026  rod->limitedRoISet()) {
2027  limitedRoi |= (1 << rodCrate);
2028  }
2029  }
2030  return (((limitedRoi >> crate) & 0x1) == 1);
2031 }
2032 
2034 
2035  int limitedRoi = 0;
2036  xAOD::RODHeaderContainer::const_iterator rodIter = (*rodTES).begin();
2037  xAOD::RODHeaderContainer::const_iterator rodIterE = (*rodTES).end();
2038  for (; rodIter != rodIterE; ++rodIter) {
2039  const xAOD::RODHeader *rod = *rodIter;
2040  const int rodCrate = rod->crate() - 8;
2041  if (rodCrate >= 0 && rodCrate < m_crates && rod->dataType() == 1 &&
2042  rod->limitedRoISet()) {
2043  limitedRoi |= (1 << rodCrate);
2044  }
2045  }
2046  return (((limitedRoi >> crate) & 0x1) == 1);
2047 }
2048 
2049 
2050 
2051 const TrigConf::L1Menu* CpmSimMonitorAlgorithm::getL1Menu(const EventContext& ctx) const {
2052  const TrigConf::L1Menu* menu = nullptr;
2053  if (detStore()->contains<TrigConf::L1Menu>(m_L1MenuKey.key())) {
2055  if( l1MenuHandle.isValid() ){
2056  menu=l1MenuHandle.cptr();
2057  }
2058  } else {
2059  menu = &(m_configSvc->l1Menu(ctx));
2060  }
2061 
2062  return menu;
2063 }
2064 
LVL1::CoordToHardware::cpModuleOverlap
unsigned int cpModuleOverlap(const Coordinate &coord)
return ID of CP module for overlap coord
Definition: CoordToHardware.cxx:213
CpmSimMonitorAlgorithm::EMTowerMismatch
@ EMTowerMismatch
Definition: CpmSimMonitorAlgorithm.h:67
xAOD::CPMTobRoI_v1::isolation
int isolation() const
Return isolation.
Definition: CPMTobRoI_v1.cxx:74
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
CpmSimMonitorAlgorithm::HadTowerMismatch
@ HadTowerMismatch
Definition: CpmSimMonitorAlgorithm.h:67
CpmSimMonitorAlgorithm::CpmSimMonitorAlgorithm
CpmSimMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CpmSimMonitorAlgorithm.cxx:9
AthMonitorAlgorithm::dataType
DataType_t dataType() const
Accessor functions for the data type.
Definition: AthMonitorAlgorithm.h:221
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
CpmSimMonitorAlgorithm::simulate
void simulate(const CpmTowerMap *towers, const CpmTowerMap *towersOv, xAOD::CPMTobRoIContainer *rois, const EventContext &ctx) const
Definition: CpmSimMonitorAlgorithm.cxx:1884
xAOD::CMXCPHits_v1::hits0
uint32_t hits0() const
Peak functions - return value of peak bunch crossing Assuming we have got the timing calibration corr...
Definition: CMXCPHits_v1.cxx:72
CpmSimMonitorAlgorithm::m_cpmTool
ToolHandle< LVL1::IL1CPMTools > m_cpmTool
Definition: CpmSimMonitorAlgorithm.h:89
xAOD::CMXCPTob_v1::crate
uint8_t crate() const
get crate
CpmSimMonitorAlgorithm::m_errorTool
ToolHandle< LVL1::ITrigT1CaloMonErrorTool > m_errorTool
Definition: CpmSimMonitorAlgorithm.h:91
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
LVL1::DataError
Error data.
Definition: DataError.h:27
get_generator_info.result
result
Definition: get_generator_info.py:21
xAOD::CMXCPHits_v1::REMOTE_2
@ REMOTE_2
Definition: CMXCPHits_v1.h:29
checkCoolLatestUpdate.variables
variables
Definition: checkCoolLatestUpdate.py:13
CpmSimMonitorAlgorithm::NumberOfSummaryBins
@ NumberOfSummaryBins
Definition: CpmSimMonitorAlgorithm.h:70
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CpmSimMonitorAlgorithm::TriggerTowerMapHad
std::map< int, const xAOD::TriggerTower * > TriggerTowerMapHad
Definition: CpmSimMonitorAlgorithm.h:95
Trk::locX
@ locX
Definition: ParamDefs.h:37
CpmSimMonitorAlgorithm::thresholdsSame
int thresholdsSame(int val1, int val2, int nThresh, int nBits) const
Definition: CpmSimMonitorAlgorithm.cxx:1735
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:38
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.LArCondContChannels.decoder
decoder
def channelSelection(self, channelList, groupType): if groupType == self.SingleGroup: pass elif group...
Definition: LArCondContChannels.py:618
CpmSimMonitorAlgorithm::m_packageName
StringProperty m_packageName
Definition: CpmSimMonitorAlgorithm.h:51
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CpmSimMonitorAlgorithm::fillXVsThresholds
void fillXVsThresholds(Monitored::Scalar< int > &xitem, Monitored::Scalar< int > &yitem, Monitored::Scalar< int > &witem, int x, int val, int nThresh, int nBits, int offset=0) const
Definition: CpmSimMonitorAlgorithm.cxx:1714
CpmSimMonitorAlgorithm::fpga
int fpga(int crate, double phi) const
Definition: CpmSimMonitorAlgorithm.cxx:1980
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
CpmSimMonitorAlgorithm::m_mutex
std::mutex m_mutex
Definition: CpmSimMonitorAlgorithm.h:181
CpmSimMonitorAlgorithm::m_rodHeaderLocation
SG::ReadHandleKey< xAOD::RODHeaderContainer > m_rodHeaderLocation
Definition: CpmSimMonitorAlgorithm.h:81
python.TriggerConfig.menu
menu
Definition: TriggerConfig.py:842
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
Definition: AthCommonDataStore.h:380
CpmSimMonitorAlgorithm::TotalSumMismatch
@ TotalSumMismatch
Definition: CpmSimMonitorAlgorithm.h:69
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Trk::loc2
@ loc2
generic first and second local coordinate
Definition: ParamDefs.h:35
xAOD::CPMTobRoI_v1::crate
int crate() const
Return crate number (0-1)
Definition: CPMTobRoI_v1.cxx:38
CpmSimMonitorAlgorithm::thresholdsDiff
int thresholdsDiff(int val1, int val2, int nThresh, int nBits) const
Definition: CpmSimMonitorAlgorithm.cxx:1750
xAOD::CMXCPTob_v1
Description of CMXCPTob_v1.
Definition: CMXCPTob_v1.h:27
TrigConf::L1Menu
L1 menu configuration.
Definition: L1Menu.h:28
CoordToHardware.h
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
CpmSimMonitorAlgorithm::m_cpCmxTool
ToolHandle< LVL1::IL1CPCMXTools > m_cpCmxTool
Definition: CpmSimMonitorAlgorithm.h:87
xAOD::CPMTower
CPMTower_v2 CPMTower
Define the latest version of the CPMTower class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/CPMTower.h:16
CpmSimMonitorAlgorithm::m_cmxCpTobLocation
SG::ReadHandleKey< xAOD::CMXCPTobContainer > m_cmxCpTobLocation
Definition: CpmSimMonitorAlgorithm.h:79
CpmSimMonitorAlgorithm::limitedRoiSet
bool limitedRoiSet(int crate, SG::ReadHandle< xAOD::RODHeaderContainer > &rodTES) const
Definition: CpmSimMonitorAlgorithm.cxx:2033
x
#define x
CpmSimMonitorAlgorithm::CpmTowerMap
xAOD::CPMTowerMap_t CpmTowerMap
Definition: CpmSimMonitorAlgorithm.h:96
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
CpmSimMonitorAlgorithm::compareHad
bool compareHad(const TriggerTowerMapHad &ttMap, const CpmTowerMap &cpMap, ErrorVector &errors, bool overlap) const
Definition: CpmSimMonitorAlgorithm.cxx:605
xAOD::CMXCPHits_v1::TOPO_OCCUPANCY_MAP
@ TOPO_OCCUPANCY_MAP
Definition: CMXCPHits_v1.h:30
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
CpmSimMonitorAlgorithm::m_overlapPresent
bool m_overlapPresent
Definition: CpmSimMonitorAlgorithm.h:64
CpmSimMonitorAlgorithm::m_cpmTowerLocation
SG::ReadHandleKey< xAOD::CPMTowerContainer > m_cpmTowerLocation
Definition: CpmSimMonitorAlgorithm.h:76
CpmSimMonitorAlgorithm::m_cpmTowerLocationOverlap
SG::ReadHandleKey< xAOD::CPMTowerContainer > m_cpmTowerLocationOverlap
Definition: CpmSimMonitorAlgorithm.h:77
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
CpmSimMonitorAlgorithm::compare
void compare(const CpmTobRoiMap &roiSimMap, const CpmTobRoiMap &roiMap, ErrorVector &errors, const xAOD::RODHeaderContainer *rodTES) const
Definition: CpmSimMonitorAlgorithm.cxx:834
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
CpmSimMonitorAlgorithm::m_errorLocation
SG::WriteHandleKey< std::vector< int > > m_errorLocation
Definition: CpmSimMonitorAlgorithm.h:54
menu
make the sidebar many part of the config
Definition: hcg.cxx:551
checkTP.save
def save(self, fileName="./columbo.out")
Definition: checkTP.py:178
xAOD::CMXCPHits_v1::cmx
uint8_t cmx() const
get cmx
LVL1::CoordinateRange
CoordinateRange class declaration.
Definition: CoordinateRange.h:36
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
python.BunchSpacingUtils.lb
lb
Definition: BunchSpacingUtils.py:88
LVL1::DataError::Overflow
@ Overflow
Definition: DataError.h:31
CpmSimMonitorAlgorithm::ErrorVector
std::vector< int > ErrorVector
Definition: CpmSimMonitorAlgorithm.h:72
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
LVL1::Coordinate
Coordinate class declaration.
Definition: TrigT1/TrigT1Interfaces/TrigT1Interfaces/Coordinate.h:50
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
xAOD::CPMTobRoI_v1::cpm
int cpm() const
Return CPM number (1-14)
Definition: CPMTobRoI_v1.cxx:44
xAOD::CMXCPHits_v1::TOTAL
@ TOTAL
Definition: CMXCPHits_v1.h:29
CpmSimMonitorAlgorithm.h
CpmSimMonitorAlgorithm::CmxCpTobMap
std::map< int, const xAOD::CMXCPTob * > CmxCpTobMap
Definition: CpmSimMonitorAlgorithm.h:97
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::CMXCPTob_v1::error
uint32_t error() const
get errorVec at peak bunch crossing
Definition: CMXCPTob_v1.cxx:92
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CpmSimMonitorAlgorithm::m_cpmTobRoiLocation
SG::ReadHandleKey< xAOD::CPMTobRoIContainer > m_cpmTobRoiLocation
Definition: CpmSimMonitorAlgorithm.h:78
CpmSimMonitorAlgorithm::ttCheck
CpmTowerMap::mapped_type ttCheck(CpmTowerMap::mapped_type tt, xAOD::CPMTowerContainer *coll) const
Definition: CpmSimMonitorAlgorithm.cxx:1991
xAOD::TriggerTower_v2
Description of TriggerTower_v2.
Definition: TriggerTower_v2.h:49
CpmSimMonitorAlgorithm::TauRoIMismatch
@ TauRoIMismatch
Definition: CpmSimMonitorAlgorithm.h:68
CpmSimMonitorAlgorithm::TriggerTowerMapEm
std::map< int, const xAOD::TriggerTower * > TriggerTowerMapEm
Definition: CpmSimMonitorAlgorithm.h:94
CpmSimMonitorAlgorithm::m_legacyCpHadInputsDisabled
Gaudi::Property< bool > m_legacyCpHadInputsDisabled
Definition: CpmSimMonitorAlgorithm.h:61
CpmSimMonitorAlgorithm::LocalSumMismatch
@ LocalSumMismatch
Definition: CpmSimMonitorAlgorithm.h:69
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LVL1::CoordToHardware::cpModule
unsigned int cpModule(const Coordinate &coord)
return ID of CP module.
Definition: CoordToHardware.cxx:52
xAOD::CPMTobRoI_v1::type
int type() const
Return type em/tau (0/1)
Definition: CPMTobRoI_v1.cxx:62
xAOD::CPMTobRoI_v1::roiWord
uint32_t roiWord() const
get roiWord
CpmSimMonitorAlgorithm::setupMap
StatusCode setupMap(const xAOD::TriggerTowerContainer *coll, TriggerTowerMapEm &emmap, TriggerTowerMapHad &hadmap) const
Definition: CpmSimMonitorAlgorithm.cxx:1767
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
CpmSimMonitorAlgorithm::m_cmxs
Gaudi::Property< int > m_cmxs
Definition: CpmSimMonitorAlgorithm.h:59
RunTileMonitoring.rod
rod
Definition: RunTileMonitoring.py:134
xAOD::RODHeader_v2
Description of RODHeader_v2.
Definition: RODHeader_v2.h:23
LVL1::DataError::Parity
@ Parity
Definition: DataError.h:31
CpmSimMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: CpmSimMonitorAlgorithm.cxx:18
AthMonitorAlgorithm::GetEventInfo
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
Definition: AthMonitorAlgorithm.cxx:107
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
CpmSimMonitorAlgorithm::m_triggerTowerLocation
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_triggerTowerLocation
Definition: CpmSimMonitorAlgorithm.h:75
CpmSimMonitorAlgorithm::m_crates
Gaudi::Property< int > m_crates
Definition: CpmSimMonitorAlgorithm.h:56
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
calibdata.ct
ct
Definition: calibdata.py:418
CpmSimMonitorAlgorithm::m_cmxCpHitsLocation
SG::ReadHandleKey< xAOD::CMXCPHitsContainer > m_cmxCpHitsLocation
Definition: CpmSimMonitorAlgorithm.h:80
CpmSimMonitorAlgorithm::m_configSvc
ServiceHandle< TrigConf::ITrigConfigSvc > m_configSvc
Definition: CpmSimMonitorAlgorithm.h:48
mergePhysValFiles.errors
list errors
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:43
CpmSimMonitorAlgorithm::EMRoIMismatch
@ EMRoIMismatch
Definition: CpmSimMonitorAlgorithm.h:67
InDetDD::local
@ local
Definition: InDetDD_Defs.h:16
CpmSimMonitorAlgorithm::LeftCMXTobMismatch
@ LeftCMXTobMismatch
Definition: CpmSimMonitorAlgorithm.h:68
xAOD::CMXCPHits_v1::LOCAL
@ LOCAL
Definition: CMXCPHits_v1.h:29
LVL1::CoordToHardware
returns the trigger hardware components associated with a given Coordinate
Definition: CoordToHardware.h:42
selection
const std::string selection
Definition: fbtTestBasics.cxx:74
LVL1::DataError::ParityMerge
@ ParityMerge
Definition: DataError.h:37
xAOD::CMXCPTob_v1::cmx
uint8_t cmx() const
get cmx
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CpmSimMonitorAlgorithm::m_modules
Gaudi::Property< int > m_modules
Definition: CpmSimMonitorAlgorithm.h:57
xAOD::phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
Definition: L2StandAloneMuon_v2.cxx:144
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
LVL1::CoordToHardware::cpCrate
unsigned int cpCrate(const Coordinate &coord)
returns crate ID covering that coord.
Definition: CoordToHardware.cxx:39
python.update_ci_reference_files.remote
remote
Definition: update_ci_reference_files.py:417
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
CpmSimMonitorAlgorithm::TopoMismatch
@ TopoMismatch
Definition: CpmSimMonitorAlgorithm.h:70
xAOD::CMXCPHits_v1::REMOTE_0
@ REMOTE_0
Definition: CMXCPHits_v1.h:29
LArNewCalib_PedestalAutoCorr.cp
cp
Definition: LArNewCalib_PedestalAutoCorr.py:188
xAOD::CMXCPHits_v1::REMOTE_1
@ REMOTE_1
Definition: CMXCPHits_v1.h:29
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
CpmSimMonitorAlgorithm::RightCMXTobMismatch
@ RightCMXTobMismatch
Definition: CpmSimMonitorAlgorithm.h:68
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
xAOD::CMXCPHits_v1::TOPO_OCCUPANCY_COUNTS
@ TOPO_OCCUPANCY_COUNTS
Definition: CMXCPHits_v1.h:30
LVL1::CoordToHardware::cpCrateOverlap
unsigned int cpCrateOverlap(const Coordinate &coord)
returns crate ID covering that overlap coord.
Definition: CoordToHardware.cxx:205
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
LVL1::CPRoIDecoder
A level 1 calorimeter trigger conversion service: returns the Coordinate represented by a RoI word.
Definition: CPRoIDecoder.h:37
DeMoScan.index
string index
Definition: DeMoScan.py:364
xAOD::CMXCPTob_v1::energy
uint8_t energy() const
Peak functions - return value of peak bunch crossing Assuming we have got the timing calibration corr...
Definition: CMXCPTob_v1.cxx:80
CpmSimMonitorAlgorithm::m_maxSlices
Gaudi::Property< int > m_maxSlices
Definition: CpmSimMonitorAlgorithm.h:58
RunTileMonitoring.towers
towers
Definition: RunTileMonitoring.py:133
xAOD::CMXCPHits_v1::crate
uint8_t crate() const
get crate
CpmSimMonitorAlgorithm::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: CpmSimMonitorAlgorithm.cxx:59
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TriggerTest.rois
rois
Definition: TriggerTest.py:23
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
CpmSimMonitorAlgorithm::getL1Menu
const TrigConf::L1Menu * getL1Menu(const EventContext &ctx) const
Definition: CpmSimMonitorAlgorithm.cxx:2051
xAOD::CPMTobRoI_v1::chip
int chip() const
Return CP chip number (0-7)
Definition: CPMTobRoI_v1.cxx:50
xAOD::CMXCPTob_v1::isolation
uint8_t isolation() const
get isolationVec at peak bunch crossing
Definition: CMXCPTob_v1.cxx:86
CpmSimMonitorAlgorithm::compareEm
bool compareEm(const TriggerTowerMapEm &ttMap, const CpmTowerMap &cpMap, ErrorVector &errors, bool overlap) const
Definition: CpmSimMonitorAlgorithm.cxx:387
copySelective.source
string source
Definition: copySelective.py:32
xAOD::CPMTobRoIContainer
CPMTobRoIContainer_v1 CPMTobRoIContainer
Define the latest version of the CPMTobRoI class.
Definition: CPMTobRoIContainer.h:18
CpmSimMonitorAlgorithm::m_L1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_L1MenuKey
Definition: CpmSimMonitorAlgorithm.h:83
CpmSimMonitorAlgorithm::CmxCpHitsMap
std::map< int, const xAOD::CMXCPHits * > CmxCpHitsMap
Definition: CpmSimMonitorAlgorithm.h:98
CpmSimMonitorAlgorithm::CpmTobRoiMap
xAOD::CPMTobRoIMap_t CpmTobRoiMap
Definition: CpmSimMonitorAlgorithm.h:99
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
LVL1::DataError::get
int get(ErrorBit bit) const
Return an error bit or data.
Definition: DataError.cxx:48
fillSCTHists.etaMod
etaMod
Definition: fillSCTHists.py:23
LVL1::TriggerTowerKey::ttKey
virtual unsigned int ttKey(const TriggerTower &tower)
returns the key of the passed tower
Definition: TriggerTowerKey.cxx:143
xAOD::CMXCPHits_v1::sourceComponent
uint8_t sourceComponent() const
get source
xAOD::CPMTobRoI_v1::energy
int energy() const
Return energy.
Definition: CPMTobRoI_v1.cxx:68
xAOD::CMXCPHits_v1
Description of CMXCPHits_v1.
Definition: CMXCPHits_v1.h:27
error
Definition: IImpactPoint3dEstimator.h:70
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
xAOD::CPMTobRoI_v1::location
int location() const
Return location (RoI local coords) (0-7)
Definition: CPMTobRoI_v1.cxx:56
LVL1::TriggerTowerKey
The TriggerTowerKey object provides the key for each trigger tower depending on its eta-phi coords.
Definition: TriggerTowerKey.h:56
xAOD::CMXCPHits_v1::hits1
uint32_t hits1() const
get hitsVec1 at peak bunch crossing
Definition: CMXCPHits_v1.cxx:78
CpmSimMonitorAlgorithm::RemoteSumMismatch
@ RemoteSumMismatch
Definition: CpmSimMonitorAlgorithm.h:69
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
xAOD::CMXCPTob_v1::cpm
uint8_t cpm() const
get cpm
xAOD::CPMTobRoI_v1
Description of CPMTobRoI_v1.
Definition: CPMTobRoI_v1.h:24
xAOD::CMXCPTob_v1::location
uint8_t location() const
get location
xAOD::CMXCPTob_v1::chip
uint8_t chip() const
get chip
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
xAOD::CMXCPHits_v1::TOPO_CHECKSUM
@ TOPO_CHECKSUM
Definition: CMXCPHits_v1.h:30
xAOD::CPMTower_v2
Description of CPMTower_v2.
Definition: CPMTower_v2.h:26