ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExGflash1DetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ExGflash1DetectorConstruction.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 //
29 //
30 // Created by Joanna Weng 26.11.2004
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 // User Classes
38 
39 // G4 Classes
40 #include "G4NistManager.hh"
41 #include "G4Material.hh"
42 #include "G4ThreeVector.hh"
43 #include "G4PVPlacement.hh"
44 #include "G4VPhysicalVolume.hh"
45 #include "G4LogicalVolume.hh"
46 #include "G4Box.hh"
47 #include "G4SDManager.hh"
48 #include "G4VisAttributes.hh"
49 #include "G4Colour.hh"
50 #include "G4SystemOfUnits.hh"
51 #include "G4AutoDelete.hh"
52 #include "globals.hh"
53 
54 //fast simulation
57 #include "GFlashShowerModel.hh"
58 #include "GFlashHitMaker.hh"
59 #include "GFlashParticleBounds.hh"
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72  :G4VUserDetectorConstruction(), fCrystalLog(nullptr), fCrystalPhys{}, fRegion(nullptr)
73 {
74  G4cout<<"ExGflash1DetectorConstruction::Detector constructor"<<G4endl;
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80 {
81  delete fFastShowerModel;
82  delete fParameterisation;
83  delete fParticleBounds;
84  delete fHitMaker;
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88 
90 {
91  //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
92  G4cout << "Defining the materials" << G4endl;
93  // Get nist material manager
94  G4NistManager* nistManager = G4NistManager::Instance();
95  // Build materials
96  G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
97  G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
98 
99  /*******************************
100  * The Experimental Hall *
101  *******************************/
102  G4double experimentalHall_x=1000.*cm;
103  G4double experimentalHall_y=1000.*cm;
104  G4double experimentalHall_z=1000.*cm;
105 
106  G4VSolid* experimentalHall_box
107  = new G4Box("expHall_box", // World Volume
108  experimentalHall_x, // x size
109  experimentalHall_y, // y size
110  experimentalHall_z); // z size
111 
112  G4LogicalVolume* experimentalHallLog
113  = new G4LogicalVolume(experimentalHall_box,
114  air,
115  "expHallLog",
116  0, //opt: fieldManager
117  0, //opt: SensitiveDetector
118  0); //opt: UserLimits
119  G4VPhysicalVolume* experimentalHallPhys
120  = new G4PVPlacement(0,
121  G4ThreeVector(), //at (0,0,0)
122  "expHall",
123  experimentalHallLog,
124  0,
125  false,
126  0);
127 
128 
129  //------------------------------
130  // Calorimeter segments
131  //------------------------------
132  // Simplified `CMS-like` PbWO4 crystal calorimeter
133 
134  G4int nbOfCrystals = 10; // this are the crystals PER ROW in this example
135  // cube of 10 x 10 crystals
136  // don't change it @the moment, since
137  // the readout in event action assumes this
138  // dimensions and is not automatically adapted
139  // in this version of the example :-(
140  // Simplified `CMS-like` PbWO4 crystal calorimeter
141  G4double calo_xside = 31*cm;
142  G4double calo_yside = 31*cm;
143  G4double calo_zside = 24*cm;
144 
145  G4double crystalWidth = 3*cm;
146  G4double crystalLength = 24*cm;
147 
148  calo_xside = (crystalWidth*nbOfCrystals)+1*cm;
149  calo_yside = (crystalWidth*nbOfCrystals)+1*cm;
150  calo_zside = crystalLength;
151 
152  G4Box* calo_box= new G4Box("CMS calorimeter", // its name
153  calo_xside/2., // size
154  calo_yside/2.,
155  calo_zside/2.);
156  G4LogicalVolume* caloLog
157  = new G4LogicalVolume(calo_box, // its solid
158  air, // its material
159  "calo log", // its name
160  0, // opt: fieldManager
161  0, // opt: SensitiveDetector
162  0); // opt: UserLimit
163 
164  G4double xpos = 0.0;
165  G4double ypos = 0.0;
166  G4double zpos = 100.0*cm;
167  new G4PVPlacement(0,
168  G4ThreeVector(xpos, ypos, zpos),
169  caloLog,
170  "calorimeter",
171  experimentalHallLog,
172  false,
173  1);
174 
175  // Crystals
176  G4VSolid* crystal_box
177  = new G4Box("Crystal", // its name
178  crystalWidth/2,
179  crystalWidth/2,
180  crystalLength/2);
181  // size
182  fCrystalLog
183  = new G4LogicalVolume(crystal_box, // its solid
184  pbWO4, // its material
185  "CrystalLog"); // its name
186 
187  for (G4int i=0; i<nbOfCrystals; i++)
188  {
189 
190  for (G4int j=0; j<nbOfCrystals; j++)
191  {
192  G4int n = i*10+j;
193  G4ThreeVector crystalPos((i*crystalWidth)-135,
194  (j*crystalWidth)-135,0 );
195  fCrystalPhys[n]
196  = new G4PVPlacement(0, // no rotation
197  crystalPos, // translation
198  fCrystalLog,
199  "crystal", // its name
200  caloLog,
201  false,
202  i);
203  }
204  }
205  G4cout << "There are " << nbOfCrystals <<
206  " crystals per row in the calorimeter, so in total "<<
207  nbOfCrystals*nbOfCrystals << " crystals" << G4endl;
208  G4cout << "They have width of " << crystalWidth /cm <<
209  " cm and a length of " << crystalLength /cm
210  <<" cm. The Material is "<< pbWO4 << G4endl;
211 
212 
213  experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
214  G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
215  G4VisAttributes* crystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
216  caloLog->SetVisAttributes(caloVisAtt);
217  fCrystalLog->SetVisAttributes(crystalVisAtt);
218 
219  // define the fParameterisation region
220  fRegion = new G4Region("crystals");
221  caloLog->SetRegion(fRegion);
222  fRegion->AddRootLogicalVolume(caloLog);
223 
224  return experimentalHallPhys;
225 }
226 
227 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
228 
230 {
231  // -- sensitive detectors:
234  = new ExGflash1SensitiveDetector("Calorimeter",this);
235  SDman->AddNewDetector(CaloSD);
237 
238  // Get nist material manager
239  G4NistManager* nistManager = G4NistManager::Instance();
240  G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
241  // -- fast simulation models:
242  // **********************************************
243  // * Initializing shower modell
244  // ***********************************************
245  G4cout << "Creating shower parameterization models" << G4endl;
246  fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
249  // Energy Cuts to kill particles:
252  // Makes the EnergieSpots
253  fHitMaker = new GFlashHitMaker();
255  G4cout<<"end shower parameterization."<<G4endl;
256  // **********************************************
257 }
258 
259 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......