source: trunk/examples/novice/N05/src/ExN05ParallelWorldForPion.cc @ 1287

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

update

File size: 4.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#include "ExN05ParallelWorldForPion.hh"
27#include "G4Box.hh"
28#include "G4LogicalVolume.hh"
29#include "G4Region.hh"
30#include "G4PVPlacement.hh"
31#include "G4ThreeVector.hh"
32#include "ExN05PionShowerModel.hh"
33
34
35ExN05ParallelWorldForPion::ExN05ParallelWorldForPion(G4String worldName)
36  : G4VUserParallelWorld(worldName)
37{;}
38
39ExN05ParallelWorldForPion::~ExN05ParallelWorldForPion()
40{;}
41
42void ExN05ParallelWorldForPion::Construct()
43{
44  // -- fake material:
45  G4double a, iz, density;
46  G4String name, symbol;
47  G4int nel;
48  a = 14.01*g/mole;
49  G4Element* elN = new G4Element(name="Nitrogen", symbol="N",  iz=7.,  a);
50  a = 16.00*g/mole;
51  G4Element* elO = new G4Element(name="Oxigen",   symbol="O",  iz=8.,  a);
52  density = 1.29e-03*g/cm3;
53  G4Material* Air = new G4Material(name="Air", density, nel=2);
54  Air->AddElement(elN, .7);
55  Air->AddElement(elO, .3);
56
57  // -------------------------------
58  //  Build parallel/ghost geometry:
59  // -------------------------------
60
61  // -- Obtain clone of mass geometry world from GetWorld() base class utility:
62  G4VPhysicalVolume* ghostWorld = GetWorld();
63  // -- Why needed ? No default ?
64  ghostWorld->GetLogicalVolume()->SetMaterial(Air);
65  G4Region* parallelWorldRegion = new G4Region("ParallelWorldRegion");
66  parallelWorldRegion->AddRootLogicalVolume(ghostWorld->GetLogicalVolume());
67 
68  // -- Create box for encompassing Elec.+Had. calorimeters together:
69  G4double detectSize = 125*cm;
70  G4Box *ghostBox
71    = new G4Box("GhostBox", detectSize+5*cm, detectSize+5*cm, 80*cm);
72  // -- Build the subsequent logical volume:
73  G4LogicalVolume* ghostLogical
74    = new G4LogicalVolume(ghostBox,
75                          Air,               // -- no material : IMPOSSIBLE !!!
76                          "GhostLogical", 
77                          0, 0, 0);
78  // -- And place this logical volume in the parallel geometry:
79  new G4PVPlacement(0,G4ThreeVector(0., 0., 175*cm),
80                    "GhostPhysical",
81                    ghostLogical,
82                    ghostWorld,false,0);
83
84  // -----------------------
85  //  Setup fast simulation:
86  // -----------------------
87
88  // -- Make Elec+Had logical volume becoming a region:
89  G4cout << "Declaring region..." << G4endl;
90  G4Region* ghostRegion = new G4Region("GhostCalorimeterRegion");
91  G4cout << "... region declared. Setting it the ghostLogical volume..." << G4endl;
92  ghostRegion->AddRootLogicalVolume(ghostLogical);
93  G4cout << "... succes.\n" << G4endl;
94
95  //  // -- Create fast simulation manager, which will handle the physics fast simulation model(s):
96  //  new G4FastSimulationManager(ghostRegion);
97
98  // -- Attach fast simulation model (create the G4FastSimulationManager if needed):
99  new ExN05PionShowerModel("ghostPionShowerModel",ghostRegion);
100 
101}
Note: See TracBrowser for help on using the repository browser.