FairRoot/PandaRoot
CreateLambdaGeometrySeparatedSupport.C
Go to the documentation of this file.
1 /*
2  * CreateLambdaGeometry.C
3  *
4  * Created on: Mar 21, 2013
5  * Author: stockman
6  */
8 {
9  //-----------------------------
10  Double_t positionOfDisk1inZ = 40.0; //in cm
11  Double_t positionOfDisk2inZ = 60.0; //in cm
12  Double_t positionOfSupport1 = positionOfDisk1inZ + 1.0;
13  Double_t positionOfSupport2 = positionOfDisk2inZ + 1.0;
14 
15 
16  //--------------------------------------------------------------------
17  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
18 
19  // Load this libraries
20  gSystem->Load("libGeoBase");
21  gSystem->Load("libParBase");
22  gSystem->Load("libBase");
23  gSystem->Load("libPndData");
24  gSystem->Load("libPassive");
25 
26  TString outfile= "../../geometry/LambdaDisksSeparatedSupport.root";
27  TFile* fi = new TFile(outfile,"RECREATE");
28 
29  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
30  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
31  geoFace->setMediaFile("../../geometry/media_pnd.geo");
32  geoFace->readMedia();
33  geoFace->print();
34 
35  FairGeoMedia *Media = geoFace->getMedia();
36  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
37 
38  FairGeoMedium *CbmMediumSilicon = Media->getMedium("silicon");
39  FairGeoMedium *CbmMediumCarbon = Media->getMedium("carbon");
40  FairGeoMedium *CbmMediumCarbonFoam = Media->getMedium("carbonfoam");
41  FairGeoMedium *CbmMediumAluminium = Media->getMedium("aluminium");
42 
43  Int_t nmed=geobuild->createMedium(CbmMediumSilicon);
44  nmed=geobuild->createMedium(CbmMediumCarbon);
45  nmed=geobuild->createMedium(CbmMediumCarbonFoam);
46  nmed=geobuild->createMedium(CbmMediumAluminium);
47 
48  TGeoManager* gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
49 
50  TGeoVolume *top = new TGeoVolumeAssembly("top");
51 
52  gGeoMan->SetTopVolume(top);
53 
54  TGeoVolume *combinedLambdaDisks = new TGeoVolumeAssembly("CombinedLambdaDisks");
55  TGeoVolumeAssembly* lambdaDisk = new TGeoVolumeAssembly("LambdaDisk");
56  TGeoVolumeAssembly* largeRing = new TGeoVolumeAssembly("LargeRing");
57  TGeoVolumeAssembly* smallRing = new TGeoVolumeAssembly("SmallRing");
58 
59 // lambdaDisk->AddNode(largeSensorVolume,0,trc1);
60 // TGeoShape* largeSensorShape = new TGeoTrd1("StripSensorActiveLargeShape", 3.4593/2, 1.9936/2,0.03/2, 5.5665/2);
61  Double_t points [16];
62  points[0] = -1.7297; points[1] = 2.7833;
63  points[2] = 1.7297; points[3] = 2.7833;
64  points[4] = 0.9968; points[5] = -2.7833;
65  points[6] = -0.9968; points[7] = -2.7833;
66 
67  points[8] = -1.7297; points[9] = 2.7833;
68  points[10] = 1.7297; points[11] = 2.7833;
69  points[12] = 0.9968; points[13] = -2.7833;
70  points[14] = -0.9968; points[15] = -2.7833;
71 
72  TGeoShape* largeSensorShape = new TGeoArb8("StripSensorActiveLargeShape", 0.03/2, points);
73  TGeoVolume* largeSensorVolume = new TGeoVolume("StripSensorActiveLargeTrap",largeSensorShape,gGeoMan->GetMedium("silicon"));
74 
75 // TGeoRotation rotSensor("rotSensor",0,90,0);
76  TGeoRotation rotSensor("rotSensor",0,0,0);
77  TGeoTranslation transLargeSensor(0,(14.8669 + 5.5665)/2,0);
78  TGeoCombiTrans combined1(transLargeSensor, rotSensor);
79 
80  for (int i = 0; i < 12; i++){
81  TString rotName("rotLargeSens");
82  rotName.Append(i+1);
83  TGeoRotation rotSens(rotName.Data(), 0,0, i*2 * 360/24);
84  TGeoHMatrix sens = rotSens * combined1;
85  largeRing->AddNode(largeSensorVolume, i, new TGeoHMatrix(sens));
86  }
87 
88  Double_t pointsSmall [16];
89  pointsSmall[0] = -1.9579/2; pointsSmall[1] = 5.3358/2;
90  pointsSmall[2] = 1.9579/2; pointsSmall[3] = 5.3358/2;
91  pointsSmall[4] = 0.5529/2; pointsSmall[5] = -5.3358/2;
92  pointsSmall[6] = -0.5529/2; pointsSmall[7] = -5.3358/2;
93 
94  pointsSmall[8] = -1.9579/2; pointsSmall[9] = 5.3358/2;
95  pointsSmall[10] = 1.9579/2; pointsSmall[11] = 5.3358/2;
96  pointsSmall[12] = 0.5529/2; pointsSmall[13] = -5.3358/2;
97  pointsSmall[14] = -0.5529/2; pointsSmall[15] = -5.3358/2;
98 
99 // TGeoShape* smallSensorShape = new TGeoTrd1("StripSensorActiveSmallShape", 1.9579/2, 0.5529/2, 0.03/2, 5.3358/2);
100  TGeoShape* smallSensorShape = new TGeoArb8("StripSensorActiveSmallShape", 0.03/2, pointsSmall);
101  TGeoVolume* smallSensorVolume = new TGeoVolume("StripSensorActiveSmallTrap", smallSensorShape, gGeoMan->GetMedium("silicon"));
102 
103  TGeoTranslation transSmallSensor(0,5.3358/2+2.1,0);
104  TGeoCombiTrans combined2(transSmallSensor, rotSensor);
105 
106  for (int i = 0; i < 12; i++){
107  TString rotName("rotSmallSens");
108  rotName.Append(i+1);
109  TGeoRotation rotSens(rotName.Data(), 0,0, i*2 * 360/24);
110  TGeoHMatrix sens = rotSens * combined2;
111  smallRing->AddNode(smallSensorVolume, i+12, new TGeoHMatrix(sens));
112  }
113 
114  lambdaDisk->AddNode(largeRing, 0, new TGeoTranslation(0,0,-0.5));
115  lambdaDisk->AddNode(largeRing, 1, new TGeoRotation("largeRingRot",0,0,360/24));
116 
117  TGeoCombiTrans combiSmallRing2(TGeoTranslation(0,0,-1.5), TGeoRotation("smallRingRot",0,0,360/24));
118  lambdaDisk->AddNode(smallRing, 0, new TGeoTranslation(0,0,-1.0));
119  lambdaDisk->AddNode(smallRing, 1, new TGeoHMatrix(combiSmallRing2));
120 
121  TGeoVolumeAssembly* supportDisk = new TGeoVolumeAssembly("SupportDisk");
122 
123  TGeoVolumeAssembly* supportLarge = new TGeoVolumeAssembly("SupportLarge");
124  TGeoShape* carbonFoamShape = new TGeoBBox(3.4/2, 0.2/2, 3.5/4);
125  TGeoVolume* carbonFoam = new TGeoVolume("CarbonFoam", carbonFoamShape, gGeoMan->GetMedium("carbonfoam"));
126  TGeoShape* carbonFiberShape = new TGeoBBox(3.4/2, 0.02/2, 3.5/4);
127  TGeoVolume* carbonFiber = new TGeoVolume("CarbonFiber", carbonFiberShape, gGeoMan->GetMedium("carbon"));
128  TGeoShape* siliconReadoutShape = new TGeoBBox(3.4/2, 0.02/2, 3.5/4);
129  TGeoVolume* siliconReadout = new TGeoVolume("SiliconReadout", siliconReadoutShape, gGeoMan->GetMedium("silicon"));
130  TGeoShape* aluCablesShape = new TGeoBBox(3.4/2, 0.4/2, 3.5/4);
131  TGeoVolume* aluCables = new TGeoVolume("AluCables", aluCablesShape, gGeoMan->GetMedium("aluminium"));
132 
133  supportLarge->AddNode(carbonFoam, 1);
134  supportLarge->AddNode(carbonFiber, 1, new TGeoTranslation(0,(0.2 + 0.02)/2, 0));
135  supportLarge->AddNode(carbonFiber, 2, new TGeoTranslation(0,-(0.2 + 0.02)/2, 0));
136  supportLarge->AddNode(siliconReadout, 1, new TGeoTranslation(0,(0.2 + 0.02 + 0.02)/2, 0));
137  supportLarge->AddNode(siliconReadout, 2, new TGeoTranslation(0,-(0.2 + 0.02 + 0.02)/2, 0));
138  supportLarge->AddNode(aluCables, 1, new TGeoTranslation(0,(0.2 + 0.02 + 0.02 + 0.4)/2, 0));
139  supportLarge->AddNode(aluCables, 2, new TGeoTranslation(0,-(0.2 + 0.02 + 0.02 + 0.4)/2, 0));
140 
141  TGeoTranslation transSupportLarge(0,(14.8669)/2 + 5.5665 + 1,0);
142 
143  for (int i = 0; i < 24; i++){
144  TString rotName("rotSupportLarge");
145  rotName.Append(i+1);
146  TGeoRotation rotSens(rotName.Data(), 0,0, i * 360/24);
147  TGeoHMatrix sens = rotSens * transSupportLarge;
148  supportDisk->AddNode(supportLarge, i+1, new TGeoHMatrix(sens));
149  }
150 
151  TGeoVolumeAssembly* supportSmall = new TGeoVolumeAssembly("SupportSmall");
152  TGeoShape* carbonFoamShapeSmall = new TGeoBBox(1.8/2, 0.2/2, 3.5/4);
153  TGeoVolume* carbonFoamSmall = new TGeoVolume("CarbonFoamSmall", carbonFoamShapeSmall, gGeoMan->GetMedium("carbonfoam"));
154  TGeoShape* carbonFiberShapeSmall = new TGeoBBox(1.8/2, 0.02/2, 3.5/4);
155  TGeoVolume* carbonFiberSmall = new TGeoVolume("CarbonFiberSmall", carbonFiberShapeSmall, gGeoMan->GetMedium("carbon"));
156  TGeoShape* siliconReadoutShapeSmall = new TGeoBBox(1.8/2, 0.02/2, 3.5/4);
157  TGeoVolume* siliconReadoutSmall = new TGeoVolume("SiliconReadoutSmall", siliconReadoutShapeSmall, gGeoMan->GetMedium("silicon"));
158  TGeoShape* aluCablesShapeSmall = new TGeoBBox(1.8/2, 0.4/2, 3.5/4);
159  TGeoVolume* aluCablesSmall = new TGeoVolume("AluCablesSmall", aluCablesShapeSmall, gGeoMan->GetMedium("aluminium"));
160 
161  supportSmall->AddNode(carbonFoamSmall, 1);
162  supportSmall->AddNode(carbonFiberSmall, 1, new TGeoTranslation(0,(0.2 + 0.02)/2, 0));
163  supportSmall->AddNode(carbonFiberSmall, 2, new TGeoTranslation(0,-(0.2 + 0.02)/2, 0));
164  supportSmall->AddNode(siliconReadoutSmall, 1, new TGeoTranslation(0,(0.2 + 0.02 + 0.02)/2, 0));
165  supportSmall->AddNode(siliconReadoutSmall, 2, new TGeoTranslation(0,-(0.2 + 0.02 + 0.02)/2, 0));
166  supportSmall->AddNode(aluCablesSmall, 1, new TGeoTranslation(0,(0.2 + 0.02 + 0.02 + 0.4)/2, 0));
167  supportSmall->AddNode(aluCablesSmall, 2, new TGeoTranslation(0,-(0.2 + 0.02 + 0.02 + 0.4)/2, 0));
168 
169  TGeoTranslation transSupportSmall(0,2.1 + 5.3358 + 0.5,0);
170 
171  for (int i = 0; i < 24; i++){
172  TString rotName("rotSupportSmall");
173  rotName.Append(i+1);
174  TGeoRotation rotSens(rotName.Data(), 0,0, i * 360/24);
175  TGeoHMatrix sens = rotSens * transSupportSmall;
176  supportDisk->AddNode(supportSmall, i+1, new TGeoHMatrix(sens));
177  }
178 
179  combinedLambdaDisks->AddNode(lambdaDisk,1,new TGeoTranslation(0,0,positionOfDisk1inZ));
180  combinedLambdaDisks->AddNode(lambdaDisk,2,new TGeoTranslation(0,0,positionOfDisk2inZ));
181  combinedLambdaDisks->AddNode(supportDisk,1, new TGeoTranslation(0,0,positionOfSupport1));
182  combinedLambdaDisks->AddNode(supportDisk,1, new TGeoTranslation(0,0,positionOfSupport2));
183 
184  top->AddNode(combinedLambdaDisks,0);
185 
186  gGeoMan->CloseGeometry();
187  top->Write();
188  fi->Close();
189  // gGeoManager->Export(outfile);
190  gGeoManager->SetVisLevel(30);
191  top->Draw("ogl");
192 }
193 
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
FairGeoLoader * geoLoad
Int_t i
Definition: run_full.C:25
FairGeoMedia * Media
TGeoManager * gGeoMan
FairGeoMedium * CbmMediumCarbon
TString rotName
TGeoManager * gGeoManager
TGeoVolume * top
FairGeoMedium * CbmMediumAluminium
FairGeoMedium * CbmMediumSilicon
FairGeoBuilder * geobuild
TFile * fi
Double_t
FairGeoInterface * geoFace
TString outfile