source: trunk/examples/advanced/Rich/src/RichTbComponent.cc@ 1205

Last change on this file since 1205 was 807, checked in by garnier, 17 years ago

update

File size: 14.2 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Rich advanced example for Geant4
27// RichTbComponent.cc for Rich of LHCb
28// History:
29// Created: Sajan Easo (Sajan.Easo@cern.ch)
30// Revision and changes: Patricia Mendez (Patricia.Mendez@cern.ch)
31/////////////////////////////////////////////////////////////////////////////
32#include <iostream>
33#include "globals.hh"
34#include "RichTbDetectorConstruction.hh"
35#include "RichTbGeometryParameters.hh"
36#include "RichTbMaterialParameters.hh"
37#include "FilterTypeSpec.hh"
38#include "RichTbComponent.hh"
39#include "G4Box.hh"
40#include "G4Tubs.hh"
41#include "G4Sphere.hh"
42#include "G4LogicalVolume.hh"
43#include "G4VPhysicalVolume.hh"
44#include "G4PVPlacement.hh"
45#include "G4RotationMatrix.hh"
46#include "G4ThreeVector.hh"
47#include "G4Transform3D.hh"
48#include "G4LogicalBorderSurface.hh"
49#include "G4Material.hh"
50#include "G4SubtractionSolid.hh"
51
52RichTbComponent::RichTbComponent(){ ; }
53RichTbComponent::RichTbComponent(RichTbMaterial* RMaterial,
54 RichTbHall* RTbHall , RichTbRunConfig* RConfig,
55 G4bool ConstructTrackingSwitch):
56 RichTbAgelLVol(std::vector<G4LogicalVolume*>(MaxNumberOfAerogelTiles)),
57 RichTbAgelPVol(std::vector<G4VPhysicalVolume*>(MaxNumberOfAerogelTiles)),
58 RichTbAgelWrapTopLVol(std::vector<G4LogicalVolume*>(MaxNumberOfAerogelTiles)),
59 RichTbAgelWrapTopPVol(std::vector<G4VPhysicalVolume*>(MaxNumberOfAerogelTiles)),
60 RichTbAgelWrapBotLVol(std::vector<G4LogicalVolume*>(MaxNumberOfAerogelTiles)),
61 RichTbAgelWrapBotPVol(std::vector<G4VPhysicalVolume*>(MaxNumberOfAerogelTiles))
62 {
63
64 ConstructTrackingGeometrySwitch=ConstructTrackingSwitch;
65
66 //First define the shapes.
67 //Components of the Vessel.
68 G4Tubs * VesselEnclosure
69 = new G4Tubs("VesselEnclosure",VesselInnerRad,VesselOuterRad,
70 VesselHalfZ,VesselStartPhi,VesselDelPhi);
71 G4RotationMatrix VesselBRot;
72 G4ThreeVector VesselBTrsl(VesselPosX,VesselPosY,VesselPosZ);
73
74 G4Transform3D VesselBTransform(VesselBRot,VesselBTrsl);
75
76 G4LogicalVolume* VesselEnclosureLog=
77 new G4LogicalVolume(VesselEnclosure, RMaterial->getNitrogenGas(),
78 "VesselEnclosure",0,0,0);
79
80 G4VPhysicalVolume* VesselEnclosurePhys=
81 new G4PVPlacement(VesselBTransform,"VesselEnclosure",
82 VesselEnclosureLog,
83 RTbHall->getRichTbHallPhysicalVolume(),
84 false,0);
85 //
86 //
87 if(ConstructTrackingSwitch){
88
89 G4int NAgelTiles=RConfig-> GetNumberOfAerogelTiles();
90
91
92 G4Box * RadFrame
93 = new G4Box("RadFrame",RadFrameHalfX,RadFrameHalfY,RadFrameHalfZ);
94
95 G4Box * RadHoldUps
96 = new G4Box("RadHoldUps",RadHoldUpHalfX,RadHoldUpHalfY,RadHoldUpHalfZ);
97 G4Tubs * RadHoldUpWin
98 = new G4Tubs("RadHoldUpWin", RadWinUpInnerRad, RadWinUpOuterRad,
99 RadWinUpHalfZ,RadWinUpStartPhi,RadWinUpDelPhi);
100
101
102 G4Box * RadHoldDns
103 = new G4Box("RadHoldDns",RadHoldDnHalfX,RadHoldDnHalfY,RadHoldDnHalfZ);
104 G4Tubs * RadHoldDnWin
105 = new G4Tubs("RadHoldDnWin", RadWinDnInnerRad, RadWinDnOuterRad,
106 RadWinDnHalfZ,RadWinDnStartPhi,RadWinDnDelPhi);
107
108
109 G4int FilterNum = RConfig->GetFilterTNumber();
110 G4Box * FilterBox=0;
111 if(FilterNum >= 0 ) {
112 G4double FilterHalfZ= FilterHalfZArray[FilterNum];
113 FilterBox
114 = new G4Box("FilterBox", FilterHalfX,FilterHalfY,FilterHalfZ);
115
116 }
117 //Mirror
118 G4double MirrThetaSize=2.0*std::asin(MirrorHorizontalChord/(MirrorRInner*2.0));
119 G4double MirrThetaStart=halfpi*rad-MirrThetaSize/2.0;
120 G4double MirrPhiSize=2.0*std::asin(MirrorVerticalChord/(MirrorRInner*2.0));
121 G4double MirrPhiStart=-MirrPhiSize/2.0;
122
123 G4Sphere* MirrorSphe= new G4Sphere("MirrorSphe",MirrorRInner,
124 MirrorROuter,MirrPhiStart,
125 MirrPhiSize,MirrThetaStart,
126 MirrThetaSize);
127
128 //Now for the rotations and translations..
129
130 G4RotationMatrix RadFrameRot;
131 G4RotationMatrix RadWinUpRot,RadWinDnRot,RadHoldUpRot,RadHoldDnRot;
132
133 G4ThreeVector RadFrameTrsl(RadFramePosX,RadFramePosY,RadFramePosZ);
134 G4Transform3D RadFrameTransform(RadFrameRot,RadFrameTrsl);
135 //
136 //
137 G4ThreeVector RadWinUpTrsl(RadWinUpShiftX,RadWinUpShiftY,RadWinUpShiftZ);
138 G4Transform3D RadWinUpTransform(RadWinUpRot,RadWinUpTrsl);
139 G4ThreeVector RadHoldUpTrsl(RadHoldUpPosX,RadHoldUpPosY,RadHoldUpPosZ);
140 G4Transform3D RadHoldUpTransform(RadHoldUpRot,RadHoldUpTrsl);
141 //
142 G4ThreeVector RadWinDnTrsl(RadWinDnShiftX,RadWinDnShiftY,RadWinDnShiftZ);
143 G4Transform3D RadWinDnTransform(RadWinDnRot,RadWinDnTrsl);
144 G4ThreeVector RadHoldDnTrsl(RadHoldDnPosX,RadHoldDnPosY,RadHoldDnPosZ);
145 G4Transform3D RadHoldDnTransform(RadHoldDnRot,RadHoldDnTrsl);
146 //
147 //
148 //
149 G4RotationMatrix MirrorRotationX, MirrorRotationY;
150 G4double MirrorExtraTiltX = RConfig->getMirrorAddTiltX();
151 G4double MirrorExtraTiltY = RConfig->getMirrorAddTiltY();
152 G4double MirrorTotRotX= MirrorNominalRotX+MirrorExtraTiltX;
153 G4double MirrorTotRotY= MirrorNominalRotY+MirrorExtraTiltY;
154 G4double MirrorPosX, MirrorPosY, MirrorPosZ;
155
156 if( MirrorTotRotX !=0.0 || MirrorTotRotY != 0.0 ) {
157 MirrorPosX =-VesselPosX-MirrorRInner*std::sin(MirrorTotRotY);
158 MirrorPosY =-VesselPosY+MirrorRInner*std::sin(MirrorTotRotX);
159 MirrorPosZ =MirrorShiftFromEnd-VesselHalfZ
160 -MirrorRInner*(std::cos(MirrorTotRotY)+std::cos(MirrorTotRotX)-1.0);
161 }else {
162 MirrorPosX =-VesselPosX;
163 MirrorPosY =-VesselPosY;
164 MirrorPosZ =MirrorNominalPosZ;
165 }
166 G4ThreeVector MirrorPos(MirrorPosX,MirrorPosY,MirrorPosZ);
167 if (MirrorTotRotX != 0.0 ) {
168 MirrorRotationX.rotateX(MirrorTotRotX);
169 }
170 MirrorRotationY.rotateY(-halfpi*rad+MirrorTotRotY);
171 G4Transform3D MirrorTransform(MirrorRotationX*MirrorRotationY,MirrorPos);
172
173 //
174
175 G4LogicalBorderSurface* VesselOuterSurface =
176 new G4LogicalBorderSurface("VesselOuterSurface",
177 RTbHall->getRichTbHallPhysicalVolume(),
178 VesselEnclosurePhys,
179 RMaterial->getOpticalEnclosureSurface());
180 G4LogicalBorderSurface* VesselInnerSurface =
181 new G4LogicalBorderSurface("VesselInnerSurface",
182 VesselEnclosurePhys,
183 RTbHall->getRichTbHallPhysicalVolume(),
184 RMaterial->getOpticalEnclosureSurface());
185
186 RichTbEnclosureOuterBSurf=VesselOuterSurface;
187 RichTbEnclosureInnerBSurf=VesselInnerSurface;
188
189 G4LogicalVolume* RadFrameLog=
190 new G4LogicalVolume(RadFrame,RMaterial->getNitrogenGas(),
191 "RadFrame",0,0,0);
192
193 G4VPhysicalVolume* RadFramePhys=
194 new G4PVPlacement(RadFrameTransform,"RadFrame",RadFrameLog,
195 VesselEnclosurePhys,false,0);
196
197 //Now for the holder upstream and downstream of the Aerogel Tiles.
198 G4SubtractionSolid* RadUpW =
199 new G4SubtractionSolid("RadUpW",RadHoldUps,RadHoldUpWin,
200 RadWinUpTransform);
201
202 G4LogicalVolume* RadUpWLog=
203 new G4LogicalVolume(RadUpW,RMaterial->getPlasticAg(),
204 "RadUpW",0,0,0);
205
206 G4VPhysicalVolume* RadUpWPhys=
207 new G4PVPlacement( RadHoldUpTransform,"RadUpW",RadUpWLog,
208 RadFramePhys ,false,0);
209 //
210 G4SubtractionSolid* RadDnW =
211 new G4SubtractionSolid("RadDnW",RadHoldDns,RadHoldDnWin,
212 RadWinDnTransform);
213
214 G4LogicalVolume* RadDnWLog=
215 new G4LogicalVolume(RadDnW,RMaterial->getAluminium(),
216 "RadDnW",0,0,0);
217
218 G4VPhysicalVolume* RadDnWPhys=
219 new G4PVPlacement( RadHoldDnTransform,"RadDnW",RadDnWLog,
220 RadFramePhys ,false,0);
221
222
223 //Now for the various aerogel tiles and the wraps above and
224 //below them
225
226 NumAerogelTiles= NAgelTiles;
227 G4RotationMatrix AgelRot,AgelWrapTopRot,AgelWrapBotRot;
228 G4double AgelPosSZ[MaxNumberOfAerogelTiles];
229 G4double AgelPosCurZ[MaxNumberOfAerogelTiles];
230 for(G4int agNum=0; agNum<NAgelTiles; agNum++ ){
231 G4int agTnumber= RConfig->GetCurAerogelTNumber(agNum);
232
233 G4Box* Agel = new G4Box("Agel", AgelHalfX[agTnumber],
234 AgelHalfY[agTnumber],AgelHalfZ[agTnumber]);
235
236 AgelPosSZ[agNum]=AgelHalfZ[agTnumber];
237
238 AgelPosCurZ[agNum]=AgelEndZ-AgelHalfZ[agTnumber];
239 for(G4int agt=0; agt<agNum; agt++ ) {
240
241 AgelPosCurZ[agNum] -= (2*AgelPosSZ[agt]+ AgelTileGapZ);
242 }
243 G4ThreeVector AgelTrsl(AgelPosX[agNum],
244 AgelPosY[agNum],AgelPosCurZ[agNum]);
245 G4Transform3D AgelTransform(AgelRot,AgelTrsl);
246
247 G4Material* CurAgelMaterial= RMaterial->getAerogelMaterial(agTnumber);
248
249 G4LogicalVolume* AgelLog=
250 new G4LogicalVolume(Agel,CurAgelMaterial,"Agel",0,0,0);
251 G4VPhysicalVolume* AgelPhys=
252 new G4PVPlacement(AgelTransform,"Agel",AgelLog,
253 RadFramePhys,false,agNum);
254
255 RichTbAgelLVol[agNum] = AgelLog;
256 RichTbAgelPVol[agNum] = AgelPhys;
257
258 G4Box* AgelWrapTop = new G4Box("AgelWrapTop", AgelWrapTopHalfX[agTnumber],
259 AgelWrapTopHalfY[agTnumber],
260 AgelWrapTopHalfZ[agTnumber]);
261 G4Box* AgelWrapBot = new G4Box("AgelWrapBot", AgelWrapBotHalfX[agTnumber],
262 AgelWrapBotHalfY[agTnumber],
263 AgelWrapBotHalfZ[agTnumber]);
264
265 G4double AgelWrapTopPosCurZ=AgelPosCurZ[agNum];
266 G4double AgelWrapBotPosCurZ=AgelPosCurZ[agNum];
267 G4double AgelWrapTopPosCurY=AgelHalfY[agTnumber]+
268 AgelWrapTopHalfY[agTnumber];
269 G4double AgelWrapBotPosCurY=-AgelHalfY[agTnumber]+
270 -AgelWrapBotHalfY[agTnumber];
271 G4ThreeVector AgelWrapTopTrsl(AgelWrapTopPosX[agNum],
272 AgelWrapTopPosCurY,AgelWrapTopPosCurZ);
273 G4Transform3D AgelWrapTopTransform(AgelWrapTopRot,AgelWrapTopTrsl);
274 G4ThreeVector AgelWrapBotTrsl(AgelWrapBotPosX[agNum],
275 AgelWrapBotPosCurY,AgelWrapBotPosCurZ);
276 G4Transform3D AgelWrapBotTransform(AgelWrapBotRot,AgelWrapBotTrsl);
277
278 G4LogicalVolume* AgelWrapTopLog=
279 new G4LogicalVolume(AgelWrapTop, RMaterial->getPlasticAg(),
280 "AgelWrapTop",0,0,0);
281 G4LogicalVolume* AgelWrapBotLog=
282 new G4LogicalVolume(AgelWrapBot, RMaterial->getPlasticAg(),
283 "AgelWrapBot",0,0,0);
284
285 G4VPhysicalVolume* AgelWrapTopPhys=
286 new G4PVPlacement(AgelWrapTopTransform,"AgelWrapTop",
287 AgelWrapTopLog,RadFramePhys,false,agNum);
288
289 G4VPhysicalVolume* AgelWrapBotPhys=
290 new G4PVPlacement(AgelWrapBotTransform,"AgelWrapBot",
291 AgelWrapBotLog,RadFramePhys,false,agNum);
292
293 RichTbAgelWrapTopLVol[agNum] = AgelWrapTopLog;
294 RichTbAgelWrapTopPVol[agNum] = AgelWrapTopPhys;
295 RichTbAgelWrapBotLVol[agNum] = AgelWrapBotLog;
296 RichTbAgelWrapBotPVol[agNum] = AgelWrapBotPhys;
297
298 }
299
300 // FilterType CurFil= RConfig->GetFilterType();
301 G4int Filnum= RConfig->GetFilterTNumber() ;
302 G4LogicalVolume* FilterLog=0;
303 G4VPhysicalVolume* FilterPhys=0;
304 if(Filnum >= 0 ) {
305
306 G4double FilterHalfZCur= FilterHalfZArray[Filnum];
307
308 G4double FilterPosZ= FilterPosZNominal-FilterHalfZNominal+FilterHalfZCur;
309
310
311 G4RotationMatrix FilterRot;
312
313 G4ThreeVector FilterTrsl(FilterPosX,FilterPosY,FilterPosZ);
314 G4Transform3D FilterTransform(FilterRot,FilterTrsl);
315
316 G4Material* CurFilterMaterial
317 = RMaterial-> getRichTbFilterMaterial( Filnum);
318
319 FilterLog=
320 new G4LogicalVolume(FilterBox, CurFilterMaterial,
321 "FilterBox",0,0,0);
322
323 FilterPhys=
324 new G4PVPlacement(FilterTransform,"FilterBox",FilterLog,
325 RadFramePhys,false,0);
326
327// G4LogicalBorderSurface* FilterInnerSurface =
328 new G4LogicalBorderSurface("RichTbFilterInnerSurface",
329 FilterPhys,VesselEnclosurePhys,
330 RMaterial->getOpticalFilterSurface());
331
332// G4LogicalBorderSurface* FilterOuterSurface =
333 new G4LogicalBorderSurface("RichTbFilterOuterSurface",
334 VesselEnclosurePhys,FilterPhys,
335 RMaterial->getOpticalFilterSurface());
336
337 }
338 G4LogicalVolume* MirrorLog=
339 new G4LogicalVolume(MirrorSphe,RMaterial->getMirrorQuartz(),
340 "MirrorSphe",0,0,0);
341
342
343 G4VPhysicalVolume* MirrorPhys=
344 new G4PVPlacement(MirrorTransform,"MirrorSphe",MirrorLog,
345 VesselEnclosurePhys,false,0);
346 G4LogicalBorderSurface* MirrorSurface =
347 new G4LogicalBorderSurface("RichTbMirrorSurface",
348 VesselEnclosurePhys,MirrorPhys,
349 RMaterial->getOpticalMirrorSurface());
350
351
352 RichTbRadFrameLVol= RadFrameLog;
353 RichTbRadFramePVol= RadFramePhys;
354
355 RichTbRadUpWLVol= RadUpWLog;
356 RichTbRadUpWPVol= RadUpWPhys;
357
358 RichTbRadDnWLVol= RadDnWLog;
359 RichTbRadDnWPVol= RadDnWPhys;
360
361 if(Filnum >= 0 ) {
362 RichTbFilterLVol = FilterLog;
363 RichTbFilterPVol = FilterPhys;
364 }
365 RichTbMirrorLVol=MirrorLog;
366 RichTbMirrorPVol=MirrorPhys;
367 RichTbMirrorBSurf=MirrorSurface;
368 }
369
370 RichTbEnclosureLVol=VesselEnclosureLog;
371 RichTbEnclosurePVol=VesselEnclosurePhys;
372
373
374 }
375
376RichTbComponent::~RichTbComponent() {; }
377
378
379
380
381
382
383
384
385
Note: See TracBrowser for help on using the repository browser.