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