ATLAS Offline Software
TrigMonRoi.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGMON_ROI_H
6 #define TRIGMON_ROI_H
7 
8 /*
9  @author Rustem Ospanov
10  @date July 2009
11 
12  @brief Compact copy of TrigRoIDescriptor.
13 */
14 
15 // Framework
16 #include "AthenaKernel/CLASS_DEF.h"
17 
18 // C/C++
19 #include <stdint.h>
20 #include <vector>
21 
22 // Local
24 
26 {
27  public:
28 
29  enum Type {
30  kNone = 0,
31  kMuon = 1,
32  kEmTau = 2,
33  kJet = 3,
34  kJetEt = 4,
35  kEnergy = 5
36  };
37 
38  TrigMonRoi();
39  explicit TrigMonRoi(unsigned int roi_word);
41 
42  void setType(Type type);
43  void addWord(unsigned int word) { m_word.push_back(word); }
44 
45  void setRoiId(unsigned int id);
46  void setNL1th(unsigned int lt);
47 
48  void setEtaPhi (float eta, float phi);
49  void setRoIArea(float eta_width, float phi_width);
50 
51  void addVar(const TrigMonVar &var);
52 
53  uint32_t getRoiWord() const { return m_word[0]; }
54 
55  Type getRoiType() const;
56  uint32_t getRoiId() const;
57  uint8_t getNL1th() const;
58 
59  float getEta() const;
60  float getPhi() const;
61  float getRoIArea() const;
62 
63  std::vector<uint32_t>& getWord() { return m_word; }
64  std::vector<uint16_t>& getVarKey() { return m_var_key; }
65  std::vector<float>& getVarVal() { return m_var_val; }
66 
67  const std::vector<uint32_t>& getWord() const { return m_word; }
68  const std::vector<uint16_t>& getVarKey() const { return m_var_key; }
69  const std::vector<float>& getVarVal() const { return m_var_val; }
70  float getVarVal( const uint32_t key ) const;
71  const std::vector<TrigMonVar> getVar() const;
72 
73  void print(std::ostream &os = std::cout);
74 
75  private:
76 
77  std::vector<uint32_t> m_word; // Encoded RoIWord and other data
78  std::vector<uint16_t> m_var_key; // Variable key
79  std::vector<float> m_var_val; // Variable value
80 };
81 
82 std::string str(const TrigMonRoi &);
83 
84 namespace Trig
85 {
86  //
87  // Roi id for special two cases when RoiId is not available
88  //
89  inline uint8_t getRoiId_Unknown() { return 255; }
90  inline uint8_t getRoiId_JetEt() { return 254; }
91  inline uint8_t getRoiId_Energy() { return 253; }
92 }
93 
94 //
95 // m_word[0] = L1 hardware RoI word
96 //
97 // m_word[1] = encoded word, if set it stores:
98 // 8 bits: 0- 8 [i] RoiId assigned by HLT
99 // 4 bits: 9-12 [t] RoiType assigned by HLT
100 // 8 bits: 13-20 [l] number of L1 thresholds activated by HLT
101 // 12 bits: 21-32 [f] free
102 //
103 // m_encoded = [pppppppppppp][llllllll][tttt][rrrrrrrr]
104 //
105 // In 2012 data, we add one more variable to record full RoI Id
106 // m_word[2] = RoI Id
107 //
108 
109 //
110 // Inlined global comparison operators
111 //
112 inline bool operator==(const TrigMonRoi &lhs, const TrigMonRoi &rhs) {
113  return lhs.getRoiWord() == rhs.getRoiWord();
114 }
115 inline bool operator <(const TrigMonRoi &lhs, const TrigMonRoi &rhs) {
116  return lhs.getRoiWord() < rhs.getRoiWord();
117 }
118 
119 inline bool operator==(const TrigMonRoi &roi, unsigned int word) {
120  return roi.getRoiWord() == word;
121 }
122 inline bool operator==(unsigned int word, const TrigMonRoi &roi) {
123  return word == roi.getRoiWord();
124 }
125 
126 CLASS_DEF( TrigMonRoi , 125550248 , 1 )
127 
128 #endif
TrigMonRoi::getRoiId
uint32_t getRoiId() const
Definition: TrigMonRoi.cxx:164
TrigMonRoi::addWord
void addWord(unsigned int word)
Definition: TrigMonRoi.h:43
TrigMonRoi::m_var_val
std::vector< float > m_var_val
Definition: TrigMonRoi.h:79
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
Trig::getRoiId_Energy
uint8_t getRoiId_Energy()
Definition: TrigMonRoi.h:91
TrigMonRoi::getVarKey
const std::vector< uint16_t > & getVarKey() const
Definition: TrigMonRoi.h:68
TrigMonRoi::kJet
@ kJet
Definition: TrigMonRoi.h:33
TrigMonRoi::getRoiType
Type getRoiType() const
Definition: TrigMonRoi.cxx:142
TrigMonRoi::getRoiWord
uint32_t getRoiWord() const
Definition: TrigMonRoi.h:53
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
TrigMonRoi::kJetEt
@ kJetEt
Definition: TrigMonRoi.h:34
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
TrigMonRoi::kEmTau
@ kEmTau
Definition: TrigMonRoi.h:32
TrigMonRoi::getEta
float getEta() const
Definition: TrigMonRoi.cxx:178
Trig
The common trigger namespace for trigger analysis tools.
Definition: CaloTowerVecMon.h:44
TrigMonRoi::setRoIArea
void setRoIArea(float eta_width, float phi_width)
Definition: TrigMonRoi.cxx:108
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
operator<
bool operator<(const TrigMonRoi &lhs, const TrigMonRoi &rhs)
Definition: TrigMonRoi.h:115
Trig::getRoiId_JetEt
uint8_t getRoiId_JetEt()
Definition: TrigMonRoi.h:90
TrigMonVar.h
TrigMonRoi::setNL1th
void setNL1th(unsigned int lt)
Definition: TrigMonRoi.cxx:75
TrigMonRoi::getPhi
float getPhi() const
Definition: TrigMonRoi.cxx:194
TrigMonRoi::kEnergy
@ kEnergy
Definition: TrigMonRoi.h:35
TrigMonRoi::kNone
@ kNone
Definition: TrigMonRoi.h:30
Trig::getRoiId_Unknown
uint8_t getRoiId_Unknown()
Definition: TrigMonRoi.h:89
TrigMonRoi::TrigMonRoi
TrigMonRoi()
Definition: TrigMonRoi.cxx:27
TrigMonVar
Definition: TrigMonVar.h:59
TrigMonRoi::addVar
void addVar(const TrigMonVar &var)
Definition: TrigMonRoi.cxx:127
TrigMonRoi::getVarVal
const std::vector< float > & getVarVal() const
Definition: TrigMonRoi.h:69
TrigMonRoi::getWord
const std::vector< uint32_t > & getWord() const
Definition: TrigMonRoi.h:67
TrigMonRoi::m_var_key
std::vector< uint16_t > m_var_key
Definition: TrigMonRoi.h:78
TrigMonRoi::getVarKey
std::vector< uint16_t > & getVarKey()
Definition: TrigMonRoi.h:64
xAODType
Definition: ObjectType.h:13
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigMonRoi::getRoIArea
float getRoIArea() const
Definition: TrigMonRoi.cxx:210
TrigMonRoi::kMuon
@ kMuon
Definition: TrigMonRoi.h:31
TrigMonRoi
Definition: TrigMonRoi.h:26
TrigMonRoi::getWord
std::vector< uint32_t > & getWord()
Definition: TrigMonRoi.h:63
str
std::string str(const TrigMonRoi &)
Definition: TrigMonRoi.cxx:274
TrigMonRoi::setType
void setType(Type type)
Definition: TrigMonRoi.cxx:43
TrigMonRoi::print
void print(std::ostream &os=std::cout)
Definition: TrigMonRoi.cxx:268
TrigMonRoi::getVarVal
std::vector< float > & getVarVal()
Definition: TrigMonRoi.h:65
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TrigMonRoi::setRoiId
void setRoiId(unsigned int id)
Definition: TrigMonRoi.cxx:54
operator==
bool operator==(const TrigMonRoi &lhs, const TrigMonRoi &rhs)
Definition: TrigMonRoi.h:112
TrigMonRoi::TrigMonRoi
TrigMonRoi(unsigned int roi_word)
TrigMonRoi::setEtaPhi
void setEtaPhi(float eta, float phi)
Definition: TrigMonRoi.cxx:92
TrigMonRoi::getNL1th
uint8_t getNL1th() const
Definition: TrigMonRoi.cxx:226
TrigMonRoi::~TrigMonRoi
~TrigMonRoi()
Definition: TrigMonRoi.h:40
CLASS_DEF.h
macros to associate a CLID to a type
TrigMonRoi::m_word
std::vector< uint32_t > m_word
Definition: TrigMonRoi.h:77
TrigMonRoi::getVar
const std::vector< TrigMonVar > getVar() const
Definition: TrigMonRoi.cxx:237
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37