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