Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Par01ParallelWorldForPion.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 //
26 // $Id: Par01ParallelWorldForPion.cc 77659 2013-11-27 08:57:46Z gcosmo $
27 //
29 #include "Par01PionShowerModel.hh"
30 
31 #include "G4Box.hh"
32 #include "G4LogicalVolume.hh"
33 #include "G4Region.hh"
34 #include "G4PVPlacement.hh"
35 #include "G4ThreeVector.hh"
36 #include "G4SystemOfUnits.hh"
37 #include "G4NistManager.hh"
38 
39 #include "G4RegionStore.hh"
40 
42  : G4VUserParallelWorld(worldName)
43 {;}
44 
46 {;}
47 
48 void Par01ParallelWorldForPion::Construct()
49 {
50  // -- Get nist material manager
51  G4NistManager* nistManager = G4NistManager::Instance();
52 
53  // Build materials
54  G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
55 
56  // -------------------------------
57  // Build parallel/ghost geometry:
58  // -------------------------------
59 
60  // -- Obtain clone of mass geometry world from GetWorld() base class utility:
61  G4VPhysicalVolume* ghostWorld = GetWorld();
62  // -- Why needed ? No default ?
63  ghostWorld->GetLogicalVolume()->SetMaterial(air);
64  G4Region* parallelWorldRegion = new G4Region("ParallelWorldRegion");
65  parallelWorldRegion->AddRootLogicalVolume(ghostWorld->GetLogicalVolume());
66 
67  // -- Create box for encompassing Elec.+Had. calorimeters together:
68  G4double detectSize = 125*cm;
69  G4Box *ghostBox
70  = new G4Box("GhostBox", detectSize+5*cm, detectSize+5*cm, 80*cm);
71  // -- Build the subsequent logical volume:
72  G4LogicalVolume* ghostLogical
73  = new G4LogicalVolume(ghostBox,
74  air, // -- no material : IMPOSSIBLE !!!
75  "GhostLogical",
76  0, 0, 0);
77  // -- And place this logical volume in the parallel geometry:
78  new G4PVPlacement(0,G4ThreeVector(0., 0., 175*cm),
79  "GhostPhysical",
80  ghostLogical,
81  ghostWorld,false,0);
82 
83  // -----------------------
84  // Setup fast simulation:
85  // -----------------------
86 
87  // -- Make Elec+Had logical volume becoming a region:
88  G4cout << "Declaring region..." << G4endl;
89  G4Region* ghostRegion = new G4Region("GhostCalorimeterRegion");
90  G4cout << "... region declared. Setting it the ghostLogical volume..." << G4endl;
91  ghostRegion->AddRootLogicalVolume(ghostLogical);
92  G4cout << "... succes.\n" << G4endl;
93 
94 }
95 
96 
97 void Par01ParallelWorldForPion::ConstructSD()
98 {
100 
101  G4Region* ghostRegion = regionStore->GetRegion("GhostCalorimeterRegion");
102  // -- Attach fast simulation model (create the G4FastSimulationManager if needed):
103  new Par01PionShowerModel("ghostPionShowerModel",ghostRegion);
104 
105 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
CLHEP::Hep3Vector G4ThreeVector
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:254
G4VPhysicalVolume * GetWorld()
Definition: G4Box.hh:63
Par01ParallelWorldForPion(G4String worldName)
static G4NistManager * Instance()
static G4RegionStore * GetInstance()
G4GLOB_DLL std::ostream G4cout
G4LogicalVolume * GetLogicalVolume() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetMaterial(G4Material *pMaterial)