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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/field/field04/src/F04PhysicsList.cc (Version 11.3.0) and /examples/extended/field/field04/src/F04PhysicsList.cc (Version 8.1.p2)


  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 field/field04/src/F04PhysicsList.cc     
 28 /// \brief Implementation of the F04PhysicsLis    
 29 //                                                
 30                                                   
 31 #include "F04PhysicsList.hh"                      
 32                                                   
 33 #include "F04PhysicsListMessenger.hh"             
 34                                                   
 35 #include "G4LossTableManager.hh"                  
 36 #include "G4OpticalPhysics.hh"                    
 37 #include "G4ParticleTable.hh"                     
 38 #include "G4ParticleTypes.hh"                     
 39 #include "G4ProcessManager.hh"                    
 40 #include "G4StepLimiterPhysics.hh"                
 41                                                   
 42 #include "F04StepMax.hh"                          
 43 #include "FTFP_BERT.hh"                           
 44 #include "QGSP_BERT.hh"                           
 45                                                   
 46 #include "G4DecayTable.hh"                        
 47 #include "G4DecayWithSpin.hh"                     
 48 #include "G4Electron.hh"                          
 49 #include "G4Gamma.hh"                             
 50 #include "G4MuMinusCapturePrecompound.hh"         
 51 #include "G4MuonDecayChannelWithSpin.hh"          
 52 #include "G4MuonMinusCapture.hh"                  
 53 #include "G4MuonRadiativeDecayChannelWithSpin.    
 54 #include "G4PionDecayMakeSpin.hh"                 
 55 #include "G4Positron.hh"                          
 56 #include "G4ProcessTable.hh"                      
 57 #include "G4SystemOfUnits.hh"                     
 58                                                   
 59 G4ThreadLocal F04StepMax* F04PhysicsList::fSte    
 60                                                   
 61 //....oooOO0OOooo........oooOO0OOooo........oo    
 62                                                   
 63 F04PhysicsList::F04PhysicsList(const G4String&    
 64 {                                                 
 65   G4LossTableManager::Instance();                 
 66                                                   
 67   defaultCutValue = 1. * mm;                      
 68                                                   
 69   fMessenger = new F04PhysicsListMessenger(thi    
 70                                                   
 71   SetVerboseLevel(1);                             
 72                                                   
 73   //    G4PhysListFactory factory;                
 74   G4VModularPhysicsList* phys = nullptr;          
 75   if (physName == "QGSP_BERT") {                  
 76     phys = new QGSP_BERT;                         
 77   }                                               
 78   else {                                          
 79     phys = new FTFP_BERT;                         
 80   }                                               
 81                                                   
 82   //    if (factory.IsReferencePhysList(physNa    
 83   //       phys =factory.GetReferencePhysList(    
 84                                                   
 85   // Physics List is defined via environment v    
 86   //    if (!phys) phys = factory.ReferencePhy    
 87                                                   
 88   if (!phys)                                      
 89     G4Exception("F04PhysicsList::F04PhysicsLis    
 90                 "PhysicsList does not exist");    
 91                                                   
 92   for (G4int i = 0;; ++i) {                       
 93     auto elem = const_cast<G4VPhysicsConstruct    
 94     if (elem == nullptr) break;                   
 95     G4cout << "RegisterPhysics: " << elem->Get    
 96     RegisterPhysics(elem);                        
 97   }                                               
 98                                                   
 99   RegisterPhysics(new G4StepLimiterPhysics());    
100   RegisterPhysics(new G4OpticalPhysics());        
101 }                                                 
102                                                   
103 //....oooOO0OOooo........oooOO0OOooo........oo    
104                                                   
105 F04PhysicsList::~F04PhysicsList()                 
106 {                                                 
107   delete fMessenger;                              
108 }                                                 
109                                                   
110 //....oooOO0OOooo........oooOO0OOooo........oo    
111                                                   
112 void F04PhysicsList::ConstructParticle()          
113 {                                                 
114   G4VModularPhysicsList::ConstructParticle();     
115                                                   
116   G4GenericIon::GenericIonDefinition();           
117                                                   
118   auto muonPlusDecayTable = new G4DecayTable()    
119   muonPlusDecayTable->Insert(new G4MuonDecayCh    
120   muonPlusDecayTable->Insert(new G4MuonRadiati    
121   G4MuonPlus::MuonPlusDefinition()->SetDecayTa    
122                                                   
123   auto muonMinusDecayTable = new G4DecayTable(    
124   muonMinusDecayTable->Insert(new G4MuonDecayC    
125   muonMinusDecayTable->Insert(new G4MuonRadiat    
126   G4MuonMinus::MuonMinusDefinition()->SetDecay    
127 }                                                 
128                                                   
129 //....oooOO0OOooo........oooOO0OOooo........oo    
130                                                   
131 void F04PhysicsList::ConstructProcess()           
132 {                                                 
133   G4VModularPhysicsList::ConstructProcess();      
134                                                   
135   fStepMaxProcess = new F04StepMax();             
136                                                   
137   auto decayWithSpin = new G4DecayWithSpin();     
138                                                   
139   G4ProcessTable* processTable = G4ProcessTabl    
140                                                   
141   G4VProcess* decay;                              
142   decay = processTable->FindProcess("Decay", G    
143                                                   
144   G4ProcessManager* pmanager;                     
145   pmanager = G4MuonPlus::MuonPlus()->GetProces    
146                                                   
147   if (pmanager) {                                 
148     if (decay) pmanager->RemoveProcess(decay);    
149     pmanager->AddProcess(decayWithSpin);          
150     // set ordering for PostStepDoIt and AtRes    
151     pmanager->SetProcessOrdering(decayWithSpin    
152     pmanager->SetProcessOrdering(decayWithSpin    
153   }                                               
154                                                   
155   decay = processTable->FindProcess("Decay", G    
156                                                   
157   pmanager = G4MuonMinus::MuonMinus()->GetProc    
158                                                   
159   if (pmanager) {                                 
160     if (decay) pmanager->RemoveProcess(decay);    
161     pmanager->AddProcess(decayWithSpin);          
162     // set ordering for PostStepDoIt and AtRes    
163     pmanager->SetProcessOrdering(decayWithSpin    
164     pmanager->SetProcessOrdering(decayWithSpin    
165   }                                               
166                                                   
167   G4VProcess* process = processTable->FindProc    
168                                                   
169   if (pmanager) {                                 
170     if (process) pmanager->RemoveProcess(proce    
171     process = new G4MuonMinusCapture(new G4MuM    
172     pmanager->AddRestProcess(process);            
173   }                                               
174                                                   
175   auto poldecay = new G4PionDecayMakeSpin();      
176                                                   
177   decay = processTable->FindProcess("Decay", G    
178                                                   
179   pmanager = G4PionPlus::PionPlus()->GetProces    
180                                                   
181   if (pmanager) {                                 
182     if (decay) pmanager->RemoveProcess(decay);    
183     pmanager->AddProcess(poldecay);               
184     // set ordering for PostStepDoIt and AtRes    
185     pmanager->SetProcessOrdering(poldecay, idx    
186     pmanager->SetProcessOrdering(poldecay, idx    
187   }                                               
188                                                   
189   decay = processTable->FindProcess("Decay", G    
190                                                   
191   pmanager = G4PionMinus::PionMinus()->GetProc    
192                                                   
193   if (pmanager) {                                 
194     if (decay) pmanager->RemoveProcess(decay);    
195     pmanager->AddProcess(poldecay);               
196     // set ordering for PostStepDoIt and AtRes    
197     pmanager->SetProcessOrdering(poldecay, idx    
198     pmanager->SetProcessOrdering(poldecay, idx    
199   }                                               
200                                                   
201   AddStepMax();                                   
202 }                                                 
203                                                   
204 /*                                                
205 //....oooOO0OOooo........oooOO0OOooo........oo    
206                                                   
207 void F04PhysicsList::RemoveFromPhysicsList(con    
208 {                                                 
209     G4bool success = false;                       
210     for (G4PhysConstVector::iterator p  = phys    
211                                      p != phys    
212         G4VPhysicsConstructor* e = (*p);          
213         if (e->GetPhysicsName() == name) {        
214            physicsVector->erase(p);               
215            success = true;                        
216            break;                                 
217         }                                         
218     }                                             
219     if (!success) {                               
220        std::ostringstream message;                
221        message << "PhysicsList::RemoveFromPhys    
222        G4Exception(message.str().c_str());        
223     }                                             
224 }                                                 
225                                                   
226 //....oooOO0OOooo........oooOO0OOooo........oo    
227                                                   
228 void F04PhysicsList::ClearPhysics()               
229 {                                                 
230     for (G4PhysConstVector::iterator p  = phys    
231                                      p != phys    
232         delete (*p);                              
233     }                                             
234     physicsVector->clear();                       
235 }                                                 
236 */                                                
237                                                   
238 //....oooOO0OOooo........oooOO0OOooo........oo    
239                                                   
240 void F04PhysicsList::SetStepMax(G4double step)    
241 {                                                 
242   fMaxChargedStep = step;                         
243   fStepMaxProcess->SetStepMax(fMaxChargedStep)    
244 }                                                 
245                                                   
246 //....oooOO0OOooo........oooOO0OOooo........oo    
247                                                   
248 F04StepMax* F04PhysicsList::GetStepMaxProcess(    
249 {                                                 
250   return fStepMaxProcess;                         
251 }                                                 
252                                                   
253 //....oooOO0OOooo........oooOO0OOooo........oo    
254                                                   
255 void F04PhysicsList::AddStepMax()                 
256 {                                                 
257   // Step limitation seen as a process            
258                                                   
259   auto particleIterator = GetParticleIterator(    
260   particleIterator->reset();                      
261   while ((*particleIterator)()) {                 
262     G4ParticleDefinition* particle = particleI    
263     G4ProcessManager* pmanager = particle->Get    
264                                                   
265     if (fStepMaxProcess->IsApplicable(*particl    
266       if (pmanager) pmanager->AddDiscreteProce    
267     }                                             
268   }                                               
269 }                                                 
270