ATLAS Offline Software
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
10  Initialize();
11 }
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
29 bool TRTHitIdHelper::isBarrel(const int& hid) const {
30  int ps = this->GetFieldValue("BarrelEndcap", hid);
31  return ps ==0;
32 }
33 
34 bool TRTHitIdHelper::isEndcap(const int& hid) const {
35  int ps = this->GetFieldValue("BarrelEndcap", hid);
36  return ps != 0;
37 }
38 
39 // Positive or Negative
40 bool TRTHitIdHelper::isPositive(const int& hid) const {
41  int ps = this->GetFieldValue("PositiveNegative", hid);
42  return ps ==0;
43 }
44 bool TRTHitIdHelper::isNegative(const int& hid) const {
45  int ps = this->GetFieldValue("PositiveNegative", hid);
46  return ps != 0;
47 }
48 
49 // Ring/Wheel
50 int TRTHitIdHelper::getRingWheel(const int& hid) const {
51  return this->GetFieldValue("RingWheel", hid);
52 }
53 
54 // Phi Sector
55 int TRTHitIdHelper::getPhiSector(const int& hid) const {
56  return this->GetFieldValue("PhiSector", hid);
57 }
58 
59 // layer/plane
60 int TRTHitIdHelper::getLayerPlane(const int& hid) const {
61  return this->GetFieldValue("LayerPlane", hid);
62 }
63 
64 // straw
65 int TRTHitIdHelper::getStraw(const int& hid) const {
66  return this->GetFieldValue("Straw", hid);
67 }
68 
69 
70 //
71 // Info packing:
72 int 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 }
TRTHitIdHelper::isNegative
bool isNegative(const int &hid) const
Definition: TRTHitIdHelper.cxx:44
HitIdHelper::SetFieldValue
void SetFieldValue(const std::string &name, int n, HitID &targetID) const
Definition: HitIdHelper.cxx:31
HitIdHelper::InitializeField
void InitializeField(const std::string &n, int vmn, int vmx)
Definition: HitIdHelper.cxx:10
TRTHitIdHelper::Initialize
void Initialize()
Definition: TRTHitIdHelper.cxx:18
TRTHitIdHelper::getLayerPlane
int getLayerPlane(const int &hid) const
Definition: TRTHitIdHelper.cxx:60
TRTHitIdHelper::isBarrel
bool isBarrel(const int &hid) const
Definition: TRTHitIdHelper.cxx:29
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
TRTHitIdHelper.h
HitIdHelper::GetFieldValue
int GetFieldValue(const std::string &name, HitID targetID) const
Definition: HitIdHelper.cxx:48
python.CaloInfoD3PDObject.PosNeg
PosNeg
Definition: CaloInfoD3PDObject.py:15
TRTHitIdHelper::getStraw
int getStraw(const int &hid) const
Definition: TRTHitIdHelper.cxx:65
TRTHitIdHelper::getRingWheel
int getRingWheel(const int &hid) const
Definition: TRTHitIdHelper.cxx:50
TRTHitIdHelper::GetHelper
static const TRTHitIdHelper * GetHelper()
Definition: TRTHitIdHelper.cxx:13
TRTHitIdHelper::getPhiSector
int getPhiSector(const int &hid) const
Definition: TRTHitIdHelper.cxx:55
TRTHitIdHelper::isEndcap
bool isEndcap(const int &hid) const
Definition: TRTHitIdHelper.cxx:34
xAOD::Straw
@ Straw
Definition: TrackingPrimitives.h:557
TRTHitIdHelper::TRTHitIdHelper
TRTHitIdHelper()
Definition: TRTHitIdHelper.cxx:9
TRTHitIdHelper::buildHitId
int buildHitId(const int, const int, const int, const int, const int, const int) const
Definition: TRTHitIdHelper.cxx:72
HitIdHelper
Definition: HitIdHelper.h:23
TRTHitIdHelper::isPositive
bool isPositive(const int &hid) const
Definition: TRTHitIdHelper.cxx:40
TRTHitIdHelper
Definition: TRTHitIdHelper.h:25