FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairPipe.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 /* Generated by Together */
9 #include "FairPipe.h"
10 
11 #include "FairGeoBuilder.h" // for FairGeoBuilder
12 #include "FairGeoInterface.h" // for FairGeoInterface
13 #include "FairGeoLoader.h" // for FairGeoLoader
14 #include "FairGeoMedia.h" // for FairGeoMedia
15 
16 #include <TGeoCompositeShape.h> // for TGeoCompositeShape
17 #include <TGeoManager.h> // for TGeoManager, gGeoManager
18 #include <TGeoMatrix.h> // for TGeoRotation
19 #include <TGeoPcon.h> // for TGeoPcon
20 #include <TGeoVolume.h> // for TGeoVolume, etc
21 
22 class FairGeoMedium;
23 
25 
27  : FairModule("FairPipe", "")
28 {}
29 
30 FairPipe::FairPipe(const char* name, const char* title)
31  : FairModule(name, title)
32 {}
33 
34 FairPipe::FairPipe(const FairPipe& rhs)
35  : FairModule(rhs)
36 {}
37 
39 {
40  /*
41  FairRun* fRun = FairRun::Instance();
42  FairRuntimeDb* rtdb= fRun->GetRuntimeDb();
43  FairGeoPassivePar* par=(FairGeoPassivePar*)(rtdb->getContainer("FairGeoPassivePar"));
44 */
45 
47  FairGeoInterface* GeoInterface = loader->getGeoInterface();
48  FairGeoMedia* Media = GeoInterface->getMedia();
49  FairGeoBuilder* geobuild = loader->getGeoBuilder();
50 
51  // Call materials
52  FairGeoMedium* medVacuum = Media->getMedium("vacuum");
53  FairGeoMedium* medSteel = Media->getMedium("steel");
54  FairGeoMedium* medAlBe = Media->getMedium("Al+Be");
55 
56  /*
57  Int_t nMedVacuum = geobuild->createMedium(medVacuum);
58  Int_t nMedSteel = geobuild->createMedium(medSteel);
59  Int_t nMedAlBe = geobuild->createMedium(medAlBe);
60 */
61  geobuild->createMedium(medVacuum);
62  geobuild->createMedium(medSteel);
63  geobuild->createMedium(medAlBe);
64 
65  Double_t parPipeLeft[9] = {0., 360., 2, -200., 7.9, 8., -32., 7.9, 8.};
66 
67  // The central part is totally filled because of the crossing operations
68  Double_t parPipeCentral[12] = {0., 360., 3, -32., 0., 8., -2., 0., .9, 20., 0., .9};
69 
70  Double_t parPipeRight[18] = {
71  0., 360., 5, 20., .8873, .9, 22., 2.073, 2.1, 120., 2.05, 2.1, 300.1, 2.85, 2.9, 1050., 5.4, 5.5};
72 
73  Double_t parPipeVacuumLeft[9] = {0., 360., 2, -200., 0., 7.9, -32., 0., 7.9};
74 
75  Double_t parPipeVacuumCentral[12] = {0., 360., 3, -32., 0., 7.9, -2., 0., .873, 20., 0., .873};
76 
77  Double_t parPipeVacuumRight[18] = {
78  0., 360., 5, 20., 0., .873, 22., 0., 2.073, 120., 0., 2.05, 300.1, 0., 2.85, 1050., 0., 5.4};
79 
80  Double_t parPipeTargetDown[27] = {
81  0., 360., 8, -215., 17.4, 17.5, -183., 17.4, 17.5, -173., 4.5, 4.6, -96., 4.5,
82  4.6, -95., 2.4, 2.5, -55., 2.4, 2.5, -54., 2.056, 2.1, -15., 1.067, 1.1,
83  };
84 
85  Double_t parPipeTargetCentral[9] = {
86  0.,
87  360.,
88  2,
89  -15.,
90  0.,
91  1.1,
92  15.,
93  0.,
94  1.1,
95  };
96 
97  Double_t parPipeTargetUp[27] = {0., 360., 8, 15., 1.067, 1.1, 54., 2.056, 2.1, 55., 2.4, 2.5, 95., 2.4,
98  2.5, 96., 4.5, 4.6, 145., 4.5, 4.6, 155., 14.4, 14.5, 215., 14.4, 14.5};
99 
100  Double_t parPipeVacuumTargetDown[27] = {0., 360., 8, -215., 0., 17.4, -183., 0., 17.4,
101  -173., 0., 4.5, -96., 0., 4.5, -95., 0., 2.4,
102  -55., 0., 2.4, -54., 0., 2.056, -15., 0., 1.067};
103 
104  Double_t parPipeVacuumTargetCentral[9] = {
105  0.,
106  360.,
107  2,
108  -15.,
109  0.,
110  1.067,
111  15.,
112  0.,
113  1.067,
114  };
115 
116  Double_t parPipeVacuumTargetUp[27] = {0., 360., 8, 15., 0., 1.067, 54., 0., 2.056, 55., 0., 2.4, 95., 0.,
117  2.4, 96., 0., 4.5, 145., 0., 4.5, 155., 0., 14.4, 215., 0., 14.4};
118 
119  TGeoPcon* pipeLeft = new TGeoPcon(parPipeLeft);
120  TGeoPcon* pipeCentral = new TGeoPcon(parPipeCentral);
121  pipeCentral->SetName("PIPE_CN");
122  TGeoPcon* pipeRight = new TGeoPcon(parPipeRight);
123  TGeoPcon* pipeTargetDown = new TGeoPcon(parPipeTargetDown);
124  TGeoPcon* pipeTargetCentral = new TGeoPcon(parPipeTargetCentral);
125  pipeTargetCentral->SetName("TRG_CN");
126  TGeoPcon* pipeTargetUp = new TGeoPcon(parPipeTargetUp);
127 
128  TGeoPcon* pipeVacuumLeft = new TGeoPcon(parPipeVacuumLeft);
129  TGeoPcon* pipeVacuumCentral = new TGeoPcon(parPipeVacuumCentral);
130  pipeVacuumCentral->SetName("PIPEV_CN");
131  TGeoPcon* pipeVacuumRight = new TGeoPcon(parPipeVacuumRight);
132  TGeoPcon* pipeVacuumTargetDown = new TGeoPcon(parPipeVacuumTargetDown);
133  TGeoPcon* pipeVacuumTargetCentral = new TGeoPcon(parPipeVacuumTargetCentral);
134  pipeVacuumTargetCentral->SetName("TRGV_CN");
135  TGeoPcon* pipeVacuumTargetUp = new TGeoPcon(parPipeVacuumTargetUp);
136 
137  TGeoRotation* r1 = new TGeoRotation("r1");
138  r1->RotateX(90.);
139  r1->RegisterYourself();
140 
141  TGeoCompositeShape* pipeCross = new TGeoCompositeShape("pipeCross", "(PIPE_CN+TRG_CN:r1) - (PIPEV_CN+TRGV_CN:r1)");
142  TGeoCompositeShape* pipeVacuumCross = new TGeoCompositeShape("pipeVacuumCross", "PIPEV_CN+TRGV_CN:r1");
143 
144  TGeoVolume* volPipeLeft = new TGeoVolume("PipeLeft", pipeLeft, gGeoManager->GetMedium("steel"));
145  TGeoVolume* volPipeCross = new TGeoVolume("PipeCross", pipeCross, gGeoManager->GetMedium("Al+Be"));
146  TGeoVolume* volPipeRight = new TGeoVolume("PipeRight", pipeRight, gGeoManager->GetMedium("steel"));
147  TGeoVolume* volPipeTargetUp = new TGeoVolume("PipeTargetUp", pipeTargetUp, gGeoManager->GetMedium("steel"));
148  TGeoVolume* volPipeTargetDown = new TGeoVolume("PipeTargetDown", pipeTargetDown, gGeoManager->GetMedium("steel"));
149 
150  TGeoVolume* volPipeVacuumLeft = new TGeoVolume("PipeVacuumLeft", pipeVacuumLeft, gGeoManager->GetMedium("vacuum"));
151  TGeoVolume* volPipeVacuumCross =
152  new TGeoVolume("PipeVacuumCross", pipeVacuumCross, gGeoManager->GetMedium("vacuum"));
153  TGeoVolume* volPipeVacuumRight =
154  new TGeoVolume("PipeVacuumRight", pipeVacuumRight, gGeoManager->GetMedium("vacuum"));
155  TGeoVolume* volPipeVacuumTargetUp =
156  new TGeoVolume("PipeVacuumTargetUp", pipeVacuumTargetUp, gGeoManager->GetMedium("vacuum"));
157  TGeoVolume* volPipeVacuumTargetDown =
158  new TGeoVolume("PipeVacuumTargetDown", pipeVacuumTargetDown, gGeoManager->GetMedium("vacuum"));
159 
160  TGeoRotation rot;
161  rot.RotateX(90.);
162 
163  TGeoVolume* beamPipe = new TGeoVolumeAssembly("BeamPipe");
164  beamPipe->AddNode(volPipeLeft, 0);
165  beamPipe->AddNode(volPipeRight, 0);
166  beamPipe->AddNode(volPipeVacuumLeft, 0);
167  beamPipe->AddNode(volPipeVacuumRight, 0);
168  beamPipe->AddNode(volPipeTargetUp, 0, new TGeoRotation(rot));
169  beamPipe->AddNode(volPipeTargetDown, 0, new TGeoRotation(rot));
170  beamPipe->AddNode(volPipeVacuumTargetUp, 0, new TGeoRotation(rot));
171  beamPipe->AddNode(volPipeVacuumTargetDown, 0, new TGeoRotation(rot));
172  beamPipe->AddNode(volPipeCross, 0);
173  beamPipe->AddNode(volPipeVacuumCross, 0);
174 
175  TGeoVolume* cave = gGeoManager->GetTopVolume();
176  cave->AddNode(beamPipe, 1);
177 }
178 
179 FairModule* FairPipe::CloneModule() const { return new FairPipe(*this); }
180 
FairGeoMedia * getMedia()
virtual void ConstructGeometry()
Definition: FairPipe.cxx:38
FairGeoMedium * getMedium(const char *)
FairGeoInterface * getGeoInterface()
Definition: FairGeoLoader.h:34
static FairGeoLoader * Instance()
ClassImp(FairEventBuilder)
FairPipe()
Definition: FairPipe.cxx:26
virtual FairModule * CloneModule() const
Definition: FairPipe.cxx:179
FairGeoBuilder * getGeoBuilder()
Definition: FairGeoLoader.h:35
virtual ~FairPipe()
Definition: FairPipe.cxx:24
virtual Int_t createMedium(FairGeoMedium *)=0