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 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/parameterisations/gflash/gflasha/src/ExGflashDetectorConstruction.cc (Version 11.3.0) and /examples/extended/parameterisations/gflash/gflasha/src/ExGflashDetectorConstruction.cc (Version 4.1.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 //                                                
 27 /// \file ExGflashDetectorConstruction.cc         
 28 /// \brief Implementation of the ExGflashDetec    
 29 //                                                
 30                                                   
 31 //....oooOO0OOooo........oooOO0OOooo........oo    
 32 //....oooOO0OOooo........oooOO0OOooo........oo    
 33                                                   
 34 // User Classes                                   
 35 #include "ExGflashDetectorConstruction.hh"        
 36                                                   
 37 #include "ExGflashHomoShowerTuning.hh"            
 38 #include "ExGflashMessenger.hh"                   
 39 #include "ExGflashSensitiveDetector.hh"           
 40                                                   
 41 // G4 Classes                                     
 42 #include "G4AutoDelete.hh"                        
 43 #include "G4Box.hh"                               
 44 #include "G4Colour.hh"                            
 45 #include "G4LogicalVolume.hh"                     
 46 #include "G4Material.hh"                          
 47 #include "G4NistManager.hh"                       
 48 #include "G4PVPlacement.hh"                       
 49 #include "G4RunManager.hh"                        
 50 #include "G4SDManager.hh"                         
 51 #include "G4SystemOfUnits.hh"                     
 52 #include "G4ThreeVector.hh"                       
 53 #include "G4VPhysicalVolume.hh"                   
 54 #include "G4VisAttributes.hh"                     
 55 #include "globals.hh"                             
 56                                                   
 57 // fast simulation                                
 58 #include "GFlashHitMaker.hh"                      
 59 #include "GFlashHomoShowerParameterisation.hh"    
 60 #include "GFlashParticleBounds.hh"                
 61 #include "GFlashShowerModel.hh"                   
 62                                                   
 63 #include "G4FastSimulationManager.hh"             
 64                                                   
 65 //....oooOO0OOooo........oooOO0OOooo........oo    
 66                                                   
 67 const G4int kMaxBin = 500;                        
 68                                                   
 69 //....oooOO0OOooo........oooOO0OOooo........oo    
 70                                                   
 71 ExGflashDetectorConstruction::ExGflashDetector    
 72 {                                                 
 73   if (fVerbose > 3) G4cout << "ExGflashDetecto    
 74   fGflashMessenger = new ExGflashMessenger(thi    
 75                                                   
 76   // Crystall                                     
 77   fCrystalWidth = 3 * cm;                         
 78   fCrystalLength = 140 * cm;                      
 79                                                   
 80   DefineMaterials();                              
 81   SetMaterial("G4_PbWO4");                        
 82 }                                                 
 83                                                   
 84 //....oooOO0OOooo........oooOO0OOooo........oo    
 85                                                   
 86 ExGflashDetectorConstruction::~ExGflashDetecto    
 87 {                                                 
 88   delete fGflashMessenger;                        
 89   delete fFastShowerModel;                        
 90   delete fParameterisation;                       
 91   delete fParticleBounds;                         
 92   delete fHitMaker;                               
 93 }                                                 
 94                                                   
 95 //....oooOO0OOooo........oooOO0OOooo........oo    
 96                                                   
 97 void ExGflashDetectorConstruction::DefineMater    
 98 {                                                 
 99   if (fVerbose > 3) G4cout << "Defining the ma    
100   // Get nist material manager                    
101   G4NistManager* nistManager = G4NistManager::    
102   // Build materials                              
103   fHallMat = nistManager->FindOrBuildMaterial(    
104   fDetMat = nistManager->FindOrBuildMaterial("    
105   nistManager->FindOrBuildMaterial("G4_CESIUM_    
106 }                                                 
107                                                   
108 //....oooOO0OOooo........oooOO0OOooo........oo    
109                                                   
110 G4VPhysicalVolume* ExGflashDetectorConstructio    
111 {                                                 
112   //--------- Definitions of Solids, Logical V    
113                                                   
114   //------------------------------                
115   // Calorimeter segments                         
116   //------------------------------                
117   // Simplified `CMS-like` PbWO4 crystal calor    
118                                                   
119   // Calorimeter                                  
120   G4double calo_xside = (fCrystalWidth * fNbOf    
121   G4double calo_yside = (fCrystalWidth * fNbOf    
122   G4double calo_zside = fCrystalLength;           
123                                                   
124   // The Experimental Hall                        
125   G4double experimentalHall_x = calo_xside * 4    
126   G4double experimentalHall_y = calo_yside * 4    
127   G4double experimentalHall_z = calo_zside * 4    
128                                                   
129   G4VSolid* experimentalHall_box = new G4Box("    
130                                              e    
131                                              e    
132                                              e    
133                                                   
134   auto experimentalHall_log = new G4LogicalVol    
135                                                   
136                                                   
137                                                   
138   G4VPhysicalVolume* experimentalHall_phys =      
139     new G4PVPlacement(nullptr,                    
140                       G4ThreeVector(),  // at     
141                       "expHall", experimentalH    
142                                                   
143   auto calo_box = new G4Box("Calorimeter",  //    
144                             calo_xside / 2.,      
145                             calo_yside / 2., c    
146   auto calo_log = new G4LogicalVolume(calo_box    
147                                       fHallMat    
148                                       "calo_lo    
149                                       nullptr,    
150                                       nullptr,    
151                                       nullptr)    
152                                                   
153   G4double xpos = 0.0;                            
154   G4double ypos = 0.0;                            
155   G4double zpos = calo_zside / 2.;  // face @     
156                                                   
157   new G4PVPlacement(nullptr, G4ThreeVector(xpo    
158                     experimentalHall_log, fals    
159                                                   
160   // Crystals                                     
161   G4VSolid* crystal_box = new G4Box("Crystal",    
162                                     fCrystalWi    
163   // size                                         
164   fCrystal_log = new G4LogicalVolume(crystal_b    
165                                      fDetMat,     
166                                      "Crystal_    
167                                                   
168   for (G4int i = 0; i < fNbOfCrystals; i++) {     
169     for (G4int j = 0; j < fNbOfCrystals; j++)     
170       G4int n = i * 10 + j;                       
171       G4ThreeVector crystalPos((i * fCrystalWi    
172                                (j * fCrystalWi    
173       new G4PVPlacement(nullptr,  // no rotati    
174                         crystalPos,  // transl    
175                         fCrystal_log,             
176                         "crystal",  // its nam    
177                         calo_log, false, n);      
178     }                                             
179   }                                               
180   G4cout << "There are " << fNbOfCrystals << "    
181          << fNbOfCrystals * fNbOfCrystals << "    
182   G4cout << "They have width of  " << fCrystal    
183          << fCrystalLength / cm << " cm." << G    
184   G4cout << fDetMat << G4endl;                    
185   G4cout << "Total Calorimeter size " << calo_    
186          << calo_zside / cm << " cm" << G4endl    
187                                                   
188   experimentalHall_log->SetVisAttributes(G4Vis    
189   auto caloVisAtt = new G4VisAttributes(G4Colo    
190   auto crystalVisAtt = new G4VisAttributes(G4C    
191   calo_log->SetVisAttributes(caloVisAtt);         
192   fCrystal_log->SetVisAttributes(crystalVisAtt    
193                                                   
194   // define the fParameterisation region          
195   //  G4cout << "\n ---> DetectorConstruction     
196   fRegion = new G4Region("crystals");             
197   calo_log->SetRegion(fRegion);                   
198   fRegion->AddRootLogicalVolume(calo_log);        
199                                                   
200   return experimentalHall_phys;                   
201 }                                                 
202                                                   
203 //....oooOO0OOooo........oooOO0OOooo........oo    
204                                                   
205 void ExGflashDetectorConstruction::ConstructSD    
206 {                                                 
207   // -- fast simulation models:                   
208   // *****************************************    
209   // * Initializing shower modell                 
210   // *****************************************    
211   if (fParameterisation != nullptr) {             
212     fParameterisation->SetMaterial(fDetMat);      
213     if (fVerbose > 3) G4cout << "Info " << __f    
214     fParameterisation->PrintMaterial(fDetMat);    
215   }                                               
216   else {                                          
217     // -- sensitive detectors:                    
218                                                   
219     G4SDManager* SDman = G4SDManager::GetSDMpo    
220                                                   
221     auto SD = new ExGflashSensitiveDetector("C    
222                                                   
223     SDman->AddNewDetector(SD);                    
224     if (fCrystal_log != nullptr) {                
225       fCrystal_log->SetSensitiveDetector(SD);     
226     }                                             
227                                                   
228     if (fVerbose > 3) G4cout << "\n--> Creatin    
229     fFastShowerModel = new GFlashShowerModel("    
230     fParameterisation =                           
231       new GFlashHomoShowerParameterisation(fDe    
232     fFastShowerModel->SetParameterisation(*fPa    
233     // Energy Cuts to kill particles:             
234     fParticleBounds = new GFlashParticleBounds    
235     fFastShowerModel->SetParticleBounds(*fPart    
236     // Makes the EnergieSpots                     
237     fHitMaker = new GFlashHitMaker();             
238     fFastShowerModel->SetHitMaker(*fHitMaker);    
239     if (fVerbose > 3) G4cout << "end shower pa    
240   }                                               
241   // *****************************************    
242   // Get Rad Len and R moliere from parameteri    
243   fSDRadLen = fParameterisation->GetX0();         
244   fSDRm = fParameterisation->GetRm();             
245   if (fVerbose > 2) {                             
246     G4cout << "Info " << __func__ << "Total Ca    
247     auto calo_xyside = fCrystalWidth * fNbOfCr    
248     G4cout << "Info Z " << __func__ << " " <<     
249            << fCrystalLength / fSDRadLen << "     
250     G4cout << "Info XY " << __func__ << " " <<    
251            << " Rm " << G4endl;                   
252   }                                               
253 }                                                 
254                                                   
255 //....oooOO0OOooo........oooOO0OOooo........oo    
256                                                   
257 void ExGflashDetectorConstruction::SetLBining(    
258 {                                                 
259   fNLtot = (G4int)Value(0);                       
260   if (fNLtot > kMaxBin) {                         
261     G4cout << "\n ---> warning from SetLBining    
262            << G4endl;                             
263     fNLtot = kMaxBin;                             
264   }                                               
265   fDLradl = Value(1);                             
266 }                                                 
267                                                   
268 //....oooOO0OOooo........oooOO0OOooo........oo    
269                                                   
270 void ExGflashDetectorConstruction::SetRBining(    
271 {                                                 
272   fNRtot = (G4int)Value(0);                       
273   if (fNRtot > kMaxBin) {                         
274     G4cout << "\n ---> warning from SetRBining    
275            << G4endl;                             
276     fNRtot = kMaxBin;                             
277   }                                               
278   fDRradl = Value(1);                             
279 }                                                 
280                                                   
281 //....oooOO0OOooo........oooOO0OOooo........oo    
282                                                   
283 void ExGflashDetectorConstruction::SetMaterial    
284 {                                                 
285   // search the material by its name              
286   G4Material* pttoMaterial = G4NistManager::In    
287                                                   
288   if (pttoMaterial != nullptr && fDetMat != pt    
289     fDetMat = pttoMaterial;                       
290     if (fCrystal_log != nullptr) {                
291       fCrystal_log->SetMaterial(fDetMat);         
292     }                                             
293     G4RunManager::GetRunManager()->PhysicsHasB    
294   }                                               
295 }                                                 
296                                                   
297 //....oooOO0OOooo........oooOO0OOooo........oo    
298