ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonSimEvent
src
TgcHitIdHelper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonSimEvent/TgcHitIdHelper.h
"
6
7
#include <iomanip>
8
#include <array>
9
10
namespace
{
11
constexpr
std::array<char, 4> v1 = {
'B'
,
'E'
,
'T'
,
'C'
};
12
constexpr
std::array<char, 9>
v2
= {
'I'
,
'M'
,
'O'
,
'E'
,
'1'
,
'2'
,
'3'
,
'4'
,
'S'
};
13
constexpr
std::array<char, 6> v3 = {
'S'
,
'L'
,
'E'
,
'R'
,
'F'
,
'G'
};
14
}
15
16
//private constructor
17
TgcHitIdHelper::TgcHitIdHelper
() :
HitIdHelper
()
18
{
19
InitializeStationName
();
20
Initialize
();
21
}
22
23
const
TgcHitIdHelper
*
TgcHitIdHelper::GetHelper
()
24
{
25
static
const
TgcHitIdHelper
helper;
26
return
&helper;
27
}
28
29
void
TgcHitIdHelper::Initialize
()
30
{
31
InitializeField
(
"StationPhi"
,1,48);
32
InitializeField
(
"StationEta"
,-5,5);
33
InitializeField
(
"GasGap"
,1,3);
34
}
35
36
void
TgcHitIdHelper::InitializeStationName
()
37
{
38
InitializeField
(
"Station[1]"
,0,
sizeof
(v1));
39
InitializeField
(
"Station[2]"
,0,
sizeof
(v2));
40
InitializeField
(
"Station[3]"
,0,
sizeof
(v3));
41
}
42
43
void
TgcHitIdHelper::SetStationName
(
const
std::string& name,
int
& hid)
const
44
{
45
for
(
unsigned
int
i=0;i<
sizeof
(v1);i++)
46
if
(v1[i]==name[0])
SetFieldValue
(
"Station[1]"
,i,hid);
47
for
(
unsigned
int
i=0;i<
sizeof
(v2);i++)
48
if
(v2[i]==name[1])
SetFieldValue
(
"Station[2]"
,i,hid);
49
for
(
unsigned
int
i=0;i<
sizeof
(v3);i++)
50
if
(v3[i]==name[2])
SetFieldValue
(
"Station[3]"
,i,hid);
51
}
52
std::string
TgcHitIdHelper::GetStationName
(
const
int
& hid)
const
53
{
54
std::string temp;
55
temp+=v1[this->
GetFieldValue
(
"Station[1]"
,hid)];
56
temp+=v2[this->
GetFieldValue
(
"Station[2]"
,hid)];
57
temp+=v3[this->
GetFieldValue
(
"Station[3]"
,hid)];
58
return
temp;
59
}
60
61
int
TgcHitIdHelper::GetStationPhi
(
const
int
& hid)
const
62
{
63
return
this->
GetFieldValue
(
"StationPhi"
,hid);
64
}
65
66
int
TgcHitIdHelper::GetStationEta
(
const
int
& hid)
const
67
{
68
return
this->
GetFieldValue
(
"StationEta"
,hid);
69
}
70
71
int
TgcHitIdHelper::GetGasGap
(
const
int
& hid)
const
72
{
73
return
this->
GetFieldValue
(
"GasGap"
,hid);
74
}
75
76
//packing method
77
int
TgcHitIdHelper::BuildTgcHitId
(
const
std::string& statName,
const
int
statPhi,
78
const
int
statEta,
const
int
gasG)
const
79
{
80
int
theID(0);
81
this->
SetStationName
(statName, theID);
82
this->
SetFieldValue
(
"StationPhi"
, statPhi, theID);
83
this->
SetFieldValue
(
"StationEta"
, statEta, theID);
84
this->
SetFieldValue
(
"GasGap"
, gasG, theID);
85
return
theID;
86
}
TgcHitIdHelper.h
HitIdHelper::GetFieldValue
int GetFieldValue(const std::string &name, HitID targetID) const
Definition
HitIdHelper.cxx:47
HitIdHelper::HitIdHelper
HitIdHelper()
Definition
HitIdHelper.h:25
HitIdHelper::InitializeField
void InitializeField(const std::string &n, int vmn, int vmx)
Definition
HitIdHelper.cxx:10
HitIdHelper::SetFieldValue
void SetFieldValue(const std::string &name, int n, HitID &targetID) const
Definition
HitIdHelper.cxx:30
TgcHitIdHelper::Initialize
void Initialize()
Definition
TgcHitIdHelper.cxx:29
TgcHitIdHelper::GetStationPhi
int GetStationPhi(const int &hid) const
Definition
TgcHitIdHelper.cxx:61
TgcHitIdHelper::BuildTgcHitId
int BuildTgcHitId(const std::string &, const int, const int, const int) const
Definition
TgcHitIdHelper.cxx:77
TgcHitIdHelper::GetStationName
std::string GetStationName(const int &hid) const
Definition
TgcHitIdHelper.cxx:52
TgcHitIdHelper::TgcHitIdHelper
TgcHitIdHelper()
Definition
TgcHitIdHelper.cxx:17
TgcHitIdHelper::InitializeStationName
void InitializeStationName()
Definition
TgcHitIdHelper.cxx:36
TgcHitIdHelper::GetStationEta
int GetStationEta(const int &hid) const
Definition
TgcHitIdHelper.cxx:66
TgcHitIdHelper::SetStationName
void SetStationName(const std::string &name, int &hid) const
Definition
TgcHitIdHelper.cxx:43
TgcHitIdHelper::GetGasGap
int GetGasGap(const int &hid) const
Definition
TgcHitIdHelper.cxx:71
TgcHitIdHelper::GetHelper
static const TgcHitIdHelper * GetHelper()
Definition
TgcHitIdHelper.cxx:23
ReadCellNoiseFromCrestCompare.v2
v2
Definition
ReadCellNoiseFromCrestCompare.py:302
Generated on
for ATLAS Offline Software by
1.17.0