From 15489dde2f89334a407f20965b70e073e17cfb94 Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Fri, 3 Jul 2020 09:54:35 +0200 Subject: [PATCH] Port changes of Tof digitization parameters from mcbm dev branch Port commits 16277 and 16488 from svn development branch --- core/detectors/tof/CbmTofCreateDigiPar.cxx | 15 ++++++++++++++- core/detectors/tof/CbmTofDigiPar.cxx | 1 + core/detectors/tof/CbmTofDigiPar.h | 15 +++++++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/core/detectors/tof/CbmTofCreateDigiPar.cxx b/core/detectors/tof/CbmTofCreateDigiPar.cxx index 18197fb3cb..d5717619df 100644 --- a/core/detectors/tof/CbmTofCreateDigiPar.cxx +++ b/core/detectors/tof/CbmTofCreateDigiPar.cxx @@ -132,6 +132,18 @@ InitStatus CbmTofCreateDigiPar::Init(){ FillCellMapAsciiGeometry(); } + // fill Transformation matrices for each cell + std::map<Int_t, TGeoNode*> nodemap; + for (Int_t iCell=0; iCell<fDigiPar->GetNrOfModules(); iCell++) { + Int_t iAddr=fDigiPar->GetCellId(iCell); + CbmTofCell *fChannelInfo = fDigiPar->GetCell(iAddr); + gGeoManager->FindNode(fChannelInfo->GetX(),fChannelInfo->GetY(),fChannelInfo->GetZ()); + TGeoNode* tGeoNode = gGeoManager->GetCurrentNode(); + nodemap.insert( std::pair<Int_t, TGeoNode*>(iAddr,tGeoNode) ); + LOG(debug) << Form("Digipar for %d, addr 0x%08x: Node=%p",iCell,iAddr,tGeoNode); + } + fDigiPar->SetNodeMap(nodemap); + return kSUCCESS; } // -------------------------------------------------------------------- @@ -473,7 +485,8 @@ void CbmTofCreateDigiPar::FillDigiPar() Int_t Nrcells = (Int_t)fCellMap.size(); LOG(debug) <<"FillDigiPar:: Nr. of tof cells: "<<Nrcells; - + SetParContainers(); + if (NULL == fDigiPar) LOG(fatal) << "Tof Digi Parameter container not available "; fDigiPar->SetNrOfCells(Nrcells); //transfer info to DigiPar TArrayI *CellId = new TArrayI(Nrcells); diff --git a/core/detectors/tof/CbmTofDigiPar.cxx b/core/detectors/tof/CbmTofDigiPar.cxx index 552e6d15b6..a916cf51f6 100644 --- a/core/detectors/tof/CbmTofDigiPar.cxx +++ b/core/detectors/tof/CbmTofDigiPar.cxx @@ -100,3 +100,4 @@ Bool_t CbmTofDigiPar::getParams(FairParamList* l) } return kTRUE; } + diff --git a/core/detectors/tof/CbmTofDigiPar.h b/core/detectors/tof/CbmTofDigiPar.h index 824eed84cf..cec301c26a 100644 --- a/core/detectors/tof/CbmTofDigiPar.h +++ b/core/detectors/tof/CbmTofDigiPar.h @@ -9,6 +9,8 @@ #include <map> // for map #include <FairParGenericSet.h> // for FairParGenericSet +#include <TGeoManager.h> +#include <TNode.h> class CbmTofCell; class FairParamList; @@ -45,8 +47,12 @@ class CbmTofDigiPar : public FairParGenericSet Int_t GetCellId(Int_t i) {return fCellIdArray[i];} - CbmTofCell* GetCell(Int_t i) {return fCellMap[i];} - + CbmTofCell* GetCell(Int_t i) {return fCellMap[i];} + + TGeoNode* GetNode(Int_t iCell) {return fCellNode[iCell];} + void SetNode(Int_t iCell, TGeoNode* tGeoNode) { fCellNode.insert( std::pair<Int_t, TGeoNode*>(iCell,tGeoNode) ); } + void SetNodeMap(std::map<Int_t, TGeoNode*> map) { fCellNode=map; } + private: /** Map of Unique Tof Cell Id to corresponding TofCell **/ @@ -59,8 +65,9 @@ class CbmTofDigiPar : public FairParGenericSet TArrayD fCellDxArray; // Array to hold the unique IDs for all cells TArrayD fCellDyArray; // Array to hold the unique IDs for all cells Int_t fNrOfCells; // Total number of cells - - ClassDef(CbmTofDigiPar,2) + std::map<Int_t, TGeoNode*> fCellNode; + + ClassDef(CbmTofDigiPar,3) }; #endif -- GitLab