ATLAS Offline Software
Loading...
Searching...
No Matches
TRTHitIdHelper.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//
8// private constructor
12
14 static const TRTHitIdHelper helper;
15 return &helper;
16}
17
19 InitializeField("Straw",0,31);
20 InitializeField("LayerPlane",0,31);
21 InitializeField("PhiSector",0,31);
22 InitializeField("RingWheel",0,31);
23 InitializeField("PositiveNegative",0,1);
24 InitializeField("BarrelEndcap",0,1);
25}
26
27 // Info retrieval:
28 // Barrel or Endcap
29bool TRTHitIdHelper::isBarrel(const int& hid) const {
30 int ps = this->GetFieldValue("BarrelEndcap", hid);
31 return ps ==0;
32}
33
34bool TRTHitIdHelper::isEndcap(const int& hid) const {
35 int ps = this->GetFieldValue("BarrelEndcap", hid);
36 return ps != 0;
37}
38
39// Positive or Negative
40bool TRTHitIdHelper::isPositive(const int& hid) const {
41 int ps = this->GetFieldValue("PositiveNegative", hid);
42 return ps ==0;
43}
44bool TRTHitIdHelper::isNegative(const int& hid) const {
45 int ps = this->GetFieldValue("PositiveNegative", hid);
46 return ps != 0;
47}
48
49// Ring/Wheel
50int TRTHitIdHelper::getRingWheel(const int& hid) const {
51 return this->GetFieldValue("RingWheel", hid);
52}
53
54// Phi Sector
55int TRTHitIdHelper::getPhiSector(const int& hid) const {
56 return this->GetFieldValue("PhiSector", hid);
57}
58
59// layer/plane
60int TRTHitIdHelper::getLayerPlane(const int& hid) const {
61 return this->GetFieldValue("LayerPlane", hid);
62}
63
64// straw
65int TRTHitIdHelper::getStraw(const int& hid) const {
66 return this->GetFieldValue("Straw", hid);
67}
68
69
70//
71// Info packing:
72int TRTHitIdHelper::buildHitId(const int BrlECap, const int PosNeg, const int RingWheel,
73 const int PhiS, const int LayerPlane, const int Straw) const {
74 int theID(0);
75 this->SetFieldValue("BarrelEndcap", BrlECap, theID);
76 this->SetFieldValue("PositiveNegative", PosNeg, theID);
77 this->SetFieldValue("RingWheel", RingWheel, theID);
78 this->SetFieldValue("PhiSector", PhiS, theID);
79 this->SetFieldValue("LayerPlane", LayerPlane, theID);
80 this->SetFieldValue("Straw", Straw, theID);
81 return theID;
82}
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
bool isPositive(const int &hid) const
int getPhiSector(const int &hid) const
int getRingWheel(const int &hid) const
bool isBarrel(const int &hid) const
int getStraw(const int &hid) const
bool isEndcap(const int &hid) const
static const TRTHitIdHelper * GetHelper()
int buildHitId(const int, const int, const int, const int, const int, const int) const
int getLayerPlane(const int &hid) const
bool isNegative(const int &hid) const