FairShip
Loading...
Searching...
No Matches
ShipTAUMagneticSpectrometer.cxx
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3// Collaboration
4
6
7#include "FairRun.h" // for FairRun
8#include "FairRuntimeDb.h" // for FairRuntimeDb
9#include "TGeoManager.h"
10// #include "FairGeoMedia.h"
11// #include "FairGeoBuilder.h"
12
13#include <iosfwd> // for ostream
14#include <iostream> // for operator<<, basic_ostream, etc
15
16#include "TGeoBBox.h"
17#include "TGeoCompositeShape.h"
18#include "TGeoElement.h"
19#include "TGeoMaterial.h"
20#include "TGeoMedium.h"
21#include "TGeoTube.h"
22#include "TGeoUniformMagField.h"
23#include "TList.h" // for TListIter, TList (ptr only)
24#include "TObjArray.h" // for TObjArray
25#include "TString.h" // for TString
26
27using std::cout;
28using std::endl;
29
31
33 : FairModule("ShipTAUMagneticSpectrometer", "") {}
34
36 const char* name, const Double_t zLS, const Double_t FeL,
37 const Double_t AirL, const Double_t SpectroL, const Double_t GapV,
38 const Double_t DGap, const Double_t MGap, const Double_t mf,
39 const char* Title)
40 : FairModule(name, Title) {
41 zLastSlab = zLS;
42 IronLenght = FeL;
43 AirLenght = AirL;
44 SpectrometerLenght = SpectroL;
45 GapFromVacuum = GapV;
46 DriftGap = DGap;
47 MiddleGap = MGap;
48 MagneticField = mf;
49}
50
52 Int_t NIronSlabs = 12;
53
54 TGeoVolume* top = gGeoManager->GetTopVolume();
55 TGeoMedium* Fe = gGeoManager->GetMedium("iron");
56
57 Double_t d = 0;
58
59 TGeoUniformMagField* magField =
60 new TGeoUniformMagField(0., -MagneticField, 0.);
61 TGeoUniformMagField* RetField =
62 new TGeoUniformMagField(0., MagneticField, 0.);
63
64 TGeoBBox* Layer = new TGeoBBox(225, 400, IronLenght / 2);
65 TGeoVolume* volLayer = new TGeoVolume("volLayer", Layer, Fe);
66 for (Int_t i = 0; i < NIronSlabs; i++) {
67 d = zLastSlab - i * (IronLenght + AirLenght);
68 top->AddNode(volLayer, i, new TGeoTranslation(0, 0, d));
69 }
70 volLayer->SetField(magField);
71
72 cout << "************************************" << endl;
73 cout << " IronLenght+AirLenght = " << IronLenght + AirLenght << endl;
74 cout << " NIronSlabs = " << NIronSlabs << endl;
75 cout << " zLastSlab = " << zLastSlab << endl;
76 cout << d << endl;
77 Double_t d1 =
78 d - (MiddleGap + IronLenght); // z coord of the center of the last layer
79 // of the first spectrometer
80 cout << d1 << endl;
81
82 TGeoVolume* volLayer2 = new TGeoVolume("volLayer2", Layer, Fe);
83 for (Int_t i = 0; i < NIronSlabs; i++) {
84 Double_t d2 = d1 - i * (IronLenght + AirLenght);
85 top->AddNode(volLayer2, i, new TGeoTranslation(0, 0, d2));
86 }
87 volLayer2->SetField(RetField);
88
89 cout << "************************************" << endl;
90}
~ShipTAUMagneticSpectrometer() override