ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
TrigMonRoi Class Reference

#include <TrigMonRoi.h>

Collaboration diagram for TrigMonRoi:

Public Types

enum  Type {
  kNone = 0, kMuon = 1, kEmTau = 2, kJet = 3,
  kJetEt = 4, kEnergy = 5
}
 

Public Member Functions

 TrigMonRoi ()
 
 TrigMonRoi (unsigned int roi_word)
 
 ~TrigMonRoi ()
 
void setType (Type type)
 
void addWord (unsigned int word)
 
void setRoiId (unsigned int id)
 
void setNL1th (unsigned int lt)
 
void setEtaPhi (float eta, float phi)
 
void setRoIArea (float eta_width, float phi_width)
 
void addVar (const TrigMonVar &var)
 
uint32_t getRoiWord () const
 
Type getRoiType () const
 
uint32_t getRoiId () const
 
uint8_t getNL1th () const
 
float getEta () const
 
float getPhi () const
 
float getRoIArea () const
 
std::vector< uint32_t > & getWord ()
 
std::vector< uint16_t > & getVarKey ()
 
std::vector< float > & getVarVal ()
 
const std::vector< uint32_t > & getWord () const
 
const std::vector< uint16_t > & getVarKey () const
 
const std::vector< float > & getVarVal () const
 
float getVarVal (const uint32_t key) const
 
const std::vector< TrigMonVargetVar () const
 
void print (std::ostream &os=std::cout)
 

Private Attributes

std::vector< uint32_t > m_word
 
std::vector< uint16_t > m_var_key
 
std::vector< float > m_var_val
 

Detailed Description

Definition at line 25 of file TrigMonRoi.h.

Member Enumeration Documentation

◆ Type

Enumerator
kNone 
kMuon 
kEmTau 
kJet 
kJetEt 
kEnergy 

Definition at line 29 of file TrigMonRoi.h.

29  {
30  kNone = 0,
31  kMuon = 1,
32  kEmTau = 2,
33  kJet = 3,
34  kJetEt = 4,
35  kEnergy = 5
36  };

Constructor & Destructor Documentation

◆ TrigMonRoi() [1/2]

TrigMonRoi::TrigMonRoi ( )

Definition at line 27 of file TrigMonRoi.cxx.

28  :m_word(1, 0)
29 {
30 }

◆ TrigMonRoi() [2/2]

TrigMonRoi::TrigMonRoi ( unsigned int  roi_word)
explicit

◆ ~TrigMonRoi()

TrigMonRoi::~TrigMonRoi ( )
inline

Definition at line 40 of file TrigMonRoi.h.

40 {}

Member Function Documentation

◆ addVar()

void TrigMonRoi::addVar ( const TrigMonVar var)

Definition at line 127 of file TrigMonRoi.cxx.

128 {
129  //
130  // Store variable as int and float, reserve 0-9 keys
131  //
132  if(var.getKey() > 9) {
133  m_var_key.push_back(var.getKey());
134  m_var_val.push_back(var.getData());
135  } else {
136  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonRoi")
137  << "Cannot add a var with key < 9 (internal use only)";
138  }
139 }

◆ addWord()

void TrigMonRoi::addWord ( unsigned int  word)
inline

Definition at line 43 of file TrigMonRoi.h.

43 { m_word.push_back(word); }

◆ getEta()

float TrigMonRoi::getEta ( ) const

Definition at line 178 of file TrigMonRoi.cxx.

179 {
180  //
181  // Search for eta value at key=0
182  //
183 
184  if(m_var_key.size() == m_var_val.size()) {
185  for(unsigned int i = 0; i < m_var_key.size(); ++i) {
186  if(m_var_key[i] == 0) return m_var_val[i];
187  }
188  }
189 
190  return -9999.0;
191 }

◆ getNL1th()

uint8_t TrigMonRoi::getNL1th ( ) const

Definition at line 226 of file TrigMonRoi.cxx.

227 {
228  //
229  // Return number of L1 thresholds assigned by HLT
230  //
231  if(m_word.size() < 2) return 0;
232 
233  return (m_word[1] & RoiBits::maskL1) >> RoiBits::shiftL1;
234 }

◆ getPhi()

float TrigMonRoi::getPhi ( ) const

Definition at line 194 of file TrigMonRoi.cxx.

195 {
196  //
197  // Search for phi value at key=1
198  //
199 
200  if(m_var_key.size() == m_var_val.size()) {
201  for(unsigned int i = 0; i < m_var_key.size(); ++i) {
202  if(m_var_key[i] == 1) return m_var_val[i];
203  }
204  }
205 
206  return -9999.0;
207 }

◆ getRoIArea()

float TrigMonRoi::getRoIArea ( ) const

Definition at line 210 of file TrigMonRoi.cxx.

211 {
212  //
213  // Search for phi value at key=2
214  //
215 
216  if(m_var_key.size() == m_var_val.size()) {
217  for(unsigned int i = 0; i < m_var_key.size(); ++i) {
218  if(m_var_key[i] == 2) return m_var_val[i];
219  }
220  }
221 
222  return -9999.0;
223 }

◆ getRoiId()

uint32_t TrigMonRoi::getRoiId ( ) const

Definition at line 164 of file TrigMonRoi.cxx.

165 {
166  //
167  // Return RoI id assigned by HLT
168  //
169  if(m_word.size() < 2) return Trig::getRoiId_Unknown();
170 
171  // For 2012 data
172  if(m_word.size() == 3) return m_word[2];
173 
174  return (m_word[1] & RoiBits::maskId) >> RoiBits::shiftId;
175 }

◆ getRoiType()

TrigMonRoi::Type TrigMonRoi::getRoiType ( ) const

Definition at line 142 of file TrigMonRoi.cxx.

143 {
144  //
145  // Return RoI type assigned by HLT
146  //
147  if(m_word.size() < 2) return kNone;
148 
149  const unsigned int val = (m_word[1] & RoiBits::maskType) >> RoiBits::shiftType;
150 
151  switch (val) {
152  case 1: return kMuon;
153  case 2: return kEmTau;
154  case 3: return kJet;
155  case 4: return kJetEt;
156  case 5: return kEnergy;
157  default: break;
158  }
159 
160  return kNone;
161 }

◆ getRoiWord()

uint32_t TrigMonRoi::getRoiWord ( ) const
inline

Definition at line 53 of file TrigMonRoi.h.

53 { return m_word[0]; }

◆ getVar()

const std::vector< TrigMonVar > TrigMonRoi::getVar ( ) const

Definition at line 237 of file TrigMonRoi.cxx.

238 {
239  //
240  // Build variables on a fly and return vector by value
241  //
242  std::vector<TrigMonVar> var;
243 
244  if(m_var_key.size() == m_var_val.size()) {
245  //
246  // Iterate over keys abd values
247  //
248  var.reserve(m_var_key.size());
249 
250  for(unsigned int i = 0; i < m_var_key.size(); ++i) {
251  var.push_back(TrigMonVar(m_var_key[i], m_var_val[i]));
252  }
253  }
254 
255  return var;
256 }

◆ getVarKey() [1/2]

std::vector<uint16_t>& TrigMonRoi::getVarKey ( )
inline

Definition at line 64 of file TrigMonRoi.h.

64 { return m_var_key; }

◆ getVarKey() [2/2]

const std::vector<uint16_t>& TrigMonRoi::getVarKey ( ) const
inline

Definition at line 68 of file TrigMonRoi.h.

68 { return m_var_key; }

◆ getVarVal() [1/3]

std::vector<float>& TrigMonRoi::getVarVal ( )
inline

Definition at line 65 of file TrigMonRoi.h.

65 { return m_var_val; }

◆ getVarVal() [2/3]

const std::vector<float>& TrigMonRoi::getVarVal ( ) const
inline

Definition at line 69 of file TrigMonRoi.h.

69 { return m_var_val; }

◆ getVarVal() [3/3]

float TrigMonRoi::getVarVal ( const uint32_t  key) const

Definition at line 258 of file TrigMonRoi.cxx.

259 {
260  for(unsigned int i = 0; i < m_var_key.size(); ++i) {
261  if (m_var_key.at(i) == key) return m_var_val.at(i);
262  }
263  return 0.;
264 }

◆ getWord() [1/2]

std::vector<uint32_t>& TrigMonRoi::getWord ( )
inline

Definition at line 63 of file TrigMonRoi.h.

63 { return m_word; }

◆ getWord() [2/2]

const std::vector<uint32_t>& TrigMonRoi::getWord ( ) const
inline

Definition at line 67 of file TrigMonRoi.h.

67 { return m_word; }

◆ print()

void TrigMonRoi::print ( std::ostream &  os = std::cout)

Definition at line 268 of file TrigMonRoi.cxx.

269 {
270  os << str(*this) << std::endl;
271 }

◆ setEtaPhi()

void TrigMonRoi::setEtaPhi ( float  eta,
float  phi 
)

Definition at line 92 of file TrigMonRoi.cxx.

93 {
94  //
95  // Add eta and phi coordinatesat key=0 and key=1
96  //
97  if(std::count(m_var_key.begin(), m_var_key.end(), 0) == 0 &&
98  std::count(m_var_key.begin(), m_var_key.end(), 1) == 0) {
99  m_var_key.push_back(0);
100  m_var_val.push_back(eta);
101 
102  m_var_key.push_back(1);
103  m_var_val.push_back(phi);
104  }
105 }

◆ setNL1th()

void TrigMonRoi::setNL1th ( unsigned int  lt)

Definition at line 75 of file TrigMonRoi.cxx.

76 {
77  //
78  // Set roi type
79  //
80  if(m_word.size() < 2) return;
81 
82  if(lt < 256) {
83  m_word[1] |= (lt << RoiBits::shiftL1);
84  }
85  else {
86  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TrigMonRoi")
87  << "setL1thresholds error! Value is out of range: " << lt;
88  }
89 }

◆ setRoIArea()

void TrigMonRoi::setRoIArea ( float  eta_width,
float  phi_width 
)

Definition at line 108 of file TrigMonRoi.cxx.

109 {
110  //
111  // Add eta and phi coordinatesat key=0 and key=1
112  //
113  if(std::count(m_var_key.begin(), m_var_key.end(), 2) == 0) {
114 
115  // Assuming the area is an ellipse - approximate
116  //float area = 3.14159*eta_width*phi_width;
117 
118  // Chainging to square area, assume supplied are full width
119  float area = eta_width * phi_width;
120 
121  m_var_key.push_back(2);
122  m_var_val.push_back(area);
123  }
124 }

◆ setRoiId()

void TrigMonRoi::setRoiId ( unsigned int  id)

Definition at line 54 of file TrigMonRoi.cxx.

55 {
56  //
57  // Set roi type
58  //
59  if(m_word.size() < 2) return;
60 
61  if(id < 256) {
62  m_word[1] |= (id << RoiBits::shiftId);
63  }
64  else {
65  if(m_word.size()<3){
66  m_word.push_back(id);
67  }
68  else{
69  m_word[2]=id;
70  }
71  }
72 }

◆ setType()

void TrigMonRoi::setType ( Type  type)

Definition at line 43 of file TrigMonRoi.cxx.

44 {
45  //
46  // Set roi type
47  //
48  if(m_word.size() < 2) return;
49 
50  m_word[1] |= (type << RoiBits::shiftType);
51 }

Member Data Documentation

◆ m_var_key

std::vector<uint16_t> TrigMonRoi::m_var_key
private

Definition at line 78 of file TrigMonRoi.h.

◆ m_var_val

std::vector<float> TrigMonRoi::m_var_val
private

Definition at line 79 of file TrigMonRoi.h.

◆ m_word

std::vector<uint32_t> TrigMonRoi::m_word
private

Definition at line 77 of file TrigMonRoi.h.


The documentation for this class was generated from the following files:
TrigMonRoi::m_var_val
std::vector< float > m_var_val
Definition: TrigMonRoi.h:79
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
TrigMonRoi::kJet
@ kJet
Definition: TrigMonRoi.h:33
RoiBits::maskL1
const uint32_t maskL1
Definition: TrigMonRoi.cxx:17
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
TrigMonRoi::kJetEt
@ kJetEt
Definition: TrigMonRoi.h:34
TrigMonRoi::kEmTau
@ kEmTau
Definition: TrigMonRoi.h:32
RoiBits::shiftL1
const uint32_t shiftL1
Definition: TrigMonRoi.cxx:22
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
RoiBits::maskType
const uint32_t maskType
Definition: TrigMonRoi.cxx:16
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
lumiFormat.i
int i
Definition: lumiFormat.py:92
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
RoiBits::maskId
const uint32_t maskId
Definition: TrigMonRoi.cxx:15
TrigMonVar
Definition: TrigMonVar.h:59
RoiBits::shiftType
const uint32_t shiftType
Definition: TrigMonRoi.cxx:21
TrigMonRoi::m_var_key
std::vector< uint16_t > m_var_key
Definition: TrigMonRoi.h:78
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
TrigMonRoi::kMuon
@ kMuon
Definition: TrigMonRoi.h:31
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
RoiBits::shiftId
const uint32_t shiftId
Definition: TrigMonRoi.cxx:20
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
area
double area(double R)
Definition: ConvertStaveServices.cxx:42
str
std::string str(const TrigMonRoi &o)
Definition: TrigMonRoi.cxx:274
TrigMonRoi::m_word
std::vector< uint32_t > m_word
Definition: TrigMonRoi.h:77
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37