ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7#include <iomanip>
8#include <array>
9
10namespace {
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
22
24{
25 static const TgcHitIdHelper helper;
26 return &helper;
27}
28
30{
31 InitializeField("StationPhi",1,48);
32 InitializeField("StationEta",-5,5);
33 InitializeField("GasGap",1,3);
34}
35
37{
38 InitializeField("Station[1]",0,sizeof(v1));
39 InitializeField("Station[2]",0,sizeof(v2));
40 InitializeField("Station[3]",0,sizeof(v3));
41}
42
43void 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}
52std::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
61int TgcHitIdHelper::GetStationPhi(const int& hid) const
62{
63 return this->GetFieldValue("StationPhi",hid);
64}
65
66int TgcHitIdHelper::GetStationEta(const int& hid) const
67{
68 return this->GetFieldValue("StationEta",hid);
69}
70
71int TgcHitIdHelper::GetGasGap(const int& hid) const
72{
73 return this->GetFieldValue("GasGap",hid);
74}
75
76//packing method
77int 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}
int GetFieldValue(const std::string &name, HitID targetID) const
void InitializeField(const std::string &n, int vmn, int vmx)
void SetFieldValue(const std::string &name, int n, HitID &targetID) const
int GetStationPhi(const int &hid) const
int BuildTgcHitId(const std::string &, const int, const int, const int) const
std::string GetStationName(const int &hid) const
void InitializeStationName()
int GetStationEta(const int &hid) const
void SetStationName(const std::string &name, int &hid) const
int GetGasGap(const int &hid) const
static const TgcHitIdHelper * GetHelper()