diff --git a/core/detectors/tof/CbmTofCreateDigiPar.cxx b/core/detectors/tof/CbmTofCreateDigiPar.cxx index 18197fb3cb0679888812a657e5b31bcb22d873b7..d5717619dfa4a4def418ba7cf300c1ed6fbbca17 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 552e6d15b6e471228b0097becb534d9ae3c1cc00..a916cf51f62c51810aba64e66f36f3c1b4ff6e27 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 824eed84cff3fc52d16e6a4c33dcb72bd8b66659..cec301c26a517b261dd9bc0da6810cb122875b36 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