From ce32d13ab38a2eead9cf75e48ceaf43ad03659ba Mon Sep 17 00:00:00 2001 From: praisig <praisig@ikf.uni-frankfurt.de> Date: Wed, 16 Sep 2020 15:14:39 +0200 Subject: [PATCH] Improve performance by initializing the channel vector in the header Instead of initilazing the spadic channel vector with each function call, it is now initialized as member variable in the header. --- core/detectors/trd/CbmTrdParSpadic.cxx | 6 ++---- core/detectors/trd/CbmTrdParSpadic.h | 6 +++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/detectors/trd/CbmTrdParSpadic.cxx b/core/detectors/trd/CbmTrdParSpadic.cxx index ce42360dbf..a3edb4c628 100644 --- a/core/detectors/trd/CbmTrdParSpadic.cxx +++ b/core/detectors/trd/CbmTrdParSpadic.cxx @@ -189,10 +189,8 @@ Int_t CbmTrdParSpadic::GetAsicChAddress(const Int_t asicChannel) { Int_t address = -1; // Channel mapping based on channels 0-15 on the odd eLink and 16-31 on the even eLink, check setting in the unpacker for your dataset - std::vector<Int_t> chvec = {23, 7, 22, 6, 21, 19, 5, 20, 18, 4, 3, - 17, 16, 2, 1, 0, 31, 30, 29, 15, 14, 28, - 27, 13, 11, 26, 12, 10, 25, 9, 24, 8}; - address = chvec.at(asicChannel); + + address = fVecSpadicChannels.at(asicChannel); return address; } diff --git a/core/detectors/trd/CbmTrdParSpadic.h b/core/detectors/trd/CbmTrdParSpadic.h index 4d70a2b716..c99f97e3e1 100644 --- a/core/detectors/trd/CbmTrdParSpadic.h +++ b/core/detectors/trd/CbmTrdParSpadic.h @@ -78,8 +78,12 @@ private: static Double_t fgSizeY; ///< SPADIC half size in y [cm] static Double_t fgSizeZ; ///< SPADIC half size in z [cm] + const std::vector<Int_t> fVecSpadicChannels = { + 23, 7, 22, 6, 21, 19, 5, 20, 18, 4, 3, 17, 16, 2, 1, 0, + 31, 30, 29, 15, 14, 28, 27, 13, 11, 26, 12, 10, 25, 9, 24, 8}; - ClassDef(CbmTrdParSpadic, 1) // Definition of SPADIC ASIC parameters + + ClassDef(CbmTrdParSpadic, 2) // Definition of SPADIC ASIC parameters }; #endif -- GitLab