SND@LHC Software
Loading...
Searching...
No Matches
ShipMagnet.cxx
Go to the documentation of this file.
1#include "ShipMagnet.h"
2
3#include "TGeoManager.h"
4#include "FairRun.h" // for FairRun
5#include "FairRuntimeDb.h" // for FairRuntimeDb
6//#include "FairGeoMedia.h"
7//#include "FairGeoBuilder.h"
8
9#include <iosfwd> // for ostream
10#include "TList.h" // for TListIter, TList (ptr only)
11#include "TObjArray.h" // for TObjArray
12#include "TString.h" // for TString
13#include "TGeoBBox.h"
14#include "TGeoCompositeShape.h"
15#include "FairGeoInterface.h"
16#include "FairGeoMedia.h"
17#include "FairGeoBuilder.h"
18#include "TGeoTube.h"
19#include "TGeoMaterial.h"
20#include "TGeoElement.h"
21#include "TGeoEltu.h"
22#include "TGeoMedium.h"
23#include <stddef.h> // for NULL
24#include <iostream> // for operator<<, basic_ostream, etc
25
26
27
32 : FairModule("ShipMagnet", "")
33{
34}
35
36ShipMagnet::ShipMagnet(const char* name, const char* Title, Double_t z, Int_t c, Double_t dx, Double_t dy, Double_t fl, Double_t YW, Double_t YD, Double_t CT)
37 : FairModule(name ,Title)
38{
39 fDesign = c;
40 fSpecMagz = z;
41 fDy = dy;
42 fDx = dx;
43 floorheight = fl;
44 YokeWidth = YW;
45 YokeDepth = YD;
46 CoilThick = CT;
47}
48
49// ----- Private method InitMedium
50Int_t ShipMagnet::InitMedium(const char* name)
51{
52 static FairGeoLoader *geoLoad=FairGeoLoader::Instance();
53 static FairGeoInterface *geoFace=geoLoad->getGeoInterface();
54 static FairGeoMedia *media=geoFace->getMedia();
55 static FairGeoBuilder *geoBuild=geoLoad->getGeoBuilder();
56
57 FairGeoMedium *ShipMedium=media->getMedium(name);
58
59 if (!ShipMedium)
60 {
61 Fatal("InitMedium","Material %s not defined in media file.", name);
62 return -1111;
63 }
64 TGeoMedium* medium=gGeoManager->GetMedium(name);
65 if (medium!=NULL)
66 return ShipMedium->getMediumIndex();
67
68 return geoBuild->createMedium(ShipMedium);
69}
70// private method make support of magnet
71TGeoVolume* ShipMagnet::MagnetSupport(Double_t hwidth,Double_t hheight,Double_t dz,Int_t colour,TGeoMedium *material)
72{
73
74 TGeoBBox *ms = new TGeoBBox("ms", hwidth,hheight-1.,dz);
75 //try to make SHiP like logo in support
76 Double_t swidth=30.; //
77 //6 cutouts from the front
78 Double_t r25=hheight-swidth/2.;
79 Double_t r1346=hwidth-swidth/2;
80 Double_t alpha=atan(hheight/hwidth)*180./TMath::Pi();
81 TGeoTubeSeg *FL1 = new TGeoTubeSeg("FL1",swidth,r1346,dz+1.,5.,alpha-5.);
82 TGeoTubeSeg *FL3 = new TGeoTubeSeg("FL3",swidth,r1346,dz+1.,180-alpha+5.,175.);
83 TGeoTubeSeg *FL4 = new TGeoTubeSeg("FL4",swidth,r1346,dz+1.,185.,180.+alpha-5.);
84 TGeoTubeSeg *FL6 = new TGeoTubeSeg("FL6",swidth,r1346,dz+1.,360.-alpha+5.,355.);
85 TGeoTubeSeg *FL2 = new TGeoTubeSeg("FL2",swidth,r25,dz+1.,alpha+5.,180-alpha-5.);
86 TGeoTubeSeg *FL5 = new TGeoTubeSeg("FL5",swidth,r25,dz+1.,180.+alpha+5.,360.-alpha-5.);
87
88 //6 cutouts from the side
89 r1346=dz-swidth/2;
90 alpha=atan(hheight/dz)*180./TMath::Pi();
91 //cout << "magsupport: "<< swidth<<", "<<r25<<", "<< r1346<<", "<<alpha <<endl;
92 TGeoTubeSeg *SL1 = new TGeoTubeSeg("SL1",swidth,r1346,hwidth+1.,5.,alpha-5.);
93 TGeoTubeSeg *SL3 = new TGeoTubeSeg("SL3",swidth,r1346,hwidth+1.,180-alpha+5.,175.);
94 TGeoTubeSeg *SL4 = new TGeoTubeSeg("SL4",swidth,r1346,hwidth+1.,185.,180.+alpha-5.);
95 TGeoTubeSeg *SL6 = new TGeoTubeSeg("SL6",swidth,r1346,hwidth+1.,360.-alpha+5.,355.);
96 TGeoTubeSeg *SL2 = new TGeoTubeSeg("SL2",swidth,r25,hwidth+1.,alpha+5.,180-alpha-5.);
97 TGeoTubeSeg *SL5 = new TGeoTubeSeg("SL5",swidth,r25,hwidth+1.,180.+alpha+5.,360.-alpha-5.);
98 TGeoRotation *r = new TGeoRotation("r"); r->RotateY(90.); r->RegisterYourself();
99
100 TGeoCompositeShape *TS = new TGeoCompositeShape("TS",\
101 "ms-FL1-FL2-FL3-FL4-FL5-FL6-SL1:r-SL2:r-SL3:r-SL4:r-SL5:r-SL6:r");
102
103 TGeoVolume *T = new TGeoVolume("TSUP", TS, material);
104 T->SetLineColor(colour);
105 return T;
106}
108{
109
110 TGeoVolume *top=gGeoManager->GetTopVolume();
111 InitMedium("iron");
112 TGeoMedium *Fe =gGeoManager->GetMedium("iron");
113 InitMedium("Aluminum");
114 TGeoMedium *Al =gGeoManager->GetMedium("Aluminum");
115 TGeoVolumeAssembly *tMagnet = new TGeoVolumeAssembly("SHiPMagnet");
116 top->AddNode(tMagnet, 1, new TGeoTranslation(0, 0, 0));
117
118 Double_t cm = 1;
119 Double_t m = 100*cm;
120 if (fDesign==1){
121 // magnet yoke
122 TGeoBBox *magyoke1 = new TGeoBBox("magyoke1", 350, 350, 125);
123 TGeoBBox *magyoke2 = new TGeoBBox("magyoke2", 250, 250, 126);
124
125 TGeoCompositeShape *magyokec = new TGeoCompositeShape("magyokec", "magyoke1-magyoke2");
126 TGeoVolume *magyoke = new TGeoVolume("magyoke", magyokec, Fe);
127 magyoke->SetLineColor(kBlue);
128 //magyoke->SetTransparency(50);
129 tMagnet->AddNode(magyoke, 1, new TGeoTranslation(0, 0, 1940));
130
131 // magnet
132 TGeoTubeSeg *magnet1a = new TGeoTubeSeg("magnet1a", 250, 300, 35, 45, 135);
133 TGeoTubeSeg *magnet1b = new TGeoTubeSeg("magnet1b", 250, 300, 35, 45, 135);
134 TGeoTubeSeg *magnet1c = new TGeoTubeSeg("magnet1c", 250, 270, 125, 45, 60);
135 TGeoTubeSeg *magnet1d = new TGeoTubeSeg("magnet1d", 250, 270, 125, 120, 135);
136
137 // magnet composite shape matrices
138 TGeoTranslation *m1 = new TGeoTranslation(0, 0, 160);
139 m1->SetName("m1");
140 m1->RegisterYourself();
141 TGeoTranslation *m2 = new TGeoTranslation(0, 0, -160);
142 m2->SetName("m2");
143 m2->RegisterYourself();
144
145 TGeoCompositeShape *magcomp1 = new TGeoCompositeShape("magcomp1", "magnet1a:m1+magnet1b:m2+magnet1c+magnet1d");
146 TGeoVolume *magnet1 = new TGeoVolume("magnet1", magcomp1, Fe);
147 magnet1->SetLineColor(kYellow);
148 tMagnet->AddNode(magnet1, 1, new TGeoTranslation(0, 0, fSpecMagz)); // was 1940
149
150 TGeoRotation m3;
151 m3.SetAngles(180, 0, 0);
152 TGeoTranslation m4(0, 0, fSpecMagz); // was 1940
153 TGeoCombiTrans m5(m4, m3);
154 TGeoHMatrix *m6 = new TGeoHMatrix(m5);
155 tMagnet->AddNode(magnet1, 2, m6);
156 }
157 else if(fDesign==2 || fDesign==3) { // fDesign==2 TP version, fDesign==3, rectangular version
158 Double_t Yokel = 1.25*m;
159 Double_t magnetIncrease = 100.*cm;
160 // magnet yoke
161 Double_t bradius = fDy/2.;
162 TGeoBBox *magyoke1 = new TGeoBBox("magyoke1", fDx+0.7*m, bradius+1.2*m, Yokel);
163 TGeoBBox *magyoke2 = new TGeoBBox("magyoke2", fDx-0.3*m, bradius+0.2*m, Yokel+0.01*cm);
164
165 TGeoCompositeShape *magyokec = new TGeoCompositeShape("magyokec", "magyoke1-magyoke2");
166 TGeoVolume *magyoke = new TGeoVolume("magyoke", magyokec, Fe);
167 magyoke->SetLineColor(kBlue);
168 tMagnet->AddNode(magyoke, 1, new TGeoTranslation(0, 0, fSpecMagz));
169
170 Double_t hsupport=(10.*m-(bradius+1.2*m)-floorheight)/2.;
171 TGeoVolume* SMS =MagnetSupport(fDx+0.7*m, hsupport, Yokel,15,Fe);
172 tMagnet->AddNode(SMS, 1, new TGeoTranslation(0, -bradius-1.2*m-hsupport, fSpecMagz));
173
174 //Attempt to make Al coils...
175 TGeoCompositeShape *MCoilc;
176 if(fDesign==2){
177 TGeoEltu *C2 = new TGeoEltu("C2",fDx,bradius+0.5*m,Yokel+0.6*m+magnetIncrease/2.);
178 TGeoEltu *C1 = new TGeoEltu("C1",fDx-0.3*m,bradius+0.2*m,Yokel+0.601*m+magnetIncrease/2.);
179 TGeoBBox *Box1 = new TGeoBBox("Box1", 1.*m, bradius+0.51*m, Yokel+0.61*m+magnetIncrease/2.);
180 TGeoBBox *Box2 = new TGeoBBox("Box2", fDx+0.01*m, bradius-0.5*m, Yokel+0.01*m+magnetIncrease/2.);
181 MCoilc = new TGeoCompositeShape("MCoilc", "C2-C1-magyokec-Box1-Box2");
182 }else{
183 TGeoBBox *C2 = new TGeoBBox("C2", fDx, bradius+0.5*m, Yokel+0.6*m+magnetIncrease/2.);
184 TGeoBBox *C1 = new TGeoBBox("C1", fDx-0.3*m, bradius+0.2*m, Yokel+0.601*m+magnetIncrease/2.);
185 MCoilc = new TGeoCompositeShape("MCoilc", "C2-C1-magyokec");
186 }
187 TGeoVolume *MCoil = new TGeoVolume("MCoil", MCoilc, Al);
188 MCoil->SetLineColor(kYellow);
189
190 tMagnet->AddNode(MCoil, 1, new TGeoTranslation(0, 0, fSpecMagz));
191
192 }else if(fDesign==4) { // rectangular a la MISIS, full opening for vessel
193 //define dimensions
194 Double_t xaperture=fDx; //half apertures
195 Double_t yaperture=fDy;
196 //built the yoke
197 TGeoBBox *magyoke1 = new TGeoBBox("magyoke1", xaperture+YokeWidth,yaperture+YokeWidth,YokeDepth);
198 TGeoBBox *magyoke2 = new TGeoBBox("magyoke2", xaperture,yaperture,YokeDepth+1.);
199 TGeoCompositeShape *magyokec = new TGeoCompositeShape("magyokec", "magyoke1-magyoke2");
200 //and a epsilon larger yoke to subtract while making the coils
201 TGeoBBox *my1 = new TGeoBBox("my1", xaperture+YokeWidth,yaperture+YokeWidth,YokeDepth+0.1*cm);
202 TGeoBBox *my2 = new TGeoBBox("my2", xaperture-0.1*cm,yaperture-0.1*cm,YokeDepth+1.);
203 TGeoCompositeShape *myc = new TGeoCompositeShape("myc", "my1-my2");
204 TGeoVolume *magyoke = new TGeoVolume("magyoke", magyokec, Fe);
205 magyoke->SetLineColor(kBlue);
206 tMagnet->AddNode(magyoke, 1, new TGeoTranslation(0, 0, fSpecMagz));
207 //and the coils: top
208 TGeoTubeSeg *CTop = new TGeoTubeSeg("CTop",1.*cm,YokeWidth,YokeDepth+CoilThick+1.*cm,0.,180.);
209 TGeoTranslation *t1 = new TGeoTranslation("t1",xaperture,yaperture-CoilThick,0.); t1->RegisterYourself();
210 TGeoTranslation *t2 = new TGeoTranslation("t2",-xaperture,yaperture-CoilThick,0.); t2->RegisterYourself();
211 TGeoCompositeShape *CTop1 = new TGeoCompositeShape("CTop1", "CTop:t1-myc");
212 TGeoCompositeShape *CTop2 = new TGeoCompositeShape("CTop2", "CTop:t2-myc");
213 TGeoVolume *MCoil1 = new TGeoVolume("MCoil1", CTop1, Al);
214 TGeoVolume *MCoil2 = new TGeoVolume("MCoil2", CTop2, Al);
215 MCoil1->SetLineColor(kYellow);
216 tMagnet->AddNode(MCoil1, 1, new TGeoTranslation(0, 0, fSpecMagz));
217 MCoil2->SetLineColor(kYellow);
218 tMagnet->AddNode(MCoil2, 1, new TGeoTranslation(0, 0, fSpecMagz));
219 //coils bottom
220 TGeoTubeSeg *CBot = new TGeoTubeSeg("CBot",1.*cm,YokeWidth,YokeDepth+CoilThick+1.*cm,180.,360.);
221 TGeoTranslation *b1 = new TGeoTranslation("b1",xaperture,-yaperture+CoilThick,0.); b1->RegisterYourself();
222 TGeoTranslation *b2 = new TGeoTranslation("b2",-xaperture,-yaperture+CoilThick,0.); b2->RegisterYourself();
223 TGeoCompositeShape *CBot1 = new TGeoCompositeShape("CBot1", "CBot:b1-myc");
224 TGeoCompositeShape *CBot2 = new TGeoCompositeShape("CBot2", "CBot:b2-myc");
225 TGeoVolume *MCoil3 = new TGeoVolume("MCoil3", CBot1, Al);
226 TGeoVolume *MCoil4 = new TGeoVolume("MCoil4", CBot2, Al);
227 MCoil3->SetLineColor(kYellow);
228 tMagnet->AddNode(MCoil3, 1, new TGeoTranslation(0, 0, fSpecMagz));
229 MCoil4->SetLineColor(kYellow);
230 tMagnet->AddNode(MCoil4, 1, new TGeoTranslation(0, 0, fSpecMagz));
231 //add vertical coils
232 TGeoBBox *CVert = new TGeoBBox("CVert",YokeWidth/2.,yaperture-CoilThick,CoilThick/2.);
233 TGeoVolume *CV = new TGeoVolume("CV", CVert, Al);
234 CV->SetLineColor(kYellow);
235 tMagnet->AddNode(CV, 1, new TGeoTranslation(xaperture+YokeWidth/2., 0, fSpecMagz-YokeDepth-CoilThick/2.));
236 tMagnet->AddNode(CV, 2, new TGeoTranslation(-xaperture-YokeWidth/2., 0, fSpecMagz-YokeDepth-CoilThick/2.));
237 tMagnet->AddNode(CV, 3, new TGeoTranslation(xaperture+YokeWidth/2., 0, fSpecMagz+YokeDepth+CoilThick/2.));
238 tMagnet->AddNode(CV, 4, new TGeoTranslation(-xaperture-YokeWidth/2., 0, fSpecMagz+YokeDepth+CoilThick/2.));
239
240
241 }
242}
243
244
245
247
248
249
250
251
252
253
254
255
256
257
258
259
260
Double_t cm
Double_t m
void ConstructGeometry()
Double_t floorheight
Definition ShipMagnet.h:26
Double_t YokeWidth
Definition ShipMagnet.h:25
virtual ~ShipMagnet()
ClassDef(ShipMagnet, 5) protected Int_t fSpecMagz
Definition ShipMagnet.h:18
Double_t fDy
Definition ShipMagnet.h:23
Double_t fDx
Definition ShipMagnet.h:24
Int_t InitMedium(const char *name)
Double_t CoilThick
Definition ShipMagnet.h:25
TGeoVolume * MagnetSupport(Double_t hwidth, Double_t hheight, Double_t dz, Int_t colour, TGeoMedium *material)
Double_t YokeDepth
Definition ShipMagnet.h:25
ClassImp(ecalContFact) ecalContFact