Geant4  10.01.p03
RE06ParallelWorld.cc
Go to the documentation of this file.
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 //
28 //
29 // $Id: RE06ParallelWorld.cc 83381 2014-08-21 14:18:13Z gcosmo $
30 //
31 
32 #include "RE06ParallelWorld.hh"
33 
34 #include "G4Tubs.hh"
35 #include "G4LogicalVolume.hh"
36 #include "G4PVPlacement.hh"
37 #include "G4PVReplica.hh"
38 
39 #include "G4SDManager.hh"
41 #include "G4VPrimitiveScorer.hh"
42 #include "G4PSEnergyDeposit.hh"
43 #include "G4PSNofSecondary.hh"
44 #include "G4PSTrackLength.hh"
45 #include "G4PSNofStep.hh"
47 #include "G4VSDFilter.hh"
48 #include "G4SDParticleFilter.hh"
49 #include "G4ios.hh"
50 #include "G4SystemOfUnits.hh"
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55 
57 :G4VUserParallelWorld(worldName),
58  fConstructed(false),
59  fSerial(false),
60  fTotalThickness(2.0*m),
61  fNumberOfLayers(20)
62 {
63  for(size_t i=0;i<3;i++)
64  {
65  fCalorLogical[i] = 0;
66  fLayerLogical[i] = 0;
67  fCalorPhysical[i] = 0;
68  fLayerPhysical[i] = 0;
69  }
70  fCalName[0] = "Calor-AP";
71  fCalName[1] = "Calor-BP";
72  fCalName[2] = "Calor-CP";
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 {;}
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81 
83 {
84  if(!fConstructed)
85  {
86  fConstructed = true;
87  SetupGeometry();
88  }
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92 
94 {
95  if(!fSDConstructed)
96  {
97  fSDConstructed = true;
99  }
100 }
101 
102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104 {
105  //
106  // World
107  //
108  G4VPhysicalVolume* ghostWorld = GetWorld();
109  G4LogicalVolume* worldLogical = ghostWorld->GetLogicalVolume();
110 
111  //
112  // Calorimeter
113  //
114  G4VSolid* calorSolid
115  = new G4Tubs("Calor",0.0,0.5*m,fTotalThickness/2.,0.0,360.*deg);
116  G4int i;
117  for(i=0;i<3;i++)
118  {
119  fCalorLogical[i] = new G4LogicalVolume(calorSolid,0,fCalName[i]);
120  if(fSerial)
121  {
122  fCalorPhysical[i] = new G4PVPlacement(0,
124  fCalorLogical[i],fCalName[i],worldLogical,false,i);
125  }
126  else
127  {
128  fCalorPhysical[i] = new G4PVPlacement(0,
129  G4ThreeVector(0.,G4double(i-1)*m,0.),
130  fCalorLogical[i],fCalName[i],worldLogical,false,i);
131  }
132  }
133 
134  //
135  // Layers --- as absorbers
136  //
137  G4VSolid* layerSolid
138  = new G4Tubs("Layer",0.0,0.5*m,fTotalThickness/2.,0.0,360.*deg);
139  for(i=0;i<3;i++)
140  {
141  fLayerLogical[i]
142  = new G4LogicalVolume(layerSolid,0,fCalName[i]+"_LayerLog");
143  fLayerPhysical[i]
144  = new G4PVReplica(fCalName[i]+"_Layer",fLayerLogical[i],fCalorLogical[i],
146  }
147 
148 }
149 
150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
151 
153 {
155  G4String filterName, particleName;
156 
157  G4SDParticleFilter* gammaFilter
158  = new G4SDParticleFilter(filterName="gammaFilter",particleName="gamma");
159  G4SDParticleFilter* electronFilter
160  = new G4SDParticleFilter(filterName="electronFilter",particleName="e-");
161  G4SDParticleFilter* positronFilter
162  = new G4SDParticleFilter(filterName="positronFilter",particleName="e+");
163  G4SDParticleFilter* epFilter
164  = new G4SDParticleFilter(filterName="epFilter");
165  epFilter->add(particleName="e-");
166  epFilter->add(particleName="e+");
167 
168  for(G4int i=0;i<3;i++)
169  {
170  G4String detName = fCalName[i]+"_para";
172 
173  G4VPrimitiveScorer* primitive;
174  primitive = new G4PSEnergyDeposit("eDep");
175  det->RegisterPrimitive(primitive);
176  primitive = new G4PSNofSecondary("nGamma");
177  primitive->SetFilter(gammaFilter);
178  det->RegisterPrimitive(primitive);
179  primitive = new G4PSNofSecondary("nElectron");
180  primitive->SetFilter(electronFilter);
181  det->RegisterPrimitive(primitive);
182  primitive = new G4PSNofSecondary("nPositron");
183  primitive->SetFilter(positronFilter);
184  det->RegisterPrimitive(primitive);
185  primitive = new G4PSTrackLength("trackLength");
186  primitive->SetFilter(epFilter);
187  det->RegisterPrimitive(primitive);
188  primitive = new G4PSNofStep("nStep");
189  primitive->SetFilter(epFilter);
190  det->RegisterPrimitive(primitive);
191 
194  }
196 
197 }
198 
199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
200 
202 {
203  if(fSerial==serial) return;
204  fSerial=serial;
205  if(!fConstructed) return;
206  for(G4int i=0;i<3;i++)
207  {
208  if(fSerial)
209  {
210  fCalorPhysical[i]
211  ->SetTranslation(G4ThreeVector(0.,0.,G4double(i-1)*2.*m));
212  }
213  else
214  {
215  fCalorPhysical[i]
216  ->SetTranslation(G4ThreeVector(0.,G4double(i-1)*m,0.));
217  }
218  }
219 }
220 
221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool RegisterPrimitive(G4VPrimitiveScorer *)
CLHEP::Hep3Vector G4ThreeVector
G4VPhysicalVolume * GetWorld()
void SetVerboseLevel(G4int vl)
Definition: G4SDManager.hh:90
Definition: G4Tubs.hh:85
void SetFilter(G4VSDFilter *f)
virtual void ConstructSD()
Definition of the RE06ParallelWorld class.
RE06ParallelWorld(G4String worldName)
void SetSerialGeometry(G4bool ser)
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
virtual void Construct()
static const double deg
Definition: G4SIunits.hh:133
bool G4bool
Definition: G4Types.hh:79
G4LogicalVolume * fLayerLogical[3]
void SetTranslation(const G4ThreeVector &v)
static G4ThreadLocal G4bool fSDConstructed
G4LogicalVolume * fCalorLogical[3]
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:67
G4LogicalVolume * GetLogicalVolume() const
void add(const G4String &particleName)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
static const double m
Definition: G4SIunits.hh:110
double G4double
Definition: G4Types.hh:76
virtual ~RE06ParallelWorld()
Definition: geomdefs.hh:54
G4VPhysicalVolume * fLayerPhysical[3]
G4VPhysicalVolume * fCalorPhysical[3]