ATLAS Offline Software
TrigConfVar.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGCONF_VAR_H
6 #define TRIGCONF_VAR_H
7 
8 /*
9  @author Rustem Ospanov
10  @date July 2009
11 
12  @brief This class provides map between id of TrigMonVar
13  and string. It stores list of id, string pairs which
14  can be saved in TrigMonConfig at end of a job.
15 */
16 
17 // Framework
18 #include "AthenaKernel/CLASS_DEF.h"
20 
21 // C/C++
22 #include <iostream>
23 #include <string>
24 #include <vector>
25 
26 // Local
28 
29 class TrigConfVar {
30  public:
31 
32  TrigConfVar();
33  TrigConfVar(const std::string &name, uint32_t id);
35 
36  const std::string& name() const { return m_name; }
37  const std::string& getName() const { return m_name; }
38 
39  uint32_t id() const { return m_id; }
40  uint32_t getId() const { return m_id; }
41 
42  void print(std::ostream &os) const;
43 
44  private:
45 
46  uint32_t m_id; // Variable id
47  std::string m_name; // Variable name
48 };
49 
50 std::string str(const TrigConfVar &);
51 
52 //
53 // Helper functions: these use static TrigConfVar vector
54 //
55 namespace Trig
56 {
57  uint16_t ReserveVarId ATLAS_NOT_THREAD_SAFE (const std::string &name);
58  uint16_t ReserveVarId ATLAS_NOT_THREAD_SAFE (const std::string &name, uint16_t id);
59 
60  bool FindVarId ATLAS_NOT_THREAD_SAFE (const std::string &name, uint16_t &id);
61  bool FindVarName ATLAS_NOT_THREAD_SAFE (const uint16_t id, std::string &name);
62 
63  std::vector<TrigConfVar> GetCurrentTrigConfVarVector ATLAS_NOT_THREAD_SAFE ();
64 }
65 
66 //
67 // Inlined comparison operators
68 //
69 inline bool operator==(const TrigConfVar &lhs, const TrigConfVar &rhs) {
70  return lhs.getId() == rhs.getId() || lhs.getName() == rhs.getName();
71 }
72 inline bool operator==(const TrigConfVar &key, const std::string &str) {
73  return key.getName() == str;
74 }
75 inline bool operator==(const std::string &str, const TrigConfVar &key) {
76  return str == key.getName();
77 }
78 inline bool operator==(const TrigConfVar &key, const unsigned int id) {
79  return key.getId() == id;
80 }
81 inline bool operator==(const unsigned int id, const TrigConfVar &key) {
82  return id == key.getId();
83 }
84 
85 inline bool operator==(const TrigConfVar &key, const TrigMonVar &var) {
86  return key.getId() == var.getId();
87 }
88 inline bool operator==(const TrigMonVar &var, const TrigConfVar &key) {
89  return key.getId() == var.getId();
90 }
91 
92 CLASS_DEF( TrigConfVar , 168672416 , 1 )
93 
94 #endif
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
TrigConfVar
Definition: TrigConfVar.h:29
Trig
The common trigger namespace for trigger analysis tools.
Definition: CaloTowerVecMon.h:44
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConfVar::print
void print(std::ostream &os) const
Definition: TrigConfVar.cxx:32
TrigMonVar.h
TrigConfVar::id
uint32_t id() const
Definition: TrigConfVar.h:39
TrigConfVar::name
const std::string & name() const
Definition: TrigConfVar.h:36
TrigConfVar::TrigConfVar
TrigConfVar()
Definition: TrigConfVar.cxx:18
TrigConfVar::~TrigConfVar
~TrigConfVar()
Definition: TrigConfVar.h:34
TrigConfVar::m_id
uint32_t m_id
Definition: TrigConfVar.h:46
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
TrigConfVar::getId
uint32_t getId() const
Definition: TrigConfVar.h:40
TrigMonVar
Definition: TrigMonVar.h:59
TrigConfVar::getName
const std::string & getName() const
Definition: TrigConfVar.h:37
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigConfVar::m_name
std::string m_name
Definition: TrigConfVar.h:47
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
str
std::string str(const TrigConfVar &)
Definition: TrigConfVar.cxx:38
Trig::ATLAS_NOT_THREAD_SAFE
uint16_t ReserveVarId ATLAS_NOT_THREAD_SAFE(const std::string &name)
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
str
Definition: BTagTrackIpAccessor.cxx:11
operator==
bool operator==(const TrigConfVar &lhs, const TrigConfVar &rhs)
Definition: TrigConfVar.h:69
checker_macros.h
Define macros for attributes used to control the static checker.
CLASS_DEF.h
macros to associate a CLID to a type
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37