Skip to content
Snippets Groups Projects
Commit f61dbc30 authored by John Chapman's avatar John Chapman
Browse files

Drop calls which change the internal state of TRTHitIdHelper after initialization

Former-commit-id: 19c270c2
parent a897d76b
Branches
Tags
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef INDETSIMEVENT_TRTHITIDHELPER
#define INDETSIMEVENT_TRTHITIDHELPER
//
// This is a helper class to build an identifing integer used by
// This is a helper class to build an identifing integer used by
// the simulation. It inherits from HitIdHelper, in order to get
// all the packing and shifting for free.
// The class is a singleton and a static GetHelper() is provided
// the constructor calls the Initialize() method which sets all the
// all the packing and shifting for free.
// The class is a singleton and a static GetHelper() is provided
// the constructor calls the Initialize() method which sets all the
// field dimensions
// Methods are provided to get access to the TRT Geometry
// description
......@@ -26,39 +26,39 @@ class TRTHitIdHelper : HitIdHelper {
public:
//
// Access to the helper
static TRTHitIdHelper* GetHelper();
static TRTHitIdHelper* GetHelper();
//
// Info retrieval:
// Barrel or Endcap
bool isBarrel(const int& hid);
bool isEndcap(const int& hid);
bool isBarrel(const int& hid) const;
bool isEndcap(const int& hid) const;
//
// Positive or negative side
bool isPositive(const int& hid);
bool isNegative(const int& hid);
// Positive or negative side
bool isPositive(const int& hid) const;
bool isNegative(const int& hid) const;
// Ring or Wheel
int getRingWheel(const int& hid);
int getRingWheel(const int& hid) const;
// PhiSector
int getPhiSector(const int& hid);
int getPhiSector(const int& hid) const;
// Layer Plane
int getLayerPlane(const int& hid);
int getLayerPlane(const int& hid) const;
// straw
int getStraw(const int& hid);
int getStraw(const int& hid) const;
//
// Info packing:
int buildHitId(const int, const int, const int, const int, const int, const int);
int buildHitId(const int, const int, const int, const int, const int, const int) const;
private:
//
// private constructor to have a singleton
TRTHitIdHelper();
TRTHitIdHelper();
//
// Initialize the helper, only called by the constructor
void Initialize();
void Initialize();
};
#endif // INDETSIMEVENT_TRTHITIDHELPER
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetSimEvent/TRTHitIdHelper.h"
//
//
// private constructor
TRTHitIdHelper::TRTHitIdHelper() :HitIdHelper() {
Initialize();
......@@ -22,75 +22,65 @@ void TRTHitIdHelper::Initialize() {
InitializeField("RingWheel",0,31);
InitializeField("PositiveNegative",0,1);
InitializeField("BarrelEndcap",0,1);
}
}
// Info retrieval:
// Barrel or Endcap
bool TRTHitIdHelper::isBarrel(const int& hid){
this->SetID(hid);
int ps = this->GetFieldValue("BarrelEndcap");
bool TRTHitIdHelper::isBarrel(const int& hid) const {
int ps = this->GetFieldValue("BarrelEndcap", hid);
if (ps ==0 ) return true;
else return false;
}
bool TRTHitIdHelper::isEndcap(const int& hid){
this->SetID(hid);
int ps = this->GetFieldValue("BarrelEndcap");
bool TRTHitIdHelper::isEndcap(const int& hid) const {
int ps = this->GetFieldValue("BarrelEndcap", hid);
if (ps ==0 ) return false;
else return true;
}
}
// Positive or Negative
bool TRTHitIdHelper::isPositive(const int& hid){
this->SetID(hid);
int ps = this->GetFieldValue("PositiveNegative");
bool TRTHitIdHelper::isPositive(const int& hid) const {
int ps = this->GetFieldValue("PositiveNegative", hid);
if (ps ==0 ) return true;
else return false;
}
bool TRTHitIdHelper::isNegative(const int& hid){
this->SetID(hid);
int ps = this->GetFieldValue("PositiveNegative");
}
bool TRTHitIdHelper::isNegative(const int& hid) const {
int ps = this->GetFieldValue("PositiveNegative", hid);
if (ps ==0 ) return false;
else return true;
}
}
// Ring/Wheel
int TRTHitIdHelper::getRingWheel(const int& hid) {
this->SetID(hid);
return this->GetFieldValue("RingWheel");
}
int TRTHitIdHelper::getRingWheel(const int& hid) const {
return this->GetFieldValue("RingWheel", hid);
}
// Phi Sector
int TRTHitIdHelper::getPhiSector(const int& hid) {
this->SetID(hid);
return this->GetFieldValue("PhiSector");
int TRTHitIdHelper::getPhiSector(const int& hid) const {
return this->GetFieldValue("PhiSector", hid);
}
// layer/plane
int TRTHitIdHelper::getLayerPlane(const int& hid) {
this->SetID(hid);
return this->GetFieldValue("LayerPlane");
int TRTHitIdHelper::getLayerPlane(const int& hid) const {
return this->GetFieldValue("LayerPlane", hid);
}
// straw
int TRTHitIdHelper::getStraw(const int& hid) {
this->SetID(hid);
return this->GetFieldValue("Straw");
int TRTHitIdHelper::getStraw(const int& hid) const {
return this->GetFieldValue("Straw", hid);
}
//
// Info packing:
int TRTHitIdHelper::buildHitId(const int BrlECap, const int PosNeg, const int RingWheel,
const int PhiS, const int LayerPlane, const int Straw) {
this->SetID(0);
this->SetFieldValue("BarrelEndcap", BrlECap);
this->SetFieldValue("PositiveNegative", PosNeg);
this->SetFieldValue("RingWheel", RingWheel);
this->SetFieldValue("PhiSector", PhiS);
this->SetFieldValue("LayerPlane", LayerPlane);
this->SetFieldValue("Straw", Straw);
return this->GetID();
const int PhiS, const int LayerPlane, const int Straw) const {
int theID(0);
this->SetFieldValue("BarrelEndcap", BrlECap, theID);
this->SetFieldValue("PositiveNegative", PosNeg, theID);
this->SetFieldValue("RingWheel", RingWheel, theID);
this->SetFieldValue("PhiSector", PhiS, theID);
this->SetFieldValue("LayerPlane", LayerPlane, theID);
this->SetFieldValue("Straw", Straw, theID);
return theID;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment