Geant4  10.02
ExGflashDetectorConstruction.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: ExGflashDetectorConstruction.cc 94396 2015-11-13 13:37:16Z gcosmo $
27 //
30 //
31 // Created by Joanna Weng 26.11.2004
32 
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
36 // User Classes
39 
40 // G4 Classes
41 #include "G4NistManager.hh"
42 #include "G4Material.hh"
43 #include "G4ThreeVector.hh"
44 #include "G4PVPlacement.hh"
45 #include "G4VPhysicalVolume.hh"
46 #include "G4LogicalVolume.hh"
47 #include "G4Box.hh"
48 #include "G4SDManager.hh"
49 #include "G4VisAttributes.hh"
50 #include "G4Colour.hh"
51 #include "G4SystemOfUnits.hh"
52 #include "G4AutoDelete.hh"
53 #include "globals.hh"
54 
55 //fast simulation
58 #include "GFlashShowerModel.hh"
59 #include "GFlashHitMaker.hh"
60 #include "GFlashParticleBounds.hh"
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
74 {
75  G4cout<<"ExGflashDetectorConstruction::Detector constructor"<<G4endl;
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79 
81 {
82  delete fFastShowerModel;
83  delete fParameterisation;
84  delete fParticleBounds;
85  delete fHitMaker;
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 
91 {
92  //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
93  G4cout << "Defining the materials" << G4endl;
94  // Get nist material manager
95  G4NistManager* nistManager = G4NistManager::Instance();
96  // Build materials
97  G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
98  G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
99 
100  /*******************************
101  * The Experimental Hall *
102  *******************************/
103  G4double experimentalHall_x=1000.*cm;
104  G4double experimentalHall_y=1000.*cm;
105  G4double experimentalHall_z=1000.*cm;
106 
107  G4VSolid* experimentalHall_box
108  = new G4Box("expHall_box", // World Volume
109  experimentalHall_x, // x size
110  experimentalHall_y, // y size
111  experimentalHall_z); // z size
112 
113  G4LogicalVolume* experimentalHall_log
114  = new G4LogicalVolume(experimentalHall_box,
115  air,
116  "expHall_log",
117  0, //opt: fieldManager
118  0, //opt: SensitiveDetector
119  0); //opt: UserLimits
120  G4VPhysicalVolume* experimentalHall_phys
121  = new G4PVPlacement(0,
122  G4ThreeVector(), //at (0,0,0)
123  "expHall",
124  experimentalHall_log,
125  0,
126  false,
127  0);
128 
129 
130  //------------------------------
131  // Calorimeter segments
132  //------------------------------
133  // Simplified `CMS-like` PbWO4 crystal calorimeter
134 
135  G4int nbOfCrystals = 10; // this are the crystals PER ROW in this example
136  // cube of 10 x 10 crystals
137  // don't change it @the moment, since
138  // the readout in event action assumes this
139  // dimensions and is not automatically adapted
140  // in this version of the example :-(
141  // Simplified `CMS-like` PbWO4 crystal calorimeter
142  G4double calo_xside = 31*cm;
143  G4double calo_yside = 31*cm;
144  G4double calo_zside = 24*cm;
145 
146  G4double crystalWidth = 3*cm;
147  G4double crystalLength = 24*cm;
148 
149  calo_xside = (crystalWidth*nbOfCrystals)+1*cm;
150  calo_yside = (crystalWidth*nbOfCrystals)+1*cm;
151  calo_zside = crystalLength;
152 
153  G4Box* calo_box= new G4Box("CMS calorimeter", // its name
154  calo_xside/2., // size
155  calo_yside/2.,
156  calo_zside/2.);
157  G4LogicalVolume* calo_log
158  = new G4LogicalVolume(calo_box, // its solid
159  air, // its material
160  "calo log", // its name
161  0, // opt: fieldManager
162  0, // opt: SensitiveDetector
163  0); // opt: UserLimit
164 
165  G4double xpos = 0.0;
166  G4double ypos = 0.0;
167  G4double zpos = 100.0*cm;
168  new G4PVPlacement(0,
169  G4ThreeVector(xpos, ypos, zpos),
170  calo_log,
171  "calorimeter",
172  experimentalHall_log,
173  false,
174  1);
175 
176  // Crystals
177  G4VSolid* crystal_box
178  = new G4Box("Crystal", // its name
179  crystalWidth/2,
180  crystalWidth/2,
181  crystalLength/2);
182  // size
183  fCrystal_log
184  = new G4LogicalVolume(crystal_box, // its solid
185  pbWO4, // its material
186  "Crystal_log"); // its name
187 
188  for (G4int i=0; i<nbOfCrystals; i++)
189  {
190 
191  for (G4int j=0; j<nbOfCrystals; j++)
192  {
193  G4int n = i*10+j;
194  G4ThreeVector crystalPos((i*crystalWidth)-135,
195  (j*crystalWidth)-135,0 );
196  fCrystal_phys[n]
197  = new G4PVPlacement(0, // no rotation
198  crystalPos, // translation
199  fCrystal_log,
200  "crystal", // its name
201  calo_log,
202  false,
203  i);
204  }
205  }
206  G4cout << "There are " << nbOfCrystals <<
207  " crystals per row in the calorimeter, so in total "<<
208  nbOfCrystals*nbOfCrystals << " crystals" << G4endl;
209  G4cout << "They have width of " << crystalWidth /cm <<
210  " cm and a length of " << crystalLength /cm
211  <<" cm. The Material is "<< pbWO4 << G4endl;
212 
213 
214  experimentalHall_log->SetVisAttributes(G4VisAttributes::Invisible);
215  G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
216  G4VisAttributes* crystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
217  calo_log->SetVisAttributes(caloVisAtt);
218  fCrystal_log->SetVisAttributes(crystalVisAtt);
219 
220  // define the fParameterisation region
221  fRegion = new G4Region("crystals");
222  calo_log->SetRegion(fRegion);
223  fRegion->AddRootLogicalVolume(calo_log);
224 
225  return experimentalHall_phys;
226 }
227 
228 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
229 
231 {
232  // -- sensitive detectors:
235  = new ExGflashSensitiveDetector("Calorimeter",this);
236  SDman->AddNewDetector(CaloSD);
238 
239  // Get nist material manager
240  G4NistManager* nistManager = G4NistManager::Instance();
241  G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
242  // -- fast simulation models:
243  // **********************************************
244  // * Initializing shower modell
245  // ***********************************************
246  G4cout << "Creating shower parameterization models" << G4endl;
247  fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
250  // Energy Cuts to kill particles:
253  // Makes the EnergieSpots
254  fHitMaker = new GFlashHitMaker();
256  G4cout<<"end shower parameterization."<<G4endl;
257  // **********************************************
258 }
259 
260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetHitMaker(GFlashHitMaker &Maker)
static const double cm
Definition: G4SIunits.hh:118
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:254
virtual G4VPhysicalVolume * Construct()
Definition: G4Box.hh:64
void SetParticleBounds(GFlashParticleBounds &SpecificBound)
static G4ThreadLocal GFlashHitMaker * fHitMaker
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
void SetRegion(G4Region *reg)
G4GLOB_DLL std::ostream G4cout
static G4ThreadLocal GFlashParticleBounds * fParticleBounds
const G4int n
static G4ThreadLocal GFlashShowerModel * fFastShowerModel
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:67
static G4ThreadLocal GFlashHomoShowerParameterisation * fParameterisation
Definition of the ExGflashSensitiveDetector class.
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
static const G4VisAttributes Invisible
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetParameterisation(GVFlashShowerParameterisation &DP)
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)