From a897d76b06309ffe24eac9e47b1d1f095403c3cd Mon Sep 17 00:00:00 2001 From: John Chapman <jchapman@cern.ch> Date: Wed, 5 Dec 2018 18:00:24 +0100 Subject: [PATCH] Drop calls which change the internal state of SiHitIdHelper after initialization Former-commit-id: d7b18364a6267d4e1ca5420d4414669decc05092 --- .../InDetSimEvent/SiHitIdHelper.h | 38 ++++++------ .../InDetSimEvent/src/SiHitIdHelper.cxx | 61 ++++++++++--------- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/InnerDetector/InDetSimEvent/InDetSimEvent/SiHitIdHelper.h b/InnerDetector/InDetSimEvent/InDetSimEvent/SiHitIdHelper.h index 2ee9d2092cf..f9843b7d7ce 100755 --- a/InnerDetector/InDetSimEvent/InDetSimEvent/SiHitIdHelper.h +++ b/InnerDetector/InDetSimEvent/InDetSimEvent/SiHitIdHelper.h @@ -1,16 +1,16 @@ /* - 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_SIHITIDHELPER #define INDETSIMEVENT_SIHITIDHELPER // -// 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 SiTracker Geometry // description @@ -26,38 +26,38 @@ class SiHitIdHelper : HitIdHelper { public: // // Access to the helper - static SiHitIdHelper* GetHelper(); + static SiHitIdHelper* GetHelper(); // // Info retrieval: // Pixel or SCT - bool isPixel(const int& hid); - bool isSCT(const int& hid); - + bool isPixel(const int& hid) const; + bool isSCT(const int& hid) const; + // Barrel or Endcap - int getBarrelEndcap(const int& hid); + int getBarrelEndcap(const int& hid) const; // Layer/Disk - int getLayerDisk(const int& hid); - + int getLayerDisk(const int& hid) const; + // eta module - int getEtaModule(const int& hid); + int getEtaModule(const int& hid) const; // phi module& - int getPhiModule(const int& hid); - + int getPhiModule(const int& hid) const; + // side - int getSide(const int& hid); + int getSide(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 - SiHitIdHelper(); + SiHitIdHelper(); // // Initialize the helper, only called by the constructor - void Initialize(); + void Initialize(); }; #endif // INDETSIMEVENT_SIHITIDHELPER diff --git a/InnerDetector/InDetSimEvent/src/SiHitIdHelper.cxx b/InnerDetector/InDetSimEvent/src/SiHitIdHelper.cxx index c2be5e907f1..25506a70acc 100755 --- a/InnerDetector/InDetSimEvent/src/SiHitIdHelper.cxx +++ b/InnerDetector/InDetSimEvent/src/SiHitIdHelper.cxx @@ -61,61 +61,62 @@ void SiHitIdHelper::Initialize() { // Info retrieval: // Pixel or SCT -bool SiHitIdHelper::isPixel(const int& hid){ - this->SetID(hid); - int ps = this->GetFieldValue("PixelSCT"); +bool SiHitIdHelper::isPixel(const int& hid) const +{ + int ps = this->GetFieldValue("PixelSCT", hid); if (ps ==0 ) return true; else return false; } -bool SiHitIdHelper::isSCT(const int& hid){ - this->SetID(hid); - int ps = this->GetFieldValue("PixelSCT"); +bool SiHitIdHelper::isSCT(const int& hid) const +{ + int ps = this->GetFieldValue("PixelSCT", hid); if (ps ==0 ) return false; else return true; } // Barrel or Endcap -int SiHitIdHelper::getBarrelEndcap(const int& hid){ - this->SetID(hid); - return this->GetFieldValue("BarrelEndcap"); +int SiHitIdHelper::getBarrelEndcap(const int& hid) const +{ + return this->GetFieldValue("BarrelEndcap", hid); } // Layer/Disk -int SiHitIdHelper::getLayerDisk(const int& hid) { - this->SetID(hid); - return this->GetFieldValue("LayerDisk"); +int SiHitIdHelper::getLayerDisk(const int& hid) const +{ + return this->GetFieldValue("LayerDisk", hid); } // eta module -int SiHitIdHelper::getEtaModule(const int& hid) { - this->SetID(hid); - return this->GetFieldValue("EtaModule"); +int SiHitIdHelper::getEtaModule(const int& hid) const +{ + return this->GetFieldValue("EtaModule", hid); } // phi module -int SiHitIdHelper::getPhiModule(const int& hid) { - this->SetID(hid); - return this->GetFieldValue("PhiModule"); +int SiHitIdHelper::getPhiModule(const int& hid) const +{ + return this->GetFieldValue("PhiModule", hid); } // side -int SiHitIdHelper::getSide(const int& hid) { - this->SetID(hid); - return this->GetFieldValue("Side"); +int SiHitIdHelper::getSide(const int& hid) const +{ + return this->GetFieldValue("Side", hid); } // // Info packing: int SiHitIdHelper::buildHitId(const int Pixel_SCT, const int BrlECap, const int LayerDisk, - const int etaM, const int phiM, const int side) { - this->SetID(0); - this->SetFieldValue("PixelSCT", Pixel_SCT); - this->SetFieldValue("BarrelEndcap", BrlECap); - this->SetFieldValue("LayerDisk", LayerDisk); - this->SetFieldValue("EtaModule", etaM); - this->SetFieldValue("PhiModule", phiM); - this->SetFieldValue("Side", side); - return this->GetID(); + const int etaM, const int phiM, const int side) const +{ + int theID(0); + this->SetFieldValue("PixelSCT", Pixel_SCT, theID); + this->SetFieldValue("BarrelEndcap", BrlECap, theID); + this->SetFieldValue("LayerDisk", LayerDisk, theID); + this->SetFieldValue("EtaModule", etaM, theID); + this->SetFieldValue("PhiModule", phiM, theID); + this->SetFieldValue("Side", side, theID); + return theID; } -- GitLab