ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExGflash2ParallelWorld.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ExGflash2ParallelWorld.cc
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29 
30 // User Classes
32 
33 // G4 Classes
34 #include "G4NistManager.hh"
35 #include "G4Material.hh"
36 #include "G4ThreeVector.hh"
37 #include "G4PVPlacement.hh"
38 #include "G4VPhysicalVolume.hh"
39 #include "G4LogicalVolume.hh"
40 #include "G4Box.hh"
41 #include "G4VisAttributes.hh"
42 #include "G4Colour.hh"
43 #include "G4SystemOfUnits.hh"
44 #include "G4AutoDelete.hh"
45 #include "globals.hh"
46 
47 //fast simulation
50 #include "GFlashShowerModel.hh"
51 #include "GFlashHitMaker.hh"
52 #include "GFlashParticleBounds.hh"
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65  :G4VUserParallelWorld(aWorldName), fRegion(nullptr)
66 {
67  G4cout<<"ExGflash2ParallelWorld::Parralel world constructor"<<G4endl;
68 }
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
73 {
74  delete fFastShowerModel;
75  delete fParameterisation;
76  delete fParticleBounds;
77  delete fHitMaker;
78 }
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81 
83 {
84  // In parallel world material does not matter
85  G4Material* dummy = nullptr;
86 
87  // Build parallel/ghost geometry:
88  auto ghostLogicalVolume = GetWorld()->GetLogicalVolume();
89 
90  // Use part of the Ex1GflashDetectorConstruction (without individual crystals)
91 
92  G4int nbOfCrystals = 10; // this are the crystals PER ROW in this example
93  // cube of 10 x 10 crystals
94  // don't change it @the moment, since
95  // the readout in event action assumes this
96  // dimensions and is not automatically adapted
97  // in this version of the example :-(
98  // Simplified `CMS-like` PbWO4 crystal calorimeter
99  G4double calo_xside = 31*cm;
100  G4double calo_yside = 31*cm;
101  G4double calo_zside = 24*cm;
102 
103  G4double crystalWidth = 3*cm;
104  G4double crystalLength = 24*cm;
105 
106  calo_xside = (crystalWidth*nbOfCrystals)+1*cm;
107  calo_yside = (crystalWidth*nbOfCrystals)+1*cm;
108  calo_zside = crystalLength;
109 
110  G4Box* calo_box= new G4Box("CMS calorimeter", // its name
111  calo_xside/2., // size
112  calo_yside/2.,
113  calo_zside/2.);
114  G4LogicalVolume* calo_log
115  = new G4LogicalVolume(calo_box, // its solid
116  dummy, // its material
117  "calo log", // its name
118  0, // opt: fieldManager
119  0, // opt: SensitiveDetector
120  0); // opt: UserLimit
121 
122  G4double xpos = 0.0;
123  G4double ypos = 0.0;
124  G4double zpos = 100.0*cm;
125  new G4PVPlacement(0,
126  G4ThreeVector(xpos, ypos, zpos),
127  calo_log,
128  "calorimeter",
129  ghostLogicalVolume,
130  false,
131  1);
132 
133  G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
134  calo_log->SetVisAttributes(caloVisAtt);
135 
136  // define the fParameterisation region
137  fRegion = new G4Region("crystals");
138  calo_log->SetRegion(fRegion);
139  fRegion->AddRootLogicalVolume(calo_log);
140 }
141 
142 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
143 
145 {
146  // Get nist material manager
147  G4NistManager* nistManager = G4NistManager::Instance();
148  G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
149  // -- fast simulation models:
150  // **********************************************
151  // * Initializing shower modell
152  // ***********************************************
153  G4cout << "Creating shower parameterization models" << G4endl;
154  fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
157  // Energy Cuts to kill particles:
160  // Makes the EnergieSpots
161  fHitMaker = new GFlashHitMaker();
163  G4cout<<"end shower parameterization."<<G4endl;
164  // **********************************************
165 }
166 
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......