ATLAS Offline Software
MuonCalibTriggerInfo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <iostream>
8 
10 #include "GaudiKernel/MsgStream.h"
11 
12 namespace MuonCalib {
13 
14  std::vector<std::pair<std::vector<int>, std::string> > MuonCalibTriggerTypeHelper::m_typeToBitAndStringMapping;
15 
17  initMap();
19  return m_typeToBitAndStringMapping[type].first;
20  }
21 
23  initMap();
25  return m_typeToBitAndStringMapping[type].second;
26  }
27 
29 
31  if (type == L1_MU0_LOW_RPC || type == L1_MU6_RPC || type == L1_MU0_HIGH_RPC) return true;
32  return false;
33  }
34 
36  if (type == L1_MU0_TGC_HALO || type == L1_MU0_TGC || type == L1_MU6_TGC) return true;
37  return false;
38  }
39 
41  if (type == L1_MBTS_1_COMM || type == L1_MBTS_2_COMM) return true;
42  return false;
43  }
44 
46  if (type == L1_EM3 || type == L1_TAU5 || type == L1_J5 || type == L1_XE20) return true;
47  return false;
48  }
49 
51  if (!validType(type)) {
52  MsgStream log(Athena::getMessageSvc(), "MuonCalibTriggerTypeHelper");
53  log << MSG::WARNING << "MuonCalibTriggerTypeHelper::addEntry -> invalid trigger type" << endmsg;
54  return;
55  }
56  std::vector<int> bits;
57  bits.push_back(bit);
58  m_typeToBitAndStringMapping[type] = std::make_pair(bits, name);
59  }
60 
61  void MuonCalibTriggerTypeHelper::addEntry(MuonCalibTriggerType type, std::vector<int>& bits, const std::string& name) {
62  if (!validType(type)) {
63  MsgStream log(Athena::getMessageSvc(), "MuonCalibTriggerTypeHelper");
64  log << MSG::WARNING << "MuonCalibTriggerTypeHelper::addEntry -> invalid trigger type" << endmsg;
65  return;
66  }
67  m_typeToBitAndStringMapping[type] = std::make_pair(bits, name);
68  }
69 
71  if (!m_typeToBitAndStringMapping.empty()) return;
73 
74  addEntry(L1_EM3, 0, "L1_EM3");
75  addEntry(L1_TAU5, 64, "L1_TAU5");
76  addEntry(L1_J5, 96, "L1_J5");
77  addEntry(L1_XE20, 129, "L1_XE20");
78 
79  std::vector<int> bits;
80  bits.push_back(23);
81  for (int i = 30; i <= 45; ++i) bits.push_back(i);
82  addEntry(L1_MBTS_1_COMM, bits, "L1_MBTS_1_COMM");
83 
84  bits.clear();
85  bits.push_back(24);
86  for (int i = 46; i <= 61; ++i) bits.push_back(i);
87  addEntry(L1_MBTS_2_COMM, bits, "L1_MBTS_2_COMM");
88  addEntry(L1_MU0_LOW_RPC, 89, "L1_MU0_LOW_RPC");
89  addEntry(L1_MU6_RPC, 90, "L1_MU6_RPC");
90  addEntry(L1_MU0_HIGH_RPC, 93, "L1_MU0_HIGH_RPC");
91  addEntry(L1_MU0_TGC_HALO, 88, "L1_MU0_TGC_HALO");
92  addEntry(L1_MU0_TGC, 91, "L1_MU0_TGC");
93  addEntry(L1_MU6_TGC, 92, "L1_MU6_TGC");
94  addEntry(NUMBEROFKNOWNTRIGGERS, -1, "UNKNOWN");
95  }
96 
98  m_type(UNKNOWNTRIGGERTYPE), m_tbpbit(0), m_tapbit(0), m_tavbit(0), m_delay(0.), m_bcIndex(0) {}
99 
101  m_type(type), m_tbpbit(0), m_tapbit(0), m_tavbit(0), m_delay(delay), m_bcIndex(0) {}
102 
103  MuonCalibTriggerInfo::MuonCalibTriggerInfo(int tbpbit, int tapbit, int tavbit, int bcIndex) :
104  m_type(UNKNOWNTRIGGERTYPE), m_tbpbit(tbpbit), m_tapbit(tapbit), m_tavbit(tavbit), m_delay(0.), m_bcIndex(bcIndex) {}
105 
107  initMap();
108  MsgStream log(Athena::getMessageSvc(), "MuonCalibTriggerTypeHelper");
109  log << MSG::INFO << "MuonCalibTriggerTypeHelper::dumpMapping, map size " << m_typeToBitAndStringMapping.size() << endmsg;
110  std::vector<std::pair<std::vector<int>, std::string> >::const_iterator it = m_typeToBitAndStringMapping.begin();
111  std::vector<std::pair<std::vector<int>, std::string> >::const_iterator it_end = m_typeToBitAndStringMapping.end();
112  int index = 0;
113  for (; it != it_end; ++it) {
114  log << MSG::INFO << "index " << index++ << " type " << it->second << " nbits " << it->first.size() << " bits " << endmsg;
115  for (unsigned int i = 0; i < it->first.size(); ++i) { log << MSG::INFO << " " << it->first[i] << endmsg; }
116  }
117  }
118 
119 } // namespace MuonCalib
MuonCalib::L1_MU0_HIGH_RPC
@ L1_MU0_HIGH_RPC
Definition: MuonCalibTriggerInfo.h:25
MuonCalib::MuonCalibTriggerTypeHelper::validType
static bool validType(MuonCalibTriggerType type)
check whether type is valid
Definition: MuonCalibTriggerInfo.cxx:28
MuonCalib::MuonCalibTriggerTypeHelper::addEntry
static void addEntry(MuonCalibTriggerType type, int bit, const std::string &name)
Definition: MuonCalibTriggerInfo.cxx:50
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
MuonCalib::MuonCalibTriggerTypeHelper::initMap
static void initMap()
Definition: MuonCalibTriggerInfo.cxx:70
index
Definition: index.py:1
MuonCalib::L1_XE20
@ L1_XE20
Definition: MuonCalibTriggerInfo.h:20
MuonCalib::L1_MU6_TGC
@ L1_MU6_TGC
Definition: MuonCalibTriggerInfo.h:28
skel.it
it
Definition: skel.GENtoEVGEN.py:396
MuonCalib::MuonCalibTriggerTypeHelper::dumpMapping
static void dumpMapping()
dump mapping
Definition: MuonCalibTriggerInfo.cxx:106
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::MuonCalibTriggerTypeHelper::isRpcTrigger
static bool isRpcTrigger(MuonCalibTriggerType type)
check whether type is valid
Definition: MuonCalibTriggerInfo.cxx:30
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
MuonCalib::UNKNOWNTRIGGERTYPE
@ UNKNOWNTRIGGERTYPE
Definition: MuonCalibTriggerInfo.h:30
MuonCalib::MuonCalibTriggerTypeHelper::m_typeToBitAndStringMapping
static std::vector< std::pair< std::vector< int >, std::string > > m_typeToBitAndStringMapping
Definition: MuonCalibTriggerInfo.h:64
MuonCalib::L1_MBTS_2_COMM
@ L1_MBTS_2_COMM
Definition: MuonCalibTriggerInfo.h:22
MuonCalib::MuonCalibTriggerType
MuonCalibTriggerType
enum for all trigger type
Definition: MuonCalibTriggerInfo.h:16
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonCalib::L1_J5
@ L1_J5
Definition: MuonCalibTriggerInfo.h:19
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonCalib::MuonCalibTriggerInfo::MuonCalibTriggerInfo
MuonCalibTriggerInfo()
default constructor
Definition: MuonCalibTriggerInfo.cxx:97
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
delay
double delay(std::size_t d)
Definition: JetTrigTimerTest.cxx:14
MuonCalib::L1_EM3
@ L1_EM3
Definition: MuonCalibTriggerInfo.h:17
MuonCalib::MuonCalibTriggerTypeHelper::triggerBits
static std::vector< int > triggerBits(MuonCalibTriggerType type)
get trigger bit for a given type
Definition: MuonCalibTriggerInfo.cxx:16
MuonCalib::L1_MU0_TGC_HALO
@ L1_MU0_TGC_HALO
Definition: MuonCalibTriggerInfo.h:26
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MuonCalib::MuonCalibTriggerTypeHelper::itemName
static std::string itemName(MuonCalibTriggerType type)
get trigger bit for a given type
Definition: MuonCalibTriggerInfo.cxx:22
MuonCalib::MuonCalibTriggerTypeHelper::isLVL1CaloTrigger
static bool isLVL1CaloTrigger(MuonCalibTriggerType type)
check whether type is valid
Definition: MuonCalibTriggerInfo.cxx:45
MuonCalib::L1_TAU5
@ L1_TAU5
Definition: MuonCalibTriggerInfo.h:18
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MuonCalib::L1_MBTS_1_COMM
@ L1_MBTS_1_COMM
Definition: MuonCalibTriggerInfo.h:21
MuonCalib::L1_MU0_LOW_RPC
@ L1_MU0_LOW_RPC
Definition: MuonCalibTriggerInfo.h:23
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonCalib::NUMBEROFKNOWNTRIGGERS
@ NUMBEROFKNOWNTRIGGERS
Definition: MuonCalibTriggerInfo.h:29
MuonCalib::L1_MU6_RPC
@ L1_MU6_RPC
Definition: MuonCalibTriggerInfo.h:24
MuonCalib::L1_MU0_TGC
@ L1_MU0_TGC
Definition: MuonCalibTriggerInfo.h:27
MuonCalib::MuonCalibTriggerTypeHelper::isTgcTrigger
static bool isTgcTrigger(MuonCalibTriggerType type)
check whether type is valid
Definition: MuonCalibTriggerInfo.cxx:35
MuonCalib::MuonCalibTriggerTypeHelper::isMbtsTrigger
static bool isMbtsTrigger(MuonCalibTriggerType type)
check whether type is valid
Definition: MuonCalibTriggerInfo.cxx:40
MuonCalibTriggerInfo.h