ATLAS Offline Software
TileMonitorAlgorithm.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TileMonitorAlgorithm.h"
6 
7 #include "CaloEvent/CaloCell.h"
9 
11 
12  int triggerIdx(0);
13  for (const std::string& triggerName : m_fillHistogramsForL1Triggers) {
14  L1TriggerTypeBit trigger = getL1TriggerTypeBitFromName(triggerName);
15  m_l1Triggers.push_back(trigger);
16  m_l1TriggerIndices[trigger] = triggerIdx;
17  ++triggerIdx;
18  }
19 
20  if (msgLvl(MSG::INFO)) {
21  msg(MSG::INFO) << "Will fill histograms for L1 triggers:";
22  for (int l1TriggerIdx : m_l1TriggerIndices) {
23  if (l1TriggerIdx >= 0) {
24  msg(MSG::INFO) << " " << m_l1TriggerBitNames[l1TriggerIdx] << "[" << l1TriggerIdx << "]";
25  }
26  }
27  msg(MSG::INFO) << endmsg;
28  }
29 
31 }
32 
33 
35 TileMonitorAlgorithm::getL1TriggerTypeBitFromName(const std::string& triggerBitName) const {
36 
37  // Convert the triger name to lower case
38  std::string loCaseTriggerBitName = triggerBitName;
39  std::transform(triggerBitName.begin(), triggerBitName.end(), loCaseTriggerBitName.begin(), ::tolower);
40 
41  if( loCaseTriggerBitName == "bit0_rndm" ) {
42  return L1TriggerTypeBit::BIT0_RNDM;
43  } else if( loCaseTriggerBitName == "bit1_zerobias" ) {
44  return L1TriggerTypeBit::BIT1_ZEROBIAS;
45  } else if( loCaseTriggerBitName == "bit2_l1cal" ) {
46  return L1TriggerTypeBit::BIT2_L1CAL;
47  } else if( loCaseTriggerBitName == "bit3_muon" ) {
48  return L1TriggerTypeBit::BIT3_MUON;
49  } else if( loCaseTriggerBitName == "bit4_rpc" ) {
50  return L1TriggerTypeBit::BIT4_RPC;
51  } else if( loCaseTriggerBitName == "bit5_ftk" ) {
52  return L1TriggerTypeBit::BIT5_FTK;
53  } else if( loCaseTriggerBitName == "bit6_ctp" ) {
54  return L1TriggerTypeBit::BIT6_CTP;
55  } else if( loCaseTriggerBitName == "bit7_calib" ) {
56  return L1TriggerTypeBit::BIT7_CALIB;
57  } else if( loCaseTriggerBitName == "anyphystrig" ) {
58  return L1TriggerTypeBit::ANY_PHYSICS;
59  } else { // Otherwise, warn the user and return "AnyPhysTrig"
60  ATH_MSG_WARNING("::getL1TriggerTypeBitFromName(): Unknown L1 trigger type bit name: "
61  << triggerBitName << ", returning AnyPhysTrig.");
62  return L1TriggerTypeBit::ANY_PHYSICS;
63  }
64 }
65 
66 
67 std::vector<int> TileMonitorAlgorithm::getL1TriggerIndices(uint32_t lvl1TriggerType) const {
68 
69  std::vector<int> triggerIndices;
70  int triggerIdx{-1};
71 
72  if (lvl1TriggerType != 0) {
73  // First bit tells if physics (=1) or calibration (=0) event
74  if ((lvl1TriggerType >> BIT7_CALIB) & 1) { // format is 0x1AAAAAAA
75  // Always try store at least AnyPhysTrig (=8)
76  triggerIdx = m_l1TriggerIndices[ANY_PHYSICS];
77  if (triggerIdx >= 0) triggerIndices.push_back(triggerIdx);
78  // Adding the phys triggers one by one
79  for (int bitTrigger = 0; bitTrigger < BIT7_CALIB; ++bitTrigger) {
80  if ((lvl1TriggerType >> bitTrigger) & 1) {
81  triggerIdx = m_l1TriggerIndices[bitTrigger];
82  if (triggerIdx >= 0) triggerIndices.push_back(triggerIdx);
83  }
84  }
85  } else { // Calibration event foramt is 0x0AAAAAAA
86  triggerIdx = m_l1TriggerIndices[BIT7_CALIB];
87  if (triggerIdx >= 0) triggerIndices.push_back(triggerIdx);
88  }
89  } else {
90  // Always try store at least AnyPhysTrig (=8)
91  triggerIdx = m_l1TriggerIndices[ANY_PHYSICS];
92  if (triggerIdx >= 0) triggerIndices.push_back(triggerIdx);
93  }
94 
95  return triggerIndices;
96 }
97 
98 bool TileMonitorAlgorithm::isPhysicsEvent(uint32_t lvl1TriggerType) const {
99  // First bit tells if physics (=1) or calibration (=0) event
100  return (lvl1TriggerType == 0) || (((lvl1TriggerType >> BIT7_CALIB) & 1) == 1);
101 }
102 
104 TileMonitorAlgorithm::getL1TriggerTypeBit(int lvl1TriggerIdx) const {
105  return m_l1Triggers.at(lvl1TriggerIdx);
106 }
107 
110  return cell ? getPartition(cell->ID(), tileID) : MAX_PART;
111 }
112 
115  return getPartition(tileID->cell_id(hash), tileID);
116 }
117 
118 
121 
122  Partition partition = MAX_PART; // by default for non Tile cell
123 
124  if (tileID->is_tile(id)) {
125  int section = tileID->section(id);
126  int side = tileID->side(id);
127 
128  if (section == 1) {
129  partition = (side == 1) ? PART_LBA : PART_LBC;
130  } else if (section == 2 || section == 3) {
131  partition = (side == 1) ? PART_EBA : PART_EBC;
132  }
133  }
134 
135  return partition;
136 }
137 
TileMonitorAlgorithm::getL1TriggerIndices
std::vector< int > getL1TriggerIndices(uint32_t lvl1TriggerType) const
Return indices of histograms to be filled according fired L1 trigger type.
Definition: TileMonitorAlgorithm.cxx:67
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
TileMonitorAlgorithm::isPhysicsEvent
bool isPhysicsEvent(uint32_t lvl1TriggerType) const
Return true if it is physics event or false for calibration event.
Definition: TileMonitorAlgorithm.cxx:98
TileMonitorAlgorithm::PART_EBA
@ PART_EBA
Definition: TileMonitorAlgorithm.h:46
TileMonitorAlgorithm::PART_EBC
@ PART_EBC
Definition: TileMonitorAlgorithm.h:47
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileMonitorAlgorithm::ANY_PHYSICS
@ ANY_PHYSICS
Definition: TileMonitorAlgorithm.h:34
Tile_Base_ID::side
int side(const Identifier &id) const
Definition: Tile_Base_ID.cxx:153
TileMonitorAlgorithm::m_l1Triggers
std::vector< L1TriggerTypeBit > m_l1Triggers
Definition: TileMonitorAlgorithm.h:101
CaloCell.h
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
TileMonitorAlgorithm::m_fillHistogramsForL1Triggers
Gaudi::Property< std::vector< std::string > > m_fillHistogramsForL1Triggers
Definition: TileMonitorAlgorithm.h:98
TileID.h
TileMonitorAlgorithm::L1TriggerTypeBit
L1TriggerTypeBit
Describes L1 trigger type bits.
Definition: TileMonitorAlgorithm.h:33
TRT::Hit::side
@ side
Definition: HitInfo.h:83
TileMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: TileMonitorAlgorithm.cxx:10
TileMonitorAlgorithm::m_l1TriggerBitNames
std::vector< std::string > m_l1TriggerBitNames
Definition: TileMonitorAlgorithm.h:103
TileMonitorAlgorithm::BIT7_CALIB
@ BIT7_CALIB
Definition: TileMonitorAlgorithm.h:34
TileID
Helper class for TileCal offline identifiers.
Definition: TileID.h:68
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileMonitorAlgorithm::Partition
Partition
Describes Tile partitions (ROS - 1)
Definition: TileMonitorAlgorithm.h:46
tolower
void tolower(std::string &s)
Definition: AthenaSummarySvc.cxx:111
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
TileMonitorAlgorithm::PART_LBC
@ PART_LBC
Definition: TileMonitorAlgorithm.h:46
AtlasDetectorID::is_tile
bool is_tile(Identifier id) const
Definition: AtlasDetectorID.h:695
TileMonitorAlgorithm.h
TileMonitorAlgorithm::m_l1TriggerIndices
std::vector< int > m_l1TriggerIndices
Definition: TileMonitorAlgorithm.h:102
TileMonitorAlgorithm::getL1TriggerTypeBit
L1TriggerTypeBit getL1TriggerTypeBit(int lvl1TriggerIdx) const
Return Level1 Trigger type bit according trigger index.
Definition: TileMonitorAlgorithm.cxx:104
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
TileMonitorAlgorithm::MAX_PART
@ MAX_PART
Definition: TileMonitorAlgorithm.h:47
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
StateLessPT_NewConfig.partition
partition
Definition: StateLessPT_NewConfig.py:49
TileMonitorAlgorithm::getL1TriggerTypeBitFromName
L1TriggerTypeBit getL1TriggerTypeBitFromName(const std::string &triggerBitName) const
Definition: TileMonitorAlgorithm.cxx:35
Tile_Base_ID::section
int section(const Identifier &id) const
Definition: Tile_Base_ID.cxx:147
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
section
void section(const std::string &sec)
Definition: TestTriggerMenuAccess.cxx:22
Tile_Base_ID::cell_id
Identifier cell_id(const Identifier &any_id) const
Definition: Tile_Base_ID.cxx:581
TileMonitorAlgorithm::getPartition
Partition getPartition(const CaloCell *cell, const TileID *tileID) const
Return Partition for Tile cell or MAX_PART otherwise.
Definition: TileMonitorAlgorithm.cxx:109
TileMonitorAlgorithm::PART_LBA
@ PART_LBA
Definition: TileMonitorAlgorithm.h:46
Identifier
Definition: IdentifierFieldParser.cxx:14