source: trunk/examples/advanced/gammaray_telescope/src/GammaRayTelTrackerROGeometry.cc @ 1272

Last change on this file since 1272 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 10.9 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//
27// $Id: GammaRayTelTrackerROGeometry.cc,v 1.6 2006/06/29 15:57:10 gunter Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30//
31// ------------------------------------------------------------
32//      GEANT 4 class implementation file
33//      CERN Geneva Switzerland
34//
35//
36//      ------------ GammaRayTelTrackerROGeometry class ------
37//           by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
38//
39// ************************************************************
40#include "G4RunManager.hh"
41#include "GammaRayTelTrackerROGeometry.hh"
42#include "GammaRayTelDummySD.hh"
43#include "GammaRayTelDetectorConstruction.hh"
44
45#include "G4LogicalVolume.hh"
46#include "G4VPhysicalVolume.hh"
47#include "G4PVPlacement.hh"
48#include "G4PVReplica.hh"
49#include "G4SDManager.hh"
50#include "G4Box.hh"
51#include "G4ThreeVector.hh"
52#include "G4Material.hh"
53 
54
55GammaRayTelTrackerROGeometry::GammaRayTelTrackerROGeometry()
56  : G4VReadOutGeometry()
57{
58}
59GammaRayTelTrackerROGeometry::GammaRayTelTrackerROGeometry(G4String aString)
60  :G4VReadOutGeometry(aString)
61{
62 G4RunManager* runManager = G4RunManager::GetRunManager();
63  GammaRayTelDetector =
64    (GammaRayTelDetectorConstruction*)(runManager->GetUserDetectorConstruction());
65}
66
67GammaRayTelTrackerROGeometry::~GammaRayTelTrackerROGeometry()
68{
69}
70
71G4VPhysicalVolume* GammaRayTelTrackerROGeometry::Build()
72{
73  // A dummy material is used to fill the volumes of the readout geometry.
74  // ( It will be allowed to set a NULL pointer in volumes of such virtual
75  // division in future, since this material is irrelevant for tracking.)
76  G4Material* dummyMat  = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
77 
78  //Builds the ReadOut World:
79
80  G4double WorldSizeXY = GammaRayTelDetector->GetWorldSizeXY();
81  G4double WorldSizeZ  = GammaRayTelDetector->GetWorldSizeZ();
82 
83  G4Box* ROWorldBox = new 
84    G4Box("ROWorldBox",WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2); 
85 
86  G4LogicalVolume* ROWorldLog = new G4LogicalVolume(ROWorldBox, dummyMat,
87                                                    "ROWorldLogical");
88  G4PVPlacement* ROWorldPhys = 
89    new G4PVPlacement(0,G4ThreeVector(),"ROWorldPhysical",
90                      ROWorldLog,0,false,0);
91 
92  // Payload RO volume:
93 
94  G4double PayloadSizeXY = GammaRayTelDetector->GetPayloadSizeXY();
95  G4double PayloadSizeZ  = GammaRayTelDetector->GetPayloadSizeZ();
96 
97  G4VSolid* solidPayloadRO
98    = new G4Box("Payload RO",           
99                PayloadSizeXY/2,
100                PayloadSizeXY/2,
101                PayloadSizeZ/2);
102 
103  G4LogicalVolume* logicPayloadRO = new 
104    G4LogicalVolume(solidPayloadRO,dummyMat,"Payload RO",0,0,0); 
105 
106  G4VPhysicalVolume* physiPayloadRO =
107    new G4PVPlacement(0, G4ThreeVector(), 
108                      "Payload RO", logicPayloadRO,ROWorldPhys,false, 0);
109 
110  // -------------------------------
111  // Tracker readout division:
112  // -------------------------------
113  // TRK Layers of Silicon MicroStrips
114 
115 
116  G4double TKRSizeXY = GammaRayTelDetector->GetTKRSizeXY();
117  G4double TKRSizeZ  = GammaRayTelDetector->GetTKRSizeZ();
118  G4double CALSizeZ  = GammaRayTelDetector->GetCALSizeZ();
119  G4double CALTKRDistance  = GammaRayTelDetector->GetCALTKRDistance();
120 
121  G4VSolid*   ROsolidTKR =
122    new G4Box("ReadOutTKR", TKRSizeXY/2,TKRSizeXY/2,TKRSizeZ/2); 
123 
124  G4LogicalVolume*  ROlogicTKR =
125    new G4LogicalVolume(ROsolidTKR,dummyMat, "ReadOutTKR",0,0,0);       
126                                                     
127 
128  G4VPhysicalVolume* ROphysiTKR = 
129    new G4PVPlacement(0, G4ThreeVector(0,0,-PayloadSizeZ/2+CALSizeZ+
130                                       CALTKRDistance+TKRSizeZ/2),
131                      "ReadOutTKR",ROlogicTKR,physiPayloadRO,
132                      false, 0);               
133 
134  // TKR Layers
135 
136 
137  G4double TKRSiliconThickness  =
138    GammaRayTelDetector->GetTKRSiliconThickness();
139  G4int NbOfTKRLayers =  GammaRayTelDetector->GetNbOfTKRLayers();
140  G4double TKRLayerDistance =  GammaRayTelDetector->GetTKRLayerDistance();
141  G4double TKRViewsDistance =  GammaRayTelDetector->GetTKRViewsDistance(); 
142 
143  G4VSolid*  solidTKRDetectorYRO = new G4Box
144    ("TKRDetectorYRO",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2); 
145 
146  G4LogicalVolume* logicTKRDetectorYRO =
147    new G4LogicalVolume(solidTKRDetectorYRO,dummyMat, "TKRDetectorYRO",0,0,0);
148
149  G4VSolid*  solidTKRDetectorXRO = new G4Box
150    ("TKRDetectorXRO",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2); 
151 
152  G4LogicalVolume* logicTKRDetectorXRO =
153    new G4LogicalVolume(solidTKRDetectorXRO,dummyMat, "TKRDetectorXRO",0,0,0);
154  G4int i=0;
155  G4VPhysicalVolume* physiTKRDetectorXRO = 0;
156  G4VPhysicalVolume* physiTKRDetectorYRO = 0;
157 
158 
159  for (i = 0; i < NbOfTKRLayers; i++)
160    {
161     
162      physiTKRDetectorYRO = 
163        new G4PVPlacement(0,G4ThreeVector(0.,0.,-TKRSizeZ/2
164                                          +TKRSiliconThickness/2 
165                                          +(i)*TKRLayerDistance),
166                          "TKRDetectorYRO",             
167                          logicTKRDetectorYRO,
168                          ROphysiTKR,
169                          false,       
170                          i);   
171     
172      physiTKRDetectorXRO = 
173        new G4PVPlacement(0,G4ThreeVector(0.,0.,
174                                          -TKRSizeZ/2+
175                                          TKRSiliconThickness/2 +
176                                          TKRViewsDistance+
177                                          TKRSiliconThickness+
178                                          (i)*TKRLayerDistance),
179                          "TKRDetectorXRO",             
180                          logicTKRDetectorXRO,
181                          ROphysiTKR,
182                          false,       
183                          i);   
184    }
185 
186
187  // Silicon Tiles
188  // some problems with the RO tree
189
190  G4double TKRActiveTileXY =  GammaRayTelDetector->GetTKRActiveTileXY();
191  G4double TKRActiveTileZ  =  GammaRayTelDetector->GetTKRActiveTileZ(); 
192
193  G4VSolid * solidTKRActiveTileXRO = new
194    G4Box("Active Tile X", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
195
196  G4VSolid * solidTKRActiveTileYRO = new
197    G4Box("Active Tile Y", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
198 
199 
200  G4LogicalVolume* logicTKRActiveTileXRO = 
201    new G4LogicalVolume(solidTKRActiveTileXRO, dummyMat,"Active Tile",0,0,0);
202
203  G4LogicalVolume* logicTKRActiveTileYRO = 
204    new G4LogicalVolume(solidTKRActiveTileYRO, dummyMat,"Active Tile",0,0,0);
205   
206  G4int j=0;
207  G4int k=0;
208 
209  G4int NbOfTKRTiles = GammaRayTelDetector->GetNbOfTKRTiles();
210  G4double SiliconGuardRing = GammaRayTelDetector->GetSiliconGuardRing();
211  G4double TilesSeparation = GammaRayTelDetector->GetTilesSeparation();
212 
213  G4VPhysicalVolume* physiTKRActiveTileXRO = 0;
214  G4VPhysicalVolume* physiTKRActiveTileYRO = 0;
215
216  G4double x=0.;
217  G4double y=0.;
218  G4double z=0.;
219
220  for (i=0;i< NbOfTKRTiles; i++)
221    { 
222      for (j=0;j< NbOfTKRTiles; j++)
223        {
224          k = i*NbOfTKRTiles + j;
225         
226          x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
227            (j)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
228          y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
229            (i)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
230          z = 0.;
231
232          physiTKRActiveTileXRO =
233            new G4PVPlacement(0,
234                              G4ThreeVector(x,y,z),
235                              "Active Tile X",         
236                              logicTKRActiveTileXRO,
237                              physiTKRDetectorXRO,
238                              false,   
239                              k);       
240
241          x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
242            (i)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
243          y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
244            (j)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
245          z = 0.;
246
247          physiTKRActiveTileYRO =
248            new G4PVPlacement(0,
249                              G4ThreeVector(x,y,z),
250                              "Active Tile Y",         
251                              logicTKRActiveTileYRO,
252                              physiTKRDetectorYRO,
253                              false,   
254                              k);
255               
256        }
257    }
258 
259 
260  // Silicon Strips
261  // some problems with the RO tree
262 
263  G4double TKRXStripX=0.;
264  G4double TKRYStripY=0.;
265  G4double TKRYStripX=0.; 
266  G4double TKRXStripY=0.;
267 
268  TKRXStripX = TKRYStripY = GammaRayTelDetector->GetTKRSiliconPitch();
269  TKRYStripX = TKRXStripY= GammaRayTelDetector->GetTKRActiveTileXY();
270  G4double TKRZStrip  = GammaRayTelDetector->GetTKRSiliconThickness();
271 
272  G4int NbOfTKRStrips  = GammaRayTelDetector->GetNbOfTKRStrips();
273 
274 
275  G4VSolid* solidTKRStripX = new G4Box("Strip X",                       
276                                       TKRXStripX/2,TKRYStripX/2,
277                                       TKRZStrip/2); 
278 
279  G4LogicalVolume* logicTKRStripX = 
280    new G4LogicalVolume(solidTKRStripX,dummyMat,"Strip X",0,0,0);       
281 
282               
283  G4VSolid* solidTKRStripY = new G4Box("Strip Y",                       
284                                       TKRXStripY/2,TKRYStripY/2,
285                                       TKRZStrip/2); 
286 
287
288  G4LogicalVolume* logicTKRStripY = 
289    new G4LogicalVolume(solidTKRStripY,dummyMat,"Strip Y",0,0,0);       
290                                                       
291                                                     
292  G4VPhysicalVolume* physiTKRStripX = 0;
293  G4VPhysicalVolume* physiTKRStripY = 0;
294  G4double TKRSiliconPitch = GammaRayTelDetector->GetTKRSiliconPitch();
295
296  for (i=0;i< NbOfTKRStrips; i++)
297    { 
298      physiTKRStripX = new 
299        G4PVPlacement(0,G4ThreeVector(-TKRActiveTileXY/2 +TKRSiliconPitch/2 +
300                                      (i)*TKRSiliconPitch, 0., 0.),
301                      "Strip X",               
302                      logicTKRStripX,
303                      physiTKRActiveTileXRO,
304                      false,   
305                      i);       
306
307       
308      physiTKRStripY = new 
309        G4PVPlacement(0,G4ThreeVector(0.,-TKRActiveTileXY/2 
310                                      +TKRSiliconPitch/2 +
311                                      (i)*TKRSiliconPitch, 0.),
312                      "Strip Y",               
313                      logicTKRStripY,
314                      physiTKRActiveTileYRO,
315                      false,   
316                      i);       
317     
318     
319
320
321
322    }
323 
324
325
326  //Flags the strip as sensitive .The pointer here serves
327  // as a flag only to check for sensitivity.
328  // (Could we make it by a simple cast of a non-NULL value ?)
329 
330  GammaRayTelDummySD * dummySensi = new GammaRayTelDummySD("Orpo");
331 
332  logicTKRStripX->SetSensitiveDetector(dummySensi);
333  logicTKRStripY->SetSensitiveDetector(dummySensi);
334 
335  //logicTKRActiveTileXRO->SetSensitiveDetector(dummySensi);
336  //logicTKRActiveTileYRO->SetSensitiveDetector(dummySensi);
337    //logicTKRDetectorRO->SetSensitiveDetector(dummySensi);
338 
339  return ROWorldPhys;
340}
341
342
343
344
345
346
347
348
349
350
Note: See TracBrowser for help on using the repository browser.