ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonSimEvent
src
RpcHitIdHelper.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/RpcHitIdHelper.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
RpcHitIdHelper::RpcHitIdHelper
(
unsigned
int
nGasGaps) :
HitIdHelper
()
18
{
19
InitializeStationName
();
20
Initialize
(nGasGaps);
21
}
22
23
const
RpcHitIdHelper
*
RpcHitIdHelper::GetHelper
(
unsigned
int
nGasGaps)
24
{
25
static
const
RpcHitIdHelper
helper(nGasGaps);
26
return
&helper;
27
}
28
29
void
RpcHitIdHelper::Initialize
(
unsigned
int
nGasGaps)
30
{
31
InitializeField
(
"PhiSector"
,1,8);
32
InitializeField
(
"ZSector"
,-8,8);
33
InitializeField
(
"DoubletR"
,1,2);
34
InitializeField
(
"GasGapLayer"
,1,nGasGaps);
35
InitializeField
(
"DoubletPhi"
,1,2);
36
InitializeField
(
"DoubletZ"
,1,3);
37
InitializeField
(
"MeasuresPhi"
,0,1);
38
39
}
40
41
void
RpcHitIdHelper::InitializeStationName
()
42
{
43
InitializeField
(
"Station[1]"
,0,
sizeof
(v1));
44
InitializeField
(
"Station[2]"
,0,
sizeof
(v2));
45
InitializeField
(
"Station[3]"
,0,
sizeof
(v3));
46
}
47
48
void
RpcHitIdHelper::SetStationName
(
const
std::string& name,
int
& hid)
const
49
{
50
for
(
unsigned
int
i=0;i<
sizeof
(v1);i++)
51
if
(v1[i]==name[0])
SetFieldValue
(
"Station[1]"
,i,hid);
52
for
(
unsigned
int
i=0;i<
sizeof
(v2);i++)
53
if
(v2[i]==name[1])
SetFieldValue
(
"Station[2]"
,i,hid);
54
for
(
unsigned
int
i=0;i<
sizeof
(v3);i++)
55
if
(v3[i]==name[2])
SetFieldValue
(
"Station[3]"
,i,hid);
56
}
57
58
std::string
RpcHitIdHelper::GetStationName
(
const
int
& hid)
const
59
{
60
char
v[4];
61
v[0]=v1[this->
GetFieldValue
(
"Station[1]"
, hid)];
62
v[1]=v2[this->
GetFieldValue
(
"Station[2]"
, hid)];
63
v[2]=v3[this->
GetFieldValue
(
"Station[3]"
, hid)];
64
v[3]=
'\0'
;
65
std::string temp=v;
66
return
temp;
67
}
68
69
int
RpcHitIdHelper::GetPhiSector
(
const
int
& hid)
const
70
{
71
return
this->
GetFieldValue
(
"PhiSector"
, hid);
72
}
73
74
int
RpcHitIdHelper::GetZSector
(
const
int
& hid)
const
75
{
76
return
this->
GetFieldValue
(
"ZSector"
, hid);
77
}
78
79
//----RPC
80
int
RpcHitIdHelper::GetDoubletR
(
const
int
& hid)
const
81
{
82
return
this->
GetFieldValue
(
"DoubletR"
, hid);
83
}
84
int
RpcHitIdHelper::GetGasGapLayer
(
const
int
& hid)
const
85
{
86
return
this->
GetFieldValue
(
"GasGapLayer"
, hid);
87
}
88
int
RpcHitIdHelper::GetDoubletPhi
(
const
int
& hid)
const
89
{
90
return
this->
GetFieldValue
(
"DoubletPhi"
, hid);
91
}
92
int
RpcHitIdHelper::GetDoubletZ
(
const
int
& hid)
const
93
{
94
return
this->
GetFieldValue
(
"DoubletZ"
, hid);
95
}
96
int
RpcHitIdHelper::GetMeasuresPhi
(
const
int
& hid)
const
97
{
98
return
this->
GetFieldValue
(
"MeasuresPhi"
, hid);
99
}
100
101
//packing method
102
int
RpcHitIdHelper::BuildRpcHitId
(
const
std::string& statName,
const
int
phiSect,
103
const
int
zSect,
const
int
doubZ,
const
int
doubR,
const
int
gasGap,
104
const
int
doubPhi,
const
int
measPhi)
const
105
{
106
107
int
theID(0);
108
this->
SetStationName
(statName, theID);
109
this->
SetFieldValue
(
"PhiSector"
, phiSect, theID);
110
this->
SetFieldValue
(
"ZSector"
, zSect, theID);
111
this->
SetFieldValue
(
"DoubletZ"
, doubZ, theID);
112
this->
SetFieldValue
(
"DoubletR"
, doubR, theID);
113
this->
SetFieldValue
(
"GasGapLayer"
, gasGap, theID);
114
this->
SetFieldValue
(
"DoubletPhi"
, doubPhi, theID);
115
this->
SetFieldValue
(
"MeasuresPhi"
, measPhi, theID);
116
return
theID;
117
}
RpcHitIdHelper.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
RpcHitIdHelper::GetDoubletPhi
int GetDoubletPhi(const int &hid) const
Definition
RpcHitIdHelper.cxx:88
RpcHitIdHelper::GetHelper
static const RpcHitIdHelper * GetHelper(unsigned int nGasGaps=2)
Definition
RpcHitIdHelper.cxx:23
RpcHitIdHelper::SetStationName
void SetStationName(const std::string &name, int &hid) const
Definition
RpcHitIdHelper.cxx:48
RpcHitIdHelper::GetPhiSector
int GetPhiSector(const int &hid) const
Definition
RpcHitIdHelper.cxx:69
RpcHitIdHelper::BuildRpcHitId
int BuildRpcHitId(const std::string &, const int, const int, const int, const int, const int, const int, const int) const
Definition
RpcHitIdHelper.cxx:102
RpcHitIdHelper::InitializeStationName
void InitializeStationName()
Definition
RpcHitIdHelper.cxx:41
RpcHitIdHelper::GetDoubletR
int GetDoubletR(const int &hid) const
Definition
RpcHitIdHelper.cxx:80
RpcHitIdHelper::RpcHitIdHelper
RpcHitIdHelper(unsigned int nGasGaps)
Definition
RpcHitIdHelper.cxx:17
RpcHitIdHelper::GetGasGapLayer
int GetGasGapLayer(const int &hid) const
Definition
RpcHitIdHelper.cxx:84
RpcHitIdHelper::GetMeasuresPhi
int GetMeasuresPhi(const int &hid) const
Definition
RpcHitIdHelper.cxx:96
RpcHitIdHelper::GetStationName
std::string GetStationName(const int &hid) const
Definition
RpcHitIdHelper.cxx:58
RpcHitIdHelper::Initialize
void Initialize(unsigned int nGasGaps)
Definition
RpcHitIdHelper.cxx:29
RpcHitIdHelper::GetDoubletZ
int GetDoubletZ(const int &hid) const
Definition
RpcHitIdHelper.cxx:92
RpcHitIdHelper::GetZSector
int GetZSector(const int &hid) const
Definition
RpcHitIdHelper.cxx:74
ReadCellNoiseFromCrestCompare.v2
v2
Definition
ReadCellNoiseFromCrestCompare.py:302
Generated on
for ATLAS Offline Software by
1.17.0