Geant4 Cross Reference |
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 // G4ProcessPlacer 27 // ------------------------------------------- 28 29 #include "G4ProcessPlacer.hh" 30 #include "G4ProcessManager.hh" 31 #include "G4VProcess.hh" 32 #include "G4ParticleTable.hh" 33 34 G4ProcessPlacer::G4ProcessPlacer(const G4Strin 35 : fParticleName(particlename) 36 { 37 } 38 39 G4ProcessPlacer::~G4ProcessPlacer() 40 { 41 } 42 43 void G4ProcessPlacer::RemoveProcess(G4VProcess 44 { 45 G4cout << "=== G4ProcessPlacer::RemoveProces 46 << G4endl; 47 G4cout << " ProcessName: " << process->GetP 48 << ", will be removed!" << G4endl; 49 50 G4cout << " The initial AlongStep Vectors: 51 PrintAlongStepGPILVec(); 52 PrintAlongStepDoItVec(); 53 54 G4cout << " The initial PostStep Vectors: " 55 PrintPostStepGPILVec(); 56 PrintPostStepDoItVec(); 57 58 GetProcessManager()->RemoveProcess(process); 59 60 G4cout << " The final AlongStep Vectors: " 61 PrintAlongStepGPILVec(); 62 PrintAlongStepDoItVec(); 63 64 G4cout << " The final PostStep Vectors: " < 65 PrintPostStepGPILVec(); 66 PrintPostStepDoItVec(); 67 68 G4cout << "================================= 69 70 } 71 72 void G4ProcessPlacer::AddProcessAs(G4VProcess* 73 { 74 G4cout << " Modifying Process Order for Pro 75 76 G4cout << " The initial AlongStep Vectors: 77 PrintAlongStepGPILVec(); 78 PrintAlongStepDoItVec(); 79 80 G4cout << "The initial PostStep Vectors: " < 81 PrintPostStepGPILVec(); 82 PrintPostStepDoItVec(); 83 84 if (sol == eLast) 85 { 86 GetProcessManager()->AddProcess(process, o 87 } 88 else if (sol == eSecond) 89 { 90 // get transportation process 91 G4VProcess *transportation = 92 (* (GetProcessManager()->GetProcessList() 93 94 if (!transportation) 95 { 96 G4Exception("G4ProcessPlacer::AddProcess 97 } 98 if (transportation->GetProcessName() != "T 99 { 100 // G4cout << " GOT HERE CoupledTran 101 G4cout << transportation->GetProcessName 102 G4Exception("G4ProcessPlacer::AddProcess 103 } 104 105 // place the given proces as first for the 106 // 31/5/11 previously set to first, then t 107 // which is more conveniently correctly se 108 GetProcessManager()->AddProcess(process); 109 GetProcessManager()->SetProcessOrderingToS 110 111 GetProcessManager()->SetProcessOrderingToS 112 113 } 114 115 // for verification inly 116 G4cout << " The final AlongStep Vectors: " 117 PrintAlongStepGPILVec(); 118 PrintAlongStepDoItVec(); 119 120 G4cout << "The final PostStep Vectors: " << 121 PrintPostStepGPILVec(); 122 PrintPostStepDoItVec(); 123 124 G4cout << "================================= 125 } 126 127 void G4ProcessPlacer::AddProcessAsSecondDoIt(G 128 { 129 G4cout << "=== G4ProcessPlacer::AddProcessAs 130 << fParticleName << G4endl; 131 AddProcessAs(process, eSecond); 132 } 133 134 void G4ProcessPlacer::AddProcessAsLastDoIt(G4V 135 { 136 G4cout << "=== G4ProcessPlacer::AddProcessAs 137 << fParticleName << G4endl; 138 AddProcessAs(process, eLast); 139 } 140 141 G4ProcessManager* G4ProcessPlacer::GetProcessM 142 { 143 // get particle iterator to add processes -- 144 G4ParticleTable* theParticleTable = nullptr; 145 G4ParticleTable::G4PTblDicIterator* theParti 146 theParticleTable = G4ParticleTable::GetParti 147 theParticleIterator = theParticleTable->GetI 148 // ----------------------------------------- 149 G4ProcessManager* processmanager = nullptr; 150 // find process manager -------------------- 151 theParticleIterator->reset(); 152 while( (*theParticleIterator)() ) /* while c 153 { 154 G4ParticleDefinition* particle = thePartic 155 if (particle->GetParticleName() == fPartic 156 { 157 processmanager = particle->GetProcessMa 158 break; 159 } 160 } 161 // ----------------------------------------- 162 if (!processmanager) 163 { 164 G4Exception("G4ProcessPlacer::GetProcessMa 165 FatalException, "NULL pointer 166 } 167 return processmanager; 168 } 169 170 void G4ProcessPlacer::PrintAlongStepGPILVec() 171 { 172 G4cout << "GPIL Vector: " << G4endl; 173 G4ProcessVector* processGPILVec = 174 GetProcessManager()->GetAlongStepProcessVe 175 PrintProcVec(processGPILVec); 176 } 177 178 void G4ProcessPlacer::PrintAlongStepDoItVec() 179 { 180 G4cout << "DoIt Vector: " << G4endl; 181 G4ProcessVector* processDoItVec = 182 GetProcessManager()->GetAlongStepProcessVe 183 PrintProcVec(processDoItVec); 184 } 185 186 187 void G4ProcessPlacer::PrintPostStepGPILVec() 188 { 189 G4cout << "GPIL Vector: " << G4endl; 190 G4ProcessVector* processGPILVec = 191 GetProcessManager()->GetPostStepProcessVec 192 PrintProcVec(processGPILVec); 193 } 194 195 void G4ProcessPlacer::PrintPostStepDoItVec() 196 { 197 G4cout << "DoIt Vector: " << G4endl; 198 G4ProcessVector* processDoItVec = 199 GetProcessManager()->GetPostStepProcessVec 200 PrintProcVec(processDoItVec); 201 } 202 203 204 void G4ProcessPlacer::PrintProcVec(G4ProcessVe 205 { 206 if (!processVec) 207 { 208 G4Exception("G4ProcessPlacer::G4ProcessPla 209 FatalException, "NULL pointer 210 } 211 G4int len = (G4int)processVec->length(); 212 if (len==0) 213 { 214 G4Exception("G4ProcessPlacer::G4ProcessPla 215 FatalException, "Length of pro 216 } 217 for (G4int i=0; i<len; ++i) 218 { 219 G4VProcess *p = (*processVec)[i]; 220 if (p) 221 { 222 G4cout << " " << p->GetProcessName() < 223 } 224 else 225 { 226 G4cout << " " << "no process found for 227 << ", in vector of length: " << l 228 } 229 } 230 } 231