ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExGflash2DetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ExGflash2DetectorConstruction.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 
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59  :G4VUserDetectorConstruction(), fCrystalLog(nullptr), fCrystalPhys{}
60 {
61  G4cout<<"ExGflash2DetectorConstruction::Detector constructor"<<G4endl;
62 }
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 {
72  //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
73  G4cout << "Defining the materials" << G4endl;
74  // Get nist material manager
75  G4NistManager* nistManager = G4NistManager::Instance();
76  // Build materials
77  G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
78  G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
79 
80  /*******************************
81  * The Experimental Hall *
82  *******************************/
83  G4double experimentalHall_x=1000.*cm;
84  G4double experimentalHall_y=1000.*cm;
85  G4double experimentalHall_z=1000.*cm;
86 
87  G4VSolid* experimentalHall_box
88  = new G4Box("expHall_box", // World Volume
89  experimentalHall_x, // x size
90  experimentalHall_y, // y size
91  experimentalHall_z); // z size
92 
93  G4LogicalVolume* experimentalHallLog
94  = new G4LogicalVolume(experimentalHall_box,
95  air,
96  "expHallLog",
97  0, //opt: fieldManager
98  0, //opt: SensitiveDetector
99  0); //opt: UserLimits
100  G4VPhysicalVolume* experimentalHallPhys
101  = new G4PVPlacement(0,
102  G4ThreeVector(), //at (0,0,0)
103  "expHall",
104  experimentalHallLog,
105  0,
106  false,
107  0);
108 
109 
110  //------------------------------
111  // Calorimeter segments
112  //------------------------------
113  // Simplified `CMS-like` PbWO4 crystal calorimeter
114 
115  G4int nbOfCrystals = 10; // this are the crystals PER ROW in this example
116  // cube of 10 x 10 crystals
117  // don't change it @the moment, since
118  // the readout in event action assumes this
119  // dimensions and is not automatically adapted
120  // in this version of the example :-(
121  // Simplified `CMS-like` PbWO4 crystal calorimeter
122  G4double calo_xside = 31*cm;
123  G4double calo_yside = 31*cm;
124  G4double calo_zside = 24*cm;
125 
126  G4double crystalWidth = 3*cm;
127  G4double crystalLength = 24*cm;
128 
129  calo_xside = (crystalWidth*nbOfCrystals)+1*cm;
130  calo_yside = (crystalWidth*nbOfCrystals)+1*cm;
131  calo_zside = crystalLength;
132 
133  G4Box* calo_box= new G4Box("CMS calorimeter", // its name
134  calo_xside/2., // size
135  calo_yside/2.,
136  calo_zside/2.);
137  G4LogicalVolume* caloLog
138  = new G4LogicalVolume(calo_box, // its solid
139  air, // its material
140  "calo log", // its name
141  0, // opt: fieldManager
142  0, // opt: SensitiveDetector
143  0); // opt: UserLimit
144 
145  G4double xpos = 0.0;
146  G4double ypos = 0.0;
147  G4double zpos = 100.0*cm;
148  new G4PVPlacement(0,
149  G4ThreeVector(xpos, ypos, zpos),
150  caloLog,
151  "calorimeter",
152  experimentalHallLog,
153  false,
154  1);
155 
156  // Crystals
157  G4VSolid* crystal_box
158  = new G4Box("Crystal", // its name
159  crystalWidth/2,
160  crystalWidth/2,
161  crystalLength/2);
162  // size
163  fCrystalLog
164  = new G4LogicalVolume(crystal_box, // its solid
165  pbWO4, // its material
166  "CrystalLog"); // its name
167 
168  for (G4int i=0; i<nbOfCrystals; i++)
169  {
170 
171  for (G4int j=0; j<nbOfCrystals; j++)
172  {
173  G4int n = i*10+j;
174  G4ThreeVector crystalPos((i*crystalWidth)-135,
175  (j*crystalWidth)-135,0 );
176  fCrystalPhys[n]
177  = new G4PVPlacement(0, // no rotation
178  crystalPos, // translation
179  fCrystalLog,
180  "crystal", // its name
181  caloLog,
182  false,
183  i);
184  }
185  }
186  G4cout << "There are " << nbOfCrystals <<
187  " crystals per row in the calorimeter, so in total "<<
188  nbOfCrystals*nbOfCrystals << " crystals" << G4endl;
189  G4cout << "They have width of " << crystalWidth /cm <<
190  " cm and a length of " << crystalLength /cm
191  <<" cm. The Material is "<< pbWO4 << G4endl;
192 
193 
194  experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
195  G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
196  G4VisAttributes* crystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
197  caloLog->SetVisAttributes(caloVisAtt);
198  fCrystalLog->SetVisAttributes(crystalVisAtt);
199 
200 
201  // Parametrisation region defined in ExGflash2ParallelWorld
202 
203  return experimentalHallPhys;
204 }
205 
206 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
207 
209 {
210  // -- sensitive detectors:
213  = new ExGflash2SensitiveDetector("Calorimeter",this);
214  SDman->AddNewDetector(CaloSD);
216 
217  // Fast simulation implemented in ExGflash2ParallelWorld
218 }
219 
220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......