source: trunk/examples/advanced/Rich/src/RichTbHpd.cc @ 807

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

update

File size: 11.4 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// RichTbHpd.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 "G4Box.hh"
35#include "G4Trd.hh"
36#include "G4Cons.hh"
37#include "G4Tubs.hh"
38#include "G4Sphere.hh"
39#include "G4RotationMatrix.hh"
40#include "G4ThreeVector.hh"
41#include "G4Transform3D.hh"
42#include "G4LogicalVolume.hh"
43#include "G4VPhysicalVolume.hh"
44#include "G4PVPlacement.hh"
45#include "G4UnionSolid.hh"
46#include "RichTbGeometryParameters.hh"
47#include "G4LogicalBorderSurface.hh"
48#include "G4LogicalSkinSurface.hh"
49#include "G4OpticalSurface.hh"
50#include "G4SDManager.hh"
51#include "RichTbSD.hh"
52#include "RichTbHpd.hh"
53
54RichTbHpd::RichTbHpd() {; }
55RichTbHpd::~RichTbHpd() { ; }
56
57RichTbHpd::RichTbHpd(RichTbMaterial* RMaterial, 
58                      G4VPhysicalVolume* MotherOfHpd, G4int ihpd,
59                     G4int NumberofSectorsInHpd,
60                      G4bool ConstructTrackingGeomSwitch){
61
62  HpdNumber=ihpd;
63  NumSectInHpd= NumberofSectorsInHpd;
64  ConstructTrackGeomSwitch=ConstructTrackingGeomSwitch;
65
66   G4Tubs* HpdMaster=
67         new G4Tubs("HPDMaster",HpdMasterInnerRad,
68                    HpdMasterRad,HpdMasterHalfZ,
69                     HpdMasterStartPhi,HpdMasterEndPhi);
70
71  //Overall rotations of the HPD
72    G4RotationMatrix HpdMasterRotationX,HpdMasterRotationY;
73    G4RotationMatrix HpdMasterRotationZ;
74    HpdMasterRotationZ.rotateZ(HpdMasterRotZ[ihpd]);
75    G4ThreeVector HpdMasterTrsl(HpdMasterPosX[ihpd],HpdMasterPosY[ihpd],
76                                HpdMasterPosZ[ihpd]);
77    G4Transform3D HpdMasterTransform(HpdMasterRotationZ,
78                                     HpdMasterTrsl);
79
80    //Now for the placements of the HpdMaster
81
82    // use vacuum . the photoelectrons travel in vacuum. hence
83    // just for simplicity the the hpdmaster is set as vacuum.
84     G4LogicalVolume* HpdMasterLog=
85      new G4LogicalVolume(HpdMaster,RMaterial->getVacuum(),
86                        "HpdMaster",0,0,0);
87    G4VPhysicalVolume* HpdMasterPhys=
88           new G4PVPlacement(HpdMasterTransform,"HpdMaster", 
89                HpdMasterLog, MotherOfHpd ,false,HpdNumber);
90
91    //Now create the Silicon Detector sectors inside the HPD.
92
93     for (G4int isec=0; isec<NumberOfSiDetSectors; isec++){   
94   
95    richSiliconDetectorSect[isec] = new RichTbSiDet(RMaterial,HpdMasterPhys,
96                             ConstructTrackGeomSwitch,ihpd,isec);
97
98     }
99    //Now for the rest of the components of the HPD
100
101   if(ConstructTrackingGeomSwitch) {
102
103    G4Tubs* HpdEnvelopeLargeTube=
104      new G4Tubs("HpdEnvelopeLargeTube",HpdEnvelopeLargeTubeInnerRad,
105                 HpdEnvelopeLargeTubeOuterRad,HpdEnvelopeLargeTubeHalfZ,
106                 HpdEnvelopeLargeTubeStartPhi, HpdEnvelopeLargeTubeEndPhi);
107
108    G4Cons* HpdEnvelopeCone =
109      new G4Cons("HpdEnvelopeCone",HpdEnvelopeConeInnerR1,
110                 HpdEnvelopeConeOuterR1,HpdEnvelopeConeInnerR2,
111                 HpdEnvelopeConeOuterR2,HpdEnvelopeConeHalfZ,
112                 HpdEnvelopeConeStartPhi,HpdEnvelopeConeEndPhi);
113
114    G4Tubs* HpdEnvelopeSmallTube=
115      new G4Tubs("HpdEnvelopeSmallTube",HpdEnvelopeSmallTubeInnerRad,
116                 HpdEnvelopeSmallTubeOuterRad,HpdEnvelopeSmallTubeHalfZ,
117                 HpdEnvelopeSmallTubeStartPhi, HpdEnvelopeSmallTubeEndPhi);
118
119    G4Tubs* HpdEnvelopeEndCap=
120      new G4Tubs("HpdEnvelopeEndcap",HpdEnvelopeEndCapInnerRad,
121                 HpdEnvelopeEndCapRad,
122                 HpdEnvelopeEndCapHalfZ,HpdEnvelopeEndCapStartPhi,
123                 HpdEnvelopeEndCapEndPhi);
124
125    G4Sphere* HpdQuartzWindowSphereseg =
126      new G4Sphere("HpdQuartzWindow", HpdQuarzWindowRInner,
127            HpdQuarzWindowROuter,HpdQuartzWStartPhi,
128            HpdQuartzWPhiSize,HpdQuartzWStartTheta,
129            HpdQuartzWThetaSize);
130
131    G4Sphere* HpdPhCathodeSphereseg =
132      new G4Sphere("HpdPhCathodeWindow", HpdPhCathodeRInner,
133            HpdPhCathodeROuter,HpdPhCathodeStartPhi,
134            HpdPhCathodePhiSize,HpdPhCathodeStartTheta,
135            HpdPhCathodeThetaSize);
136
137    //rotations and translations
138   //Define Rotations for the HPD components
139  //                 even if they have no real rotations.
140
141    G4RotationMatrix HpdEnvelopeLargeTubeRotation,
142                     HpdEnvelopeConeRotation,
143                     HpdEnvelopeSmallTubeRotation;
144    G4RotationMatrix HpdEnvelopeEndCapRotation,HpdQuartzWRotation;
145    G4RotationMatrix HpdPhCathodeRotation;
146
147
148    G4ThreeVector HpdEnvelopeLargeTubeTrsl(HpdEnvelopeLargeTubePosX,
149                                        HpdEnvelopeLargeTubePosY,
150                                        HpdEnvelopeLargeTubePosZ);
151    G4Transform3D HpdEnvelopeLargeTubeTransform(HpdEnvelopeLargeTubeRotation,
152                                               HpdEnvelopeLargeTubeTrsl);
153
154    G4ThreeVector HpdEnvelopeConeTrsl(HpdEnvelopeConeShiftX,
155                                      HpdEnvelopeConeShiftY,
156                                      HpdEnvelopeConeShiftZ);
157    G4Transform3D HpdEnvelopeConeTransform(HpdEnvelopeConeRotation,
158                                           HpdEnvelopeConeTrsl);
159
160
161    G4ThreeVector HpdEnvelopeSmallTubeTrsl(HpdEnvelopeSmallTubeShiftX,
162                                        HpdEnvelopeSmallTubeShiftY,
163                                        HpdEnvelopeSmallTubeShiftZ);
164    G4Transform3D HpdEnvelopeSmallTubeTransform(HpdEnvelopeSmallTubeRotation,
165                                               HpdEnvelopeSmallTubeTrsl);
166
167    G4ThreeVector HpdEnvelopeEndCapTrsl(HpdEnvelopeEndCapShiftX,
168                                     HpdEnvelopeEndCapShiftY,
169                                     HpdEnvelopeEndCapShiftZ);
170    G4Transform3D HpdEnvelopeEndCapTransform(HpdEnvelopeEndCapRotation,
171                                               HpdEnvelopeEndCapTrsl);
172
173    G4ThreeVector HpdQuartzWTrsl(HpdQuartzWPosX,
174                                 HpdQuartzWPosY,
175                                 HpdQuartzWPosZ);
176    G4Transform3D HpdQuartzWTransform(HpdQuartzWRotation,
177                                               HpdQuartzWTrsl);
178    G4ThreeVector HpdPhCathodeTrsl(HpdPhCathodePosX,
179                                   HpdPhCathodePosY,
180                                   HpdPhCathodePosZ);
181    G4Transform3D HpdPhCathodeTransform(HpdPhCathodeRotation,
182                                               HpdPhCathodeTrsl);
183
184    //Now for the placements
185    G4UnionSolid* HpdEnvelopeTubeLC =
186      new G4UnionSolid("HpdEnvelopeTubeLC", HpdEnvelopeLargeTube, 
187                       HpdEnvelopeCone,
188                       HpdEnvelopeConeTransform);
189     
190//    G4LogicalVolume*  HpdEnvelopeTubeLCLog=
191      new G4LogicalVolume(HpdEnvelopeTubeLC,RMaterial->getHpdTubeMaterial(),
192                          "HpdEnvelopeTubeLC",0,0,0);
193
194    G4UnionSolid* HpdEnvelopeTubeLCS =
195      new G4UnionSolid("HpdEnvelopeTubeLCS", HpdEnvelopeTubeLC, 
196                       HpdEnvelopeSmallTube,
197                       HpdEnvelopeSmallTubeTransform);
198     
199//    G4LogicalVolume*  HpdEnvelopeTubeLCSLog=
200      new G4LogicalVolume(HpdEnvelopeTubeLCS,RMaterial->getHpdTubeMaterial(),
201                          "HpdEnvelopeTubeLCS",0,0,0);
202
203    G4UnionSolid* HpdEnvelopeTubeGrand =
204      new G4UnionSolid("HpdEnvelopeTubeGrand", HpdEnvelopeTubeLCS, 
205                      HpdEnvelopeEndCap,HpdEnvelopeEndCapTransform);
206
207
208    G4LogicalVolume*  HpdEnvelopeTubeGrandLog=
209      new G4LogicalVolume(HpdEnvelopeTubeGrand,RMaterial->getHpdTubeMaterial(),
210                          "HpdEnvelopeTubeGrand",0,0,0);
211
212    //
213    //
214    G4LogicalVolume* HpdQuartzWindowLog=
215      new G4LogicalVolume( HpdQuartzWindowSphereseg,
216                           RMaterial->getPadHpdQuartzWMaterial(),
217                           "HpdQuartzWindow",0,0,0);
218
219   G4LogicalVolume* HpdPhCathodeLog=
220      new G4LogicalVolume( HpdPhCathodeSphereseg,
221                           RMaterial->getPadHpdPhCathodeMaterial(),
222                           "HpdPhCathode",0,0,0);
223   //
224   //
225    G4VPhysicalVolume* HpdEnvelopeTubeGrandPhys=
226           new G4PVPlacement(HpdEnvelopeLargeTubeTransform,
227                "HpdEnvelopeTubeGrand", 
228                HpdEnvelopeTubeGrandLog,HpdMasterPhys,false,HpdNumber);
229
230    G4VPhysicalVolume* HpdQuartzWindowPhys=
231           new G4PVPlacement(HpdQuartzWTransform,"HpdQuartzWindow", 
232                HpdQuartzWindowLog,HpdMasterPhys,false,HpdNumber);
233
234    G4VPhysicalVolume* HpdPhCathodePhys=
235           new G4PVPlacement(HpdPhCathodeTransform,"HpdPhCathode", 
236                HpdPhCathodeLog,HpdMasterPhys,false,HpdNumber);
237
238
239//   G4LogicalBorderSurface* HpdQuartzWSurface =
240     new G4LogicalBorderSurface("HpdQuartzWSurface",HpdMasterPhys,
241                                 HpdQuartzWindowPhys,
242                          RMaterial->getOpticalHpdTQuartzWSurface());
243
244//   G4LogicalBorderSurface* HpdQPhCathodeSurface =
245     new G4LogicalBorderSurface("HpdQPhCathodeSurface",HpdQuartzWindowPhys,
246                                 HpdPhCathodePhys,
247                 RMaterial->getOpticalHpdQuartzWPhCathodeSurface());
248
249//   G4LogicalBorderSurface* HpdPhCathodeQSurface =
250     new G4LogicalBorderSurface("HpdQPhCathodeSurface", HpdPhCathodePhys,
251                                HpdQuartzWindowPhys,
252                 RMaterial->getOpticalHpdQuartzWPhCathodeSurface());
253
254   //change made on 26-9-01 SE to make photocathode transparent.
255   //    G4LogicalSkinSurface* HpdPhCathodeSkinSurface =
256   //    new G4LogicalSkinSurface("HpdPhCathodeSkinSurface",
257   //                          HpdPhCathodeLog,
258   //            RMaterial->getOpticalPhCathodeSkinSurface());
259
260//    G4LogicalBorderSurface* HpdPhCathodeMasterSurface =
261      new G4LogicalBorderSurface("HpdPhCathodeMasterSurface",
262                                 HpdPhCathodePhys,HpdMasterPhys,   
263                 RMaterial->getOpticalPhCathodeBorderSurface());
264
265//    G4LogicalBorderSurface* HpdMasterPhCathodeSurface =
266      new G4LogicalBorderSurface("HpdMasterPhCathodeSurface",
267                        HpdMasterPhys,HpdPhCathodePhys,   
268                 RMaterial->getOpticalPhCathodeBorderSurface());
269
270//   G4LogicalBorderSurface* HpdEnvelopeSurface =
271     new G4LogicalBorderSurface("HpdEnvelopeSurface",HpdMasterPhys,
272                          HpdEnvelopeTubeGrandPhys,
273                                RMaterial->getOpticalHpdMetalSurface());
274    RichTbHpdEnvelopeTubeGrandLVol=HpdEnvelopeTubeGrandLog;
275    RichTbHpdEnvelopeTubeGrandPVol=HpdEnvelopeTubeGrandPhys;
276    RichTbHpdQuartzWLVol=HpdQuartzWindowLog;
277    RichTbHpdQuartzWPVol=HpdQuartzWindowPhys;
278    RichTbPhCathodeLVol=HpdPhCathodeLog;
279    RichTbPhCathodePVol=HpdPhCathodePhys;
280
281   }
282    RichTbHpdLVol=HpdMasterLog;
283    RichTbHpdPVol=HpdMasterPhys;
284       
285
286}
287
288
289
290
291
292
293
Note: See TracBrowser for help on using the repository browser.