4 #include "TClonesArray.h"
5 #include "TLorentzVector.h"
11 #include "TGeoCompositeShape.h"
12 #include "TGeoMatrix.h"
13 #include "TGeoManager.h"
14 #include "TVirtualMC.h"
16 #include "FairVolume.h"
17 #include "FairGeoMedia.h"
18 #include "FairGeoInterface.h"
19 #include "FairGeoLoader.h"
20 #include "FairGeoBuilder.h"
21 #include "FairRuntimeDb.h"
23 #include "FairModule.h"
36 vname = vname.Strip();
37 TGeoVolume* vcave =
gGeoManager->FindVolumeFast(vname.Data());
40 TGeoVolume* mag =
new TGeoVolumeAssembly(
"PndMdtMagnet");
41 TGeoVolume* magBarrel =
new TGeoVolumeAssembly(
"PndMdtMagnetBarrel");
42 TGeoVolume* magEndcap =
new TGeoVolumeAssembly(
"PndMdtMagnetEndcap");
46 Text_t longbuffer[250];
52 TGeoRotation tRot, tRotSlice;
55 FairGeoLoader*
geoLoad = FairGeoLoader::Instance();
56 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
57 FairGeoMedia *
Media = geoFace->getMedia();
58 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
59 FairGeoMedium *medmdtiron = Media->getMedium(
"iron");
60 geobuild->createMedium(medmdtiron);
80 for(
int i=0;
i<13;
i++)
138 mpx = (my - mpz)*(
TMath::Tan(TMath::ACos(-1.0)/8.0));
139 sprintf(buffer,
"mbox%i",
i);
140 TGeoBBox* mbox =
new TGeoBBox(buffer,mpx/10.0,mpy/10.0,mpz/10.0,0);
141 TGeoTranslation* mtgt =
new TGeoTranslation(0.0,mz0/10.0,0.0);
142 mtgt->SetName(
"mtgt");
143 mtgt->RegisterYourself();
147 for(
int j=0; j<8; j++)
153 sprintf(buffer,
"mbox%i:mtgt-mhuptub",
i);
157 if (j==0) sprintf(buffer,
"mbox%i:mtgt-mhupbox",
i);
158 if (j==4) sprintf(buffer,
"mbox%i:mtgt-mhdotub2",
i);
161 TGeoCompositeShape* mtgcs =
new TGeoCompositeShape(
"mtgcs",buffer);
166 sprintf(buffer,
"magnet%i",300+8*
i+j);
167 TGeoVolume* volume =
new TGeoVolume(buffer,mtgcs,
gGeoManager->GetMedium(
"iron"));
168 volume->SetLineColor(3);
169 magBarrel->AddNode(volume,300+8*
i+j,
new TGeoCombiTrans(mx0/10.0,my0/10.0,0.0,
new TGeoRotation(tRot)));
173 if(j==2 || j==6) k=j-2;
177 sprintf(buffer,
"magnet%i",300+8*
i+j);
178 TGeoVolume* volume =
new TGeoVolume(buffer,mbox,
gGeoManager->GetMedium(
"iron"));
179 volume->SetLineColor(3);
180 magBarrel->AddNode(volume,300+8*
i+j,
new TGeoCombiTrans(mx0/10.0,my0/10.0,mz0/10.0,
new TGeoRotation(tRot)));
189 TGeoRotation magtgrl;
190 magtgrl.RotateY(0.0);
191 TGeoRotation* magtgr0 =
new TGeoRotation(magtgrl);
192 magtgr0->SetName(
"magtgr0");
193 magtgr0->RegisterYourself();
194 magtgrl.RotateY(45.0);
195 TGeoRotation* magtgr1 =
new TGeoRotation(magtgrl);
196 magtgr1->SetName(
"magtgr1");
197 magtgr1->RegisterYourself();
198 magtgrl.RotateY(45.0);
199 TGeoRotation* magtgr2 =
new TGeoRotation(magtgrl);
200 magtgr2->SetName(
"magtgr2");
201 magtgr2->RegisterYourself();
202 magtgrl.RotateY(45.0);
203 TGeoRotation* magtgr3 =
new TGeoRotation(magtgrl);
204 magtgr3->SetName(
"magtgr3");
205 magtgr3->RegisterYourself();
206 magtgrl.RotateY(45.0);
207 TGeoRotation* magtgr4 =
new TGeoRotation(magtgrl);
208 magtgr4->SetName(
"magtgr4");
209 magtgr4->RegisterYourself();
210 magtgrl.RotateY(45.0);
211 TGeoRotation* magtgr5 =
new TGeoRotation(magtgrl);
212 magtgr5->SetName(
"magtgr5");
213 magtgr5->RegisterYourself();
214 magtgrl.RotateY(45.0);
215 TGeoRotation* magtgr6 =
new TGeoRotation(magtgrl);
216 magtgr6->SetName(
"magtgr6");
217 magtgr6->RegisterYourself();
218 magtgrl.RotateY(45.0);
219 TGeoRotation* magtgr7 =
new TGeoRotation(magtgrl);
220 magtgr7->SetName(
"magtgr7");
221 magtgr7->RegisterYourself();
229 TGeoTranslation* magtgt =
new TGeoTranslation(0.0,0.0,my/(-10.0));
230 magtgt->SetName(
"magtgt");
231 magtgt->RegisterYourself();
232 new TGeoTrd2(
"magtrd",dx1/10.0,dx2/10.0,dy1/10.0,dy2/10.0,dz/10.0);
234 for(
int i=0;
i<5;
i++)
254 for(
int j=0; j<8; j++)
256 sprintf(buffer,
"magtgcs%i",(8*
i)+j);
257 sprintf(longbuffer,
"magtrd:magtgt-mhbox%i:magtgr%i",
i+2,j);
258 TGeoCompositeShape* magtgcs =
new TGeoCompositeShape(buffer,longbuffer);
259 sprintf(buffer,
"magnet%i",500+8*
i+j);
260 TGeoVolume* volume =
new TGeoVolume(buffer,magtgcs,
gGeoManager->GetMedium(
"iron"));
261 volume->SetLineColor(3);
262 magEndcap->AddNode(volume,500+8*
i+j,
new TGeoCombiTrans(0.0,0.0,mz0/10.0,
new TGeoRotation(tRot)));
267 mag->AddNode(magBarrel,1);
268 mag->AddNode(magEndcap,1);
269 vcave->AddNode(mag,1);
#define PndMdtMagnet_L100
#define PndMdtMagnet_L104
#define PndMdtMagnet_L111
#define PndMdtMagnet_H02_V
#define PndMdtMagnet_L108
#define PndMdtMagnet_L102
#define PndMdtMagnet_L200
#define PndMdtMagnet_H05_H
#define PndMdtMagnet_H01_Length
#define PndMdtMagnet_H06_H
#define PndMdtMagnet_H03_H
#define PndMdtMagnet_H02_H
#define PndMdtMagnet_L203
#define PndMdtMagnet_H_U_R
TGeoManager * gGeoManager
#define PndMdtMagnet_L202
#define PndMdtMagnet_L107
#define PndMdtMagnet_H05_V
#define PndMdtMagnet_H_U_Z
#define PndMdtMagnet_H04_H
FairGeoBuilder * geobuild
#define PndMdtMagnet_Barrel_Displacement
#define PndMdtMagnet_L110
#define PndMdtMagnet_H_U_X
#define PndMdtMagnet_Endcap_Height
#define PndMdtMagnet_L101
#define PndMdtMagnet_L201
#define PndMdtMagnet_H_D_R1
#define PndMdtMagnet_Barrel_Length
#define PndMdtMagnet_L106
#define PndMdtMagnet_H04_V
#define PndMdtMagnet_L112
#define PndMdtMagnet_H06_V
#define PndMdtMagnet_L103
#define PndMdtMagnet_H_D_R2
FairGeoInterface * geoFace
#define PndMdtMagnet_L105
#define PndMdtMagnet_H03_V
#define PndMdtMagnet_L109
#define PndMdtMagnet_L204