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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/exoticphysics/channeling/ch2/src/DetectorConstruction.cc (Version 11.3.0) and /examples/extended/exoticphysics/channeling/ch2/src/DetectorConstruction.cc (Version 10.7.p3)


  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 DetectorConstruction.cc                 
 27 /// \brief Implementation of the DetectorConst    
 28 //                                                
 29 //....oooOO0OOooo........oooOO0OOooo........oo    
 30                                                   
 31 #include "DetectorConstruction.hh"                
 32                                                   
 33 #include "G4RunManager.hh"                        
 34 #include "G4NistManager.hh"                       
 35 #include "G4Box.hh"                               
 36 #include "G4LogicalVolume.hh"                     
 37 #include "G4RegionStore.hh"                       
 38 #include "G4VisAttributes.hh"                     
 39 #include "PrimaryGeneratorAction.hh"              
 40                                                   
 41 //....oooOO0OOooo........oooOO0OOooo........oo    
 42                                                   
 43 DetectorConstruction::DetectorConstruction()      
 44 {                                                 
 45     //instantiate the messenger                   
 46     fMessenger = new DetectorConstructionMesse    
 47                                                   
 48     //Crystal size                                
 49     fCrystalSize.setX(20*CLHEP::mm);              
 50     fCrystalSize.setY(20*CLHEP::mm);              
 51     fCrystalSize.setZ(0.0305*CLHEP::mm);          
 52                                                   
 53     //Crystal planes or axes considered           
 54     fLattice = "(111)";                           
 55                                                   
 56     //Detector size                               
 57     fDetectorSize.setX(10*CLHEP::cm);             
 58     fDetectorSize.setY(10*CLHEP::cm);             
 59     fDetectorSize.setZ(0.1*CLHEP::mm);            
 60 }                                                 
 61                                                   
 62 //....oooOO0OOooo........oooOO0OOooo........oo    
 63                                                   
 64 G4VPhysicalVolume* DetectorConstruction::Const    
 65 {                                                 
 66     //Check overlap option                        
 67     G4bool checkOverlaps = true;                  
 68                                                   
 69     //Materials                                   
 70     G4NistManager* nist = G4NistManager::Insta    
 71     G4Material* world_mat = nist->FindOrBuildM    
 72     G4Material* silicon = nist->FindOrBuildMat    
 73                                                   
 74     //World                                       
 75     G4Box* solidWorld = new G4Box("World", 0.2    
 76     G4LogicalVolume* logicWorld = new G4Logica    
 77     G4VPhysicalVolume* physWorld = new G4PVPla    
 78                                     (0,           
 79                                      G4ThreeVe    
 80                                      logicWorl    
 81                                      "World",     
 82                                      0,           
 83                                      false,       
 84                                      0,           
 85                                      checkOver    
 86     logicWorld->SetVisAttributes(G4VisAttribut    
 87                                                   
 88                                                   
 89     // --------------- Crystal ---------------    
 90                                                   
 91     //Select crystal material                     
 92     fCrystalMaterial = nist->FindOrBuildMateri    
 93                                                   
 94     //Crystal rotation angle (also the angle o    
 95     G4RotationMatrix* crystalRotationMatrix =     
 96     crystalRotationMatrix->rotateY(-fAngleX);     
 97     crystalRotationMatrix->rotateX(-fAngleY);     
 98                                                   
 99     //Setting crystal position                    
100     G4ThreeVector posCrystal = G4ThreeVector(0    
101                                                   
102     //crystal volume                              
103     G4Box* solidCrystal = new G4Box("Crystal",    
104                                     fCrystalSi    
105                                     fCrystalSi    
106                                     fCrystalSi    
107                                                   
108     fLogicCrystal = new G4LogicalVolume(solidC    
109                                         fCryst    
110                                         "Cryst    
111     new G4PVPlacement(crystalRotationMatrix,      
112                       posCrystal,                 
113                       fLogicCrystal,              
114                       "Crystal",                  
115                       logicWorld,                 
116                       false,                      
117                       0,                          
118                       checkOverlaps);             
119                                                   
120     if (fActivateChannelingModel)                 
121     {                                             
122       //crystal region (necessary for the Fast    
123       G4Region* regionCh = new G4Region("Cryst    
124       regionCh->AddRootLogicalVolume(fLogicCry    
125     }                                             
126                                                   
127     //visualization attributes                    
128     G4VisAttributes* crystalVisAttribute =        
129         new G4VisAttributes(G4Colour(1., 0., 0    
130     crystalVisAttribute->SetForceSolid(true);     
131     fLogicCrystal->SetVisAttributes(crystalVis    
132                                                   
133     //print Crystal info                          
134     G4cout << "Crystal material: " << fCrystal    
135     G4cout << "Crystal size: " << fCrystalSize    
136            << "x" << fCrystalSize.y()/CLHEP::m    
137            << "x" << fCrystalSize.z()/CLHEP::m    
138     if (fActivateChannelingModel)                 
139     {                                             
140         G4cout << "G4ChannelingFastSimModel ac    
141         G4cout << "Crystal bending angle: " <<    
142         G4cout << "Crystal Lattice: " << fLatt    
143         G4cout << "Crystal angleX: " << fAngle    
144         G4cout << "Crystal angleY: " << fAngle    
145         G4cout << "ActivateRadiationModel: " <    
146                                                   
147         if (fCrystallineUndulatorAmplitude > D    
148             fCrystallineUndulatorPeriod > DBL_    
149             G4cout << "Crystalline undulator a    
150             G4cout << "undulator amplitude: "     
151                    << fCrystallineUndulatorAmp    
152                    << " nm" << G4endl;            
153             G4cout << "undulator period: "        
154                    << fCrystallineUndulatorPer    
155                    << " mm" << G4endl;            
156             G4cout << "undulator phase: "         
157                    << fCrystallineUndulatorPha    
158                    << " rad" << G4endl;           
159         }                                         
160                                                   
161         G4cout << G4endl;                         
162     }                                             
163     else                                          
164     {                                             
165         G4cout << "G4ChannelingFastSimModel is    
166     }                                             
167                                                   
168     // --------------- Detector --------------    
169     //Setting detector position                   
170     G4ThreeVector posDetector =                   
171             G4ThreeVector(0, 0, fDetectorFront    
172                                                   
173     //particle detector volume                    
174     G4Box* detector = new G4Box("Detector",       
175                                 fDetectorSize.    
176                                 fDetectorSize.    
177                                 fDetectorSize.    
178                                                   
179     G4LogicalVolume* logicDetector = new G4Log    
180                                                   
181                                                   
182     new G4PVPlacement(0,                          
183                       posDetector,                
184                       logicDetector,              
185                       "Detector",                 
186                       logicWorld,                 
187                       false,                      
188                       0,                          
189                       checkOverlaps);             
190                                                   
191     //visualization attributes                    
192     G4VisAttributes* detectorVisAttribute =       
193         new G4VisAttributes(G4Colour(1., 0., 1    
194     detectorVisAttribute->SetForceSolid(true);    
195     logicDetector->SetVisAttributes(detectorVi    
196                                                   
197     //always return the physical World            
198     return physWorld;                             
199 }                                                 
200                                                   
201 //....oooOO0OOooo........oooOO0OOooo........oo    
202                                                   
203 void DetectorConstruction::ConstructSDandField    
204 {                                                 
205   if (fActivateChannelingModel)                   
206   {                                               
207     // --------------- fast simulation -------    
208     //extract the region of the crystal from t    
209     G4RegionStore* regionStore = G4RegionStore    
210     G4Region* regionCh = regionStore->GetRegio    
211                                                   
212     //create the channeling model for this reg    
213     G4ChannelingFastSimModel* channelingModel     
214         new G4ChannelingFastSimModel("Channeli    
215                                                   
216     //activate the channeling model               
217     channelingModel->Input(fCrystalMaterial, f    
218     //setting bending angle of the crystal pla    
219     channelingModel->GetCrystalData()->SetBend    
220                                                   
221     //setting crystalline undulator parameters    
222     //NOTE: they are incompatible with a bent     
223     if (fCrystallineUndulatorAmplitude > DBL_E    
224         fCrystallineUndulatorPeriod > DBL_EPSI    
225     {                                             
226         channelingModel->GetCrystalData()->Set    
227             fCrystallineUndulatorAmplitude,       
228             fCrystallineUndulatorPeriod,          
229             fCrystallineUndulatorPhase,           
230             fLogicCrystal);                       
231     }                                             
232                                                   
233     /*                                            
234     Set the multiple of critical channeling an    
235     the angular cut of the model (otherwise st    
236     a number too low reduces the accuracy of t    
237     a number too high sometimes drastically re    
238     The default value is 100, while for many p    
239     CAUTION: If you set this value to 1 meanin    
240     this will cut off the physics of overbarri    
241     the particle is not in channeling. This wi    
242     */                                            
243     channelingModel->SetDefaultLindhardAngleNu    
244     //you may set a particular limit for a cer    
245     //(has a priority vs default):                
246     channelingModel->SetLindhardAngleNumberHig    
247     channelingModel->SetLindhardAngleNumberHig    
248                                                   
249     channelingModel->SetLindhardAngleNumberHig    
250     channelingModel->SetLindhardAngleNumberHig    
251     channelingModel->SetLindhardAngleNumberHig    
252     channelingModel->SetLindhardAngleNumberHig    
253     channelingModel->SetLindhardAngleNumberHig    
254     channelingModel->SetLindhardAngleNumberHig    
255     //channelingModel->SetLindhardAngleNumberH    
256                                                   
257     /*                                            
258     Set the low kinetic energy cut for the mod    
259     too low energy may reduce the simulation s    
260     too high energy can cut off a useful physi    
261     A recommended value depends a lot on the c    
262     since below quantum channeling effects may    
263     are not forbidden. For energies considerab    
264     for multiphoton radiation emission,a lower    
265     */                                            
266     channelingModel->SetDefaultLowKineticEnerg    
267     //you may set a particular limit for a cer    
268     //(has a priority vs default):                
269     channelingModel->SetLowKineticEnergyLimit(    
270     channelingModel->SetLowKineticEnergyLimit(    
271     channelingModel->SetLowKineticEnergyLimit(    
272     channelingModel->SetLowKineticEnergyLimit(    
273     channelingModel->SetLowKineticEnergyLimit(    
274     channelingModel->SetLowKineticEnergyLimit(    
275     channelingModel->SetLowKineticEnergyLimit(    
276     channelingModel->SetLowKineticEnergyLimit(    
277     //channelingModel->SetLowKineticEnergyLimi    
278                                                   
279     /*                                            
280     activate the radiation model (do it only w    
281     radiation production in an oriented crysta    
282     */                                            
283     if (fActivateRadiationModel)                  
284     {                                             
285         channelingModel->RadiationModelActivat    
286         G4cout << "Radiation model activated"     
287                                                   
288         /*                                        
289         Set the number of the photons used in     
290         too low number reduces the accuracy of    
291         too high number reduces the calculatio    
292         In most of the cases 150 is a minimal     
293         */                                        
294         channelingModel->GetRadiationModel()->    
295                 SetSamplingPhotonsNumber(fSamp    
296                                                   
297         /*                                        
298         Increase the statistics of sampling ph    
299         By default it is not active! In many c    
300         It is very useful for a soft spectrum     
301         the charged particle energy, in order     
302         to apply as many ranges as you want.      
303         NOTE: usually important for crystallin    
304         CAUTION: insert only an integer number    
305         and ONLY > 1 .                            
306         CAUTION: this energy range must not be    
307         (i.e. below minimum photon energy (see    
308         range with an increased statistics if     
309         CAUTION: this is a multiple of the sta    
310         this energy range => make sure the tot    
311         to regularly get in this energy range,    
312         */                                        
313         if(fTimesPhotonStatistics>1)              
314         {channelingModel->GetRadiationModel()-    
315                     AddStatisticsInPhotonEnerg    
316                                                   
317                                                   
318                                                   
319         /*                                        
320         Adjust the angular distribution of the    
321         changing the multiple of the opening r    
322         the model should work correctly in the    
323         too small multiple reduces the accurac    
324         too high value requires more sampling     
325         */                                        
326         channelingModel->GetRadiationModel()->    
327                 SetRadiationAngleFactor(fRadia    
328                                                   
329         /*                                        
330         Set the minimal energy of radiated pho    
331         of the spectrum you are interested in:    
332         too low number vs the charged particle    
333         in a total or in a particular energy r    
334         too high number may reduce the accurac    
335         Generally 1 MeV is a recommended value    
336         */                                        
337         channelingModel->GetRadiationModel()->    
338                                                   
339         /*                                        
340         Set the number of trajectory steps aft    
341         check (whether the probability is belo    
342         at the first iteration also the sampli    
343         the angles of this first part of the t    
344         too higher number of steps reduces the    
345         of the single radiation probability th    
346         too low number may reduce the accuracy    
347         sampling photons.                         
348         Generally the range between 1000-10000    
349         */                                        
350         channelingModel->GetRadiationModel()->    
351                 SetNSmallTrajectorySteps(fNSma    
352     }                                             
353   }                                               
354 }                                                 
355                                                   
356 //....oooOO0OOooo........oooOO0OOooo........oo    
357                                                   
358