EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PndPipe.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PndPipe.cxx
1 /* Generated by Together */
2 #include "PndPipe.h"
3 #include "FairGeoLoader.h"
4 #include "FairGeoInterface.h"
5 #include "PndGeoPipe.h"
6 #include "FairGeoRootBuilder.h"
7 #include "FairGeoNode.h"
8 #include "FairGeoMedia.h"
9 #include "FairRuntimeDb.h"
10 #include "PndGeoPassivePar.h"
11 #include "TObjArray.h"
12 #include "TGeoPcon.h"
13 #include "TGeoVolume.h"
14 #include "TGeoMatrix.h"
15 #include "TGeoManager.h"
16 #include "TGeoCompositeShape.h"
17 #include "FairRun.h"
18 
20 {
21 }
22 
24 {
25 }
26 
27 PndPipe::PndPipe(const char * name, const char * title)
28  : FairModule(name ,title)
29 {
30 }
31 
32 Bool_t PndPipe::CheckIfSensitive(std::string name){
33  // just to get rid of the warrning during run, not need this is a passive element!
34  return kFALSE;
35 }
36 
38 
39  TString fileName=GetGeometryFileName();
40  if (fileName.EndsWith(".root")) {
41  std::cout<< "<I> PndPipe - Using geometry " << fileName <<std::endl;
43  } else if (fileName.EndsWith(".geo")) {
44  std::cout<< "<I> PndPipe - Using geometry " << fileName <<std::endl;
46  } else {
47  std::cout<< "<I> PndPipe - Using default geometry" <<std::endl;
48 
49  FairRun *fRun = FairRun::Instance();
50  FairRuntimeDb *rtdb= fRun->GetRuntimeDb();
51  PndGeoPassivePar* par=(PndGeoPassivePar*)(rtdb->getContainer("PndGeoPassivePar"));
52 
54  FairGeoInterface *GeoInterface =loader->getGeoInterface();
55  FairGeoMedia *Media = GeoInterface->getMedia();
56  FairGeoBuilder *geobuild = loader->getGeoBuilder();
57 
58  // Call materials
59  FairGeoMedium *medVacuum = Media->getMedium("vacuum");
60  FairGeoMedium *medSteel = Media->getMedium("steel");
61  FairGeoMedium *medAlBe = Media->getMedium("Al+Be");
62 
63  Int_t nMedVacuum = geobuild->createMedium(medVacuum);
64  Int_t nMedSteel = geobuild->createMedium(medSteel);
65  Int_t nMedAlBe = geobuild->createMedium(medAlBe);
66 
67  Double_t parPipeLeft[9] = { 0., 360., 2,
68  -200., 7.9, 8.,
69  -32., 7.9, 8.};
70 
71  // The central part is totally filled because of the crossing operations
72  Double_t parPipeCentral[12] = { 0., 360., 3,
73  -32., 0., 8.,
74  -2., 0., .9,
75  23., 0., .9};
76 
77  Double_t parPipeRight[18] = { 0., 360., 5,
78  23., .8873, .9,
79  25., 2.073, 2.1,
80  120., 2.05, 2.1,
81  300.1, 2.85, 2.9,
82  1050., 5.4, 5.5};
83 
84  Double_t parPipeVacuumLeft[9] = { 0., 360., 2,
85  -200., 0., 7.9,
86  -32., 0., 7.9 };
87 
88  Double_t parPipeVacuumCentral[12] = { 0., 360., 3,
89  -32., 0., 7.9,
90  -2., 0., .873,
91  23., 0., .873};
92 
93  Double_t parPipeVacuumRight[18] = { 0., 360., 5,
94  23., 0., .873,
95  25., 0., 2.073,
96  120., 0., 2.05,
97  300.1, 0., 2.85,
98  1050., 0., 5.4};
99 
100 
101  Double_t parPipeTargetDown[27] = { 0., 360., 8,
102  -215., 17.4, 17.5,
103  -183., 17.4, 17.5,
104  -173., 4.5, 4.6,
105  -96., 4.5, 4.6,
106  -95., 2.4, 2.5,
107  -55., 2.4, 2.5,
108  -54., 2.056, 2.1,
109  -15., 1.067, 1.1,};
110 
111  Double_t parPipeTargetCentral[9] = { 0., 360., 2,
112  -15., 0., 1.1,
113  15., 0., 1.1,};
114 
115  Double_t parPipeTargetUp[27] = { 0., 360., 8,
116  15., 1.067, 1.1,
117  54., 2.056, 2.1,
118  55., 2.4, 2.5,
119  95., 2.4, 2.5,
120  96., 4.5, 4.6,
121  145., 4.5, 4.6,
122  155., 14.4, 14.5,
123  215., 14.4, 14.5};
124 
125  Double_t parPipeVacuumTargetDown[27] = { 0., 360., 8,
126  -215., 0., 17.4,
127  -183., 0., 17.4,
128  -173., 0., 4.5,
129  -96., 0., 4.5,
130  -95., 0., 2.4,
131  -55., 0., 2.4,
132  -54., 0., 2.056,
133  -15., 0., 1.067};
134 
135  Double_t parPipeVacuumTargetCentral[9] = { 0., 360., 2,
136  -15., 0., 1.067,
137  15., 0., 1.067,};
138 
139  Double_t parPipeVacuumTargetUp[27] = { 0., 360., 8,
140  15., 0., 1.067,
141  54., 0., 2.056,
142  55., 0., 2.4,
143  95., 0., 2.4,
144  96., 0., 4.5,
145  145., 0., 4.5,
146  155., 0., 14.4,
147  215., 0., 14.4};
148 
149  TGeoPcon *pipeLeft = new TGeoPcon(parPipeLeft);
150  TGeoPcon *pipeCentral = new TGeoPcon(parPipeCentral);pipeCentral->SetName("PIPE_CN");
151  TGeoPcon *pipeRight = new TGeoPcon(parPipeRight);
152  TGeoPcon *pipeTargetDown = new TGeoPcon(parPipeTargetDown);
153  TGeoPcon *pipeTargetCentral = new TGeoPcon(parPipeTargetCentral); pipeTargetCentral->SetName("TRG_CN");
154  TGeoPcon *pipeTargetUp = new TGeoPcon(parPipeTargetUp);
155 
156  TGeoPcon *pipeVacuumLeft = new TGeoPcon(parPipeVacuumLeft);
157  TGeoPcon *pipeVacuumCentral = new TGeoPcon(parPipeVacuumCentral); pipeVacuumCentral->SetName("PIPEV_CN");
158  TGeoPcon *pipeVacuumRight = new TGeoPcon(parPipeVacuumRight);
159  TGeoPcon *pipeVacuumTargetDown = new TGeoPcon(parPipeVacuumTargetDown);
160  TGeoPcon *pipeVacuumTargetCentral = new TGeoPcon(parPipeVacuumTargetCentral); pipeVacuumTargetCentral->SetName("TRGV_CN");
161  TGeoPcon *pipeVacuumTargetUp = new TGeoPcon(parPipeVacuumTargetUp);
162 
163  TGeoRotation *r1 = new TGeoRotation("r1");
164  r1->RotateX(90.);
165  r1->RegisterYourself();
166 
167  TGeoCompositeShape *pipeCross = new TGeoCompositeShape("pipeCross", "(PIPE_CN+TRG_CN:r1) - (PIPEV_CN+TRGV_CN:r1)");
168  TGeoCompositeShape *pipeVacuumCross = new TGeoCompositeShape("pipeVacuumCross", "PIPEV_CN+TRGV_CN:r1");
169 
170 
171  TGeoVolume *volPipeLeft = new TGeoVolume("PipeLeft", pipeLeft, gGeoManager->GetMedium("steel"));
172  TGeoVolume *volPipeCross = new TGeoVolume("PipeCross", pipeCross, gGeoManager->GetMedium("Al+Be"));
173  TGeoVolume *volPipeRight = new TGeoVolume("PipeRight", pipeRight, gGeoManager->GetMedium("steel"));
174  TGeoVolume *volPipeTargetUp = new TGeoVolume("PipeTargetUp", pipeTargetUp, gGeoManager->GetMedium("steel"));
175  TGeoVolume *volPipeTargetDown = new TGeoVolume("PipeTargetDown", pipeTargetDown, gGeoManager->GetMedium("steel"));
176 
177  TGeoVolume *volPipeVacuumLeft = new TGeoVolume("PipeVacuumLeft", pipeVacuumLeft, gGeoManager->GetMedium("vacuum"));
178  TGeoVolume *volPipeVacuumCross = new TGeoVolume("PipeVacuumCross", pipeVacuumCross, gGeoManager->GetMedium("vacuum"));
179  TGeoVolume *volPipeVacuumRight = new TGeoVolume("PipeVacuumRight", pipeVacuumRight, gGeoManager->GetMedium("vacuum"));
180  TGeoVolume *volPipeVacuumTargetUp = new TGeoVolume("PipeVacuumTargetUp", pipeVacuumTargetUp, gGeoManager->GetMedium("vacuum"));
181  TGeoVolume *volPipeVacuumTargetDown = new TGeoVolume("PipeVacuumTargetDown", pipeVacuumTargetDown, gGeoManager->GetMedium("vacuum"));
182 
183  TGeoRotation rot;
184  rot.RotateX(90.);
185 
186  TGeoVolume *beamPipe = new TGeoVolumeAssembly("BeamPipe");
187  beamPipe->AddNode(volPipeLeft, 0);
188  beamPipe->AddNode(volPipeRight, 0);
189  beamPipe->AddNode(volPipeVacuumLeft, 0);
190  beamPipe->AddNode(volPipeVacuumRight, 0);
191  beamPipe->AddNode(volPipeTargetUp, 0, new TGeoRotation(rot));
192  beamPipe->AddNode(volPipeTargetDown, 0, new TGeoRotation(rot));
193  beamPipe->AddNode(volPipeVacuumTargetUp, 0, new TGeoRotation(rot));
194  beamPipe->AddNode(volPipeVacuumTargetDown, 0, new TGeoRotation(rot));
195  beamPipe->AddNode(volPipeCross, 0);
196  beamPipe->AddNode(volPipeVacuumCross, 0);
197 
198  TGeoVolume *cave = gGeoManager->GetTopVolume();
199  cave->AddNode(beamPipe, 1);
200 
201  }
202 
203 }
204 
206