CbmRoot
Loading...
Searching...
No Matches
CbmMustModule.cxx
Go to the documentation of this file.
1/* Copyright (C) 2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Radoslaw Karabowicz [committer] */
4
14#include "CbmMustModule.h"
15
16#include "CbmMustAddress.h"
17
18#include <Logger.h> // for LOG
19
20#include <string>
21
22// ----- Default constructor -------------------------------------------
24// -------------------------------------------------------------------------
25
26
27// ----- Standard constructor ------------------------------------------
28CbmMustModule::CbmMustModule(int iStation, int iLayer, int iModule, TVector3 position, TVector3 direction)
29 : TObject()
30 , fAddress(CbmMustAddress::GetAddress(iStation, iLayer, iModule))
31 , fPosition(position)
32 , fDirection(direction)
33{
34}
35// -------------------------------------------------------------------------
36
38{
39 SortTubes();
40 fIsInitialized = true;
41 return true;
42}
43
45{
46 if (!fIsInitialized) return nullptr;
47 return fTubes.at(CbmMustAddress::GetTubeIndex(address));
48}
49
51{
52 for (const auto tempTube : fTubes) {
53 if (tempTube->GetTubeIndex() == tubeIndex) return tempTube;
54 }
55 return nullptr;
56}
57
59{
60 if (fIsInitialized) return false;
61 for (const auto tempTube : fTubes) {
62 if (tempTube->GetTubeIndex() == tube->GetTubeIndex()) return false;
63 }
64 fTubes.push_back(tube);
65 return true;
66}
67
69{
70 LOG(info) << " Module " << fAddress << " (@ (" << fPosition.X() << "," << fPosition.Y() << "," << fPosition.Z()
71 << ") -> (" << fDirection.X() << "," << fDirection.Y() << "," << fDirection.Z() << "):";
72 std::string tubeString(fTubes.size(), '.');
73 std::string tubeNumbDec(fTubes.size(), '0');
74 std::string tubeNumbOne(fTubes.size(), '0');
75 int iobj{0};
76 for (const auto tempTube : fTubes) {
77 // if ( iobj == 0 )
78 LOG(info) << " Tube " << tempTube->GetAddress() << " @ " << tempTube->GetPosition().X() << ","
79 << tempTube->GetPosition().Y() << "," << tempTube->GetPosition().Z() << " -> "
80 << tempTube->GetWireDirection().X() << "," << tempTube->GetWireDirection().Y() << ","
81 << tempTube->GetWireDirection().Z();
82 tubeNumbDec[iobj] = char(tempTube->GetTubeIndex() / 10 + 48);
83 tubeNumbOne[iobj] = char(tempTube->GetTubeIndex() % 10 + 48);
84 tubeString[tempTube->GetTubeIndex() - 1] = '*';
85 iobj++;
86 }
87 LOG(info) << " Tubes " << tubeString;
88 LOG(info) << " - " << tubeNumbDec;
89 LOG(info) << " - " << tubeNumbOne;
90}
Interface class to unique address for the MuST.
static int32_t GetTubeIndex(int32_t address)
bool AddTube(CbmMustTube *tube)
CbmMustTube * GetTubeByIndex(int tubeIndex)
TVector3 fDirection
TVector3 fPosition
uint32_t GetAddress() const
CbmMustTube * GetTubeByAddress(uint32_t address) const
std::vector< CbmMustTube * > fTubes
uint32_t fAddress
int GetTubeIndex() const
Definition CbmMustTube.h:35