ATLAS Offline Software
TRTMonitoringRun3RAW_Alg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #define FILLEVENTNORMALIZATION(NBINS, MIN, WIDTH, VALUE, VARPASSED, VAR, HISTGROUP) \
6 for (int i = 1; i <= NBINS; i++) \
7  if (MIN + WIDTH*(i-1) >= VALUE || MIN + WIDTH*(i+1) <= VALUE) \
8  { \
9  VARPASSED = 0.0; \
10  VAR = i; \
11  fill(HISTGROUP, VARPASSED, VAR); \
12  }
13 
15 
21 #include "InDetIdentifier/TRT_ID.h"
23 #include "TrkTrack/Track.h"
31 
33 
34 #include <sstream>
35 #include <iomanip>
36 #include <memory>
37 #include <cmath>
38 using namespace std;
39 
40 //Private Static Const data member initialization
43 constexpr int TRTMonitoringRun3RAW_Alg::s_Straw_max[2] = {1642, 3840};
44 constexpr int TRTMonitoringRun3RAW_Alg::s_iChip_max[2] = {104, 240};
45 
46 TRTMonitoringRun3RAW_Alg::TRTMonitoringRun3RAW_Alg( const std::string& name, ISvcLocator* pSvcLocator )
47 :AthMonitorAlgorithm(name,pSvcLocator)
48 ,m_idHelper(nullptr)
49 ,m_pTRTHelper(nullptr)
50 ,m_mgr(nullptr)
51 ,m_sumTool("TRT_StrawStatusSummaryTool", this)
52 ,m_TRTStrawNeighbourSvc("TRT_StrawNeighbourSvc", name)
53 ,m_BSSvc("TRT_ByteStream_ConditionsSvc", name)
54 ,m_trackSelTool("InDet::InDetTrackSelectionTool/TrackSelectionTool", this)
55 {
56  declareProperty("InDetTRTStrawStatusSummaryTool", m_sumTool);
57  declareProperty("TrackSelectionTool", m_trackSelTool);
58  declareProperty("doStraws", m_doStraws = true);
59  declareProperty("doExpert", m_doExpert = false);
60  declareProperty("doChips", m_doChips = true);
61  declareProperty("doTracksMon", m_doTracksMon = true);
62  declareProperty("doRDOsMon", m_doRDOsMon = true);
63  declareProperty("doShift", m_doShift = true);
64  declareProperty("doMaskStraws", m_doMaskStraws = true);
65  declareProperty("useHoleFinder", m_useHoleFinder = false);
66  declareProperty("DoHitsMon", m_doHitsMon = true);
67  declareProperty("DistanceToStraw", m_DistToStraw = 0.4);
68  declareProperty("totalEvents", m_usedEvents = -1);
69  declareProperty("min_si_hits", m_min_si_hits = 1);
70  declareProperty("min_pixel_hits", m_min_pixel_hits = 0);
71  declareProperty("min_sct_hits", m_min_sct_hits = 0);
72  declareProperty("min_trt_hits", m_min_trt_hits = 10);
73  declareProperty("MinTRTHitCut", m_minTRThits = 10);
74  declareProperty("every_xth_track", m_every_xth_track = 1);
75  declareProperty("max_abs_eta", m_max_abs_eta = 2.5);
76  declareProperty("max_abs_d0", m_max_abs_d0 = 10 * CLHEP::mm);
77  declareProperty("max_abs_z0", m_max_abs_z0 = 300 * CLHEP::mm);
78  declareProperty("MinTrackP", m_minP = 0.0 * CLHEP::GeV);
79  declareProperty("min_pT", m_min_pT = 0.5 * CLHEP::GeV);
80 }
81 
83 
85  using namespace Monitored;
86 
87  ATH_MSG_VERBOSE("Initializing TRT Monitoring");
88 
89  // initialize superclass
91 
92  // Retrieve detector manager.
93  ATH_CHECK( detStore()->retrieve(m_mgr, "TRT") );
94  // Get ID helper for TRT to access various detector components like straw, straw_layer, layer_or_wheel, phi_module, etc...
95  ATH_CHECK( detStore()->retrieve(m_pTRTHelper, "TRT_ID") );
96  ATH_CHECK( detStore()->retrieve(m_idHelper, "AtlasID") );
97 
98  if (m_doExpert) {
99  // Retrieve the TRT_Straw Status Service.
100  if (m_sumTool.name().empty()) {
101  ATH_MSG_WARNING("TRT_StrawStatusTool not given.");
102  } else {
103  ATH_CHECK( m_sumTool.retrieve() );
104  }
105 
106  Identifier ident;
107 
108  if (m_sumTool.name() != "") {
109  ATH_MSG_VERBOSE("Trying " << m_sumTool << " isGood");
110  ATH_MSG_VERBOSE("TRT_StrawStatusTool reports status = " << m_sumTool->getStatus(ident));
111  }
112 
113  // Retrieve the TRT_ByteStreamService.
114  if (m_BSSvc.name().empty()) {
115  ATH_MSG_WARNING("TRT_ByteStreamSvc not given.");
116  } else {
117  ATH_CHECK( m_BSSvc.retrieve() );
118  }
119  }//If do expert
120 
121  // Get Track summary tool
122  if (m_TrackSummaryTool.retrieve().isFailure())
123  ATH_MSG_ERROR("Cannot get TrackSummaryTool");
124  else
125  ATH_MSG_DEBUG("Retrieved succesfully the track summary tool" << m_TrackSummaryTool);
126 
127  // Retrieve TRTTrackHoleSearchTool
128  if (m_useHoleFinder || m_doExpert) {
129  ATH_CHECK( m_trt_hole_finder.retrieve() );
130  }
131  else {
132  m_trt_hole_finder.disable();
133  }
134 
135  // Initialization of VarHandleKeys
136  ATH_CHECK( m_rdoContainerKey.initialize() );
138  ATH_CHECK( m_combTrackCollectionKey.initialize() );
139  ATH_CHECK( m_trackCollectionKey.initialize() );
141 
142  // InDetTrackSelectionTools initialization:
143  ATH_CHECK( m_trackSelTool.retrieve() );
144 
145  // initialize chip lookup maps
146  ATH_CHECK( m_TRTStrawNeighbourSvc.retrieve() );
147 
148  //loop over straw hash index to create straw number mapping for TRTViewer
149  unsigned int maxHash = m_pTRTHelper->straw_layer_hash_max();
150 
151  for (int ibe = 0; ibe < 2; ibe++) { // ibe=0(barrel), ibe=1(endcap)
152  for (unsigned int index = 0; index < maxHash; index++) {
153  IdentifierHash idHash = index;
154  Identifier id = m_pTRTHelper->layer_id(idHash);
155  int idBarrelEndcap = m_pTRTHelper->barrel_ec(id);
156  int idLayerWheel = m_pTRTHelper->layer_or_wheel(id);
157  int idPhiModule = m_pTRTHelper->phi_module(id);
158  int idStrawLayer = m_pTRTHelper->straw_layer(id);
159  bool isBarrel = m_pTRTHelper->is_barrel(id);
160  int idSide;
161  int sectorflag = 0;
162  const InDetDD::TRT_BaseElement *element = nullptr;
163 
164  if (ibe == 0) { // barrel
165  idSide = idBarrelEndcap ? 1 : -1;
166 
167  if (isBarrel && (idBarrelEndcap == -1)) {
168  sectorflag = 1;
169  element = m_mgr->getBarrelElement(idSide, idLayerWheel, idPhiModule, idStrawLayer);
170  }
171  } else if (ibe == 1) { // endcap
172  idSide = idBarrelEndcap ? 1 : 0;
173 
174  if (!isBarrel && ((idBarrelEndcap == -2) || (idBarrelEndcap == 2))) {
175  sectorflag = 1;
176  element = m_mgr->getEndcapElement(idSide, idLayerWheel, idStrawLayer, idPhiModule);//, idStrawLayer_ec);
177  }
178  }
179 
180  if (sectorflag == 1) {
181  if (!element) continue;
182 
183  for (unsigned int istraw = 0; istraw < element->nStraws(); istraw++) {
184  std::vector<Identifier> neighbourIDs;
185  Identifier strawID = m_pTRTHelper->straw_id(id, int(istraw));
186  int i_chip, i_pad;
187  m_TRTStrawNeighbourSvc->getChip(strawID, i_chip);
188  m_TRTStrawNeighbourSvc->getPad(id, i_pad);
189 
190  if (ibe == 0) { //barrel
191  if (idLayerWheel == 1) i_chip += 21;
192 
193  if (idLayerWheel == 2) i_chip += 54;
194 
195  int tempStrawNumber = strawNumber(istraw, idStrawLayer, idLayerWheel);
196 
197  if (tempStrawNumber < 0 || tempStrawNumber > (s_Straw_max[ibe] - 1)) {
198  ATH_MSG_WARNING("Found tempStrawNumber = " << tempStrawNumber << " out of range.");
199  } else {
200  m_mat_chip_B.at(idPhiModule).at(tempStrawNumber) = i_chip;
201  m_mat_chip_B.at(idPhiModule + 32).at(tempStrawNumber) = i_chip;
202  }
203  } else if (ibe == 1) { //endcap
204  ++i_chip -= 104;
205  int tempStrawNumber = strawNumberEndCap(istraw, idStrawLayer, idLayerWheel, idPhiModule, idSide);
206 
207  if (tempStrawNumber < 0 || tempStrawNumber > (s_Straw_max[ibe] - 1)) {
208  ATH_MSG_WARNING("Found tempStrawNumber = " << tempStrawNumber << " out of range.");
209  } else {
210  m_mat_chip_E.at(idPhiModule).at(tempStrawNumber) = i_chip;
211  m_mat_chip_E.at(idPhiModule + 32).at(tempStrawNumber) = i_chip;
212  }
213  }
214  }
215  }
216  }
217  }
218 
219  return StatusCode::SUCCESS;
220 }
221 
222 //----------------------------------------------------------------------------------//
223 std::vector<std::vector<std::vector<int>>> TRTMonitoringRun3RAW_Alg::initScaleVectors() const {
224 //----------------------------------------------------------------------------------//
225 // if (m_flagforscale == 0 ) return 0;
226  std::vector<std::vector<std::vector<int>>> scale_hHitWMap;
227  std::vector<std::vector<int>> scale_hHitWMap_B, scale_hHitWMap_EA, scale_hHitWMap_EC;
228  std::vector<int> scale_B_Xe, scale_B_Ar, scale_EA_Xe, scale_EA_Ar, scale_EC_Xe, scale_EC_Ar;
229 
230  scale_hHitWMap.clear();
231  scale_hHitWMap_B.clear();
232  scale_hHitWMap_EA.clear();
233  scale_hHitWMap_EC.clear();
234  scale_B_Xe.clear();
235  scale_B_Ar.clear();
236  scale_EA_Xe.clear();
237  scale_EA_Ar.clear();
238  scale_EC_Xe.clear();
239  scale_EC_Ar.clear();
240 
241  for (int i = 0; i < s_Straw_max[0]; i++) {
242  float countAr = 0;
243  float countXe = 0;
244  int sN, sLN, lN;
245  strawNumber_reverse(i, &sN, &sLN, &lN);
246 
247  for (int side = -1 ; side < 2; side += 2 ) {
248  for (int j = 0; j < 32; j++ ) {
249  Identifier Dummy_Identifier;
250  Dummy_Identifier = m_pTRTHelper->straw_id(side, j, lN, sLN, sN);
251  bool isArgonStraw = (Straw_Gastype( m_sumTool->getStatusHT(Dummy_Identifier) ) == GasType::Ar);
252 
253  if (isArgonStraw)
254  countAr += 1.0;
255  else
256  countXe += 1.0;
257  }
258  }
259  scale_B_Xe.push_back(countXe);
260  scale_B_Ar.push_back(countAr);
261  }
262 
263  for (int i = 0; i < s_Straw_max[1]; i++) {
264  scale_EA_Xe.push_back(32);
265  scale_EA_Ar.push_back(32);
266  scale_EC_Xe.push_back(32);
267  scale_EC_Ar.push_back(32);
268  }
269 
270  scale_hHitWMap_B.push_back(scale_B_Xe);
271  scale_hHitWMap_B.push_back(scale_B_Ar);
272  scale_hHitWMap_EA.push_back(scale_EA_Xe);
273  scale_hHitWMap_EA.push_back(scale_EA_Ar);
274  scale_hHitWMap_EC.push_back(scale_EC_Xe);
275  scale_hHitWMap_EC.push_back(scale_EC_Ar);
276  scale_hHitWMap.push_back(scale_hHitWMap_B);
277  scale_hHitWMap.push_back(scale_hHitWMap_EA);
278  scale_hHitWMap.push_back(scale_hHitWMap_EC);
279 
280 // m_flagforscale = 0;
281  return scale_hHitWMap;
282 }
283 
284 
285 //-------------------------------------------------------------------------------------------------//
287 //-------------------------------------------------------------------------------------------------//
288  StatusCode sc = StatusCode::SUCCESS;
289 
290  auto ChipBSErrorsVsLB_x = Monitored::Scalar<float>("ChipBSErrorsVsLB_x", 0.0);
291  auto ChipBSErrorsVsLB_y = Monitored::Scalar<float>("ChipBSErrorsVsLB_y", 0.0);
292  auto RobBSErrorsVsLB_x = Monitored::Scalar<float>("RobBSErrorsVsLB_x", 0.0);
293  auto RobBSErrorsVsLB_y = Monitored::Scalar<float>("RobBSErrorsVsLB_y", 0.0);
294 
295  const TRT_BSErrContainer emptyErrCont;//Empty dummy instance for MC
296  const TRT_BSErrContainer* bsErrCont=&emptyErrCont;
297 
298  if (!m_bsErrContKey.empty()) {
299  //Regular real-data case, get the byte-stream errors from SG
301  bsErrCont=bsErrContHdl.cptr();
302  }
303  else {
304  ATH_MSG_DEBUG("MC case, using dummy TRT_BSErrContainer");
305  }
306 
307  const unsigned int lumiBlock = eventInfo.lumiBlock();
308  ATH_MSG_VERBOSE("This is lumiblock : " << lumiBlock);
309 
310  //if ((int)lumiBlock != m_lastLumiBlock) {
311  // m_lastLumiBlock = lumiBlock;
312  //}
313 
314  //Get BSConversion errors
315  const std::set<std::pair<uint32_t, uint32_t> > &L1IDErrorSet = bsErrCont->getL1ErrorSet();
316  const std::set<std::pair<uint32_t, uint32_t> > &BCIDErrorSet = bsErrCont->getBCIDErrorSet();
317  const std::set<uint32_t> &MissingErrorSet = bsErrCont->getMissingErrorSet();
318  const std::set<uint32_t> &SidErrorSet = bsErrCont->getSidErrorSet();
319  const std::set<std::pair<uint32_t, uint32_t> > &RobStatusErrorSet = bsErrCont->getRobErrorSet();
320 
321  const unsigned int rod_id_base[2][2] = { { 0x310000, 0x320000 }, { 0x330000, 0x340000 } };
322  const unsigned int nChipsTotal[2][2] = { { 3328, 3328 }, { 7680, 7680 } };
323  const unsigned int nRobsTotal[2][2] = { { 32, 32 }, { 64, 64 } };
324  float nBSErrors[2][2] = { { 0, 0 }, { 0, 0 } };
325  float nRobErrors[2][2] = { { 0, 0 }, { 0, 0 } };
326 
327  const std::set<std::pair<uint32_t, uint32_t> > *errorset1[2] = { &BCIDErrorSet, &L1IDErrorSet };
328 
329  for (int iset = 0; iset < 2; ++iset) {
330  for (auto setIt = errorset1[iset]->begin(); setIt != errorset1[iset]->end(); ++setIt) {
331  for (int ibe = 0; ibe < 2; ++ibe) {
332  for (int iside = 0; iside < 2; ++iside) {
333  if (((setIt->first >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
334  nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
335  }
336  }
337  }
338  }
339  }
340 
341  const std::set<uint32_t> *errorset2[2] = { &MissingErrorSet, &SidErrorSet };
342 
343  for (int iset = 0; iset < 2; ++iset) {
344  for (auto setIt = errorset2[iset]->begin(); setIt != errorset2[iset]->end(); ++setIt) {
345  for (int ibe = 0; ibe < 2; ++ibe) {
346  for (int iside = 0; iside < 2; ++iside) {
347  if (((*setIt >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
348  nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
349  }
350  }
351  }
352  }
353  }
354 
355  for (int ibe = 0; ibe < 2; ++ibe) {
356  for (int iside = 0; iside < 2; ++iside) {
357  ChipBSErrorsVsLB_x = lumiBlock;
358  ChipBSErrorsVsLB_y = nBSErrors[ibe][iside];
359  for (unsigned int i = 0; i < lumiBlock; i++) // we need this so the LastBinThreshold algorithm can find the last bin
360  fill("RDOShiftSmryRebinnedHistograms"+std::to_string(ibe)+std::to_string(iside), ChipBSErrorsVsLB_x, ChipBSErrorsVsLB_y);
361  }
362  }
363 
364  for (auto setIt = RobStatusErrorSet.begin(); setIt != RobStatusErrorSet.end(); ++setIt) {
365  for (int ibe = 0; ibe < 2; ++ibe) {
366  for (int iside = 0; iside < 2; ++iside) {
367  if (setIt->first % rod_id_base[ibe][iside] < 0xffff) {
368  nRobErrors[ibe][iside] += 1. / nRobsTotal[ibe][iside];
369  }
370  }
371  }
372  }
373 
374  for (int ibe = 0; ibe < 2; ++ibe) {
375  for (int iside = 0; iside < 2; ++iside) {
376  RobBSErrorsVsLB_x = lumiBlock;
377  RobBSErrorsVsLB_y = nRobErrors[ibe][iside];
378  for (unsigned int i = 0; i < lumiBlock; i++) // we need this so the LastBinThreshold algorithm can find the last bin
379  fill("RDOShiftSmryRebinnedHistograms"+std::to_string(ibe)+std::to_string(iside), RobBSErrorsVsLB_x, RobBSErrorsVsLB_y);
380  }
381  }
382 
383  return sc;
384 }
385 
386 
387 //----------------------------------------------------------------------------------//
389 //----------------------------------------------------------------------------------//
390  // return logical board index:
391  // 0 for Board 1S (has 10 chips) 0 - 9
392  // 1 for 1L (11) 10 - 20
393  // 2 for 2S (15) 21 - 35
394  // 3 for 2L, first 9 chips 36 - 44
395  // 4 for 2L, second 9 chips 45 - 53
396  // 5 for 3S, first 11 54 - 64
397  // 6 for 3S, second 12 65 - 76
398  // 7 for 3L, first 13 77 - 89
399  // 8 for 3L, second 14 90 - 103
400  const int list[] = {10, 11, 15, 9, 9, 11, 12, 13, 14};
401  int count = 0;
402  chip--;
403 
404  for (int i = 0; i < 9; i++) {
405  count += list[i];
406 
407  if (chip < count) return i + 1;
408  else if (chip == 104) return 9;
409  }
410 
411  assert(count == 104);
412  assert(false); // should never come this far
413  return -1;
414 }
415 
416 
417 //----------------------------------------------------------------------------------//
419 //----------------------------------------------------------------------------------//
420  const int remainder = (chip - 1) % 12;
421  const int Board = int(((chip - 1) - remainder) / 12);
422  return Board + 1;
423 }
424 
425 
426 
427 // Check for EventBurst: Counts high level hits and returns true if the count is less than m_passEventBurstCut.
428 // If m_EventBurstCut is less than zero, returns allways true
429 //----------------------------------------------------------------------------------//
431 //----------------------------------------------------------------------------------//
432  if (m_EventBurstCut <= 0) return true;
433 
434  int nHLHits = 0;
435  TRT_RDO_Container::const_iterator RDO_CollectionBegin = rdoContainer.begin();
436  TRT_RDO_Container::const_iterator RDO_CollectionEnd = rdoContainer.end();
437 
438  for (; RDO_CollectionBegin != RDO_CollectionEnd; ++RDO_CollectionBegin) {
439  const InDetRawDataCollection<TRT_RDORawData> *TRT_Collection(*RDO_CollectionBegin);
440 
441  if (!TRT_Collection) continue;
442  else {
443  DataVector<TRT_RDORawData>::const_iterator p_rdo = TRT_Collection->begin();
444 
445  for (; p_rdo != TRT_Collection->end(); ++p_rdo) {
446  const TRT_LoLumRawData *p_lolum = dynamic_cast<const TRT_LoLumRawData *>(*p_rdo);
447 
448  if (!p_lolum) continue;
449 
450  if (p_lolum->highLevel()) nHLHits++;
451  }
452  }
453  }
454 
455  if (nHLHits > m_EventBurstCut) return false;
456  else return true;
457 }
458 
459 
460 
461 // Returns the straw number (0-1641) given the layerNumber, strawlayerNumber, and strawNumber, all gotten from Athena IDHelper
462 //----------------------------------------------------------------------------------//
463 int TRTMonitoringRun3RAW_Alg::strawNumber(int strawNumber, int strawlayerNumber, int LayerNumber) const {
464 //----------------------------------------------------------------------------------//
465  int addToStrawNumber = 0;
466  int addToStrawNumberNext = 0;
467  int i = 0;
468  const int numberOfStraws[75] = {
469  0,
470  15,
471  16, 16, 16, 16,
472  17, 17, 17, 17, 17,
473  18, 18, 18, 18, 18,
474  19, 19, 19,
475  18,
476  19,
477  20, 20, 20, 20, 20,
478  21, 21, 21, 21, 21,
479  22, 22, 22, 22, 22,
480  23, 23, 23, 23, 23,
481  24, 24,
482  23, 23,
483  24, 24, 24, 24,
484  25, 25, 25, 25, 25,
485  26, 26, 26, 26, 26,
486  27, 27, 27, 27, 27,
487  28, 28, 28, 28, 28,
488  29, 29, 29, 29,
489  28,
490  0
491  };
492 
493  do {
494  i++;
495  addToStrawNumber += numberOfStraws[i - 1];
496  addToStrawNumberNext = addToStrawNumber + numberOfStraws[i];
497  } while (strawLayerNumber(strawlayerNumber, LayerNumber) != i - 1);
498 
499  strawNumber = addToStrawNumberNext - strawNumber - 1;
500 
501  if (strawNumber < 0 || strawNumber > s_Straw_max[0] - 1) {
502  ATH_MSG_WARNING("strawNumber = " << strawNumber << " out of range. Will set to 0.");
503  strawNumber = 0;
504  }
505 
506  return strawNumber;
507 }
508 
509 //----------------------------------------------------------------------------------//
510 int TRTMonitoringRun3RAW_Alg::strawNumber_reverse (int inp_strawnumber, int *strawNumber, int *strawlayerNumber, int *LayerNumber) const {
511 //----------------------------------------------------------------------------------//
512  const int numberOfStraws[75] = {
513  0,
514  15,
515  16, 16, 16, 16,
516  17, 17, 17, 17, 17,
517  18, 18, 18, 18, 18,
518  19, 19, 19,
519  18,
520  19,
521  20, 20, 20, 20, 20,
522  21, 21, 21, 21, 21,
523  22, 22, 22, 22, 22,
524  23, 23, 23, 23, 23,
525  24, 24,
526  23, 23,
527  24, 24, 24, 24,
528  25, 25, 25, 25, 25,
529  26, 26, 26, 26, 26,
530  27, 27, 27, 27, 27,
531  28, 28, 28, 28, 28,
532  29, 29, 29, 29,
533  28,
534  0
535  };
536  //ToDo check inp_strawnumber
537  int i = 1;
538 
539  for (i = 1; inp_strawnumber >= 0; i++) {
540  inp_strawnumber -= numberOfStraws[i];
541  }
542 
543  i -= 2;
544  strawLayerNumber_reverse(i, strawlayerNumber, LayerNumber);
545  *strawNumber = -inp_strawnumber - 1;
546  return 0;
547 }
548 
549 //----------------------------------------------------------------------------------//
550 int TRTMonitoringRun3RAW_Alg::strawNumberEndCap(int strawNumber, int strawLayerNumber, int LayerNumber, int phi_stack, int side) const {
551 //----------------------------------------------------------------------------------//
552  // Before perfoming map, corrections need to be perfomed.
553  // apply special rotations for endcap mappings
554  // for eca, rotate triplets by 180 for stacks 9-16, and 25-32.
555  static const int TripletOrientation[2][32] = {
556  {
557  1, 1, 1, 1, 1, 1, 1, 1,
558  0, 0, 0, 0, 0, 0, 0, 0,
559  1, 1, 1, 1, 1, 1, 1, 1,
560  0, 0, 0, 0, 0, 0, 0, 0
561  },
562  {
563  1, 1, 1, 1, 1, 1, 1, 1,
564  0, 0, 0, 0, 0, 0, 0, 0,
565  1, 1, 1, 1, 1, 1, 1, 1,
566  0, 0, 0, 0, 0, 0, 0, 0
567  }
568  };
569  int phi1 = -1;
570 
571  if (side == 2) phi1 = phi_stack, side = 1;
572  else if (side == -2) phi1 = 31 - phi_stack, side = 0;
573 
574  if (phi1 > -1) {
575  if (TripletOrientation[side][phi1]) {
576  //Change straw number from 0-23 in straw layer to 0-192
578 
580 
581  strawNumber = (192 - 1) * TripletOrientation[side][phi1] + strawNumber * (1 - 2 * TripletOrientation[side][phi1]); //actual rotation
582 
583  //take strawNumber back to 0-23
585 
586  if (strawLayerNumber > 7) strawLayerNumber = int(strawNumber / 24) + 8;
587 
588  strawNumber = strawNumber % 24;
589  }
590 
591  //Finish rotation
592  //Flip straw in layer.
593 
594  if (side == 0) strawNumber = 23 - strawNumber;
595 
596  //Finish Flipping
597  }
598 
599  // Done with corrections
600  // Start mapping from athena identifiers to TRTViewer maps
601  int strawNumberNew = 0;
602 
603  if (LayerNumber < 6 && strawLayerNumber > 7) {
604  strawNumberNew = strawNumberNew + (384 * LayerNumber);
605  strawNumberNew = strawNumberNew + 192 + (strawLayerNumber % 8) + (strawNumber * 8);
606  } else if (LayerNumber < 6 && strawLayerNumber < 8) {
607  strawNumberNew = strawNumberNew + (384 * LayerNumber);
608  strawNumberNew = strawNumberNew + (strawLayerNumber % 8) + (strawNumber * 8);
609  } else if (LayerNumber > 5 && strawLayerNumber > 7) {
610  strawNumberNew = strawNumberNew + 2304 + 192 * (LayerNumber - 6);
611  strawNumberNew = strawNumberNew + 192 + (strawLayerNumber % 8) + (8 * strawNumber);
612  } else if (LayerNumber > 5 && strawLayerNumber < 8) {
613  strawNumberNew = strawNumberNew + 2304 + 192 * (LayerNumber - 6);
614  strawNumberNew = strawNumberNew + (strawLayerNumber % 8) + (8 * strawNumber);
615  }
616 
617  strawNumber = strawNumberNew;
618 
619  if (strawNumber < 0 || strawNumber > s_Straw_max[1] - 1) {
620  ATH_MSG_WARNING("strawNumber = " << strawNumber << " out of range. Will set to 0.");
621  strawNumber = 0;
622  }
623 
624  return strawNumber;
625 }
626 
627 
628 //----------------------------------------------------------------------------------//
630 //----------------------------------------------------------------------------------//
631  switch (LayerNumber) {
632  case 0:
633  return strawLayerNumber;
634 
635  case 1:
636  return strawLayerNumber + 19;
637 
638  case 2:
639  return strawLayerNumber + 43;
640 
641  default:
642  return strawLayerNumber;
643  }
644 }
645 
646 //----------------------------------------------------------------------------------//
647 int TRTMonitoringRun3RAW_Alg::strawLayerNumber_reverse(int strawLayerNumInp, int *strawLayerNumber, int *LayerNumber) const {
648 //----------------------------------------------------------------------------------//
649  //Danger? There are no checks on input
650  //use with care
651  if (strawLayerNumInp < 19) {
652  *strawLayerNumber = strawLayerNumInp;
653  *LayerNumber = 0;
654  } else if (strawLayerNumInp < 43) {
655  *strawLayerNumber = strawLayerNumInp - 19;
656  *LayerNumber = 1;
657  } else {
658  *strawLayerNumber = strawLayerNumInp - 43;
659  *LayerNumber = 2;
660  }
661 
662  return 0;
663 }
664 
665 //----------------------------------------------------------------------------------//
666 float TRTMonitoringRun3RAW_Alg::radToDegrees(float radValue) const{
667 //----------------------------------------------------------------------------------//
668  float degreeValue = radValue / M_PI * 180;
669 
670  if (degreeValue < 0) degreeValue += 360;
671 
672  return degreeValue;
673 }
674 
675 struct straw_struct {
677  float HitTrMapS_y;
682 };
683 
684 struct chip_struct {
686  float HitTrMapC_y;
693 };
694 
707 };
708 
721 };
722 
725  bool isAr;
728 };
729 
730 //Fill the TRT RDO Histograms
731 //----------------------------------------------------------------------------------//
733  const xAOD::EventInfo& eventInfo,
734  const InDetTimeCollection* trtBCIDCollection) const {
735 //----------------------------------------------------------------------------------//
736  ATH_MSG_DEBUG("Filling TRT RDO Histograms");
737 
738  // TProfile
739  auto HitToTLongTrMapS_x = Monitored::Scalar<float>("HitToTLongTrMapS_x", 0.0);
740  auto HitToTLongTrMapS_y = Monitored::Scalar<float>("HitToTLongTrMapS_y", 0.0);
741  auto HitToTLongMapS_x = Monitored::Scalar<float>("HitToTLongMapS_x", 0.0);
742  auto HitToTLongMapS_y = Monitored::Scalar<float>("HitToTLongMapS_y", 0.0);
743  auto BCIDvsOcc_x = Monitored::Scalar<float>("BCIDvsOcc_x", 0.0);
744  auto BCIDvsOcc_y = Monitored::Scalar<float>("BCIDvsOcc_y", 0.0);
745  auto AvgHLOcc_side_x = Monitored::Scalar<float>("AvgHLOcc_side_x", 0.0);
746  auto AvgHLOcc_side_y = Monitored::Scalar<float>("AvgHLOcc_side_y", 0.0);
747  auto AvgLLOcc_side_x = Monitored::Scalar<float>("AvgLLOcc_side_x", 0.0);
748  auto AvgLLOcc_side_y = Monitored::Scalar<float>("AvgLLOcc_side_y", 0.0);
749  auto AvgLLOccMod_side_x = Monitored::Scalar<float>("AvgLLOccMod_side_x", 0.0);
750  auto AvgLLOccMod_side_y = Monitored::Scalar<float>("AvgLLOccMod_side_y", 0.0);
751  auto AvgHLOccMod_side_x = Monitored::Scalar<float>("AvgHLOccMod_side_x", 0.0);
752  auto AvgHLOccMod_side_y = Monitored::Scalar<float>("AvgHLOccMod_side_y", 0.0);
753  auto ChipBSErrorsVsLB_x = Monitored::Scalar<float>("ChipBSErrorsVsLB_x", 0.0);
754  auto ChipBSErrorsVsLB_y = Monitored::Scalar<float>("ChipBSErrorsVsLB_y", 0.0);
755  auto RobBSErrorsVsLB_x = Monitored::Scalar<float>("RobBSErrorsVsLB_x", 0.0);
756  auto RobBSErrorsVsLB_y = Monitored::Scalar<float>("RobBSErrorsVsLB_y", 0.0);
757  auto NHitsperLB_x = Monitored::Scalar<float>("NHitsperLB_x", 0.0);
758  auto NHitsperLB_y = Monitored::Scalar<float>("NHitsperLB_y", 0.0);
759  auto NHLHitsperLB_x = Monitored::Scalar<float>("NHLHitsperLB_x", 0.0);
760  auto NHLHitsperLB_y = Monitored::Scalar<float>("NHLHitsperLB_y", 0.0);
761 
762  // TH1F
763  auto OccAll = Monitored::Scalar<float>("OccAll", 0.0);
764 
765  // TH2F
766 
767  // TEfficiency
768  auto HtoLMapS = Monitored::Scalar<float>("HtoLMapS", 0.0);
769  auto HtoLMapS_passed = Monitored::Scalar<bool>("HtoLMapS_passed", false);
770  auto HtoLMapC = Monitored::Scalar<float>("HtoLMapC", 0.0);
771  auto HtoLMapC_passed = Monitored::Scalar<bool>("HtoLMapC_passed", false);
772  auto OccupancyC = Monitored::Scalar<float>("OccupancyC", 0.0);
773  auto OccupancyC_passed = Monitored::Scalar<bool>("OccupancyC_passed", false);
774  auto StrawOcc = Monitored::Scalar<float>("StrawOcc", 0.0);
775  auto StrawOcc_passed = Monitored::Scalar<bool>("StrawOcc_passed", false);
776 
777  const unsigned int lumiBlock = eventInfo.lumiBlock();
778  ATH_MSG_VERBOSE("This is lumiblock : " << lumiBlock);
779  auto good_bcid = eventInfo.bcid();
780 
781  TRT_RDO_Container::const_iterator RDO_CollectionBegin = rdoContainer.begin();
782  TRT_RDO_Container::const_iterator RDO_CollectionEnd = rdoContainer.end();
783  //Check readout Integrity of TRT
784  ATH_CHECK( checkTRTReadoutIntegrity(eventInfo) );
785  int numberOfStacks_b[2]; //Total stack number of barrel and endcap
786  numberOfStacks_b[0] = s_numberOfBarrelStacks * 3;
787  numberOfStacks_b[1] = s_numberOfEndCapStacks * 2;
788  Identifier TRT_Identifier;
789  int numberOfStrawsMod[3]; // For barrel(number if straw in module)
790  numberOfStrawsMod[0] = 329;
791  numberOfStrawsMod[1] = 520;
792  numberOfStrawsMod[2] = 793;
793  int numberOfStrawsWheel[2]; // For endcap
794  numberOfStrawsWheel[0] = 2304; //6 layers (6*16=96) 96*24=2304 straws in wheel type A
795  numberOfStrawsWheel[1] = 1536; //8 layers (8*8=64) 64*24=1536 straws in wheel type B
796  int moduleHits_B[192];
797  int moduleHits_E[128];
798  int HLmoduleHits_B[192];
799  int HLmoduleHits_E[128];
800  int nHitsperLB_B = 0;
801  int nHLHitsperLB_B = 0;
802  int nHitsperLB_E[2] = {0, 0};
803  int nHLHitsperLB_E[2] = {0, 0};
804 
805  for (int i = 0; i < 192; i++) {
806  moduleHits_B[i] = 0;
807  HLmoduleHits_B[i] = 0;
808  }
809 
810  for (int i = 0; i < 128; i++) {
811  moduleHits_E[i] = 0;
812  HLmoduleHits_E[i] = 0;
813  }
814 
815  auto scale_hHitWMap_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(2);
816  auto scale_hHitWMap_E_passed = std::make_unique<short int[][2][s_Straw_max[1]]>(2);
817 
818  auto scale_hHitHWMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
819  auto scale_hHitHWMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
820  auto scale_hHitWMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
821  auto scale_hHitWMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
822  auto scale_hHitAMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
823  auto scale_hHitAMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
824  auto scale_hHitAWMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
825  auto scale_hHitAWMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
826  auto scale_hHitHMapS_B_passed = std::make_unique<short int[][s_Straw_max[0]]>(s_numberOfBarrelStacks*2);
827  auto scale_hHitHMapC_B_passed = std::make_unique<short int[][s_iChip_max[0]]>(s_numberOfBarrelStacks*2);
828 
829  auto scale_hHitHWMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
830  auto scale_hHitHWMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
831  auto scale_hHitWMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
832  auto scale_hHitWMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
833  auto scale_hHitAMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
834  auto scale_hHitAMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
835  auto scale_hHitAWMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
836  auto scale_hHitAWMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
837  auto scale_hHitHMapS_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(s_numberOfEndCapStacks*2);
838  auto scale_hHitHMapC_E_passed = std::make_unique<short int[][s_iChip_max[1]]>(s_numberOfEndCapStacks*2);
839 
840  int goodid_status = 0;
841  int prev_bcid = 0;
842 
843  if (trtBCIDCollection) {
844  InDetTimeCollection::const_iterator itrt_bcid = trtBCIDCollection->begin();
845 
846  while (goodid_status == 0 && itrt_bcid != trtBCIDCollection->end()) {
847 
848  const unsigned int trt_bcid = (*itrt_bcid).second;
849 
850  if (itrt_bcid > trtBCIDCollection->begin() && prev_bcid - trt_bcid == 0) {
851  goodid_status = 1;
852  } else if (itrt_bcid > trtBCIDCollection->begin() && prev_bcid - trt_bcid != 0) {
853  ATH_MSG_WARNING("TRT BCID is not consistent. TRT RODID is " <<
854  std::hex << (*itrt_bcid).first << " trt bcid from ROD is " <<
855  std::hex << trt_bcid);
856  }
857 
858  prev_bcid = trt_bcid;
859  ++itrt_bcid;
860  }
861  }
862 
863  // Test out the TRT_StrawStatusSummarySvc.
864  if (!m_sumTool.name().empty() && m_doExpert) {
865  ATH_MSG_VERBOSE("Trying " << m_sumTool << " isGood");
866  ATH_MSG_VERBOSE("TRT_StrawStatusTool reports status = " << m_sumTool->getStatus(TRT_Identifier));
867  }
868 
869  // ibe = 0 (Barrel), ibe = 1 (Endcap)
870  int nTRTHits[2];
871  for (int ibe = 0; ibe < 2; ibe++) {
872  nTRTHits[ibe] = 0;
873 
874  // Insert here
875  // Scaling for online environment
876 
877  }
878 
879  int nhitsall = 0;
880 
881  std::map<int,std::map<int, std::vector<straw_struct>>> straw_map;
882  std::map<int,std::map<int, std::vector<chip_struct>>> chip_map;
883  std::map<int,std::vector<straw_shifter_struct>> straw_shifter_map;
884  std::map<int,std::map<int, std::vector<straw_struct_prob>>> straw_map_prob;
885  std::map<int,std::map<int, std::vector<chip_struct_prob>>> chip_map_prob;
886 
887  std::vector<std::vector<std::vector<int>>> scale_hHitWMap = initScaleVectors();
888 
889  for (; RDO_CollectionBegin != RDO_CollectionEnd; ++RDO_CollectionBegin) {
890  const InDetRawDataCollection<TRT_RDORawData> *TRT_Collection(*RDO_CollectionBegin);
891 
892  if (!TRT_Collection) continue;
893 
894  DataVector<TRT_RDORawData>::const_iterator p_rdo = TRT_Collection->begin();
895 
896  for (; p_rdo != TRT_Collection->end(); ++p_rdo) {
897  int middleHTbit = (*p_rdo)->getWord() & 0x00020000;
898  //0x00020000 = 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000
899  int hitinvaliditygate = (*p_rdo)->getWord() & 0x000DFE80;
900  //0x000DFE80 = 0000 0000 0000 0000 0000 1101 1111 1110 1000 0000 //
901  bool is_middleHTbit_high = (middleHTbit != 0);
902  bool is_anybininVgate_high = (hitinvaliditygate != 0);
903  TRT_Identifier = (*p_rdo)->identify();
904 
905  if (m_doMaskStraws && m_sumTool->get_status(TRT_Identifier)) continue;
906 
907  int barrel_ec = m_pTRTHelper->barrel_ec(TRT_Identifier);
908  //ToDo: Check TRT_LoLumRawData object
909  const TRT_LoLumRawData *p_lolum = dynamic_cast<const TRT_LoLumRawData *>(*p_rdo);
910 
911  if (!p_lolum) continue;
912 
913  nhitsall++;
914  int ibe = abs(barrel_ec) - 1;
915  int iside = barrel_ec > 0 ? 0 : 1;
916 
917  //if barrel_ec is outof range go to next measurement in rdo_collection
918  if (ibe != 1 && ibe != 0) {
919  ATH_MSG_DEBUG("TRT part retrieved from TRT Identifier is not a barrel or an endcap");
920  continue;
921  }
922 
923  int moduleNumber_barrel1[2];
924  int moduleNumber_barrel2[2];
925  int moduleNumber_barrel3[2];
926  int moduleNumber_endcapA[2];
927  int moduleNumber_endcapB[2];
928  // Get TRT Identifier
929  // Need to know phi module, module layer, straw layer, and straw # within the layer
930  // To get proper straw numbering
931  TRT_Identifier = p_lolum->identify();
932  //inline function checks m_ArgonXenonSplitter
933  const bool isArgonStraw = (Straw_Gastype( m_sumTool->getStatusHT(TRT_Identifier) ) == GasType::Ar);
934  int phi_module = m_pTRTHelper->phi_module(TRT_Identifier);
935  int layer_or_wheel = m_pTRTHelper->layer_or_wheel(TRT_Identifier);
936  int straw_layer = m_pTRTHelper->straw_layer(TRT_Identifier);
937  int straw = m_pTRTHelper->straw(TRT_Identifier);
938  int thisStrawNumber;
939  int chip = 0;
940  int board = -1;
941  //ToDo: Check if that is really neccessary
942  bool is_barrel = m_pTRTHelper->is_barrel(TRT_Identifier);
943 
944  //Сheck straw number and find the correct chip and m_ board values
945  if ( is_barrel && ibe == 0 ) {
946  thisStrawNumber = strawNumber(straw, straw_layer, layer_or_wheel);
947 
948  if (thisStrawNumber >= 0 && thisStrawNumber < s_Straw_max[ibe]) {
949  chip = m_mat_chip_B.at(phi_module).at(thisStrawNumber);
950  }
951 
952  board = chipToBoard(chip);
953 
954  } else if ( !is_barrel && ibe == 1 ) {
955  thisStrawNumber = strawNumberEndCap(straw, straw_layer, layer_or_wheel, phi_module, barrel_ec);
956 
957  if (thisStrawNumber >= 0 && thisStrawNumber < s_Straw_max[ibe]) {
958  chip = m_mat_chip_E.at(phi_module).at(thisStrawNumber);
959  }
960 
961  board = chipToBoard_EndCap(chip);
962  } else {
963  thisStrawNumber = -1;
964  }
965 
966  if (thisStrawNumber < 0 || thisStrawNumber >= s_Straw_max[ibe]) {
967  ATH_MSG_WARNING("Found m_strawNumber = " << thisStrawNumber << " out of range.");
968  continue;
969  }
970  const int driftTimeBin = p_lolum->driftTimeBin();
971  const int trailingEdge = p_lolum->trailingEdge();
972  const bool highlevel = is_middleHTbit_high; //Hardcoded Middle Bit
973  const bool firstBinHigh = p_lolum->firstBinHigh(); // If the first time bin is up then the hit is out of time window
974  const bool lastBinHigh = p_lolum->lastBinHigh(); // If the last bin is up then the hit is out of time window.
975  const float timeOverThreshold = p_lolum->timeOverThreshold();
976  moduleNumber_barrel1[0] = phi_module;
977  moduleNumber_barrel1[1] = phi_module + 96;
978  moduleNumber_barrel2[0] = phi_module + s_numberOfBarrelStacks;
979  moduleNumber_barrel2[1] = phi_module + s_numberOfBarrelStacks + 96;
980  moduleNumber_barrel3[0] = phi_module + 2*s_numberOfBarrelStacks;
981  moduleNumber_barrel3[1] = phi_module + 2*s_numberOfBarrelStacks + 96;
982  moduleNumber_endcapA[0] = phi_module;
983  moduleNumber_endcapA[1] = phi_module + 64;
984  moduleNumber_endcapB[0] = phi_module + s_numberOfEndCapStacks;
985  moduleNumber_endcapB[1] = phi_module + s_numberOfEndCapStacks + 64;
986  int iphi_module = -999;
987 
988  if (iside == 0) {
989  iphi_module = phi_module;
990  } else if (iside == 1) {
991  iphi_module = phi_module + 32;
992  }
993 
994  if (m_doStraws) {
995  straw_shifter_struct& this_struct = straw_shifter_map[barrel_ec].emplace_back();
996  this_struct.strawNumber = thisStrawNumber;
997  this_struct.isAr = isArgonStraw;
998  this_struct.HitWMap_passed = true;
999  this_struct.HitWMap_Ar_passed = true;
1000  if (abs(barrel_ec) == 1) scale_hHitWMap_B_passed[isArgonStraw ? 1 : 0][thisStrawNumber]++;
1001  if (abs(barrel_ec) == 2) scale_hHitWMap_E_passed[barrel_ec < 0 ? 1 : 0][isArgonStraw ? 1 : 0][thisStrawNumber]++;
1002  }
1003 
1004  nTRTHits[ibe]++;
1005  if (ibe == 0) {
1006 
1007  if (m_doShift) {
1008  nHitsperLB_B++;
1009 
1010  if (highlevel) {
1011  nHLHitsperLB_B++;
1012  }
1013  }
1014  } else if (ibe == 1) {
1015  nTRTHits[ibe]++;
1016 
1017  if (m_doShift) {
1018  nHitsperLB_E[iside]++;
1019 
1020  if (highlevel) {
1021  nHLHitsperLB_E[iside]++;
1022  }
1023  }
1024  }
1025 
1026  if (m_doExpert) {
1027  if (m_doStraws) {
1028  straw_struct_prob& this_struct = straw_map_prob[ibe][iphi_module].emplace_back();
1029  this_struct.strawNumber = thisStrawNumber;
1030  this_struct.HitHWMapS_cut = highlevel && is_middleHTbit_high;
1031  this_struct.HitWMapS_cut = (driftTimeBin > 2) && (driftTimeBin < 17);
1032  this_struct.HitAMapS_cut = (firstBinHigh || lastBinHigh || (driftTimeBin > 0) || (trailingEdge < 23));
1033  this_struct.HitAWMapS_cut = is_anybininVgate_high;
1034  this_struct.HitHMapS_cut = highlevel;
1035  this_struct.HitHWMapS_passed = 1.;
1036  this_struct.HitWMapS_passed = 1.;
1037  this_struct.HitAMapS_passed = 1.;
1038  this_struct.HitAWMapS_passed = 1.;
1039  this_struct.HitHMapS_passed = 1.;
1040  if (ibe == 0) {
1041  if (highlevel && is_middleHTbit_high) scale_hHitHWMapS_B_passed[iphi_module][thisStrawNumber]++;
1042  if ((driftTimeBin > 2) && (driftTimeBin < 17)) scale_hHitWMapS_B_passed[iphi_module][thisStrawNumber]++;
1043  if (firstBinHigh || lastBinHigh || (driftTimeBin > 0) || (trailingEdge < 23)) scale_hHitAMapS_B_passed[iphi_module][thisStrawNumber]++;
1044  if (is_anybininVgate_high) scale_hHitAWMapS_B_passed[iphi_module][thisStrawNumber]++;
1045  if (highlevel) scale_hHitHMapS_B_passed[iphi_module][thisStrawNumber]++;
1046  }
1047  if (ibe == 1) {
1048  if (highlevel && is_middleHTbit_high) scale_hHitHWMapS_E_passed[iphi_module][thisStrawNumber]++;
1049  if ((driftTimeBin > 2) && (driftTimeBin < 17)) scale_hHitWMapS_E_passed[iphi_module][thisStrawNumber]++;
1050  if (firstBinHigh || lastBinHigh || (driftTimeBin > 0) || (trailingEdge < 23)) scale_hHitAMapS_E_passed[iphi_module][thisStrawNumber]++;
1051  if (is_anybininVgate_high) scale_hHitAWMapS_E_passed[iphi_module][thisStrawNumber]++;
1052  if (highlevel) scale_hHitHMapS_E_passed[iphi_module][thisStrawNumber]++;
1053  }
1054  }
1055 
1056  float trailingEdgeScaled = (trailingEdge + 1)*3.125;
1057 
1058  if (m_doStraws) {
1059  straw_struct& this_struct = straw_map[ibe][iphi_module].emplace_back();
1060  this_struct.strawNumber = thisStrawNumber;
1061  this_struct.HitTrMapS_y = trailingEdgeScaled;
1062  this_struct.HitToTMapS_y = timeOverThreshold;
1063  this_struct.HitToTLong_cut = (timeOverThreshold > m_longToTCut);
1064  this_struct.HitTrWMapS_y = trailingEdgeScaled;
1065  this_struct.HitTrWMapS_cut = (trailingEdge < 23) && !lastBinHigh && !firstBinHigh;
1066 
1067  if (highlevel) {
1068  HtoLMapS = thisStrawNumber;
1069  HtoLMapS_passed = 1.0;
1070  fill("RDOStackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLMapS_passed, HtoLMapS);
1071  } else {
1072  HtoLMapS = thisStrawNumber;
1073  HtoLMapS_passed = 0.0;
1074  fill("RDOStackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLMapS_passed, HtoLMapS);
1075  }
1076  }
1077 
1078  if (m_doChips) {
1079  chip_struct_prob& this_struct = chip_map_prob[ibe][iphi_module].emplace_back();
1080  this_struct.chipNumber = chip - 1;
1081  this_struct.HitHWMapC_cut = highlevel && is_middleHTbit_high;
1082  this_struct.HitWMapC_cut = (driftTimeBin > 2) && (driftTimeBin < 17);
1083  this_struct.HitAMapC_cut = (firstBinHigh || lastBinHigh || (driftTimeBin > 0) || (trailingEdge < 23));
1084  this_struct.HitAWMapC_cut = is_anybininVgate_high;
1085  this_struct.HitHMapC_cut = highlevel;
1086  this_struct.HitHWMapC_passed = 1.;
1087  this_struct.HitWMapC_passed = 1.;
1088  this_struct.HitAMapC_passed = 1.;
1089  this_struct.HitAWMapC_passed = 1.;
1090  this_struct.HitHMapC_passed = 1.;
1091  if (ibe == 0) {
1092  if (highlevel && is_middleHTbit_high) scale_hHitHWMapC_B_passed[iphi_module][chip - 1]++;
1093  if ((driftTimeBin > 2) && (driftTimeBin < 17)) scale_hHitWMapC_B_passed[iphi_module][chip - 1]++;
1094  if (firstBinHigh || lastBinHigh || (driftTimeBin > 0) || (trailingEdge < 23)) scale_hHitAMapC_B_passed[iphi_module][chip - 1]++;
1095  if (is_anybininVgate_high) scale_hHitAWMapC_B_passed[iphi_module][chip - 1]++;
1096  if (highlevel) scale_hHitHMapC_B_passed[iphi_module][chip - 1]++;
1097  }
1098  if (ibe == 1) {
1099  if (highlevel && is_middleHTbit_high) scale_hHitHWMapC_E_passed[iphi_module][chip - 1]++;
1100  if ((driftTimeBin > 2) && (driftTimeBin < 17)) scale_hHitWMapC_E_passed[iphi_module][chip - 1]++;
1101  if (firstBinHigh || lastBinHigh || (driftTimeBin > 0) || (trailingEdge < 23)) scale_hHitAMapC_E_passed[iphi_module][chip - 1]++;
1102  if (is_anybininVgate_high) scale_hHitAWMapC_E_passed[iphi_module][chip - 1]++;
1103  if (highlevel) scale_hHitHMapC_E_passed[iphi_module][chip - 1]++;
1104  }
1105  }
1106 
1107  if (m_doChips) {
1108  chip_struct& this_struct = chip_map[ibe][iphi_module].emplace_back();
1109  this_struct.chipNumber = chip - 1;
1110  this_struct.HitTrMapC_y = trailingEdgeScaled;
1111  this_struct.HitToTMapC_y = timeOverThreshold;
1112  this_struct.HitTrWMapC_cut = (trailingEdge < 23) && !lastBinHigh && !firstBinHigh;
1113  this_struct.HtoBCMap_cut = false;
1114  this_struct.HtoBCMapB_y = board - 1;
1115  this_struct.HtoBCMapC_x = -1;
1116  this_struct.HtoBCMapB_x = -1;
1117  if (p_lolum->highLevel(1)) {
1118  this_struct.HtoBCMapC_x = 0.;
1119  this_struct.HtoBCMapB_x = 0.;
1120  this_struct.HtoBCMap_cut=true;
1121  }
1122 
1123  if (p_lolum->highLevel(2)) {
1124  this_struct.HtoBCMapC_x = 1.;
1125  this_struct.HtoBCMapB_x = 1.;
1126  this_struct.HtoBCMap_cut=true;
1127  }
1128 
1129  if (p_lolum->highLevel(3)) {
1130  this_struct.HtoBCMapC_x = 2.;
1131  this_struct.HtoBCMapB_x = 2.;
1132  this_struct.HtoBCMap_cut=true;
1133  }
1134 
1135  if (highlevel) {
1136  HtoLMapC = chip - 1;
1137  HtoLMapC_passed = 1.0;
1138  fill("RDOStackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLMapC_passed, HtoLMapC);
1139  } else {
1140  HtoLMapC = chip - 1;
1141  HtoLMapC_passed = 0.0;
1142  fill("RDOStackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLMapC_passed, HtoLMapC);
1143  }
1144  }
1145  }
1146 
1147  //Set Module Numbers.
1148  int moduleNumber = -1;
1149 
1150  if (ibe == 0) {
1151  if (layer_or_wheel == 0) {
1152  moduleNumber = moduleNumber_barrel1[iside];
1153  moduleHits_B[moduleNumber]++;
1154  } else if (layer_or_wheel == 1) {
1155  moduleNumber = moduleNumber_barrel2[iside];
1156  moduleHits_B[moduleNumber]++;
1157  } else if (layer_or_wheel == 2) {
1158  moduleNumber = moduleNumber_barrel3[iside];
1159  moduleHits_B[moduleNumber]++;
1160  }
1161 
1162  if (highlevel) {
1163  if (layer_or_wheel == 0) {
1164  moduleNumber = moduleNumber_barrel1[iside];
1165  HLmoduleHits_B[moduleNumber]++;
1166  } else if (layer_or_wheel == 1) {
1167  moduleNumber = moduleNumber_barrel2[iside];
1168  HLmoduleHits_B[moduleNumber]++;
1169  } else if (layer_or_wheel == 2) {
1170  moduleNumber = moduleNumber_barrel3[iside];
1171  HLmoduleHits_B[moduleNumber]++;
1172  }
1173  }
1174  } else if (ibe == 1) {
1175  if (layer_or_wheel < 6) {
1176  moduleNumber = moduleNumber_endcapA[iside];
1177  moduleHits_E[moduleNumber]++;
1178  } else if (layer_or_wheel > 5) {
1179  moduleNumber = moduleNumber_endcapB[iside];
1180  moduleHits_E[moduleNumber]++;
1181  }
1182 
1183  if (highlevel) {
1184  if (layer_or_wheel < 6) {
1185  moduleNumber = moduleNumber_endcapA[iside];
1186  HLmoduleHits_E[moduleNumber]++;
1187  } else if (layer_or_wheel > 5) {
1188  moduleNumber = moduleNumber_endcapB[iside];
1189  HLmoduleHits_E[moduleNumber]++;
1190  }
1191  }
1192  }
1193  }
1194  }
1195 
1196  // Barrel straw normalization
1197  for (int k = 0; k < s_Straw_max[0]; k++) {
1198  for (int iGas = 0; iGas < 2; iGas++) {
1199  try {
1200  if (scale_hHitWMap[0][iGas].at(k) - scale_hHitWMap_B_passed[iGas][k] >= 0) {
1201  for (int j = 0; j < scale_hHitWMap[0][iGas].at(k) - scale_hHitWMap_B_passed[iGas][k]; j++) {
1202  if (m_doStraws) {
1203  straw_shifter_struct& this_struct = straw_shifter_map[1].emplace_back(); // index 1 is Barrel
1204  this_struct.strawNumber = k;
1205  this_struct.isAr = iGas > 0 ? true : false;
1206  this_struct.HitWMap_passed = false;
1207  this_struct.HitWMap_Ar_passed = false;
1208  }
1209  }
1210  } else {
1211  ATH_MSG_ERROR("Scale value " << scale_hHitWMap[0][iGas].at(k) - scale_hHitWMap_B_passed[iGas][k] <<
1212  " is less than zero in scaling for Barrel, iGas = " << iGas << ", k = " << k);
1213  }
1214  } catch (out_of_range &e) {
1215  ATH_MSG_ERROR("Index " << k << " out of range in scaling for Barrel");
1216  }
1217  }
1218  }
1219 
1220  // Endcap straw normalization
1221  for (int k = 0; k < s_Straw_max[1]; k++) {
1222  for (int iside = 0; iside < 2; iside++) {
1223  for (int iGas = 0; iGas < 2; iGas++) {
1224  try {
1225  if (scale_hHitWMap[iside + 1][iGas].at(k) - scale_hHitWMap_E_passed[iside][iGas][k] >= 0) {
1226  for (int j = 0; j < scale_hHitWMap[iside + 1][iGas].at(k) - scale_hHitWMap_E_passed[iside][iGas][k]; j++) {
1227  if (m_doStraws) {
1228  straw_shifter_struct& this_struct = straw_shifter_map[iside == 0 ? 2 : -2].emplace_back(); // index 2 is EA, index -2 is EC
1229  this_struct.strawNumber = k;
1230  this_struct.isAr = iGas > 0 ? true : false;
1231  this_struct.HitWMap_passed = false;
1232  this_struct.HitWMap_Ar_passed = false;
1233  }
1234  }
1235  } else {
1236  ATH_MSG_ERROR("Scale value " << scale_hHitWMap[iside + 1][iGas].at(k) - scale_hHitWMap_E_passed[iside][iGas][k] <<
1237  " is less than zero in scaling for Endcap, iside = " << iside << ", iGas = " << iGas << ", k = " << k);
1238  }
1239  } catch (out_of_range &e) {
1240  ATH_MSG_ERROR("Index " << k << " out of range in scaling for Endcap");
1241  }
1242  }
1243  }
1244  }
1245 
1246  if (m_doExpert) {
1247  // Barrel straw normalization
1248  for (int k = 0; k < s_Straw_max[0]; k++) {
1249  for (int iside = 0; iside < 2; iside++) {
1250  for (int phi_module = 0; phi_module < s_numberOfBarrelStacks; phi_module++) {
1251  int iphi_module = -999;;
1252  if (iside == 0) iphi_module = phi_module; else if (iside == 1) iphi_module = phi_module + 32;
1253  if (scale_hHitHWMapS_B_passed[iphi_module][k] < 2 || scale_hHitWMapS_B_passed[iphi_module][k] < 2 ||
1254  scale_hHitAMapS_B_passed[iphi_module][k] < 2 || scale_hHitAWMapS_B_passed[iphi_module][k] < 2 ||
1255  scale_hHitHMapS_B_passed[iphi_module][k] < 2) {
1256  for (int l = 0; l < 1 - scale_hHitHWMapS_B_passed[iphi_module][k]; l++){
1257  straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back(); // index 0 is Barrel, A and C are splitted by iphi_module
1258  this_struct.strawNumber = k;
1259  this_struct.HitHWMapS_cut = true;
1260  this_struct.HitHWMapS_passed = false;
1261  }
1262  for (int l = 0; l < 1 - scale_hHitWMapS_B_passed[iphi_module][k]; l++){
1263  straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back();
1264  this_struct.strawNumber = k;
1265  this_struct.HitWMapS_cut = true;
1266  this_struct.HitWMapS_passed = false;
1267  }
1268  for (int l = 0; l < 1 - scale_hHitAMapS_B_passed[iphi_module][k]; l++){
1269  straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back();
1270  this_struct.strawNumber = k;
1271  this_struct.HitAMapS_cut = true;
1272  this_struct.HitAMapS_passed = false;
1273  }
1274  for (int l = 0; l < 1 - scale_hHitAWMapS_B_passed[iphi_module][k]; l++){
1275  straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back();
1276  this_struct.strawNumber = k;
1277  this_struct.HitAWMapS_cut = true;
1278  this_struct.HitAWMapS_passed = false;
1279  }
1280  for (int l = 0; l < 1 - scale_hHitHMapS_B_passed[iphi_module][k]; l++){
1281  straw_struct_prob& this_struct = straw_map_prob[0][iphi_module].emplace_back();
1282  this_struct.strawNumber = k;
1283  this_struct.HitHMapS_cut = true;
1284  this_struct.HitHMapS_passed = false;
1285  }
1286  } else{
1287  ATH_MSG_ERROR("Scale value is less than zero in normalization for Barrel straw!");
1288  }
1289  }
1290  }
1291  }
1292 
1293  // Barrel chip normalization
1294  for (int k = 0; k < s_iChip_max[0]; k++) {
1295  for (int iside = 0; iside < 2; iside++) {
1296  for (int phi_module = 0; phi_module < s_numberOfBarrelStacks; phi_module++) {
1297  int iphi_module = -999;;
1298  if (iside == 0) iphi_module = phi_module; else if (iside == 1) iphi_module = phi_module + 32;
1299  if (scale_hHitHWMapC_B_passed[iphi_module][k] < 17 || scale_hHitWMapC_B_passed[iphi_module][k] < 17 ||
1300  scale_hHitAMapC_B_passed[iphi_module][k] < 17 || scale_hHitAWMapC_B_passed[iphi_module][k] < 17 ||
1301  scale_hHitHMapC_B_passed[iphi_module][k] < 17) {
1302  for (int l = 0; l < 16*1. - scale_hHitHWMapC_B_passed[iphi_module][k]; l++){
1303  chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back(); // index 0 is Barrel, A and C are splitted by iphi_module
1304  this_struct.chipNumber = k;
1305  this_struct.HitHWMapC_cut = true;
1306  this_struct.HitHWMapC_passed = false;
1307  }
1308  for (int l = 0; l < 16*1. - scale_hHitWMapC_B_passed[iphi_module][k]; l++){
1309  chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1310  this_struct.chipNumber = k;
1311  this_struct.HitWMapC_cut = true;
1312  this_struct.HitWMapC_passed = false;
1313  }
1314  for (int l = 0; l < 16*1. - scale_hHitAMapC_B_passed[iphi_module][k]; l++){
1315  chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1316  this_struct.chipNumber = k;
1317  this_struct.HitAMapC_cut = true;
1318  this_struct.HitAMapC_passed = false;
1319  }
1320  for (int l = 0; l < 16*1. - scale_hHitAWMapC_B_passed[iphi_module][k]; l++){
1321  chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1322  this_struct.chipNumber = k;
1323  this_struct.HitAWMapC_cut = true;
1324  this_struct.HitAWMapC_passed = false;
1325  }
1326  for (int l = 0; l < 16*1. - scale_hHitHMapC_B_passed[iphi_module][k]; l++){
1327  chip_struct_prob& this_struct = chip_map_prob[0][iphi_module].emplace_back();
1328  this_struct.chipNumber = k;
1329  this_struct.HitHMapC_cut = true;
1330  this_struct.HitHMapC_passed = false;
1331  }
1332  } else{
1333  ATH_MSG_ERROR("Scale value is less than zero in normalization for Barrel chip!");
1334  }
1335  }
1336  }
1337  }
1338 
1339  // Endcap straw normalization
1340  for (int k = 0; k < s_Straw_max[1]; k++) {
1341  for (int iside = 0; iside < 2; iside++) {
1342  for (int phi_module = 0; phi_module < s_numberOfEndCapStacks; phi_module++) {
1343  int iphi_module = -999;;
1344  if (iside == 0) iphi_module = phi_module; else if (iside == 1) iphi_module = phi_module + 32;
1345  if (scale_hHitHWMapS_E_passed[iphi_module][k] < 2 || scale_hHitWMapS_E_passed[iphi_module][k] < 2 ||
1346  scale_hHitAMapS_E_passed[iphi_module][k] < 2 || scale_hHitAWMapS_E_passed[iphi_module][k] < 2 ||
1347  scale_hHitHMapS_E_passed[iphi_module][k] < 2) {
1348  for (int l = 0; l < 1. - scale_hHitHWMapS_E_passed[iphi_module][k]; l++){
1349  straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back(); // index 1 is Endcap, A and C are splitted by iphi_module
1350  this_struct.strawNumber = k;
1351  this_struct.HitHWMapS_cut = true;
1352  this_struct.HitHWMapS_passed = false;
1353  }
1354  for (int l = 0; l < 1. - scale_hHitWMapS_E_passed[iphi_module][k]; l++){
1355  straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back();
1356  this_struct.strawNumber = k;
1357  this_struct.HitWMapS_cut = true;
1358  this_struct.HitWMapS_passed = false;
1359  }
1360  for (int l = 0; l < 1. - scale_hHitAMapS_E_passed[iphi_module][k]; l++){
1361  straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back();
1362  this_struct.strawNumber = k;
1363  this_struct.HitAMapS_cut = true;
1364  this_struct.HitAMapS_passed = false;
1365  }
1366  for (int l = 0; l < 1. - scale_hHitAWMapS_E_passed[iphi_module][k]; l++){
1367  straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back();
1368  this_struct.strawNumber = k;
1369  this_struct.HitAWMapS_cut = true;
1370  this_struct.HitAWMapS_passed = false;
1371  }
1372  for (int l = 0; l < 1. - scale_hHitHMapS_E_passed[iphi_module][k]; l++){
1373  straw_struct_prob& this_struct = straw_map_prob[1][iphi_module].emplace_back();
1374  this_struct.strawNumber = k;
1375  this_struct.HitHMapS_cut = true;
1376  this_struct.HitHMapS_passed = false;
1377  }
1378  } else{
1379  ATH_MSG_ERROR("Scale value is less than zero in normalization for Endcap straw!");
1380  }
1381  }
1382  }
1383  }
1384 
1385  // Endcap chip normalization
1386  for (int k = 0; k < s_iChip_max[1]; k++) {
1387  for (int iside = 0; iside < 2; iside++) {
1388  for (int phi_module = 0; phi_module < s_numberOfEndCapStacks; phi_module++) {
1389  int iphi_module = -999;;
1390  if (iside == 0) iphi_module = phi_module; else if (iside == 1) iphi_module = phi_module + 32;
1391  if (scale_hHitHWMapC_E_passed[iphi_module][k] < 17 || scale_hHitWMapC_E_passed[iphi_module][k] < 17 ||
1392  scale_hHitAMapC_E_passed[iphi_module][k] < 17 || scale_hHitAWMapC_E_passed[iphi_module][k] < 17 ||
1393  scale_hHitHMapC_E_passed[iphi_module][k] < 17) {
1394  for (int l = 0; l < 16*1. - scale_hHitHWMapC_E_passed[iphi_module][k]; l++){
1395  chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back(); // index 0 is Barrel, A and C are splitted by iphi_module
1396  this_struct.chipNumber = k;
1397  this_struct.HitHWMapC_cut = true;
1398  this_struct.HitHWMapC_passed = false;
1399  }
1400  for (int l = 0; l < 16*1. - scale_hHitWMapC_E_passed[iphi_module][k]; l++){
1401  chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1402  this_struct.chipNumber = k;
1403  this_struct.HitWMapC_cut = true;
1404  this_struct.HitWMapC_passed = false;
1405  }
1406  for (int l = 0; l < 16*1. - scale_hHitAMapC_E_passed[iphi_module][k]; l++){
1407  chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1408  this_struct.chipNumber = k;
1409  this_struct.HitAMapC_cut = true;
1410  this_struct.HitAMapC_passed = false;
1411  }
1412  for (int l = 0; l < 16*1. - scale_hHitAWMapC_E_passed[iphi_module][k]; l++){
1413  chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1414  this_struct.chipNumber = k;
1415  this_struct.HitAWMapC_cut = true;
1416  this_struct.HitAWMapC_passed = false;
1417  }
1418  for (int l = 0; l < 16*1. - scale_hHitHMapC_E_passed[iphi_module][k]; l++){
1419  chip_struct_prob& this_struct = chip_map_prob[1][iphi_module].emplace_back();
1420  this_struct.chipNumber = k;
1421  this_struct.HitHMapC_cut = true;
1422  this_struct.HitHMapC_passed = false;
1423  }
1424  } else{
1425  ATH_MSG_ERROR("Scale value is less than zero in normalization for Endcap chip!");
1426  }
1427  }
1428  }
1429  }
1430  }
1431 
1432  for (const auto& ibarrel_ecpair : straw_shifter_map) {
1433  int ibe = abs(ibarrel_ecpair.first) - 1;
1434  int iside = ibarrel_ecpair.first > 0 ? 0 : 1;
1435  auto strawNumber = Monitored::Collection("strawNumber", ibarrel_ecpair.second, [](const auto& s){return s.strawNumber;});
1436  auto HitWMap_passed = Monitored::Collection("HitWMap_passed", ibarrel_ecpair.second, [](const auto& s){return s.HitWMap_passed;});
1437  auto HitWMap_Ar_passed = Monitored::Collection("HitWMap_Ar_passed", ibarrel_ecpair.second, [](const auto& s){return s.HitWMap_Ar_passed;});
1438  auto isAr = Monitored::Collection("isAr", ibarrel_ecpair.second, [](const auto& s){return s.isAr;});
1439  auto isNotAr = Monitored::Collection("isNotAr", ibarrel_ecpair.second, [](const auto& s){return not s.isAr;});
1440  if (ibe == 0) {
1441  fill("RDOHistograms0", strawNumber, HitWMap_passed, HitWMap_Ar_passed, isAr, isNotAr);
1442  } else if (ibe == 1) {
1443  fill("RDOHistograms1"+std::to_string(iside), strawNumber, HitWMap_passed, HitWMap_Ar_passed, isAr, isNotAr);
1444  }
1445  }
1446 
1447  if (m_doExpert) {
1448  for (const auto& ibepair : straw_map_prob) {
1449  for (const auto& iphi_modulepair : ibepair.second ) {
1450  auto strawNumber = Monitored::Collection("strawNumber", iphi_modulepair.second, [](const auto& s){return s.strawNumber;});
1451  auto HitHWMapS_passed = Monitored::Collection("HitHWMapS_passed", iphi_modulepair.second, [](const auto& s){return s.HitHWMapS_passed;});
1452  auto HitWMapS_passed = Monitored::Collection("HitWMapS_passed", iphi_modulepair.second, [](const auto& s){return s.HitWMapS_passed;});
1453  auto HitAMapS_passed = Monitored::Collection("HitAMapS_passed", iphi_modulepair.second, [](const auto& s){return s.HitAMapS_passed;});
1454  auto HitAWMapS_passed = Monitored::Collection("HitAWMapS_passed", iphi_modulepair.second, [](const auto& s){return s.HitAWMapS_passed;});
1455  auto HitHMapS_passed = Monitored::Collection("HitHMapS_passed", iphi_modulepair.second, [](const auto& s){return s.HitHMapS_passed;});
1456  auto HitHWMapS_cut = Monitored::Collection("HitHWMapS_cut", iphi_modulepair.second, [](const auto& s){return s.HitHWMapS_cut;});
1457  auto HitWMapS_cut = Monitored::Collection("HitWMapS_cut", iphi_modulepair.second, [](const auto& s){return s.HitWMapS_cut;});
1458  auto HitAMapS_cut = Monitored::Collection("HitAMapS_cut", iphi_modulepair.second, [](const auto& s){return s.HitAMapS_cut;});
1459  auto HitAWMapS_cut = Monitored::Collection("HitAWMapS_cut", iphi_modulepair.second, [](const auto& s){return s.HitAWMapS_cut;});
1460  auto HitHMapS_cut = Monitored::Collection("HitHMapS_cut", iphi_modulepair.second, [](const auto& s){return s.HitHMapS_cut;});
1461 
1462  fill("RDOStackHistograms"+std::to_string(ibepair.first)+std::to_string(iphi_modulepair.first), strawNumber, HitHWMapS_passed, HitHWMapS_cut,
1463  HitWMapS_passed, HitWMapS_cut, HitAMapS_passed, HitAMapS_cut, HitAWMapS_passed, HitAWMapS_cut, HitHMapS_passed, HitHMapS_cut);
1464  }
1465  }
1466 
1467  for (const auto& ibepair : chip_map_prob) {
1468  for (const auto& iphi_modulepair : ibepair.second ) {
1469  auto chipNumber = Monitored::Collection("chipNumber", iphi_modulepair.second, [](const auto& s){return s.chipNumber;});
1470  auto HitHWMapC_passed = Monitored::Collection("HitHWMapC_passed", iphi_modulepair.second, [](const auto& s){return s.HitHWMapC_passed;});
1471  auto HitWMapC_passed = Monitored::Collection("HitWMapC_passed", iphi_modulepair.second, [](const auto& s){return s.HitWMapC_passed;});
1472  auto HitAMapC_passed = Monitored::Collection("HitAMapC_passed", iphi_modulepair.second, [](const auto& s){return s.HitAMapC_passed;});
1473  auto HitAWMapC_passed = Monitored::Collection("HitAWMapC_passed", iphi_modulepair.second, [](const auto& s){return s.HitAWMapC_passed;});
1474  auto HitHMapC_passed = Monitored::Collection("HitHMapC_passed", iphi_modulepair.second, [](const auto& s){return s.HitHMapC_passed;});
1475  auto HitHWMapC_cut = Monitored::Collection("HitHWMapC_cut", iphi_modulepair.second, [](const auto& s){return s.HitHWMapC_cut;});
1476  auto HitWMapC_cut = Monitored::Collection("HitWMapC_cut", iphi_modulepair.second, [](const auto& s){return s.HitWMapC_cut;});
1477  auto HitAMapC_cut = Monitored::Collection("HitAMapC_cut", iphi_modulepair.second, [](const auto& s){return s.HitAMapC_cut;});
1478  auto HitAWMapC_cut = Monitored::Collection("HitAWMapC_cut", iphi_modulepair.second, [](const auto& s){return s.HitAWMapC_cut;});
1479  auto HitHMapC_cut = Monitored::Collection("HitHMapC_cut", iphi_modulepair.second, [](const auto& s){return s.HitHMapC_cut;});
1480 
1481  fill("RDOStackHistograms"+std::to_string(ibepair.first)+std::to_string(iphi_modulepair.first), chipNumber, HitHWMapC_passed, HitHWMapC_cut,
1482  HitWMapC_passed, HitWMapC_cut, HitAMapC_passed, HitAMapC_cut, HitAWMapC_passed, HitAWMapC_cut, HitHMapC_passed, HitHMapC_cut);
1483  }
1484  }
1485  }
1486 
1487  for (const auto& ibepair : straw_map) {
1488  for (const auto& iphi_modulepair : ibepair.second ) {
1489  auto strawNumber = Monitored::Collection("strawNumber", iphi_modulepair.second, [](const auto& s){return s.strawNumber;});
1490  auto HitTrMapS_y = Monitored::Collection("HitTrMapS_y", iphi_modulepair.second, [](const auto& s){return s.HitTrMapS_y;});
1491  auto HitToTMapS_y = Monitored::Collection("HitToTMapS_y", iphi_modulepair.second, [](const auto& s){return s.HitToTMapS_y;});
1492  auto HitToTLong_cut = Monitored::Collection("HitToTLong_cut", iphi_modulepair.second, [](const auto& s){return s.HitToTLong_cut;});
1493  auto HitTrWMapS_y = Monitored::Collection("HitTrWMapS_y", iphi_modulepair.second, [](const auto& s){return s.HitTrWMapS_y;});
1494  auto HitTrWMapS_cut = Monitored::Collection("HitTrWMapS_cut", iphi_modulepair.second, [](const auto& s){return s.HitTrWMapS_cut;});
1495 
1496  fill("RDOStackHistograms"+std::to_string(ibepair.first)+std::to_string(iphi_modulepair.first), strawNumber,
1497  HitTrMapS_y, HitToTMapS_y, HitToTLong_cut, HitTrWMapS_y, HitTrWMapS_cut);
1498  }
1499  }
1500 
1501  for (const auto& ibepair : chip_map) {
1502  for (const auto& iphi_modulepair : ibepair.second ) {
1503  auto chipNumber = Monitored::Collection("chipNumber", iphi_modulepair.second, [](const auto& s){return s.chipNumber;});
1504  auto HitTrMapC_y = Monitored::Collection("HitTrMapC_y", iphi_modulepair.second, [](const auto& s){return s.HitTrMapC_y;});
1505  auto HitToTMapC_y = Monitored::Collection("HitToTMapC_y", iphi_modulepair.second, [](const auto& s){return s.HitToTMapC_y;});
1506  auto HtoBCMapC_x = Monitored::Collection("HtoBCMapC_x", iphi_modulepair.second, [](const auto& s){return s.HtoBCMapC_x;});
1507  auto HtoBCMapB_x = Monitored::Collection("HtoBCMapB_x", iphi_modulepair.second, [](const auto& s){return s.HtoBCMapB_x;});
1508  auto HtoBCMapB_y = Monitored::Collection("HtoBCMapB_y", iphi_modulepair.second, [](const auto& s){return s.HtoBCMapB_y;});
1509  auto HtoBCMap_cut = Monitored::Collection("HtoBCMap_cut", iphi_modulepair.second, [](const auto& s){return s.HtoBCMap_cut;});
1510  auto HitTrWMapC_cut = Monitored::Collection("HitTrWMapC_cut", iphi_modulepair.second, [](const auto& s){return s.HitTrWMapC_cut;});
1511 
1512  fill("RDOStackHistograms"+std::to_string(ibepair.first)+std::to_string(iphi_modulepair.first),
1513  chipNumber, HitTrMapC_y, HitToTMapC_y, HtoBCMapC_x, HtoBCMapB_x, HtoBCMapB_y, HtoBCMap_cut, HitTrWMapC_cut);
1514  }
1515  }
1516 
1517  OccAll = nhitsall/350848.;
1518  fill("RDOHistograms0", OccAll);
1519 
1520  //ToDo Explain this
1521  for (int ibe = 0; ibe < 2; ibe++) {
1522  if (m_doShift) {
1523  if (ibe == 0) {
1524  BCIDvsOcc_x = good_bcid;
1525  BCIDvsOcc_y = nTRTHits[ibe]/105088.0;
1526  fill("RDOHistograms0", BCIDvsOcc_x, BCIDvsOcc_y);
1527  } else if (ibe == 1) {
1528  BCIDvsOcc_x = good_bcid;
1529  BCIDvsOcc_y = nTRTHits[ibe]/245760.0;
1530  fill("RDOHistograms1", BCIDvsOcc_x, BCIDvsOcc_y);
1531  }
1532 
1533  for (int iside = 0; iside < 2; iside++) {
1534  for (int i = 1; i <= numberOfStacks_b[ibe]; i++) {
1535 
1536  int index_tmp = 0;
1537  int modulenum_tmp = 0;
1538 
1539  if (iside == 0) {
1540  index_tmp = i - 1;
1541  modulenum_tmp = i - 1;
1542  } else if (iside == 1) {
1543  index_tmp = i + 31;
1544 
1545  if (ibe == 0) modulenum_tmp = (i - 1) + 96;
1546  else if (ibe == 1) modulenum_tmp = (i - 1) + 64;
1547  }
1548 
1549  int nclass = -1;
1550 
1551  if (i <= s_numberOfBarrelStacks) {
1552  nclass = 0;
1553  } else if (i <= 2 * s_numberOfBarrelStacks && i > s_numberOfBarrelStacks) {
1554  nclass = 1;
1555  } else if (i > 2 * s_numberOfBarrelStacks) {
1556  nclass = 2;
1557  }
1558  int LLocc_index = index_tmp - 32 * nclass;
1559 
1560  if (nclass >= 0) {
1561  if (ibe == 0) {
1562  float occLL = float(moduleHits_B[modulenum_tmp]) / float(numberOfStrawsMod[nclass]);
1563  float occHL = float(HLmoduleHits_B[modulenum_tmp]) / float(numberOfStrawsMod[nclass]);
1564  AvgLLOcc_side_x = i - (32 * nclass);
1565  AvgLLOcc_side_y = occLL;
1566  AvgHLOcc_side_x = i - (32 * nclass);
1567  AvgHLOcc_side_y = occHL;
1568  AvgLLOccMod_side_x = i;
1569  AvgLLOccMod_side_y = occLL;
1570  AvgHLOccMod_side_x = i;
1571  AvgHLOccMod_side_y = occHL;
1572  } else if (ibe == 1) {
1573  float occLL = float(moduleHits_E[modulenum_tmp]) / float(numberOfStrawsWheel[nclass]);
1574  float occHL = float(HLmoduleHits_E[modulenum_tmp]) / float(numberOfStrawsWheel[nclass]);
1575 
1576  if (LLocc_index < 64) {
1577  } else {
1578  ATH_MSG_WARNING("m_LLOcc index out of bounds!"); // To satisfy Coverity defect CID 16514 which we believe is a false report.
1579  }
1580  AvgLLOcc_side_x = i - (32 * nclass);
1581  AvgLLOcc_side_y = occLL;
1582  AvgHLOcc_side_x = i - (32 * nclass);
1583  AvgHLOcc_side_y = occHL;
1584  AvgLLOccMod_side_x = i;
1585  AvgLLOccMod_side_y = occLL;
1586  AvgHLOccMod_side_x = i;
1587  AvgHLOccMod_side_y = occHL;
1588  }
1589  fill("RDOLLHLOccHistograms"+std::to_string(ibe)+std::to_string(iside), AvgLLOcc_side_x, AvgLLOcc_side_y, AvgHLOcc_side_x, AvgHLOcc_side_y,
1590  AvgLLOccMod_side_x, AvgLLOccMod_side_y, AvgHLOccMod_side_x, AvgHLOccMod_side_y);
1591  }
1592  }
1593  }
1594  }
1595  // Normalization for online environmenmet
1596  // Insert here
1597  }
1598 
1599  if (m_doShift) {
1600  const unsigned int lumiBlock = eventInfo.lumiBlock();
1601  ATH_MSG_VERBOSE("This is lumiblock : " << lumiBlock);
1602  int lastLumiBlock = -99; // ToDo - last lumiblock calculation is not correct
1603  if ((int)lumiBlock != lastLumiBlock) {
1604  lastLumiBlock = lumiBlock;
1605  }
1606  float evtLumiBlock = 1.;
1607  float lumiBlockScale = (evtLumiBlock > 0) ? (1. / evtLumiBlock) : 0;
1608  const float barrelConst = 1. / 105088;
1609  const float endcapConst = 1. / 122880;
1610 
1611  if (m_doTracksMon && evtLumiBlock > 0) {
1612  NHitsperLB_x = lastLumiBlock;
1613  NHitsperLB_y = (float)nHitsperLB_B * lumiBlockScale * barrelConst;
1614  fill("RDOShiftRebinnedBarrelHistograms0", NHitsperLB_x, NHitsperLB_y);
1615  NHLHitsperLB_x = lastLumiBlock;
1616  NHLHitsperLB_y = (float)nHLHitsperLB_B * lumiBlockScale * barrelConst;
1617  fill("RDOShiftRebinnedBarrelHistograms0", NHLHitsperLB_x, NHLHitsperLB_y);
1618 
1619  for (int iside = 0; iside < 2; iside++) {
1620  NHitsperLB_x = lastLumiBlock;
1621  NHitsperLB_y = (float)nHitsperLB_E[iside] * lumiBlockScale * endcapConst;
1622  fill("RDOShiftRebinnedEndcapHistograms1"+std::to_string(iside), NHitsperLB_x, NHitsperLB_y);
1623  NHLHitsperLB_x = lastLumiBlock;
1624  NHLHitsperLB_y = (float)nHLHitsperLB_E[iside] * lumiBlockScale * endcapConst;
1625  fill("RDOShiftRebinnedEndcapHistograms1"+std::to_string(iside), NHLHitsperLB_x, NHLHitsperLB_y);
1626  }
1627 
1628  nHitsperLB_B = 0;
1629  nHLHitsperLB_B = 0;
1630 
1631  for (int iside = 0; iside < 2; iside++) {
1632  nHitsperLB_E[iside] = 0;
1633  nHLHitsperLB_E[iside] = 0;
1634  }
1635  }
1636  }
1637 
1638  ATH_MSG_DEBUG("end of event and lumi block");
1639 
1640  //Get BSConversion Errors from BSConditionsServices:
1641  std::set<std::pair<uint32_t, uint32_t> > *L1IDErrorSet = m_BSSvc->getIdErrorSet(TRTByteStreamErrors::L1IDError);
1642  std::set<std::pair<uint32_t, uint32_t> > *BCIDErrorSet = m_BSSvc->getIdErrorSet(TRTByteStreamErrors::BCIDError);
1643  std::set<uint32_t> *MissingErrorSet = m_BSSvc->getErrorSet(TRTByteStreamErrors::MISSINGError);
1644  std::set<uint32_t> *SidErrorSet = m_BSSvc->getErrorSet(TRTByteStreamErrors::SIDError);
1645  std::set<std::pair<uint32_t, uint32_t> > *RobStatusErrorSet = m_BSSvc->getRodRobErrorSet(TRTByteStreamErrors::RobStatusError);
1646  const unsigned int rod_id_base[2][2] = { { 0x310000, 0x320000 }, { 0x330000, 0x340000 } };
1647  const unsigned int nChipsTotal[2][2] = { { 3328, 3328 }, { 7680, 7680 } };
1648  const unsigned int nRobsTotal[2][2] = { { 32, 32 }, { 64, 64 } };
1649  float nBSErrors[2][2] = { { 0, 0 }, { 0, 0 } };
1650  float nRobErrors[2][2] = { { 0, 0 }, { 0, 0 } };
1651  const std::set<std::pair<uint32_t, uint32_t> > *errorset1[2] = { BCIDErrorSet, L1IDErrorSet };
1652 
1653  for (int iset = 0; iset < 2; ++iset) {
1654  for (auto setIt = errorset1[iset]->begin(); setIt != errorset1[iset]->end(); ++setIt) {
1655  for (int ibe = 0; ibe < 2; ++ibe) {
1656  for (int iside = 0; iside < 2; ++iside) {
1657  if (((setIt->first >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
1658  nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
1659  }
1660  }
1661  }
1662  }
1663  }
1664 
1665  const std::set<uint32_t> *errorset2[2] = { MissingErrorSet, SidErrorSet };
1666 
1667  for (int iset = 0; iset < 2; ++iset) {
1668  for (auto setIt = errorset2[iset]->begin(); setIt != errorset2[iset]->end(); ++setIt) {
1669  for (int ibe = 0; ibe < 2; ++ibe) {
1670  for (int iside = 0; iside < 2; ++iside) {
1671  if (((*setIt >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
1672  nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
1673  }
1674  }
1675  }
1676  }
1677  }
1678 
1679  for (int ibe = 0; ibe < 2; ++ibe) {
1680  for (int iside = 0; iside < 2; ++iside) {
1681  ChipBSErrorsVsLB_x = lumiBlock;
1682  ChipBSErrorsVsLB_y = nBSErrors[ibe][iside];
1683  for (unsigned int i = 0; i < lumiBlock; i++) {
1684  // we need this so the LastBinThreshold algorithm can find the last bin
1685  fill("RDOShiftSmryRebinnedHistograms"+std::to_string(ibe)+std::to_string(iside), ChipBSErrorsVsLB_x, ChipBSErrorsVsLB_y);
1686  }
1687  }
1688  }
1689 
1690  for (auto setIt = RobStatusErrorSet->begin(); setIt != RobStatusErrorSet->end(); ++setIt) {
1691  for (int ibe = 0; ibe < 2; ++ibe) {
1692  for (int iside = 0; iside < 2; ++iside) {
1693  if (setIt->first % rod_id_base[ibe][iside] < 0xffff) {
1694  nRobErrors[ibe][iside] += 1. / nRobsTotal[ibe][iside];
1695  }
1696  }
1697  }
1698  }
1699 
1700  for (int ibe = 0; ibe < 2; ++ibe) {
1701  for (int iside = 0; iside < 2; ++iside) {
1702  RobBSErrorsVsLB_x = lumiBlock;
1703  RobBSErrorsVsLB_y = nRobErrors[ibe][iside];
1704  for (unsigned int i = 0; i < lumiBlock; i++) {
1705  // we need this so the LastBinThreshold algorithm can find the last bin
1706  fill("RDOShiftSmryRebinnedHistograms"+std::to_string(ibe)+std::to_string(iside), RobBSErrorsVsLB_x, RobBSErrorsVsLB_y);
1707  }
1708  }
1709  }
1710 
1711  ATH_MSG_VERBOSE("Leaving Fill TRT RDO Histograms");
1712  return StatusCode::SUCCESS;
1713 }
1714 
1715 // Fill the TRT Efficiency Histograms
1716 //----------------------------------------------------------------------------------//
1718 //----------------------------------------------------------------------------------//
1719  ATH_MSG_VERBOSE("Filling TRT Efficiency Histograms");
1720 
1721  // TEfficiency
1722  auto Efficiency_eta = Monitored::Scalar<float>("Efficiency_eta", 0.0);
1723  auto Efficiency_phi = Monitored::Scalar<float>("Efficiency_phi", 0.0);
1724  auto Efficiency_pt = Monitored::Scalar<float>("Efficiency_pt", 0.0);
1725  auto Efficiency_z0 = Monitored::Scalar<float>("Efficiency_z0", 0.0);
1726  auto EfficiencyBarrel_locR = Monitored::Scalar<float>("EfficiencyBarrel_locR", 0.0);
1727  auto EfficiencyBarrel_locR_Ar = Monitored::Scalar<float>("EfficiencyBarrel_locR_Ar", 0.0);
1728  auto EfficiencyBarrelMap = Monitored::Scalar<float>("EfficiencyBarrelMap", 0.0);
1729  auto EfficiencyEndCapMap = Monitored::Scalar<float>("EfficiencyEndCapMap", 0.0);
1730  auto EfficiencyEndCap_locR = Monitored::Scalar<float>("EfficiencyEndCap_locR", 0.0);
1731  auto EfficiencyEndCap_locR_Ar = Monitored::Scalar<float>("EfficiencyEndCap_locR_Ar", 0.0);
1732  auto EfficiencyS = Monitored::Scalar<float>("EfficiencyS", 0.0);
1733  auto EfficiencyC = Monitored::Scalar<float>("EfficiencyC", 0.0);
1734  auto Efficiency_eta_passed = Monitored::Scalar<float>("Efficiency_eta_passed", 0.0);
1735  auto Efficiency_phi_passed = Monitored::Scalar<float>("Efficiency_phi_passed", 0.0);
1736  auto Efficiency_pt_passed = Monitored::Scalar<float>("Efficiency_pt_passed", 0.0);
1737  auto Efficiency_z0_passed = Monitored::Scalar<float>("Efficiency_z0_passed", 0.0);
1738  auto EfficiencyBarrel_locR_passed = Monitored::Scalar<bool>("EfficiencyBarrel_locR_passed", false);
1739  auto EfficiencyBarrel_locR_Ar_passed = Monitored::Scalar<bool>("EfficiencyBarrel_locR_Ar_passed", false);
1740  auto EfficiencyBarrelMap_passed = Monitored::Scalar<bool>("EfficiencyBarrelMap_passed", false);
1741  auto EfficiencyEndCapMap_passed = Monitored::Scalar<bool>("EfficiencyEndCapMap_passed", false);
1742  auto EfficiencyEndCap_locR_passed = Monitored::Scalar<bool>("EfficiencyEndCap_locR_passed", false);
1743  auto EfficiencyEndCap_locR_Ar_passed = Monitored::Scalar<bool>("EfficiencyEndCap_locR_Ar_passed", false);
1744  auto EfficiencyS_passed = Monitored::Scalar<bool>("EfficiencyS_passed", false);
1745  auto EfficiencyC_passed = Monitored::Scalar<bool>("EfficiencyC_passed", false);
1746 
1747  // Reduce unnecessary divisions
1748  const float invGeV = 1. / CLHEP::GeV;
1749  const float invmm = 1. / CLHEP::mm;
1750  int itrack = 0;
1751  float track_pt = 0;
1752  float track_eta = 0;
1753  float track_phi = 0;
1754  float track_d0 = 0;
1755  float track_z0 = 0;
1756 
1757  for (auto track = combTrackCollection.begin(); track != combTrackCollection.end(); ++track) {
1758  // Online: use all tracks, offline: use only every xth track, skip the rest
1759  if (m_environment != Environment_t::online && (itrack % m_every_xth_track) != 0) continue;
1760 
1761  ++itrack;
1762  // Get perigee
1763  const Trk::Perigee *perigee = (*track)->perigeeParameters();
1764 
1765  if (perigee) {
1766  track_pt = perigee->pT();
1767  track_eta = perigee->eta();
1768  track_phi = perigee->parameters()[Trk::phi0];
1769  track_d0 = perigee->parameters()[Trk::d0];
1770  track_z0 = perigee->parameters()[Trk::z0];
1771  ATH_MSG_DEBUG("This track has perigee parameters:\n"
1772  << " pT = " << track_pt * invGeV << " GeV" << "\n"
1773  << " eta = " << track_eta << "\n"
1774  << " phi0 = " << track_phi << "\n"
1775  << " d0 = " << track_d0 * invmm << "\n"
1776  << " z0 = " << track_z0 * invmm << "\n"
1777  << " theta = " << perigee->parameters()[Trk::theta] << "\n"
1778  << " qOverP = " << perigee->parameters()[Trk::qOverP]);
1779  } else {
1780  ATH_MSG_DEBUG("This track has null perigeeParameters.");
1781  continue;
1782  }
1783 
1784  const Trk::TrackStates *track_states = (*track)->trackStateOnSurfaces();
1785 
1786  if (track_states) {
1787  ATH_MSG_DEBUG("This track has " << track_states->size() << " track states on surface.");
1788  } else {
1789  ATH_MSG_DEBUG("This track has null track states on surface.");
1790  continue;
1791  }
1792 
1793  const std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->summary(*(*track)));
1794  int n_trt_hits = summary->get(Trk::numberOfTRTHits);
1795  int n_sct_hits = summary->get(Trk::numberOfSCTHits);
1796  int n_pixel_hits = summary->get(Trk::numberOfPixelHits);
1797  float p = 1.0e+08;
1798 
1799  if (perigee) {
1800  p = (perigee->parameters()[Trk::qOverP] != 0.) ? std::abs(1. / (perigee->parameters()[Trk::qOverP])) : 1.0e+08;
1801  }
1802 
1803 
1804  // Preselect tracks
1805  const bool passed_track_preselection = (static_cast<bool>(m_trackSelTool->accept(**track)) || m_isCosmics) &&
1806  n_trt_hits >= m_min_trt_hits &&
1807  p > m_minP &&
1808  perigee->pT() > (m_isCosmics?m_min_pT : 2.0 * CLHEP::GeV);
1809 
1810  ATH_MSG_DEBUG("track has ntrt = " << n_trt_hits
1811  << " and nsct = " << n_sct_hits
1812  << " and npix = " << n_pixel_hits);
1813 
1814  if (!passed_track_preselection) {
1815  ATH_MSG_DEBUG("This track failed preselection.");
1816  continue;
1817  }
1818 
1819  ATH_MSG_DEBUG("This track passed preselection.");
1820 
1821  for (auto it = track_states->begin(); it != track_states->end(); it++) {
1822  if ( !((*it)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
1823 
1824  const Trk::TrackParameters *track_parameters = (*it)->trackParameters();
1825 
1826  if (!track_parameters) continue;
1827 
1828  Identifier id = track_parameters->associatedSurface().associatedDetectorElementIdentifier();
1829 
1830  if ( !((m_pTRTHelper->is_trt(id)) )) continue;
1831 
1832  float locR = track_parameters->parameters()[Trk::driftRadius];
1833  int barrel_ec = m_pTRTHelper->barrel_ec(id);
1834  int layer_or_wheel = m_pTRTHelper->layer_or_wheel(id);
1835  int phi_module = m_pTRTHelper->phi_module(id);
1836  int straw_layer = m_pTRTHelper->straw_layer(id);
1837  int straw = m_pTRTHelper->straw(id);
1838  const bool isArgonStraw = (Straw_Gastype( m_sumTool->getStatusHT(id) ) == GasType::Ar);
1839  // Assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
1840  int ibe = abs(barrel_ec) - 1; // ibe = 0 (Barrel), ibe = 1 (Endcap)
1841  int iside = barrel_ec > 0 ? 0 : 1; // iside = 0 (Side A), iside = 1 (Side C)
1842 
1843  if (ibe == 0) {
1844  if (isArgonStraw) {
1845  EfficiencyBarrel_locR_Ar = locR;
1846  EfficiencyBarrel_locR_Ar_passed = 1.0;
1847  fill("TRTEfficiencyHistogramsBarrel", EfficiencyBarrel_locR_Ar_passed, EfficiencyBarrel_locR_Ar);
1848  } else {
1849  EfficiencyBarrel_locR = locR;
1850  EfficiencyBarrel_locR_passed = 1.0;
1851  fill("TRTEfficiencyHistogramsBarrel", EfficiencyBarrel_locR_passed, EfficiencyBarrel_locR);
1852  }
1853  } else if (ibe == 1) {
1854  if (isArgonStraw) {
1855  EfficiencyBarrel_locR_Ar = locR;
1856  EfficiencyBarrel_locR_Ar_passed = 1.0;
1857  fill("TRTEfficiencyHistogramsEndCap"+std::to_string(iside), EfficiencyBarrel_locR_Ar_passed, EfficiencyBarrel_locR_Ar);
1858  } else {
1859  EfficiencyEndCap_locR = locR;
1860  EfficiencyEndCap_locR_passed = 1.0;
1861  fill("TRTEfficiencyHistogramsEndCap"+std::to_string(iside), EfficiencyEndCap_locR_passed, EfficiencyEndCap_locR);
1862  }
1863  }
1864 
1865  if (std::abs(locR) >= 1.3) continue;
1866 
1867  int thisStrawNumber = 0;
1868  int chip = 0;
1869 
1870  if (ibe == 0) {
1871  thisStrawNumber = strawNumber(straw, straw_layer, layer_or_wheel);
1872 
1873  if (thisStrawNumber >= 0 && thisStrawNumber < s_Straw_max[ibe])
1874  chip = m_mat_chip_B.at(phi_module).at(thisStrawNumber);
1875  } else if (ibe == 1) {
1876  thisStrawNumber = strawNumberEndCap(straw, straw_layer, layer_or_wheel, phi_module, barrel_ec);
1877 
1878  if (thisStrawNumber >= 0 && thisStrawNumber < s_Straw_max[ibe])
1879  chip = m_mat_chip_E.at(phi_module).at(thisStrawNumber);
1880  }
1881 
1882  if (ibe == 0) {
1883  EfficiencyBarrelMap = thisStrawNumber;
1884  EfficiencyBarrelMap_passed = 1.0;
1885  fill("TRTEfficiencyHistogramsBarrel", EfficiencyBarrelMap_passed, EfficiencyBarrelMap);
1886  } else if (ibe == 1) {
1887  EfficiencyEndCapMap = thisStrawNumber;
1888  EfficiencyEndCapMap_passed = 1.0;
1889  fill("TRTEfficiencyHistogramsEndCap", EfficiencyEndCapMap_passed, EfficiencyEndCapMap);
1890  }
1891 
1892  if (m_doExpert) {
1893  if (iside == 0) {
1894  EfficiencyS = thisStrawNumber;
1895  EfficiencyS_passed = 1.0;
1896  fill("TRTEfficiencyHistograms"+std::to_string(ibe)+std::to_string(phi_module), EfficiencyS_passed, EfficiencyS);
1897  EfficiencyC = chip;
1898  EfficiencyC_passed = 1.0;
1899  fill("TRTEfficiencyHistograms"+std::to_string(ibe)+std::to_string(phi_module), EfficiencyC_passed, EfficiencyC);
1900  } else if (iside == 1) {
1901  EfficiencyS = thisStrawNumber;
1902  EfficiencyS_passed = 1.0;
1903  fill("TRTEfficiencyHistograms"+std::to_string(ibe)+std::to_string(phi_module + 32), EfficiencyS_passed, EfficiencyS);
1904  EfficiencyC = chip;
1905  EfficiencyC_passed = 1.0;
1906  fill("TRTEfficiencyHistograms"+std::to_string(ibe)+std::to_string(phi_module + 32), EfficiencyC_passed, EfficiencyC);
1907  }
1908  }
1909 
1910  Efficiency_eta_passed = track_eta;
1911  Efficiency_eta = 1.0;
1912  fill("TRTEfficiencyHistograms", Efficiency_eta_passed, Efficiency_eta);
1913  Efficiency_phi_passed = track_phi;
1914  Efficiency_phi = 1.0;
1915  fill("TRTEfficiencyHistograms", Efficiency_phi_passed, Efficiency_phi);
1916  Efficiency_pt_passed = track_pt*invGeV;
1917  Efficiency_pt = 1.0;
1918  fill("TRTEfficiencyHistograms", Efficiency_pt_passed, Efficiency_pt);
1919  Efficiency_z0_passed = track_z0;
1920  Efficiency_z0 = 1.0;
1921  fill("TRTEfficiencyHistograms", Efficiency_z0_passed, Efficiency_z0);
1922  }
1923 
1924 
1925  // Use hole finder to find holes on this track
1926  if (m_useHoleFinder) {
1927  std::unique_ptr<const Trk::TrackStates> holes (m_trt_hole_finder->getHolesOnTrack(*(*track)));
1928 
1929  if (!holes) {
1930  ATH_MSG_WARNING("TRTTrackHoleSearchTool returned null results.");
1931  continue;
1932  } else {
1933  for (auto it = holes->begin(); it != holes->end(); ++it) { // holes->size() is always 0 for some reason
1934  if ( !((*it)->type(Trk::TrackStateOnSurface::Hole)) ) continue;
1935 
1936  const Trk::TrackParameters *track_parameters = (*it)->trackParameters();
1937 
1938  if (!track_parameters) continue;
1939 
1940  Identifier id = track_parameters->associatedSurface().associatedDetectorElementIdentifier();
1941 
1942  if ( !(m_pTRTHelper->is_trt(id)) ) continue;
1943 
1944  float locR = track_parameters->parameters()[Trk::driftRadius];
1945  int barrel_ec = m_pTRTHelper->barrel_ec(id);
1946  int layer_or_wheel = m_pTRTHelper->layer_or_wheel(id);
1947  int phi_module = m_pTRTHelper->phi_module(id);
1948  int straw_layer = m_pTRTHelper->straw_layer(id);
1949  int straw = m_pTRTHelper->straw(id);
1950  const bool isArgonStraw = Straw_Gastype( m_sumTool->getStatusHT(id) ) == GasType::Ar;
1951  // Assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
1952  int ibe = abs(barrel_ec) - 1; // ibe = 0 (Barrel), ibe = 1 (Endcap)
1953  int iside = barrel_ec > 0 ? 0 : 1; // iside = 0 (Side A), iside = 1 (Side C)
1954 
1955  if (ibe == 0) {
1956  if (isArgonStraw) {
1957  EfficiencyBarrel_locR_Ar = locR;
1958  EfficiencyBarrel_locR_Ar_passed = 0.0;
1959  fill("TRTEfficiencyHistograms", EfficiencyBarrel_locR_Ar_passed, EfficiencyBarrel_locR_Ar);
1960  } else {
1961  EfficiencyBarrel_locR = locR;
1962  EfficiencyBarrel_locR_passed = 0.0;
1963  fill("TRTEfficiencyHistograms", EfficiencyBarrel_locR_passed, EfficiencyBarrel_locR);
1964  }
1965  } else if (ibe == 1) {
1966  if (isArgonStraw) {
1967  EfficiencyEndCap_locR_Ar = locR;
1968  EfficiencyEndCap_locR_Ar_passed = 0.0;
1969  fill("TRTEfficiencyHistogramsEndCap"+std::to_string(iside), EfficiencyEndCap_locR_Ar_passed, EfficiencyEndCap_locR_Ar);
1970  } else {
1971  EfficiencyEndCap_locR = locR;
1972  EfficiencyEndCap_locR_passed = 0.0;
1973  fill("TRTEfficiencyHistogramsEndCap"+std::to_string(iside), EfficiencyEndCap_locR_passed, EfficiencyEndCap_locR);
1974  }
1975  }
1976 
1977  if (std::abs(locR) >= 1.3) continue;
1978 
1979  int thisStrawNumber = 0;
1980  int chip = 0;
1981 
1982  if (ibe == 0) {
1983  thisStrawNumber = strawNumber(straw, straw_layer, layer_or_wheel);
1984 
1985  if (thisStrawNumber >= 0 && thisStrawNumber < s_Straw_max[ibe]) {
1986  chip = m_mat_chip_B.at(phi_module).at(thisStrawNumber);
1987  }
1988  } else if (ibe == 1) {
1989  thisStrawNumber = strawNumberEndCap(straw, straw_layer, layer_or_wheel, phi_module, barrel_ec);
1990 
1991  if (thisStrawNumber >= 0 && thisStrawNumber < s_Straw_max[ibe]) {
1992  chip = m_mat_chip_E.at(phi_module).at(thisStrawNumber);
1993  }
1994  }
1995 
1996  if (ibe == 0) {
1997  EfficiencyBarrelMap = thisStrawNumber;
1998  EfficiencyBarrelMap_passed = 0.0;
1999  fill("TRTEfficiencyHistogramsBarrel", EfficiencyBarrelMap_passed, EfficiencyBarrelMap);
2000  } else if (ibe == 1) {
2001  EfficiencyEndCapMap = thisStrawNumber;
2002  EfficiencyEndCapMap_passed = 0.0;
2003  fill("TRTEfficiencyHistogramsEndCap", EfficiencyEndCapMap_passed, EfficiencyEndCapMap);
2004  }
2005 
2006  if (m_doExpert) {
2007  if (iside == 0) {
2008  EfficiencyS = thisStrawNumber;
2009  EfficiencyS_passed = 0.0;
2010  fill("TRTEfficiencyHistograms"+std::to_string(ibe)+std::to_string(phi_module), EfficiencyS_passed, EfficiencyS);
2011  EfficiencyC = chip;
2012  EfficiencyC_passed = 0.0;
2013  fill("TRTEfficiencyHistograms"+std::to_string(ibe)+std::to_string(phi_module), EfficiencyC_passed, EfficiencyC);
2014  } else if (iside == 1) {
2015  EfficiencyS = thisStrawNumber;
2016  EfficiencyS_passed = 0.0;
2017  fill("TRTEfficiencyHistograms"+std::to_string(ibe)+std::to_string(phi_module + 32), EfficiencyS_passed, EfficiencyS);
2018  EfficiencyC = chip;
2019  EfficiencyC_passed = 0.0;
2020  fill("TRTEfficiencyHistograms"+std::to_string(ibe)+std::to_string(phi_module + 32), EfficiencyC_passed, EfficiencyC);
2021  }
2022  }
2023  Efficiency_eta_passed = track_eta;
2024  Efficiency_eta = 0.0;
2025  fill("TRTEfficiencyHistograms", Efficiency_eta_passed, Efficiency_eta);
2026  Efficiency_phi_passed = track_phi;
2027  Efficiency_phi = 0.0;
2028  fill("TRTEfficiencyHistograms", Efficiency_phi_passed, Efficiency_phi);
2029  Efficiency_pt_passed = track_pt*invGeV;
2030  Efficiency_pt = 0.0;
2031  fill("TRTEfficiencyHistograms", Efficiency_pt_passed, Efficiency_pt);
2032  Efficiency_z0_passed = track_z0;
2033  Efficiency_z0 = 0.0;
2034  fill("TRTEfficiencyHistograms", Efficiency_z0_passed, Efficiency_z0);
2035  }
2036  }
2037  }
2038  }
2039 
2040  // Efficiency calculations
2041  // Insert here
2042 
2043  return StatusCode::SUCCESS;
2044 }
2045 
2046 
2051 };
2052 
2053 // Fill TRT Hits histograms
2054 //----------------------------------------------------------------------------------//
2056 //----------------------------------------------------------------------------------//
2057  ATH_MSG_VERBOSE("Filling TRT Tracks Histos");
2058 
2059  // TH1F
2060  auto HLhitOnTrack_B = Monitored::Scalar<float>("HLhitOnTrack_B", 0.0);
2061  auto HLhitOnTrack_E = Monitored::Scalar<float>("HLhitOnTrack_E", 0.0);
2062  auto HtoLRatioOnTrack_B_Ar = Monitored::Scalar<float>("HtoLRatioOnTrack_B_Ar", 0.0);
2063  auto HtoLRatioOnTrack_B_Xe = Monitored::Scalar<float>("HtoLRatioOnTrack_B_Xe", 0.0);
2064  auto HtoLRatioOnTrack_B = Monitored::Scalar<float>("HtoLRatioOnTrack_B", 0.0);
2065  auto HtoLRatioOnTrack_E = Monitored::Scalar<float>("HtoLRatioOnTrack_E", 0.0);
2066  auto HtoLRatioOnTrack_E_Ar = Monitored::Scalar<float>("HtoLRatioOnTrack_E_Ar", 0.0);
2067  auto HtoLRatioOnTrack_E_Xe = Monitored::Scalar<float>("HtoLRatioOnTrack_E_Xe", 0.0);
2068  auto NumSwLLWoT_E = Monitored::Scalar<float>("NumSwLLWoT_E", 0.0);
2069  auto NumSwLLWoT_B = Monitored::Scalar<float>("NumSwLLWoT_B", 0.0);
2070  auto HitHWonTMapS = Monitored::Scalar<float>("HitHWonTMapS", 0.0);
2071  auto HitWonTMapS = Monitored::Scalar<float>("HitWonTMapS", 0.0);
2072  auto HitAonTMapS = Monitored::Scalar<float>("HitAonTMapS", 0.0);
2073  auto HitAWonTMapS = Monitored::Scalar<float>("HitAWonTMapS", 0.0);
2074  auto HitHonTMapS = Monitored::Scalar<float>("HitHonTMapS", 0.0);
2075  auto HitHWonTMapC = Monitored::Scalar<float>("HitHWonTMapC", 0.0);
2076  auto HitWonTMapC = Monitored::Scalar<float>("HitWonTMapC", 0.0);
2077  auto HitAonTMapC = Monitored::Scalar<float>("HitAonTMapC", 0.0);
2078  auto HitAWonTMapC = Monitored::Scalar<float>("HitAWonTMapC", 0.0);
2079  auto HitHonTMapC = Monitored::Scalar<float>("HitHonTMapC", 0.0);
2080 
2081  // TEfficiency
2082  auto StrawEffDetPhi_B = Monitored::Scalar<float>("StrawEffDetPhi_B", 0.0);
2083  auto StrawEffDetPhi_B_passed = Monitored::Scalar<float>("StrawEffDetPhi_B_passed", 0.0);
2084  auto StrawEffDetPhi_E = Monitored::Scalar<float>("StrawEffDetPhi_E", 0.0);
2085  auto StrawEffDetPhi_E_passed = Monitored::Scalar<float>("StrawEffDetPhi_E_passed", 0.0);
2086  auto EfficiencyS = Monitored::Scalar<float>("EfficiencyS", 0.0);
2087  auto EfficiencyS_passed = Monitored::Scalar<bool>("EfficiencyS_passed", false);
2088  auto EfficiencyC = Monitored::Scalar<float>("EfficiencyC", 0.0);
2089  auto EfficiencyC_passed = Monitored::Scalar<bool>("EfficiencyC_passed", false);
2090  auto HtoLonTMapS = Monitored::Scalar<float>("HtoLonTMapS", 0.0);
2091  auto HtoLonTMapS_passed = Monitored::Scalar<bool>("HtoLonTMapS_passed", false);
2092  auto HtoLWonTMapS = Monitored::Scalar<float>("HtoLWonTMapS", 0.0);
2093  auto HtoLWonTMapS_passed = Monitored::Scalar<bool>("HtoLWonTMapS_passed", false);
2094  auto HtoLonTMapC = Monitored::Scalar<float>("HtoLonTMapC", 0.0);
2095  auto HtoLonTMapC_passed = Monitored::Scalar<bool>("HtoLonTMapC_passed", false);
2096  auto HtoLWonTMapC = Monitored::Scalar<float>("HtoLWonTMapC", 0.0);
2097  auto HtoLWonTMapC_passed = Monitored::Scalar<bool>("HtoLWonTMapC_passed", false);
2098  auto HitTronTMapC_x = Monitored::Scalar<float>("HitTronTMapC_x", 0.0);
2099  auto HitTronTMapC_y = Monitored::Scalar<float>("HitTronTMapC_y", 0.0);
2100  auto HitTronTMapS_x = Monitored::Scalar<float>("HitTronTMapS_x", 0.0);
2101  auto HitTronTMapS_y = Monitored::Scalar<float>("HitTronTMapS_y", 0.0);
2102  auto HitToTonTMapS_x = Monitored::Scalar<float>("HitToTonTMapS_x", 0.0);
2103  auto HitToTonTMapS_y = Monitored::Scalar<float>("HitToTonTMapS_y", 0.0);
2104  auto HitToTonTMapC_x = Monitored::Scalar<float>("HitToTonTMapC_x", 0.0);
2105  auto HitToTonTMapC_y = Monitored::Scalar<float>("HitToTonTMapC_y", 0.0);
2106 
2107 
2108 
2109  // TProfile
2110  auto HitWonTMap_B_y = Monitored::Scalar<float>("HitWonTMap_B_y", 0.0);
2111  auto HitWonTMap_E_y = Monitored::Scalar<float>("HitWonTMap_E_y", 0.0);
2112 
2113  auto scale_hHitWonTMap_B = std::make_unique<short int[]>(s_Straw_max[0]);
2114  auto scale_hHitWonTMap_E = std::make_unique<short int[][s_Straw_max[1]]>(2);
2115  auto scale_hHitWonTMap_B_passed = std::make_unique<short int[]>(s_Straw_max[0]);
2116  auto scale_hHitWonTMap_E_passed = std::make_unique<short int[][s_Straw_max[1]]>(2);
2117 
2118  std::map<int,std::vector<straw_edge_struct>> straw_edge_map;
2119 
2120  auto p_trk = trackCollection.begin();
2121 
2122  const Trk::Perigee *mPer = nullptr;
2123  const DataVector<const Trk::TrackParameters> *AllTrkPar(nullptr);
2125 
2126  int ntrackstack[2][64];
2127 
2128  for (int ibe = 0; ibe < 2; ibe++) {
2129  std::fill(ntrackstack[ibe], ntrackstack[ibe] + 64, 0);
2130  }
2131 
2132  for (; p_trk != trackCollection.end(); ++p_trk) {
2133  const std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->summary(*(*p_trk)));
2134  int nTRTHits = summary->get(Trk::numberOfTRTHits);
2135 
2136  if (nTRTHits < m_minTRThits) continue;
2137 
2138  AllTrkPar = (*p_trk)->trackParameters();
2139 
2140  // Search of MeasuredPerigee in TrackParameters
2141  // The following algorithm only finds the First perigee measurement.
2142  // As there should be one and only one perigee measurement then this assumption should be valid.
2143  // But no check is done to see if there is more than one perigee measurement.
2144  for (p_trkpariter = AllTrkPar->begin(); p_trkpariter != AllTrkPar->end(); ++p_trkpariter) {
2145  //if track parameter does have a measured perigee then the track parameter is a keeper and break out of the loop
2146  if ((mPer = dynamic_cast<const Trk::Perigee *>(*p_trkpariter))) break;
2147  }
2148 
2149  if (!mPer) continue;
2150 
2151  float theta = mPer->parameters()[Trk::theta];
2152  float p = (mPer->parameters()[Trk::qOverP] != 0.) ? std::abs(1. / (mPer->parameters()[Trk::qOverP])) : 10e7;
2153  float pT = (p * sin(theta));
2154  pT = pT * 1e-3; // GeV
2155 
2156  if (p < m_minP) continue;
2157 
2158  const Trk::TrackStates *trackStates = (**p_trk).trackStateOnSurfaces();
2159 
2160  if (trackStates == nullptr) continue;
2161 
2162  Trk::TrackStates::const_iterator TSOSItBegin0 = trackStates->begin();
2163  Trk::TrackStates::const_iterator TSOSItBegin = trackStates->begin();
2164  Trk::TrackStates::const_iterator TSOSItBeginTemp = trackStates->begin();
2165  Trk::TrackStates::const_iterator TSOSItEnd = trackStates->end();
2166 
2167  const bool passed_track_preselection = (static_cast<bool>(m_trackSelTool->accept(**p_trk)) || m_isCosmics) &&
2169  mPer->pT() > (m_isCosmics?m_min_pT : 2.0 * CLHEP::GeV);
2170 
2171  if (!passed_track_preselection) continue;
2172 
2173  int nTRTHitsW[2][2];
2174  int nTRTHitsW_Ar[2][2];
2175  int nTRTHitsW_Xe[2][2];
2176  int nTRTHLHitsW[2][2];
2177  int nTRTHLHitsW_Ar[2][2];
2178  int nTRTHLHitsW_Xe[2][2];
2179  int nTRTHits_side[2][2];
2180  int nTRTHitsW_perwheel[2][18];
2181  int hitontrack[2] = {0, 0};
2182  int hitontrack_E_side[2] = {0, 0};
2183 
2184  for (int ibe = 0; ibe < 2; ibe++) {
2185  for (int iside = 0; iside < 2; iside++) {
2186  nTRTHits_side[ibe][iside] = -1;
2187  nTRTHitsW[ibe][iside] = 0;
2188  nTRTHitsW_Ar[ibe][iside] = 0;
2189  nTRTHitsW_Xe[ibe][iside] = 0;
2190  nTRTHLHitsW[ibe][iside] = 0;
2191  nTRTHLHitsW_Ar[ibe][iside] = 0;
2192  nTRTHLHitsW_Xe[ibe][iside] = 0;
2193  }
2194  std::fill(nTRTHitsW_perwheel[ibe], nTRTHitsW_perwheel[ibe] + 18, 0);
2195  }
2196 
2197  bool isBarrelOnly = true;
2198  bool ECAhit = false;
2199  bool ECChit = false;
2200  bool Bhit = false;
2201  int barrel_ec = 0;
2202  int layer_or_wheel = 0;
2203  int phi_module = 0;
2204  int straw_layer = 0;
2205  int straw = 0;
2206  int nearest_straw_layer[2] = {100, 100};
2207  int nearest_straw[2] = {0, 0};
2208  int testLayer[2] = {100, 100};
2209  float phi2D[2] = {-100, -100};
2210 
2211  for (TSOSItBeginTemp = TSOSItBegin0; TSOSItBeginTemp != TSOSItEnd; ++TSOSItBeginTemp) {
2212  if ((*TSOSItBeginTemp) == nullptr) continue;
2213 
2214  if (! ((*TSOSItBeginTemp)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
2215  const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack *>((*TSOSItBeginTemp)->measurementOnTrack());
2216 
2217  if (!trtCircle) continue;
2218  const Trk::TrackParameters *aTrackParam = dynamic_cast<const Trk::TrackParameters *>((*TSOSItBeginTemp)->trackParameters());
2219 
2220  if (!aTrackParam) continue;
2221  Identifier DCoTId = trtCircle->identify();
2222  barrel_ec = m_pTRTHelper->barrel_ec(DCoTId);
2223  int ibe = std::abs(barrel_ec) - 1;
2224  layer_or_wheel = m_pTRTHelper->layer_or_wheel (DCoTId);
2225  straw_layer = m_pTRTHelper->straw_layer(DCoTId);
2226  straw = m_pTRTHelper->straw(DCoTId);
2227 
2228  // Restrict ourselves to the inner most TRT layers To get detector phi.
2229  if (layer_or_wheel >= testLayer[ibe]) continue;
2230  testLayer[ibe] = layer_or_wheel;
2231 
2232  if (straw_layer < nearest_straw_layer[ibe]) {
2233  nearest_straw_layer[ibe] = straw_layer;
2234  nearest_straw[ibe] = straw;
2235  const InDetDD::TRT_BaseElement *circleElement = nullptr;
2236  circleElement = trtCircle->detectorElement();
2237  phi2D[ibe] = radToDegrees(circleElement->strawCenter(nearest_straw[ibe]).phi());
2238  circleElement = nullptr;
2239  }
2240  }
2241 
2242  if (phi2D[0] == -999) {
2243  ATH_MSG_DEBUG("Track did not go through inner layer of Barrel.");
2244  } else {
2245  ATH_MSG_VERBOSE("Track's closest approach is m_layer_or_wheel: " <<
2246  testLayer[0] << " m_straw_layer: " <<
2247  nearest_straw_layer[0] << " (in the Barrel).");
2248  }
2249 
2250  if (phi2D[1] == -999) {
2251  ATH_MSG_DEBUG("Track did not go through any inner layer of EndCap A or C.");
2252  } else {
2253  ATH_MSG_VERBOSE("Track's closest approach is m_layer_or_wheel: " <<
2254  testLayer[1] << " m_straw_layer: " <<
2255  nearest_straw_layer[1] << " (in the EndCaps).");
2256  }
2257 
2258  bool trackfound[2][64];
2259 
2260  for (int i = 0; i < 2; i++) {
2261  std::fill(trackfound[i], trackfound[i] + 64, false);
2262  }
2263 
2264  for (TSOSItBegin = TSOSItBegin0; TSOSItBegin != TSOSItEnd; ++TSOSItBegin) {
2265  // Select a TSOS which is non-empty, measurement type and contains both drift circle and track parameters informations
2266  if ((*TSOSItBegin) == nullptr) continue;
2267 
2268  if ( !((*TSOSItBegin)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
2269 
2270  const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack *>((*TSOSItBegin)->measurementOnTrack());
2271 
2272  if (!trtCircle) continue;
2273 
2274  const Trk::TrackParameters *aTrackParam = dynamic_cast<const Trk::TrackParameters *>((*TSOSItBegin)->trackParameters());
2275 
2276  if (!aTrackParam) continue;
2277 
2278  Identifier DCoTId = trtCircle->identify();
2279  barrel_ec = m_pTRTHelper->barrel_ec(DCoTId);
2280  layer_or_wheel = m_pTRTHelper->layer_or_wheel(DCoTId);
2281  phi_module = m_pTRTHelper->phi_module(DCoTId);
2282  straw_layer = m_pTRTHelper->straw_layer(DCoTId);
2283  straw = m_pTRTHelper->straw(DCoTId);
2284  int ibe = std::abs(barrel_ec) - 1; // ibe = 0 (Barrel), ibe = 1 (Endcap)
2285  int iside = barrel_ec > 0 ? 0 : 1; // iside = 0 (Side A), iside = 1 (Side C)
2286  int thisStrawNumber[2] = {-1, -1};
2287  int chip[2] = {0, 0};
2288 
2289  if (ibe == 0) {
2290  thisStrawNumber[ibe] = strawNumber(straw, straw_layer, layer_or_wheel);
2291 
2292  if (thisStrawNumber[ibe] >= 0 && thisStrawNumber[ibe] < s_Straw_max[ibe]) {
2293  chip[ibe] = m_mat_chip_B.at(phi_module).at(thisStrawNumber[ibe]);
2294  }
2295  } else if (ibe == 1) {
2296  thisStrawNumber[ibe] = strawNumberEndCap(straw, straw_layer, layer_or_wheel, phi_module, barrel_ec);
2297 
2298  if (thisStrawNumber[ibe] >= 0 && thisStrawNumber[ibe] < s_Straw_max[ibe]) {
2299  chip[ibe] = m_mat_chip_E.at(phi_module).at(thisStrawNumber[ibe]);
2300  }
2301  } else {
2302  thisStrawNumber[ibe] = -1;
2303  }
2304 
2305  if (thisStrawNumber[ibe] < 0 || thisStrawNumber[ibe] >= s_Straw_max[ibe]) continue;
2306 
2307  if (ibe == 0) {
2308  Bhit = true;
2309  } else if (barrel_ec == 2) {
2310  isBarrelOnly = false;
2311  ECAhit = true;
2312  } else if (barrel_ec == -2) {
2313  isBarrelOnly = false;
2314  ECChit = true;
2315  }
2316 
2317  Identifier surfaceID;
2318  surfaceID = trtCircle->identify();
2319  const bool isArgonStraw = ( Straw_Gastype( m_sumTool->getStatusHT(surfaceID) ) == GasType::Ar );
2320  // Assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
2321  float temp_locr = aTrackParam->parameters()[Trk::driftRadius];
2322  int iphi_module = -9999;
2323 
2324  if (iside == 0) iphi_module = phi_module;
2325  else if (iside == 1) iphi_module = phi_module + 32;
2326 
2327  trackfound[ibe][iphi_module] = true;
2328 
2329  if (((ibe == 0) && (temp_locr < m_DistToStraw)) ||
2330  ((ibe == 1) && ((*TSOSItBegin)->type(Trk::TrackStateOnSurface::Measurement) ||
2331  (*TSOSItBegin)->type(Trk::TrackStateOnSurface::Outlier) ||
2332  (*TSOSItBegin)->type(Trk::TrackStateOnSurface::Hole)) &&
2333  (temp_locr < m_DistToStraw))) {
2334  if (m_idHelper->is_trt(DCoTId)) {
2335  if (ibe == 0) {
2336  hitontrack[ibe]++;
2337 
2338  if (m_doShift) {
2339  StrawEffDetPhi_B_passed = phi_module;
2340  StrawEffDetPhi_B = 1.0;
2341  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), StrawEffDetPhi_B_passed, StrawEffDetPhi_B);
2342 
2343  if (m_doStraws) scale_hHitWonTMap_B[thisStrawNumber[ibe]]++;
2344  }
2345 
2346  } else if (ibe == 1) {
2347  hitontrack[ibe]++;
2348  hitontrack_E_side[iside]++;
2349 
2350  if (m_doShift) {
2351  StrawEffDetPhi_E_passed = phi_module;
2352  StrawEffDetPhi_E = 1.0;
2353  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+std::to_string(iside), StrawEffDetPhi_E_passed, StrawEffDetPhi_E);
2354 
2355  if (m_doStraws) scale_hHitWonTMap_E[iside][thisStrawNumber[ibe]]++;
2356  }
2357  }
2358 
2359  if (m_doStraws && m_doExpert) {
2360  EfficiencyS = thisStrawNumber[ibe];
2361  EfficiencyS_passed = 1.0;
2362  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), EfficiencyS_passed, EfficiencyS);
2363  }
2364 
2365  if (m_doChips && m_doExpert) {
2366  EfficiencyC = chip[ibe] - 1;
2367  EfficiencyC_passed = 1.0;
2368  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), EfficiencyC_passed, EfficiencyC);
2369  }
2370  }
2371  } else {
2372  if (m_idHelper->is_trt(DCoTId)) { // ToDo: Is this really needed?
2373  if (ibe == 0) {
2374  if (m_doShift) {
2375  StrawEffDetPhi_B_passed = phi_module;
2376  StrawEffDetPhi_B = 0.0;
2377  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), StrawEffDetPhi_B_passed, StrawEffDetPhi_B);
2378 
2379  if (m_doStraws) scale_hHitWonTMap_B[thisStrawNumber[ibe]]++;
2380  }
2381  } else if (ibe == 1) {
2382  if (m_doShift) {
2383  StrawEffDetPhi_E_passed = phi_module;
2384  StrawEffDetPhi_E = 0.0;
2385  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+std::to_string(iside), StrawEffDetPhi_E_passed, StrawEffDetPhi_E);
2386 
2387  if (m_doStraws) scale_hHitWonTMap_E[iside][thisStrawNumber[ibe]]++;
2388  }
2389  }
2390 
2391  if (m_doStraws && m_doExpert) {
2392  EfficiencyS = thisStrawNumber[ibe];
2393  EfficiencyS_passed = 0.0;
2394  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), EfficiencyS_passed, EfficiencyS);
2395  }
2396 
2397  if (m_doChips && m_doExpert) {
2398  EfficiencyC = chip[ibe] - 1;
2399  EfficiencyC_passed = 0.0;
2400  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), EfficiencyC_passed, EfficiencyC);
2401  }
2402  }
2403  }
2404  const InDet::TRT_DriftCircle *RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle *>(trtCircle->prepRawData());
2405  if (RawDriftCircle) {
2406  nTRTHits_side[ibe][iside]++;
2407  float timeOverThreshold = RawDriftCircle->timeOverThreshold();
2408  int middleHTbit = RawDriftCircle->getWord() & 0x00020000;
2409  //0x00020000 = 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000
2410  int hitinvaliditygate = RawDriftCircle->getWord() & 0x000DFE80;
2411  //0x000DFE80 = 0000 0000 0000 0000 0000 1101 1111 1110 1000 0000
2412  bool is_middleHTbit_high = (middleHTbit != 0);
2413  bool is_anybininVgate_high = (hitinvaliditygate != 0);
2414 
2415  if (m_doExpert && m_doStraws) {
2416  HitToTonTMapS_x = thisStrawNumber[ibe];
2417  HitToTonTMapS_y = timeOverThreshold;
2418  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitToTonTMapS_x, HitToTonTMapS_y);
2419  }
2420 
2421  if (m_doExpert && m_doChips) {
2422  HitToTonTMapC_x = chip[ibe] - 1;
2423  HitToTonTMapC_y = timeOverThreshold;
2424  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitToTonTMapC_x, HitToTonTMapC_y);
2425  }
2426 
2427  if (m_doExpert && m_doStraws) {
2428  if (is_middleHTbit_high) {
2429  HitHonTMapS = thisStrawNumber[ibe];
2430  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitHonTMapS);
2431  HitHWonTMapS = thisStrawNumber[ibe];
2432  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitHWonTMapS);
2433 
2434  HtoLonTMapS = thisStrawNumber[ibe];
2435  HtoLonTMapS_passed = 1.0;
2436  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLonTMapS_passed, HtoLonTMapS);
2437  HtoLWonTMapS = thisStrawNumber[ibe];
2438  HtoLWonTMapS_passed = 1.0;
2439  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLWonTMapS_passed, HtoLWonTMapS);
2440  }
2441  }
2442 
2443  if (m_doExpert && m_doChips) {
2444  if (is_middleHTbit_high) {
2445  HitHWonTMapC = chip[ibe] - 1;
2446  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitHWonTMapC);
2447  HitHonTMapC = chip[ibe] - 1;
2448  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitHonTMapC);
2449  HtoLonTMapC = chip[ibe] - 1;
2450  HtoLonTMapC_passed = 1.0;
2451  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLonTMapC_passed, HtoLonTMapC);
2452  HtoLWonTMapC = chip[ibe] - 1;
2453  HtoLWonTMapC_passed = 1.0;
2454  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLWonTMapC_passed, HtoLWonTMapC);
2455  }
2456  }
2457 
2458  const int driftTimeBin = RawDriftCircle->driftTimeBin();
2459 
2460  if ( (driftTimeBin < 24) &&
2461  !(RawDriftCircle->lastBinHigh()) &&
2462  !(RawDriftCircle->firstBinHigh()) ) {
2463  if (m_doStraws && m_doShift) {
2464  if (ibe == 0) {
2465  straw_edge_struct& this_struct = straw_edge_map[1].emplace_back(); // index 1 is Barrel
2466  this_struct.strawNumber = thisStrawNumber[ibe];
2467  this_struct.HitWonTMap_B_y = 1.0;
2468  scale_hHitWonTMap_B_passed[thisStrawNumber[ibe]]++;
2469  } else if (ibe == 1) {
2470  straw_edge_struct& this_struct = straw_edge_map[iside == 0 ? 2 : -2].emplace_back(); // index 2 is EA, index -2 is EC
2471  this_struct.strawNumber = thisStrawNumber[ibe];
2472  this_struct.HitWonTMap_E_y = 1.0;
2473  scale_hHitWonTMap_E_passed[iside][thisStrawNumber[ibe]]++;
2474  }
2475  }
2476  }
2477 
2478  if ((driftTimeBin > 2) && (driftTimeBin < 17)) {
2479  if (m_doExpert && m_doStraws) {
2480  HitWonTMapS = thisStrawNumber[ibe];
2481  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitWonTMapS);
2482 
2483  }
2484  if (m_doExpert && m_doChips) {
2485  HitWonTMapC = chip[ibe] - 1;
2486  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitWonTMapC);
2487  }
2488  }
2489 
2490  const int trailingEdge = RawDriftCircle->trailingEdge();
2491  float trailingEdgeScaled = (trailingEdge + 1) * 3.125;
2492 
2493  if ((trailingEdge < 23) &&
2494  !(RawDriftCircle->lastBinHigh()) &&
2495  !(RawDriftCircle->firstBinHigh())) {
2496  if (m_doExpert && m_doStraws) {
2497  HitTronTMapS_x = thisStrawNumber[ibe];
2498  HitTronTMapS_y = trailingEdgeScaled;
2499  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitTronTMapS_x, HitTronTMapS_y);
2500  }
2501 
2502  if (m_doExpert && m_doChips) {
2503  HitTronTMapC_x = chip[ibe] - 1;
2504  HitTronTMapC_y = trailingEdgeScaled;
2505  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitTronTMapC_x, HitTronTMapC_y);
2506  }
2507  }
2508 
2509  const bool firstBinHigh = RawDriftCircle->firstBinHigh();
2510  const bool lastBinHigh = RawDriftCircle->lastBinHigh();
2511 
2512  if (firstBinHigh || lastBinHigh || driftTimeBin > 0 || trailingEdge < 23) {
2513  if (m_doExpert && m_doStraws) {
2514  HitAonTMapS = thisStrawNumber[ibe];
2515  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitAonTMapS);
2516 
2517  if (!is_middleHTbit_high) {
2518  HtoLonTMapS = thisStrawNumber[ibe];
2519  HtoLonTMapS_passed = 0.0;
2520  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLonTMapS_passed, HtoLonTMapS);
2521  }
2522  }
2523 
2524  if (m_doExpert && m_doChips) {
2525  HitAonTMapC = chip[ibe] - 1;
2526  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitAonTMapC);
2527  if (!is_middleHTbit_high) {
2528  HtoLonTMapC = chip[ibe] - 1;
2529  HtoLonTMapC_passed = 0.0;
2530  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLonTMapC_passed, HtoLonTMapC);
2531  }
2532  }
2533 
2534  nTRTHitsW[ibe][iside]++;
2535 
2536  if (isArgonStraw) nTRTHitsW_Ar[ibe][iside]++;
2537  else nTRTHitsW_Xe[ibe][iside]++;
2538 
2539  nTRTHitsW_perwheel[iside][layer_or_wheel]++;
2540 
2541  if (is_middleHTbit_high) {
2542  nTRTHLHitsW[ibe][iside]++;
2543  if (isArgonStraw) nTRTHLHitsW_Ar[ibe][iside]++;
2544  else nTRTHLHitsW_Xe[ibe][iside]++;
2545  }
2546  }
2547 
2548  if (is_anybininVgate_high) {
2549  if (m_doExpert && m_doStraws) {
2550  HitAWonTMapS = thisStrawNumber[ibe];
2551  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitAWonTMapS);
2552 
2553  if (!is_middleHTbit_high) {
2554  HtoLWonTMapS = thisStrawNumber[ibe];
2555  HtoLWonTMapS_passed = 0.0;
2556  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLWonTMapS_passed, HtoLWonTMapS);
2557  }
2558  }
2559 
2560  if (m_doExpert && m_doChips) {
2561  HitAWonTMapC = chip[ibe] - 1;
2562  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HitAWonTMapC);
2563 
2564  if (!is_middleHTbit_high) {
2565  HtoLWonTMapC = chip[ibe] - 1;
2566  HtoLWonTMapC_passed = 0.0;
2567  fill("TRTTrackHistograms"+std::to_string(ibe)+std::to_string(iphi_module), HtoLWonTMapC_passed, HtoLWonTMapC);
2568  }
2569  }
2570  }
2571  }
2572  }
2573 
2574  // ToDo: work on the part below
2575  for (int ibe = 0; ibe < 2; ibe++) {
2576  for (int i = 0; i < 64; i++)
2577  if (trackfound[ibe][i])
2578  ntrackstack[ibe][i]++;
2579 
2580  if (phi2D[ibe] < 0) continue;
2581 
2582 
2583  if (m_doShift) {
2584  if (ibe == 0) {
2585  if (isBarrelOnly) {
2586  if (nTRTHitsW[ibe][0] > 0) {
2587  if (nTRTHitsW[ibe][1] > 0) {
2588  NumSwLLWoT_B = nTRTHitsW[ibe][0] + nTRTHitsW[ibe][1];
2589  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), NumSwLLWoT_B);
2590  }
2591  else {
2592  NumSwLLWoT_B = nTRTHitsW[ibe][0];
2593  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), NumSwLLWoT_B);
2594  }
2595  } else if (nTRTHitsW[ibe][1] > 0) {
2596  NumSwLLWoT_B = nTRTHitsW[ibe][1];
2597  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), NumSwLLWoT_B);
2598  }
2599  }
2600 
2601  if (nTRTHLHitsW[ibe][0] > 0) {
2602  if (nTRTHLHitsW[ibe][1] > 0) {
2603  HLhitOnTrack_B = nTRTHLHitsW[ibe][0] + nTRTHLHitsW[ibe][1];
2604  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), HLhitOnTrack_B);
2605  } else {
2606  HLhitOnTrack_B = nTRTHLHitsW[ibe][0];
2607  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), HLhitOnTrack_B);
2608  }
2609  } else if (nTRTHLHitsW[ibe][1] > 0) {
2610  HLhitOnTrack_B = nTRTHLHitsW[ibe][1];
2611  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), HLhitOnTrack_B);
2612  }
2613 
2614  if (nTRTHitsW[ibe][0] + nTRTHitsW[ibe][1] > 0) {
2615  HtoLRatioOnTrack_B = (float)(nTRTHLHitsW[ibe][0] + nTRTHLHitsW[ibe][1]) / (nTRTHitsW[ibe][0] + nTRTHitsW[ibe][1]);
2616  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), HtoLRatioOnTrack_B);
2617  }
2618 
2619  if (nTRTHitsW_Ar[ibe][0] + nTRTHitsW_Ar[ibe][1] > 0) {
2620  HtoLRatioOnTrack_B_Ar = (float)(nTRTHLHitsW_Ar[ibe][0] + nTRTHLHitsW_Ar[ibe][1]) / (nTRTHitsW_Ar[ibe][0] + nTRTHitsW_Ar[ibe][1]);
2621  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), HtoLRatioOnTrack_B_Ar);
2622  }
2623 
2624  if (nTRTHitsW_Xe[ibe][0] + nTRTHitsW_Xe[ibe][1] > 0) {
2625  HtoLRatioOnTrack_B_Xe = (float)(nTRTHLHitsW_Xe[ibe][0] + nTRTHLHitsW_Xe[ibe][1]) / (nTRTHitsW_Xe[ibe][0] + nTRTHitsW_Xe[ibe][1]);
2626  fill("ShiftTRTTrackHistograms"+std::to_string(ibe), HtoLRatioOnTrack_B_Xe);
2627  }
2628  } else if (ibe == 1) {
2629  if (nTRTHitsW[ibe][0] > 0) {
2630  if (nTRTHitsW[ibe][1] > 0) {
2631  if (ECAhit && !ECChit && !Bhit) {
2632  NumSwLLWoT_E = nTRTHitsW[ibe][0];
2633  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+"0", NumSwLLWoT_E);
2634  }
2635 
2636  if (ECChit && !ECAhit && !Bhit) {
2637  NumSwLLWoT_E = nTRTHitsW[ibe][1];
2638  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+"1", NumSwLLWoT_E);
2639  }
2640  }
2641 
2642  if (ECAhit && !ECChit && !Bhit) {
2643  NumSwLLWoT_E = nTRTHitsW[ibe][0];
2644  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+"0", NumSwLLWoT_E);
2645  }
2646  } else if (nTRTHitsW[ibe][1] > 0) {
2647  if (ECChit && !ECAhit && !Bhit) {
2648  NumSwLLWoT_E = nTRTHitsW[ibe][1];
2649  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+"1", NumSwLLWoT_E);
2650  }
2651  }
2652 
2653  for (int iside = 0; iside < 2; iside++) {
2654  if (nTRTHLHitsW[ibe][iside] > 0) {
2655  HLhitOnTrack_E = nTRTHLHitsW[ibe][iside];
2656  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+std::to_string(iside), HLhitOnTrack_E);
2657  }
2658 
2659  if ((nTRTHitsW[ibe][iside]) > 0) {
2660  HtoLRatioOnTrack_E = (float)(nTRTHLHitsW[ibe][iside]) / nTRTHitsW[ibe][iside];
2661  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+std::to_string(iside), HtoLRatioOnTrack_E);
2662 
2663  if ((nTRTHitsW_Ar[ibe][iside]) > 0) {
2664  HtoLRatioOnTrack_E_Ar = (float)(nTRTHLHitsW_Ar[ibe][iside]) / nTRTHitsW_Ar[ibe][iside];
2665  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+std::to_string(iside), HtoLRatioOnTrack_E_Ar);
2666  }
2667 
2668  if ((nTRTHitsW_Xe[ibe][iside]) > 0) {
2669  HtoLRatioOnTrack_E_Xe = (float)(nTRTHLHitsW_Xe[ibe][iside]) / nTRTHitsW_Xe[ibe][iside];
2670  fill("ShiftTRTTrackHistograms"+std::to_string(ibe)+std::to_string(iside), HtoLRatioOnTrack_E_Xe);
2671  }
2672  }
2673  }
2674  }
2675  }
2676  }
2677  }
2678 
2679  // Barrel straw normalization
2680  for (int k = 0; k < s_Straw_max[0]; k++) {
2681  try {
2682  if (scale_hHitWonTMap_B[k] - scale_hHitWonTMap_B_passed[k] >= 0) {
2683  for (int j = 0; j < scale_hHitWonTMap_B[k] - scale_hHitWonTMap_B_passed[k]; j++) {
2684  if (m_doStraws) {
2685  straw_edge_struct& this_struct = straw_edge_map[1].emplace_back(); // index 1 is Barrel
2686  this_struct.strawNumber = k;
2687  this_struct.HitWonTMap_B_y = 0;
2688  }
2689  }
2690  } else {
2691  ATH_MSG_ERROR("Scale value " << scale_hHitWonTMap_B[k] - scale_hHitWonTMap_B_passed[k] <<
2692  " is less than zero in scaling for Barrel, k = " << k);
2693  }
2694  } catch (out_of_range &e) {
2695  ATH_MSG_ERROR("Index " << k << " out of range in scaling for Barrel");
2696  }
2697  }
2698 
2699  // Endcap straw normalization
2700  for (int k = 0; k < s_Straw_max[1]; k++) {
2701  for (int iside = 0; iside < 2; iside++) {
2702  try {
2703  if (scale_hHitWonTMap_E[iside][k] - scale_hHitWonTMap_E_passed[iside][k] >= 0) {
2704  for (int j = 0; j < scale_hHitWonTMap_E[iside][k] - scale_hHitWonTMap_E_passed[iside][k]; j++) {
2705  if (m_doStraws) {
2706  straw_edge_struct& this_struct = straw_edge_map[iside == 0 ? 2 : -2].emplace_back(); // index 2 is EA, index -2 is EC
2707  this_struct.strawNumber = k;
2708  this_struct.HitWonTMap_E_y = 0;
2709  }
2710  }
2711  } else {
2712  ATH_MSG_ERROR("Scale value " << scale_hHitWonTMap_E[iside][k] - scale_hHitWonTMap_E_passed[iside][k] <<
2713  " is less than zero in scaling for Endcap, iside = " << iside << ", k = " << k);
2714  }
2715  } catch (out_of_range &e) {
2716  ATH_MSG_ERROR("Index " << k << " out of range in scaling for Endcap");
2717  }
2718  }
2719  }
2720 
2721  for (const auto& ibarrel_ecpair : straw_edge_map) {
2722  int ibe = abs(ibarrel_ecpair.first) - 1;
2723  int iside = ibarrel_ecpair.first > 0 ? 0 : 1;
2724  auto strawNumber = Monitored::Collection("strawNumber", ibarrel_ecpair.second, [](const auto& s){return s.strawNumber;});
2725  auto HitWonTMap_B_y = Monitored::Collection("HitWonTMap_B_y", ibarrel_ecpair.second, [](const auto& s){return s.HitWonTMap_B_y;});
2726  auto HitWonTMap_E_y = Monitored::Collection("HitWonTMap_E_y", ibarrel_ecpair.second, [](const auto& s){return s.HitWonTMap_E_y;});
2727  if (ibe == 0) {
2728  fill("ShiftTRTTrackHistograms0", strawNumber, HitWonTMap_B_y);
2729  } else if (ibe == 1) {
2730  fill("ShiftTRTTrackHistograms1"+std::to_string(iside), strawNumber, HitWonTMap_E_y);
2731  }
2732  }
2733 
2734  return StatusCode::SUCCESS;
2735 }
2736 
2737 
2738 StatusCode TRTMonitoringRun3RAW_Alg::fillHistograms( const EventContext& ctx ) const {
2739  using namespace Monitored;
2740  bool passEventBurst;
2741 
2742  ATH_MSG_VERBOSE("Monitoring Histograms being filled");
2743 
2745  SG::ReadHandle<xAOD::EventInfo> xAODEventInfo = GetEventInfo(ctx);
2749 
2750  if (m_doRDOsMon) {
2751  if (!rdoContainer.isValid()) {
2752  ATH_MSG_ERROR("Could not find TRT Raw Data Object " << m_rdoContainerKey.key() <<
2753  " in store");
2754  return StatusCode::FAILURE;
2755  }
2756 
2757  passEventBurst = checkEventBurst(*rdoContainer);
2758  if (passEventBurst) {
2759  if (!trtBCIDCollection.isValid()) {
2760  ATH_MSG_INFO("Could not find BCID collection " << m_TRT_BCIDCollectionKey.key() <<
2761  " in store");
2762  }
2763 
2764  ATH_CHECK( fillTRTRDOs(*rdoContainer, *xAODEventInfo, trtBCIDCollection.ptr()) );
2765  }
2766  } else passEventBurst = true;
2767 
2768  if (m_useHoleFinder) {
2769  if (!combTrackCollection.isValid()) {
2770  ATH_MSG_ERROR("Could not find track collection " << m_combTrackCollectionKey.key() <<
2771  " in store");
2772  return StatusCode::FAILURE;
2773  }
2774  ATH_CHECK( fillTRTEfficiency(*combTrackCollection) );
2775  }
2776 
2777  if (m_doHitsMon) {
2778  if (!trackCollection.isValid()) {
2779  ATH_MSG_ERROR("Could not find track collection " << m_trackCollectionKey.key() <<
2780  " in store");
2781  return StatusCode::FAILURE;
2782  }
2783  if (passEventBurst) {
2784  ATH_CHECK( fillTRTHits(*trackCollection) );
2785  }
2786  }
2787 
2788  return StatusCode::SUCCESS;
2789 }
TRTMonitoringRun3RAW_Alg::strawLayerNumber
int strawLayerNumber(int strawLayerNumber, int LayerNumber) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:629
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
straw_shifter_struct::isAr
bool isAr
Definition: TRTMonitoringRun3RAW_Alg.cxx:725
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
chip_struct_prob::chipNumber
int chipNumber
Definition: TRTMonitoringRun3RAW_Alg.cxx:710
TRTMonitoringRun3RAW_Alg::m_EventBurstCut
IntegerProperty m_EventBurstCut
Definition: TRTMonitoringRun3RAW_Alg.h:168
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
TRT_ID::layer_id
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition: TRT_ID.h:500
TRT_BSErrContainer::getMissingErrorSet
const std::set< uint32_t > & getMissingErrorSet(void) const
Definition: TRT_BSErrContainer.h:33
lastBinHigh
bool lastBinHigh(unsigned int m_word)
Definition: driftCircle.h:108
straw_shifter_struct::HitWMap_passed
float HitWMap_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:726
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
chip_struct_prob::HitAWMapC_passed
float HitAWMapC_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:718
TRT::Hit::straw
@ straw
Definition: HitInfo.h:82
InDet::TRT_DriftCircleOnTrack::prepRawData
virtual const TRT_DriftCircle * prepRawData() const override final
returns the PrepRawData - is a TRT_DriftCircle in this scope
Definition: TRT_DriftCircleOnTrack.h:202
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TRTMonitoringRun3RAW_Alg::m_doHitsMon
bool m_doHitsMon
Definition: TRTMonitoringRun3RAW_Alg.h:89
TRTMonitoringRun3RAW_Alg.h
chip_struct_prob::HitHWMapC_passed
float HitHWMapC_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:712
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
TRTMonitoringRun3RAW_Alg::m_BSSvc
ServiceHandle< ITRT_ByteStream_ConditionsSvc > m_BSSvc
Definition: TRTMonitoringRun3RAW_Alg.h:133
TRTMonitoringRun3RAW_Alg::m_useHoleFinder
bool m_useHoleFinder
Definition: TRTMonitoringRun3RAW_Alg.h:88
straw_struct::HitToTLong_cut
bool HitToTLong_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:679
straw_shifter_struct::strawNumber
int strawNumber
Definition: TRTMonitoringRun3RAW_Alg.cxx:724
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TRTMonitoringRun3RAW_Alg::m_min_pT
float m_min_pT
Definition: TRTMonitoringRun3RAW_Alg.h:110
TRT_DetectorManager.h
TRTMonitoringRun3RAW_Alg::m_trackCollectionKey
SG::ReadHandleKey< TrackCollection > m_trackCollectionKey
Definition: TRTMonitoringRun3RAW_Alg.h:140
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TRTMonitoringRun3RAW_Alg::m_idHelper
const AtlasDetectorID * m_idHelper
Definition: TRTMonitoringRun3RAW_Alg.h:66
TRT_LoLumRawData::highLevel
virtual bool highLevel() const override final
Definition: TRT_LoLumRawData.h:128
chip_struct_prob::HitAMapC_passed
float HitAMapC_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:716
TRTByteStreamErrors::L1IDError
@ L1IDError
Definition: ITRT_ByteStream_ConditionsSvc.h:20
TRTMonitoringRun3RAW_Alg::m_min_si_hits
int m_min_si_hits
Definition: TRTMonitoringRun3RAW_Alg.h:100
TRT_LoLumRawData::lastBinHigh
bool lastBinHigh() const
Definition: TRT_LoLumRawData.h:165
TRTMonitoringRun3RAW_Alg::m_TRT_BCIDCollectionKey
SG::ReadHandleKey< InDetTimeCollection > m_TRT_BCIDCollectionKey
Definition: TRTMonitoringRun3RAW_Alg.h:138
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TRT_LoLumRawData
Definition: TRT_LoLumRawData.h:25
index
Definition: index.py:1
Trk::ParametersBase::associatedSurface
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
InDetDD::holes
@ holes
Definition: InDetDD_Defs.h:17
InDetDD::TRT_DetectorManager::getBarrelElement
const TRT_BarrelElement * getBarrelElement(unsigned int positive, unsigned int moduleIndex, unsigned int phiIndex, unsigned int strawLayerIndex) const
Access Barrel Elements:---------------—(Fast)-------------------------—.
Definition: TRT_DetectorManager.cxx:113
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
TRTMonitoringRun3RAW_Alg::strawNumber_reverse
int strawNumber_reverse(int inp_strawnumber, int *strawNumber, int *strawlayerNumber, int *LayerNumber) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:510
TRT_ID::straw_layer_hash_max
size_type straw_layer_hash_max(void) const
Definition: TRT_ID.h:920
chip_struct::HitToTMapC_y
float HitToTMapC_y
Definition: TRTMonitoringRun3RAW_Alg.cxx:688
InDet::TRT_DriftCircle::timeOverThreshold
double timeOverThreshold() const
returns Time over threshold in ns
straw_edge_struct
Definition: TRTMonitoringRun3RAW_Alg.cxx:2047
InDetDD::TRT_BaseElement::nStraws
unsigned int nStraws() const
Number of straws in the element.
chip_struct::HtoBCMapB_x
int HtoBCMapB_x
Definition: TRTMonitoringRun3RAW_Alg.cxx:690
EventPrimitivesHelpers.h
Trk::Surface::associatedDetectorElementIdentifier
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
TRTMonitoringRun3RAW_Alg::m_max_abs_d0
float m_max_abs_d0
Definition: TRTMonitoringRun3RAW_Alg.h:106
chip_struct::HitTrWMapC_cut
bool HitTrWMapC_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:687
chip_struct_prob
Definition: TRTMonitoringRun3RAW_Alg.cxx:709
straw_struct_prob::HitAWMapS_cut
bool HitAWMapS_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:703
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
straw_struct::HitToTMapS_y
float HitToTMapS_y
Definition: TRTMonitoringRun3RAW_Alg.cxx:678
skel.it
it
Definition: skel.GENtoEVGEN.py:423
straw_struct_prob::HitWMapS_cut
bool HitWMapS_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:699
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
straw_shifter_struct::HitWMap_Ar_passed
float HitWMap_Ar_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:727
M_PI
#define M_PI
Definition: ActiveFraction.h:11
straw_struct::strawNumber
int strawNumber
Definition: TRTMonitoringRun3RAW_Alg.cxx:676
TRTMonitoringRun3RAW_Alg::chipToBoard_EndCap
int chipToBoard_EndCap(int chip) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:418
InDetDD::TRT_BaseElement::strawCenter
const Amg::Vector3D & strawCenter(int straw) const
Straw Surface: Local -> global transform of the straw via integer.
Definition: TRT_BaseElement.cxx:143
Trk::z0
@ z0
Definition: ParamDefs.h:70
straw_struct::HitTrWMapS_cut
bool HitTrWMapS_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:680
TRTMonitoringRun3RAW_Alg::m_TrackSummaryTool
ToolHandle< Trk::ITrackSummaryTool > m_TrackSummaryTool
Definition: TRTMonitoringRun3RAW_Alg.h:146
AthMonitorAlgorithm::m_environment
AthMonitorAlgorithm::Environment_t m_environment
Instance of the Environment_t enum.
Definition: AthMonitorAlgorithm.h:350
TRTMonitoringRun3RAW_Alg::m_rdoContainerKey
SG::ReadHandleKey< TRT_RDO_Container > m_rdoContainerKey
Definition: TRTMonitoringRun3RAW_Alg.h:137
TRTMonitoringRun3RAW_Alg::m_isCosmics
BooleanProperty m_isCosmics
Definition: TRTMonitoringRun3RAW_Alg.h:167
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
TRTMonitoringRun3RAW_Alg::m_minTRThits
int m_minTRThits
Definition: TRTMonitoringRun3RAW_Alg.h:104
straw_edge_struct::HitWonTMap_B_y
float HitWonTMap_B_y
Definition: TRTMonitoringRun3RAW_Alg.cxx:2049
TRTMonitoringRun3RAW_Alg::m_min_trt_hits
int m_min_trt_hits
Definition: TRTMonitoringRun3RAW_Alg.h:103
Trk::locR
@ locR
Definition: ParamDefs.h:50
TRTMonitoringRun3RAW_Alg::chipToBoard
int chipToBoard(int chip) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:388
AtlasDetectorID::is_trt
bool is_trt(Identifier id) const
Definition: AtlasDetectorID.h:782
InDetRawDataContainer
Definition: InDetRawDataContainer.h:27
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
straw_struct_prob::HitHWMapS_cut
bool HitHWMapS_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:697
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
TRTMonitoringRun3RAW_Alg::m_doExpert
bool m_doExpert
Definition: TRTMonitoringRun3RAW_Alg.h:82
TRTMonitoringRun3RAW_Alg::m_TRTStrawNeighbourSvc
ServiceHandle< ITRT_StrawNeighbourSvc > m_TRTStrawNeighbourSvc
Definition: TRTMonitoringRun3RAW_Alg.h:132
InDetRawDataContainer.h
InDet::TRT_DriftCircle::driftTimeBin
int driftTimeBin() const
returns the leading edge bin defined as in TRT_LoLumRawData to be the first 0-1 transition
InDet::TRT_DriftCircleOnTrack
Definition: TRT_DriftCircleOnTrack.h:53
straw_struct_prob::strawNumber
int strawNumber
Definition: TRTMonitoringRun3RAW_Alg.cxx:696
TRTMonitoringRun3RAW_Alg::fillTRTEfficiency
StatusCode fillTRTEfficiency(const TrackCollection &combTrackCollection) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:1717
InDet::TRT_DriftCircleOnTrack::detectorElement
virtual const InDetDD::TRT_BaseElement * detectorElement() const override final
returns the detector element, assoicated with the PRD of this class
Definition: TRT_DriftCircleOnTrack.h:224
TRTMonitoringRun3RAW_Alg::TRTMonitoringRun3RAW_Alg
TRTMonitoringRun3RAW_Alg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TRTMonitoringRun3RAW_Alg.cxx:46
chip_struct
Definition: TRTMonitoringRun3RAW_Alg.cxx:684
InDet::TRT_DriftCircle
Definition: TRT_DriftCircle.h:32
TRTMonitoringRun3RAW_Alg::m_max_abs_z0
float m_max_abs_z0
Definition: TRTMonitoringRun3RAW_Alg.h:107
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
TRTMonitoringRun3RAW_Alg::strawLayerNumber_reverse
int strawLayerNumber_reverse(int strawLayerNumInp, int *strawLayerNumber, int *LayerNumber) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:647
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
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
TRTByteStreamErrors::RobStatusError
@ RobStatusError
Definition: ITRT_ByteStream_ConditionsSvc.h:24
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
ITRT_ConditionsSvc.h
TRT_BSErrContainer::getRobErrorSet
const std::set< std::pair< uint32_t, uint32_t > > & getRobErrorSet(void) const
Definition: TRT_BSErrContainer.h:31
Trk::TrackStateOnSurface::Outlier
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
Definition: TrackStateOnSurface.h:122
TRT::Hit::side
@ side
Definition: HitInfo.h:83
Track.h
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
TRTMonitoringRun3RAW_Alg::fillTRTHits
StatusCode fillTRTHits(const TrackCollection &trackCollection) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:2055
straw_struct_prob::HitHMapS_passed
float HitHMapS_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:706
TRT_LoLumRawData::driftTimeBin
virtual int driftTimeBin() const override final
Definition: TRT_LoLumRawData.h:57
TRT_BSErrContainer
Definition: TRT_BSErrContainer.h:20
TRT_LoLumRawData::firstBinHigh
bool firstBinHigh() const
Definition: TRT_LoLumRawData.h:154
chip_struct::HtoBCMapC_x
int HtoBCMapC_x
Definition: TRTMonitoringRun3RAW_Alg.cxx:689
TRTMonitoringRun3RAW_Alg::m_minP
float m_minP
Definition: TRTMonitoringRun3RAW_Alg.h:109
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
chip_struct_prob::HitWMapC_cut
bool HitWMapC_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:713
TRTMonitoringRun3RAW_Alg::strawNumber
int strawNumber(int strawNumber, int strawlayerNumber, int LayerNumber) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:463
TRT_ID::straw
int straw(const Identifier &id) const
Definition: TRT_ID.h:902
TRTMonitoringRun3RAW_Alg::Straw_Gastype
GasType Straw_Gastype(int stat) const
Definition: TRTMonitoringRun3RAW_Alg.h:149
TRTMonitoringRun3RAW_Alg::initScaleVectors
std::vector< std::vector< std::vector< int > > > initScaleVectors() const
Definition: TRTMonitoringRun3RAW_Alg.cxx:223
straw_struct::HitTrWMapS_y
float HitTrWMapS_y
Definition: TRTMonitoringRun3RAW_Alg.cxx:681
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ITRT_DAQ_ConditionsSvc.h
ITRT_StrawStatusSummaryTool.h
abstract interface to TRT straw status constants
TRTMonitoringRun3RAW_Alg::m_doStraws
bool m_doStraws
Definition: TRTMonitoringRun3RAW_Alg.h:81
TRTMonitoringRun3RAW_Alg::radToDegrees
float radToDegrees(float radValue) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:666
Trk::TrackStateOnSurface::Hole
@ Hole
A hole on the track - this is defined in the following way.
Definition: TrackStateOnSurface.h:128
lumiFormat.i
int i
Definition: lumiFormat.py:92
TrackCollection
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Definition: TrackCollection.h:19
TRTMonitoringRun3RAW_Alg::s_Straw_max
static const int s_Straw_max[2]
Definition: TRTMonitoringRun3RAW_Alg.h:75
Monitored
Generic monitoring tool for athena components.
Definition: GenericMonitoringTool.h:30
Trk::theta
@ theta
Definition: ParamDefs.h:72
TRTMonitoringRun3RAW_Alg::s_numberOfBarrelStacks
static const int s_numberOfBarrelStacks
Definition: TRTMonitoringRun3RAW_Alg.h:78
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::numberOfSCTHits
@ numberOfSCTHits
number of SCT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:71
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
straw_edge_struct::strawNumber
int strawNumber
Definition: TRTMonitoringRun3RAW_Alg.cxx:2048
TRTMonitoringRun3RAW_Alg::m_doRDOsMon
bool m_doRDOsMon
Definition: TRTMonitoringRun3RAW_Alg.h:85
straw_struct_prob
Definition: TRTMonitoringRun3RAW_Alg.cxx:695
Trk::driftRadius
@ driftRadius
trt, straws
Definition: ParamDefs.h:59
TrackCollection.h
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
TRTMonitoringRun3RAW_Alg::m_bsErrContKey
SG::ReadHandleKey< TRT_BSErrContainer > m_bsErrContKey
Definition: TRTMonitoringRun3RAW_Alg.h:142
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
ITRT_CalDbTool.h
abstract interface to TRT calibration constants
TrackSummary.h
Trk::ParametersBase
Definition: ParametersBase.h:55
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
TRT_DriftCircleOnTrack.h
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.
TRTMonitoringRun3RAW_Alg::m_usedEvents
float m_usedEvents
Definition: TRTMonitoringRun3RAW_Alg.h:91
InDet::TRT_DriftCircle::trailingEdge
int trailingEdge() const
returns the trailing edge bin
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
TRTMonitoringRun3RAW_Alg::m_combTrackCollectionKey
SG::ReadHandleKey< TrackCollection > m_combTrackCollectionKey
Definition: TRTMonitoringRun3RAW_Alg.h:139
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:893
TRTMonitoringRun3RAW_Alg::~TRTMonitoringRun3RAW_Alg
virtual ~TRTMonitoringRun3RAW_Alg()
Definition: TRTMonitoringRun3RAW_Alg.cxx:82
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< const Trk::TrackStateOnSurface >
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
TRTByteStreamErrors::BCIDError
@ BCIDError
Definition: ITRT_ByteStream_ConditionsSvc.h:19
xAOD::EventInfo_v1::lumiBlock
uint32_t lumiBlock() const
The current event's luminosity block number.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
straw_edge_struct::HitWonTMap_E_y
float HitWonTMap_E_y
Definition: TRTMonitoringRun3RAW_Alg.cxx:2050
TRTMonitoringRun3RAW_Alg::s_numberOfEndCapStacks
static const int s_numberOfEndCapStacks
Definition: TRTMonitoringRun3RAW_Alg.h:79
straw_struct_prob::HitAMapS_cut
bool HitAMapS_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:701
TRTMonitoringRun3RAW_Alg::m_mat_chip_B
std::vector< std::vector< unsigned char > > m_mat_chip_B
Definition: TRTMonitoringRun3RAW_Alg.h:71
straw_struct_prob::HitHMapS_cut
bool HitHMapS_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:705
firstBinHigh
bool firstBinHigh(unsigned int m_word)
Definition: driftCircle.h:104
InDetDD::TRT_DetectorManager::getEndcapElement
const TRT_EndcapElement * getEndcapElement(unsigned int positive, unsigned int wheelIndex, unsigned int strawLayerIndex, unsigned int phiIndex) const
Access Endcap Elements:---------------—(Fast)--------------------------—.
Definition: TRT_DetectorManager.cxx:129
TRTMonitoringRun3RAW_Alg::initialize
virtual StatusCode initialize() override
initialize
Definition: TRTMonitoringRun3RAW_Alg.cxx:84
chip_struct::HtoBCMapB_y
int HtoBCMapB_y
Definition: TRTMonitoringRun3RAW_Alg.cxx:691
TRTMonitoringRun3RAW_Alg::m_doShift
bool m_doShift
Definition: TRTMonitoringRun3RAW_Alg.h:86
Trk::numberOfTRTHits
@ numberOfTRTHits
number of TRT outliers
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:79
TRT_LoLumRawData::trailingEdge
int trailingEdge() const
Definition: TRT_LoLumRawData.h:66
InDetTimeCollection
std::vector< std::pair< uint32_t, unsigned int > > InDetTimeCollection
Definition: InDetTimeCollection.h:12
AthMonitorAlgorithm::Environment_t::online
@ online
remainder
std::vector< std::string > remainder(const std::vector< std::string > &v1, const std::vector< std::string > &v2)
list of entries in a vector that are not in another
Definition: compareFlatTrees.cxx:44
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Trk::d0
@ d0
Definition: ParamDefs.h:69
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
TRT_LoLumRawData::timeOverThreshold
virtual double timeOverThreshold() const override final
Definition: TRT_LoLumRawData.h:47
straw_struct_prob::HitWMapS_passed
float HitWMapS_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:700
TRTMonitoringRun3RAW_Alg::m_longToTCut
FloatProperty m_longToTCut
Definition: TRTMonitoringRun3RAW_Alg.h:95
InDet::TRT_DriftCircle::lastBinHigh
bool lastBinHigh() const
returns true if the last bin is high
TRT_BSErrContainer::getSidErrorSet
const std::set< uint32_t > & getSidErrorSet(void) const
Definition: TRT_BSErrContainer.h:39
TRT::Hit::ident
@ ident
Definition: HitInfo.h:77
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
chip_struct_prob::HitAWMapC_cut
bool HitAWMapC_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:717
chip_struct_prob::HitHMapC_passed
float HitHMapC_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:720
chip_struct::HitTrMapC_y
float HitTrMapC_y
Definition: TRTMonitoringRun3RAW_Alg.cxx:686
TRTMonitoringRun3RAW_Alg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: TRTMonitoringRun3RAW_Alg.cxx:2738
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
ITRT_StrawNeighbourSvc.h
Abstract interface to information on straws electronic grouping.
SG::ReadHandle::ptr
const_pointer_type ptr()
Dereference the pointer.
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
TRTByteStreamErrors::MISSINGError
@ MISSINGError
Definition: ITRT_ByteStream_ConditionsSvc.h:21
DataVector< RawDataT >::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
IInDetConditionsSvc.h
TRTMonitoringRun3RAW_Alg::m_mat_chip_E
std::vector< std::vector< unsigned char > > m_mat_chip_E
Definition: TRTMonitoringRun3RAW_Alg.h:70
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
DeMoScan.index
string index
Definition: DeMoScan.py:362
TRTMonitoringRun3RAW_Alg::m_every_xth_track
int m_every_xth_track
Definition: TRTMonitoringRun3RAW_Alg.h:105
straw_struct::HitTrMapS_y
float HitTrMapS_y
Definition: TRTMonitoringRun3RAW_Alg.cxx:677
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
TRT_ID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel.
Definition: TRT_ID.h:857
TRTMonitoringRun3RAW_Alg::m_trt_hole_finder
ToolHandle< Trk::ITrackHoleSearchTool > m_trt_hole_finder
Definition: TRTMonitoringRun3RAW_Alg.h:145
lumiFormat.fill
fill
Definition: lumiFormat.py:111
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
straw_shifter_struct
Definition: TRTMonitoringRun3RAW_Alg.cxx:723
TRTMonitoringRun3RAW_Alg::m_doChips
bool m_doChips
Definition: TRTMonitoringRun3RAW_Alg.h:83
TRTMonitoringRun3RAW_Alg::m_min_pixel_hits
int m_min_pixel_hits
Definition: TRTMonitoringRun3RAW_Alg.h:101
TRTMonitoringRun3RAW_Alg::m_DistToStraw
float m_DistToStraw
Definition: TRTMonitoringRun3RAW_Alg.h:90
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:73
chip_struct_prob::HitAMapC_cut
bool HitAMapC_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:715
Trk::RIO_OnTrack::identify
virtual Identifier identify() const final
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:155
TRT_BSErrContainer::getL1ErrorSet
const std::set< std::pair< uint32_t, uint32_t > > & getL1ErrorSet() const
Definition: TRT_BSErrContainer.h:42
straw_struct_prob::HitAMapS_passed
float HitAMapS_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:702
TRTMonitoringRun3RAW_Alg::m_doMaskStraws
bool m_doMaskStraws
Definition: TRTMonitoringRun3RAW_Alg.h:87
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
chip_struct_prob::HitWMapC_passed
float HitWMapC_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:714
straw_struct_prob::HitAWMapS_passed
float HitAWMapS_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:704
TRTMonitoringRun3RAW_Alg::m_trackSelTool
ToolHandle< InDet::IInDetTrackSelectionTool > m_trackSelTool
Definition: TRTMonitoringRun3RAW_Alg.h:134
chip_struct_prob::HitHWMapC_cut
bool HitHWMapC_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:711
TRTMonitoringRun3RAW_Alg::strawNumberEndCap
int strawNumberEndCap(int strawNumber, int strawLayerNumber, int LayerNumber, int phi_stack, int side) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:550
TRTMonitoringRun3RAW_Alg::m_sumTool
ToolHandle< ITRT_StrawStatusSummaryTool > m_sumTool
Definition: TRTMonitoringRun3RAW_Alg.h:131
timeOverThreshold
double timeOverThreshold(unsigned int m_word)
Definition: driftCircle.h:116
TRTMonitoringRun3RAW_Alg::m_doTracksMon
bool m_doTracksMon
Definition: TRTMonitoringRun3RAW_Alg.h:84
TRTMonitoringRun3RAW_Alg::fillTRTRDOs
StatusCode fillTRTRDOs(const TRT_RDO_Container &rdoContainer, const xAOD::EventInfo &eventInfo, const InDetTimeCollection *trtBCIDCollection) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:732
InDetRawData::identify
virtual Identifier identify() const override final
Definition: InDetRawData.h:41
TRTMonitoringRun3RAW_Alg::s_iChip_max
static const int s_iChip_max[2]
Definition: TRTMonitoringRun3RAW_Alg.h:76
TRTByteStreamErrors::SIDError
@ SIDError
Definition: ITRT_ByteStream_ConditionsSvc.h:23
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
InDet::TRT_DriftCircle::getWord
unsigned int getWord() const
returns the TRT dataword
TRTMonitoringRun3RAW_Alg::m_pTRTHelper
const TRT_ID * m_pTRTHelper
Definition: TRTMonitoringRun3RAW_Alg.h:67
xAOD::EventInfo_v1::bcid
uint32_t bcid() const
The bunch crossing ID of the event.
xAOD::lumiBlock
setTeId lumiBlock
Definition: L2StandAloneMuon_v1.cxx:327
TRTMonitoringRun3RAW_Alg::checkEventBurst
bool checkEventBurst(const TRT_RDO_Container &rdoContainer) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:430
chip_struct::chipNumber
int chipNumber
Definition: TRTMonitoringRun3RAW_Alg.cxx:685
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
trailingEdge
int trailingEdge(unsigned int m_word)
Definition: driftCircle.h:64
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
InDet::TRT_DriftCircle::firstBinHigh
bool firstBinHigh() const
returns true if the first bin is high
readCCLHist.float
float
Definition: readCCLHist.py:83
Trk::phi0
@ phi0
Definition: ParamDefs.h:71
Trk::TrackStateOnSurface::Measurement
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Definition: TrackStateOnSurface.h:101
TRTMonitoringRun3RAW_Alg::checkTRTReadoutIntegrity
StatusCode checkTRTReadoutIntegrity(const xAOD::EventInfo &eventInfo) const
Definition: TRTMonitoringRun3RAW_Alg.cxx:286
straw_struct
Definition: TRTMonitoringRun3RAW_Alg.cxx:675
TRT_BSErrContainer::getBCIDErrorSet
const std::set< std::pair< uint32_t, uint32_t > > & getBCIDErrorSet() const
Definition: TRT_BSErrContainer.h:45
chip_struct::HtoBCMap_cut
bool HtoBCMap_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:692
DataVector< RawDataT >::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
chip_struct_prob::HitHMapC_cut
bool HitHMapC_cut
Definition: TRTMonitoringRun3RAW_Alg.cxx:719
fitman.k
k
Definition: fitman.py:528
straw_struct_prob::HitHWMapS_passed
float HitHWMapS_passed
Definition: TRTMonitoringRun3RAW_Alg.cxx:698
TRTMonitoringRun3RAW_Alg::m_max_abs_eta
float m_max_abs_eta
Definition: TRTMonitoringRun3RAW_Alg.h:108
InDetDD::TRT_BaseElement
Definition: TRT_BaseElement.h:57
invGeV
constexpr float invGeV
Definition: PFTrackSelector.cxx:10
TRT_ID::straw_id
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
Definition: TRT_ID.h:581
driftTimeBin
int driftTimeBin(unsigned int m_word)
Definition: driftCircle.h:50
TRTMonitoringRun3RAW_Alg::m_min_sct_hits
int m_min_sct_hits
Definition: TRTMonitoringRun3RAW_Alg.h:102
TRTMonitoringRun3RAW_Alg::m_mgr
const InDetDD::TRT_DetectorManager * m_mgr
Definition: TRTMonitoringRun3RAW_Alg.h:68
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65