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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/extended/parameterisations/Par01/src/Par01DetectorConstruction.cc (Version 11.3.0) and /examples/extended/parameterisations/Par01/src/Par01DetectorConstruction.cc (Version 6.0.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 /// \file Par01/src/Par01DetectorConstruction.    
 27 /// \brief Implementation of the Par01Detector    
 28 //                                                
 29 //                                                
 30 //                                                
 31 #include "Par01DetectorConstruction.hh"           
 32                                                   
 33 #include "Par01CalorimeterSD.hh"                  
 34 #include "Par01EMShowerModel.hh"                  
 35 #include "Par01PiModel.hh"                        
 36                                                   
 37 #include "G4Box.hh"                               
 38 #include "G4Colour.hh"                            
 39 #include "G4Element.hh"                           
 40 #include "G4ElementTable.hh"                      
 41 #include "G4LogicalVolume.hh"                     
 42 #include "G4Material.hh"                          
 43 #include "G4MaterialTable.hh"                     
 44 #include "G4NistManager.hh"                       
 45 #include "G4PVPlacement.hh"                       
 46 #include "G4ProductionCuts.hh"                    
 47 #include "G4RegionStore.hh"                       
 48 #include "G4SDManager.hh"                         
 49 #include "G4SystemOfUnits.hh"                     
 50 #include "G4ThreeVector.hh"                       
 51 #include "G4Tubs.hh"                              
 52 #include "G4VisAttributes.hh"                     
 53                                                   
 54 //....oooOO0OOooo........oooOO0OOooo........oo    
 55                                                   
 56 Par01DetectorConstruction::Par01DetectorConstr    
 57 {                                                 
 58   ;                                               
 59 }                                                 
 60                                                   
 61 //....oooOO0OOooo........oooOO0OOooo........oo    
 62                                                   
 63 Par01DetectorConstruction::~Par01DetectorConst    
 64 {                                                 
 65   ;                                               
 66 }                                                 
 67                                                   
 68 //....oooOO0OOooo........oooOO0OOooo........oo    
 69                                                   
 70 G4VPhysicalVolume* Par01DetectorConstruction::    
 71 {                                                 
 72   G4cout << "\nPar01DetectorConstruction....\n    
 73                                                   
 74   //--------- Material definition ---------       
 75   // Get nist material manager                    
 76   G4NistManager* nistManager = G4NistManager::    
 77                                                   
 78   // Build materials                              
 79   G4Material* air = nistManager->FindOrBuildMa    
 80   G4Material* csi = nistManager->FindOrBuildMa    
 81   G4Material* helium = nistManager->FindOrBuil    
 82   G4Material* iron = nistManager->FindOrBuildM    
 83                                                   
 84   //--------- G4VSolid, G4LogicalVolume, G4VPh    
 85                                                   
 86   //--------------                                
 87   // World:                                       
 88   //--------------                                
 89   G4Box* WorldBox = new G4Box("WorldBox", 400     
 90   G4LogicalVolume* WorldLog = new G4LogicalVol    
 91   G4PVPlacement* WorldPhys =                      
 92     new G4PVPlacement(0, G4ThreeVector(), "Wor    
 93   // Size of detectors:                           
 94   G4double detectSize = 125 * cm;                 
 95                                                   
 96   //-----------------------------                 
 97   // "Drift Chamber":                             
 98   // Not used in parameterisation.                
 99   //-----------------------------                 
100   // -- Logical volume:                           
101   G4Box* driftChamberBox = new G4Box("DriftCha    
102   G4LogicalVolume* driftChamberLog =              
103     new G4LogicalVolume(driftChamberBox, heliu    
104   // -- Placement:                                
105   // G4PVPlacement *driftChamberPhys  =           
106   new G4PVPlacement(0, G4ThreeVector(0., 0., 5    
107                     WorldPhys, false, 0);         
108                                                   
109   //--------------------------                    
110   // "Calorimeter": used in                       
111   // parameterisation below                       
112   //--------------------------                    
113   // -- Logical volume:                           
114   G4Box* calorimeterBox = new G4Box("Calorimet    
115   G4LogicalVolume* calorimeterLog =               
116     new G4LogicalVolume(calorimeterBox, air, "    
117   // -- Placement:                                
118   G4PVPlacement* calorimeterPhys = new G4PVPla    
119     0, G4ThreeVector(0., 0., 120 * cm), "Calor    
120                                                   
121   //--------------------------------------        
122   // The calorimeter is filled with               
123   // crystals:                                    
124   //--------------------------------------        
125   // -- Logical volume:                           
126   G4double CrystalX = 2.5 * cm;                   
127   G4double CrystalY = CrystalX;                   
128   G4double CrystalZ = 20 * cm;                    
129   G4Box* CrystalSolid = new G4Box("CrystalSoli    
130   fCrystalLog = new G4LogicalVolume(CrystalSol    
131                                                   
132   G4String tName1("Crystal");  // Allow all ta    
133   // same name (delayed copy)                     
134                                                   
135   // -- and placements inside the calorimeter:    
136   G4int copyNo = 0;                               
137   G4double xTlate, yTlate;                        
138   fnX = 48;                                       
139   fnY = 48;                                       
140   for (G4int j = 0; j < fnY; j++) {               
141     yTlate = -detectSize + 3 * CrystalY + j *     
142     for (G4int i = 0; i < fnX; i++) {             
143       xTlate = -detectSize + 3 * CrystalX + i     
144       new G4PVPlacement(0, G4ThreeVector(xTlat    
145                         calorimeterPhys, false    
146     }                                             
147   }                                               
148                                                   
149   //--------------------------                    
150   // "Hadron Calorimeter": used                   
151   // in parameterisation with                     
152   // a parallel geometry                          
153   //--------------------------                    
154   // -- Logical volume:                           
155   G4Box* hadCaloBox = new G4Box("HadCaloSolid"    
156   G4LogicalVolume* hadCaloLog = new G4LogicalV    
157   // -- Placement:                                
158   G4PVPlacement* hadCaloPhys = new G4PVPlaceme    
159     0, G4ThreeVector(0., 0., 200 * cm), "HadCa    
160                                                   
161   //--------------------------------------        
162   // The calorimeter is filled with               
163   // towers:                                      
164   //--------------------------------------        
165   // -- Logical volume:                           
166   G4double TowerX = 5 * cm;                       
167   G4double TowerY = TowerX;                       
168   G4double TowerZ = 45 * cm;                      
169   G4Box* TowerSolid = new G4Box("TowerSolid",     
170   fTowerLog = new G4LogicalVolume(TowerSolid,     
171                                                   
172   G4String tName2("Tower");                       
173                                                   
174   // -- and placements inside the calorimeter:    
175   copyNo = 0;                                     
176   fnXhad = 23;                                    
177   fnYhad = 23;                                    
178   for (G4int jj = 0; jj < fnYhad; jj++) {         
179     yTlate = -detectSize + 3 * TowerY + jj * 2    
180     for (G4int i = 0; i < fnXhad; i++) {          
181       xTlate = -detectSize + 3 * TowerX + i *     
182       new G4PVPlacement(0, G4ThreeVector(xTlat    
183                         false, copyNo++);         
184     }                                             
185   }                                               
186                                                   
187   // -- Makes the calorimeterLog volume becomi    
188   G4Region* caloRegion = new G4Region("EM_calo    
189   caloRegion->AddRootLogicalVolume(calorimeter    
190   std::vector<double> cuts;                       
191   cuts.push_back(1.0 * mm);                       
192   cuts.push_back(1.0 * mm);                       
193   cuts.push_back(1.0 * mm);                       
194   cuts.push_back(1.0 * mm);                       
195   caloRegion->SetProductionCuts(new G4Producti    
196   caloRegion->GetProductionCuts()->SetProducti    
197                                                   
198   //  Makes had. calo a region to:                
199   G4Region* hadRegion = new G4Region("HAD_calo    
200   hadRegion->AddRootLogicalVolume(hadCaloLog);    
201   cuts.clear();                                   
202   cuts.push_back(1.0 * cm);                       
203   cuts.push_back(1.0 * cm);                       
204   cuts.push_back(1.0 * cm);                       
205   cuts.push_back(1.0 * cm);                       
206   hadRegion->SetProductionCuts(new G4Productio    
207   hadRegion->GetProductionCuts()->SetProductio    
208                                                   
209   //--------- Visualization attributes -------    
210   WorldLog->SetVisAttributes(G4VisAttributes::    
211                                                   
212   auto driftchamberTubeVisAtt = new G4VisAttri    
213   driftchamberTubeVisAtt->SetForceWireframe(tr    
214   driftChamberLog->SetVisAttributes(driftchamb    
215                                                   
216   auto calorimeterBoxVisAtt = new G4VisAttribu    
217   calorimeterBoxVisAtt->SetForceWireframe(true    
218   calorimeterLog->SetVisAttributes(calorimeter    
219                                                   
220   auto crystalVisAtt = new G4VisAttributes(G4C    
221   crystalVisAtt->SetForceWireframe(true);         
222   fCrystalLog->SetVisAttributes(crystalVisAtt)    
223                                                   
224   auto hadCaloBoxVisAtt = new G4VisAttributes(    
225   hadCaloBoxVisAtt->SetForceWireframe(true);      
226   hadCaloLog->SetVisAttributes(hadCaloBoxVisAt    
227                                                   
228   auto towerVisAtt = new G4VisAttributes(G4Col    
229   towerVisAtt->SetForceWireframe(true);           
230   fTowerLog->SetVisAttributes(towerVisAtt);       
231                                                   
232   //------------------------------------------    
233                                                   
234   //-----------------------                       
235   // Returns the pointer to                       
236   // the physical world:                          
237   //-----------------------                       
238   return WorldPhys;                               
239 }                                                 
240                                                   
241 //....oooOO0OOooo........oooOO0OOooo........oo    
242                                                   
243 void Par01DetectorConstruction::ConstructSDand    
244 {                                                 
245   //--------- Sensitive detector -------------    
246   G4SDManager* SDman = G4SDManager::GetSDMpoin    
247   G4String calorimeterSDname = "Par01/Calorime    
248   Par01CalorimeterSD* CalorimeterSD =             
249     new Par01CalorimeterSD(calorimeterSDname,     
250   SDman->AddNewDetector(CalorimeterSD);           
251   fCrystalLog->SetSensitiveDetector(Calorimete    
252                                                   
253   G4String hadCalorimeterSDname = "Par01/Hadro    
254   Par01CalorimeterSD* HadCalorimeterSD =          
255     new Par01CalorimeterSD(hadCalorimeterSDnam    
256   SDman->AddNewDetector(HadCalorimeterSD);        
257   fTowerLog->SetSensitiveDetector(HadCalorimet    
258                                                   
259   // --------------- fast simulation ---------    
260   G4RegionStore* regionStore = G4RegionStore::    
261                                                   
262   G4Region* caloRegion = regionStore->GetRegio    
263   // builds a model and sets it to the envelop    
264   new Par01EMShowerModel("emShowerModel", calo    
265 }                                                 
266