ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
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
35TileMonitorAlgorithm::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" ) {
43 } else if( loCaseTriggerBitName == "bit1_zerobias" ) {
45 } else if( loCaseTriggerBitName == "bit2_l1cal" ) {
47 } else if( loCaseTriggerBitName == "bit3_muon" ) {
49 } else if( loCaseTriggerBitName == "bit4_rpc" ) {
51 } else if( loCaseTriggerBitName == "bit5_ftk" ) {
53 } else if( loCaseTriggerBitName == "bit6_ctp" ) {
55 } else if( loCaseTriggerBitName == "bit7_calib" ) {
57 } else if( loCaseTriggerBitName == "anyphystrig" ) {
59 } else { // Otherwise, warn the user and return "AnyPhysTrig"
60 ATH_MSG_WARNING("::getL1TriggerTypeBitFromName(): Unknown L1 trigger type bit name: "
61 << triggerBitName << ", returning AnyPhysTrig.");
63 }
64}
65
66
67std::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
98bool 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
105 return m_l1Triggers.at(lvl1TriggerIdx);
106}
107
109TileMonitorAlgorithm::getPartition(const CaloCell* cell, const TileID* tileID) const {
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
#define endmsg
#define ATH_MSG_WARNING(x)
void tolower(std::string &s)
void section(const std::string &sec)
bool msgLvl(const MSG::Level lvl) const
virtual StatusCode initialize() override
initialize
bool is_tile(Identifier id) const
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
This is a "hash" representation of an Identifier.
Helper class for TileCal offline identifiers.
Definition TileID.h:67
std::vector< int > m_l1TriggerIndices
std::vector< L1TriggerTypeBit > m_l1Triggers
Partition
Describes Tile partitions (ROS - 1)
Gaudi::Property< std::vector< std::string > > m_fillHistogramsForL1Triggers
L1TriggerTypeBit getL1TriggerTypeBitFromName(const std::string &triggerBitName) const
virtual StatusCode initialize() override
initialize
std::vector< int > getL1TriggerIndices(uint32_t lvl1TriggerType) const
Return indices of histograms to be filled according fired L1 trigger type.
L1TriggerTypeBit
Describes L1 trigger type bits.
L1TriggerTypeBit getL1TriggerTypeBit(int lvl1TriggerIdx) const
Return Level1 Trigger type bit according trigger index.
bool isPhysicsEvent(uint32_t lvl1TriggerType) const
Return true if it is physics event or false for calibration event.
Partition getPartition(const CaloCell *cell, const TileID *tileID) const
Return Partition for Tile cell or MAX_PART otherwise.
std::vector< std::string > m_l1TriggerBitNames
Identifier cell_id(const Identifier &any_id) const
int side(const Identifier &id) const
int section(const Identifier &id) const