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