CbmRoot
Loading...
Searching...
No Matches
CbmTrdParModGeo.cxx
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Alexandru Bercuci, Florian Uhlig [committer] */
4
5#include "CbmTrdParModGeo.h"
6
7#include <Logger.h>
8
9#include <TGeoBBox.h> // for TGeoBBox
10#include <TGeoMatrix.h> // for TGeoHMatrix
11#include <TGeoPhysicalNode.h> // for TGeoPhysicalNode
12
13#include <string.h> // for memcpy, memset
14
15//___________________________________________________________________
16CbmTrdParModGeo::CbmTrdParModGeo(const char* name, const char* title) : CbmTrdParMod(name, title), fNode(nullptr)
17{
18 // AB : Do not initialize the physical node (alignment aware) at this point as the alignment is not applied yet
19 // fNode = new TGeoPhysicalNode(title);
20}
21
22//___________________________________________________________________
24
25//___________________________________________________________________
26Double_t CbmTrdParModGeo::GetDX() const { return ((TGeoBBox*) fNode->GetShape())->GetDX(); }
27
28//___________________________________________________________________
29Double_t CbmTrdParModGeo::GetDY() const { return ((TGeoBBox*) fNode->GetShape())->GetDY(); }
30
31//___________________________________________________________________
32Double_t CbmTrdParModGeo::GetDZ() const { return ((TGeoBBox*) fNode->GetShape())->GetDZ(); }
33
34//_______________________________________________________________________________
35void CbmTrdParModGeo::LocalToMaster(Double_t in[3], Double_t out[3]) const
36{
37 if (!fNode) return;
38 fNode->GetMatrix()->LocalToMaster(in, out);
39}
40
41//___________________________________________________________________
42void CbmTrdParModGeo::GetXYZ(Double_t xyz[3]) const
43{
44 memset(xyz, 0, 3 * sizeof(Double_t));
45 Double_t gxyz[3];
46 fNode->GetMatrix()->LocalToMaster(xyz, gxyz);
47 memcpy(xyz, gxyz, 3 * sizeof(Double_t));
48}
49
50//___________________________________________________________________
52{
53 if (fNode) {
54 LOG(warn) << "CbmTrdParModGeo::SetNode: Aligned info already loaded. Updating";
55 delete fNode;
56 }
57 fNode = new TGeoPhysicalNode(GetTitle());
58 if (!fNode) return false;
59
60 LOG(debug) << GetName() << " : " << GetTitle();
61 // fNode->GetMatrix()->Print();
62
63 return true;
64}
65
ClassImp(CbmConverterManager)
Definition of geometry for one TRD module.
virtual Double_t GetDY() const
virtual Double_t GetDX() const
virtual ~CbmTrdParModGeo()
TGeoPhysicalNode * fNode
geometrical data for the module
virtual Double_t GetDZ() const
CbmTrdParModGeo(const char *name="CbmTrdParModGeo", const char *title="TRD module geometry")
virtual void LocalToMaster(Double_t in[3], Double_t out[3]) const
virtual void GetXYZ(Double_t xyz[3]) const
Definition of generic parameters for one TRD module.