CbmRoot
Loading...
Searching...
No Matches
CbmMagnet.cxx
Go to the documentation of this file.
1/* Copyright (C) 2006-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig, Volker Friese, Denis Bertini [committer] */
4
5/* Generated by Together */
6
7#include "CbmMagnet.h"
8
9#include <TString.h>
10
11//#include "TList.h"
12//#include "TObjArray.h"
13#include "TGeoMatrix.h"
14
15CbmMagnet::CbmMagnet() : FairModule("CbmMagnet", "CbmMagnet"), frot(NULL), fposrot(NULL) {}
16
17CbmMagnet::CbmMagnet(const char* name, const char* title, Double_t px, Double_t py, Double_t pz, Double_t rx,
18 Double_t ry, Double_t rz)
19 : FairModule(name, title)
20 , frot(new TGeoRotation("", rx, ry, rz))
21 , fposrot(new TGeoCombiTrans(px, py, pz, frot))
22{
23}
24
26
28{
29 TString fileName = GetGeometryFileName();
30
31 if (fileName.EndsWith(".root")) {
32
33 LOG(info) << "Constructing MAGNET from ROOT file " << fileName.Data();
34
35 // Quick and dirty fix: The top magnet volume of magnet_v18a is centred
36 // at the origin of the GCS. It has to be shifted by 40 cm downstream
37 // (centre coordinates (0, 0, 40) cm) in order to be at the proper place.
38 // TODO: We have to urgently find a convention, such that this is not arbitrary.
39 if (fileName.Contains("magnet_v18a.geo.root")) {
40 LOG(info) << "Magnet with shift 40 cm";
41 TGeoTranslation* trans = new TGeoTranslation();
42 trans->SetTranslation(0., 0., 40.);
43 ConstructRootGeometry(trans);
44 } //? v18a
45
46 // Similar fix for v18b (for muon setup, without field clamps). This
47 // geometry is internally shifted by 80 cm downstream (along z). It has
48 // thus to be shifted by -40 cm in z to be in the proper position.
49 else if (fileName.Contains("magnet_v18b.geo.root")) {
50 LOG(info) << "Constructing magnet with shift -40 cm";
51 TGeoTranslation* trans = new TGeoTranslation();
52 trans->SetTranslation(0., 0., -40.);
53 ConstructRootGeometry(trans);
54 } //? v18b
55
56 else
57 ConstructRootGeometry(); //? not v18a or v18b; no explicite shift
58 }
59 else if (fileName.EndsWith(".gdml")) {
60 LOG(info) << "Constructing MAGNET from GDML file " << fileName.Data();
61 ConstructGDMLGeometry(fposrot);
62 }
63 else {
64 LOG(fatal) << "Geometry format of MAGNET file " << fileName.Data() << " not supported.";
65 }
66}
67
68Bool_t CbmMagnet::IsSensitive(const std::string&)
69{
70 // There are no sensitive volumes in the magnet
71 return kFALSE;
72}
73
74Bool_t CbmMagnet::CheckIfSensitive(std::string name) { return IsSensitive(name); }
75
76
ClassImp(CbmConverterManager)
bool Bool_t
virtual ~CbmMagnet()
Definition CbmMagnet.cxx:25
TGeoRotation * frot
Definition CbmMagnet.h:25
TGeoCombiTrans * fposrot
Definition CbmMagnet.h:26
virtual void ConstructGeometry()
Definition CbmMagnet.cxx:27
Bool_t CheckIfSensitive(std::string name)
Definition CbmMagnet.cxx:74
virtual Bool_t IsSensitive(const std::string &name)
Definition CbmMagnet.cxx:68