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] [ 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/advanced/HGCal_testbeam/src/DetectorConstruction.cc (Version 11.3.0) and /examples/advanced/HGCal_testbeam/src/DetectorConstruction.cc (Version 9.6.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 #include "DetectorConstruction.hh"                
 27                                                   
 28 #include "HGCalTBMaterials.hh"                    
 29 #include "SiPMSD.hh"                              
 30 #include "SiliconPixelSD.hh"                      
 31 #include "DetectorConstruction0.hh"               
 32 #include "DetectorConstruction1.hh"               
 33 #include "DetectorConstruction2.hh"               
 34                                                   
 35 #include "G4Box.hh"                               
 36 #include "G4PVPlacement.hh"                       
 37 #include "G4GenericMessenger.hh"                  
 38 #include "G4LogicalVolume.hh"                     
 39 #include "G4ProductionCuts.hh"                    
 40 #include "G4RunManager.hh"                        
 41 #include "G4SDManager.hh"                         
 42 #include "G4UImanager.hh"                         
 43 #include "G4UserLimits.hh"                        
 44 #include "G4String.hh"                            
 45                                                   
 46 //....oooOO0OOooo........oooOO0OOooo........oo    
 47                                                   
 48 DetectorConstruction::DetectorConstruction()      
 49     : G4VUserDetectorConstruction(), fConfigur    
 50   DefineCommands();                               
 51 }                                                 
 52                                                   
 53 //....oooOO0OOooo........oooOO0OOooo........oo    
 54                                                   
 55 DetectorConstruction::~DetectorConstruction()     
 56                                                   
 57 //....oooOO0OOooo........oooOO0OOooo........oo    
 58                                                   
 59 G4VPhysicalVolume *DetectorConstruction::Const    
 60   // definition of the fMaterials                 
 61   fMaterials = new HGCalTBMaterials();            
 62   fMaterials->SetEventDisplayColorScheme();       
 63                                                   
 64   /***** Definition of the world = beam line *    
 65                                                   
 66   // World = Beam line                            
 67   G4Box *solidWorld = new G4Box("World", 0.5 *    
 68                                 0.5 * fMateria    
 69                                 0.5 * fMateria    
 70                                                   
 71   G4Material *world_mat = fMaterials->GetAir()    
 72   fLogicWorld = new G4LogicalVolume(solidWorld    
 73                                                   
 74   G4VPhysicalVolume *physWorld = new G4PVPlace    
 75       0, G4ThreeVector(0., 0., 0.), fLogicWorl    
 76                                                   
 77   return physWorld;                               
 78 }                                                 
 79                                                   
 80 //....oooOO0OOooo........oooOO0OOooo........oo    
 81                                                   
 82 void DetectorConstruction::ConstructHGCal() {     
 83                                                   
 84   G4double z0 = -fMaterials->GetBeamLineLength    
 85                                                   
 86   std::cout << "Constructing configuration " <    
 87                                                   
 88   /*****    START GENERIC PLACEMENT ALGORITHM     
 89   for (size_t item_index = 0; item_index < fEl    
 90     std::string item_type = fElementsMap[item_    
 91     G4double dz = fElementsMap[item_index].sec    
 92     z0 += dz;                                     
 93                                                   
 94     // places the item at inside the world at     
 95     // item's thickness                           
 96     fMaterials->PlaceItemInLogicalVolume(item_    
 97   }                                               
 98                                                   
 99   G4RunManager::GetRunManager()->GeometryHasBe    
100   G4UImanager *UImanager = G4UImanager::GetUIp    
101   UImanager->ApplyCommand("/vis/drawVolume");     
102   UImanager->ApplyCommand("/vis/viewer/set/tar    
103                           std::to_string(fVisV    
104   UImanager->ApplyCommand("/vis/scene/add/traj    
105   UImanager->ApplyCommand("/vis/scene/add/hits    
106 }                                                 
107                                                   
108 //....oooOO0OOooo........oooOO0OOooo........oo    
109                                                   
110 void DetectorConstruction::ConstructSDandField    
111   G4SDManager *sdman = G4SDManager::GetSDMpoin    
112                                                   
113   SiliconPixelSD *sensitiveSilicon = new Silic    
114       (fMaterials->GetSiPixelLogical()->GetNam    
115   sdman->AddNewDetector(sensitiveSilicon);        
116   fMaterials->GetSiPixelLogical()->SetSensitiv    
117                                                   
118   SiPMSD *sensitiveSiPM = new SiPMSD(             
119       (fMaterials->GetAHCALSiPMlogical()->GetN    
120   sdman->AddNewDetector(sensitiveSiPM);           
121   fMaterials->GetAHCALSiPMlogical()->SetSensit    
122 }                                                 
123                                                   
124 //....oooOO0OOooo........oooOO0OOooo........oo    
125                                                   
126 void DetectorConstruction::SelectConfiguration    
127                                                   
128   if (fConfiguration != -1) {                     
129     G4ExceptionDescription msg;                   
130     msg << "Configuration " << fConfiguration     
131         << "Configuration can be set only once    
132         << "edit your macro if necessary).\n";    
133     G4Exception("DetectorConstruction::SelectC    
134                 JustWarning, msg);                
135     return;                                       
136   }                                               
137                                                   
138   fVisViewpoint = 0;                              
139   if (val == 0)                                   
140     DetectorConstruction0(fElementsMap, fVisVi    
141   else if (val == 1)                              
142     DetectorConstruction1(fElementsMap, fVisVi    
143   else if (val == 2)                              
144     DetectorConstruction2(fElementsMap, fVisVi    
145   else {                                          
146     G4ExceptionDescription msg;                   
147     msg << "Configuration " << val << " is not    
148         << "Choose between configuration 0, 1,    
149     G4Exception("DetectorConstruction::SelectC    
150                 JustWarning, msg);                
151     return;                                       
152   }                                               
153   fConfiguration = val;                           
154                                                   
155   ConstructHGCal();                               
156 }                                                 
157                                                   
158 //....oooOO0OOooo........oooOO0OOooo........oo    
159                                                   
160 void DetectorConstruction::SetStepSizeSilicon(    
161   // setting the step size in silicon:            
162   G4double maxTrackLength = val * 0.001 * CLHE    
163   fMaterials->GetSiPixelLogical()->SetUserLimi    
164       new G4UserLimits(0, maxTrackLength));       
165                                                   
166   G4Region *reg = fMaterials->GetSiPixelLogica    
167   G4ProductionCuts *cuts = new G4ProductionCut    
168   cuts->SetProductionCut(maxTrackLength);         
169   reg->SetProductionCuts(cuts);                   
170 }                                                 
171                                                   
172 //....oooOO0OOooo........oooOO0OOooo........oo    
173                                                   
174 void DetectorConstruction::DefineCommands() {     
175   // define command directory using generic me    
176   fMessenger = new G4GenericMessenger(this, "/    
177                                       "Configu    
178                                                   
179   // configuration command                        
180   auto &configCmd = fMessenger->DeclareMethod(    
181       "configuration", &DetectorConstruction::    
182       "Select the configuration (0 for HGCal t    
183       " with beamline (upstream material), or     
184   configCmd.SetParameterName("index", true);      
185   configCmd.SetDefaultValue("0");                 
186                                                   
187   auto &SiStepSizeCmd = fMessenger->DeclareMet    
188       "stepSilicon", &DetectorConstruction::Se    
189       "Maximum step size in silicon pixels, un    
190   SiStepSizeCmd.SetParameterName("size", true)    
191   SiStepSizeCmd.SetDefaultValue("30.");           
192 }                                                 
193                                                   
194 //....oooOO0OOooo........oooOO0OOooo........oo    
195