[819] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4ProcessTable.cc,v 1.13 2007/10/06 05:33:58 kurasige Exp $ |
---|
[963] | 28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
[819] | 29 | // |
---|
| 30 | // |
---|
| 31 | // ------------------------------------------------------------ |
---|
| 32 | // GEANT 4 class header file |
---|
| 33 | // |
---|
| 34 | // History: first implementation, based on object model of |
---|
| 35 | // 4th Aug 1998, H.Kurashige |
---|
| 36 | // ------------------------------------------------------------ |
---|
| 37 | // History: |
---|
| 38 | // Use STL vector instead of RW vector 1. Mar 00 H.Kurashige |
---|
| 39 | // |
---|
| 40 | |
---|
| 41 | #include "G4ProcessTableMessenger.hh" |
---|
| 42 | #include "G4ProcessTable.hh" |
---|
| 43 | |
---|
| 44 | // constructor ////////////////////////// |
---|
| 45 | G4ProcessTable::G4ProcessTable():verboseLevel(1) |
---|
| 46 | { |
---|
| 47 | #ifdef G4VERBOSE |
---|
| 48 | if (verboseLevel>1){ |
---|
| 49 | G4cout << "-- G4ProcessTable constructor --" << G4endl; |
---|
| 50 | } |
---|
| 51 | #endif |
---|
| 52 | fProcTblVector = new G4ProcTableVector(); |
---|
| 53 | fProcNameVector = new G4ProcNameVector(); |
---|
| 54 | tmpTblVector = new G4ProcTableVector(); |
---|
| 55 | fProcTblMessenger = 0; |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | // copy constructor ////////////////////////// |
---|
| 59 | G4ProcessTable::G4ProcessTable(const G4ProcessTable &) |
---|
| 60 | { |
---|
| 61 | #ifdef G4VERBOSE |
---|
| 62 | if (verboseLevel>0){ |
---|
| 63 | G4cout << "-- G4ProcessTable copy constructor --" << G4endl; |
---|
| 64 | } |
---|
| 65 | #endif |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | // destructor ////////////////////////// |
---|
| 69 | G4ProcessTable::~G4ProcessTable() |
---|
| 70 | { |
---|
| 71 | #ifdef G4VERBOSE |
---|
| 72 | if (verboseLevel>1){ |
---|
| 73 | G4cout << "-- G4ProcessTable destructor --" << G4endl; |
---|
| 74 | } |
---|
| 75 | #endif |
---|
| 76 | |
---|
| 77 | if ( tmpTblVector != 0) { |
---|
| 78 | tmpTblVector ->clear(); |
---|
| 79 | delete tmpTblVector; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | if ( fProcTblVector != 0) { |
---|
| 83 | G4ProcTableVector::iterator idx; |
---|
| 84 | |
---|
| 85 | // destruction of processes has moved to G4VUserPhysicsList |
---|
| 86 | for (idx=fProcTblVector->begin(); idx!=fProcTblVector->end(); ++idx) { |
---|
| 87 | // delete all processes |
---|
| 88 | // delete (*idx)->GetProcess(); |
---|
| 89 | delete (*idx); |
---|
| 90 | } |
---|
| 91 | fProcTblVector ->clear(); |
---|
| 92 | delete fProcTblVector; |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | if ( fProcNameVector != 0) { |
---|
| 96 | fProcNameVector ->clear(); |
---|
| 97 | delete fProcNameVector; |
---|
| 98 | } |
---|
| 99 | fProcessTable =0; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | ///////////////////////// |
---|
| 103 | G4UImessenger* G4ProcessTable::CreateMessenger() |
---|
| 104 | { |
---|
| 105 | if (fProcTblMessenger == 0) { |
---|
| 106 | fProcTblMessenger = new G4ProcessTableMessenger(this); |
---|
| 107 | } |
---|
| 108 | return fProcTblMessenger; |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | ///////////////////////// |
---|
| 112 | void G4ProcessTable::DeleteMessenger() |
---|
| 113 | { |
---|
| 114 | if (fProcTblMessenger != 0) { |
---|
| 115 | delete fProcTblMessenger; |
---|
| 116 | } |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | ////////////////////////// |
---|
| 121 | G4ProcessTable & G4ProcessTable::operator=(const G4ProcessTable &right) |
---|
| 122 | { |
---|
| 123 | #ifdef G4VERBOSE |
---|
| 124 | if (verboseLevel>0){ |
---|
| 125 | G4cout << "-- G4ProcessTable assignment operator --" << G4endl; |
---|
| 126 | } |
---|
| 127 | #endif |
---|
| 128 | if (&right == this) return *this; |
---|
| 129 | else return *this; |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | ////////////////////////// |
---|
| 133 | G4int G4ProcessTable::operator==(const G4ProcessTable &right) const |
---|
| 134 | { |
---|
| 135 | return (this == &right); |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | ////////////////////////// |
---|
| 139 | G4int G4ProcessTable::operator!=(const G4ProcessTable &right) const |
---|
| 140 | { |
---|
| 141 | return (this != &right); |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | // Static class variable: ptr to single instance of class |
---|
| 145 | G4ProcessTable* G4ProcessTable::fProcessTable =0; |
---|
| 146 | |
---|
| 147 | |
---|
| 148 | ////////////////////////// |
---|
| 149 | G4ProcessTable* G4ProcessTable::GetProcessTable() |
---|
| 150 | { |
---|
| 151 | static G4ProcessTable theProcessTable; |
---|
| 152 | if (!fProcessTable){ |
---|
| 153 | fProcessTable = &theProcessTable; |
---|
| 154 | } |
---|
| 155 | return fProcessTable; |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | ////////////////////////// |
---|
| 159 | G4int G4ProcessTable::Insert(G4VProcess* aProcess, |
---|
| 160 | G4ProcessManager* aProcMgr) |
---|
| 161 | { |
---|
| 162 | if ( (aProcess == 0) || ( aProcMgr == 0 ) ){ |
---|
| 163 | #ifdef G4VERBOSE |
---|
| 164 | if (verboseLevel>0){ |
---|
| 165 | G4cout << "G4ProcessTable::Insert : arguments are 0 pointer "<<G4endl; |
---|
| 166 | } |
---|
| 167 | #endif |
---|
| 168 | return -1; |
---|
| 169 | } |
---|
| 170 | |
---|
| 171 | #ifdef G4VERBOSE |
---|
| 172 | if (verboseLevel>1){ |
---|
| 173 | G4cout << "G4ProcessTable::Insert "; |
---|
| 174 | G4cout << " Process[" << aProcess->GetProcessName() << "]"; |
---|
| 175 | G4cout << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]"; |
---|
| 176 | G4cout << G4endl; |
---|
| 177 | } |
---|
| 178 | #endif |
---|
| 179 | |
---|
| 180 | G4ProcTableVector::iterator itr; |
---|
| 181 | G4int idxTbl=0; |
---|
| 182 | G4ProcTblElement* anElement; |
---|
| 183 | G4bool isFoundInTbl = false; |
---|
| 184 | // loop over all elements |
---|
| 185 | for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) { |
---|
| 186 | anElement = (*itr); |
---|
| 187 | // check if this process is included |
---|
| 188 | if (aProcess == anElement->GetProcess()) { |
---|
| 189 | isFoundInTbl = true; |
---|
| 190 | |
---|
| 191 | // add the process manager into the element |
---|
| 192 | // unless this process manager is included |
---|
| 193 | if (!anElement->Contains(aProcMgr)) { |
---|
| 194 | anElement->Insert(aProcMgr); |
---|
| 195 | #ifdef G4VERBOSE |
---|
| 196 | if (verboseLevel>2){ |
---|
| 197 | G4cout << " This Process Manager is registered !! " << G4endl; |
---|
| 198 | } |
---|
| 199 | #endif |
---|
| 200 | } |
---|
| 201 | break; |
---|
| 202 | } |
---|
| 203 | } |
---|
| 204 | // add this process into the table by creating a new element |
---|
| 205 | if (!isFoundInTbl) { |
---|
| 206 | G4ProcTblElement* newElement = new G4ProcTblElement(aProcess); |
---|
| 207 | newElement->Insert(aProcMgr); |
---|
| 208 | fProcTblVector->push_back(newElement); |
---|
| 209 | // add into name vector |
---|
| 210 | G4ProcNameVector::iterator ip; |
---|
| 211 | G4bool isFound = false; |
---|
| 212 | for (ip=fProcNameVector->begin(); ip!=fProcNameVector->end(); ++ip) { |
---|
| 213 | isFound |= (aProcess->GetProcessName() == (*ip)); |
---|
| 214 | } |
---|
| 215 | if (!isFound) { |
---|
| 216 | fProcNameVector->push_back(aProcess->GetProcessName() ); |
---|
| 217 | #ifdef G4VERBOSE |
---|
| 218 | if (verboseLevel>2){ |
---|
| 219 | G4cout << " This Process is registered !! " << G4endl; |
---|
| 220 | } |
---|
| 221 | #endif |
---|
| 222 | } |
---|
| 223 | } |
---|
| 224 | return idxTbl; |
---|
| 225 | } |
---|
| 226 | |
---|
| 227 | ////////////////////////// |
---|
| 228 | G4int G4ProcessTable::Remove( G4VProcess* aProcess, |
---|
| 229 | G4ProcessManager* aProcMgr) |
---|
| 230 | { |
---|
| 231 | if ( (aProcess == 0) || ( aProcMgr == 0 ) ){ |
---|
| 232 | #ifdef G4VERBOSE |
---|
| 233 | if (verboseLevel>0){ |
---|
| 234 | G4cout << "G4ProcessTable::Remove : arguments are 0 pointer "<< G4endl; |
---|
| 235 | } |
---|
| 236 | #endif |
---|
| 237 | return -1; |
---|
| 238 | } |
---|
| 239 | |
---|
| 240 | #ifdef G4VERBOSE |
---|
| 241 | if (verboseLevel>1){ |
---|
| 242 | G4cout << "G4ProcessTable::Remove "; |
---|
| 243 | G4cout << " Process[" << aProcess->GetProcessName() << "]"; |
---|
| 244 | G4cout << " Particle[" << aProcMgr->GetParticleType()->GetParticleName() << "]" << G4endl; |
---|
| 245 | } |
---|
| 246 | #endif |
---|
| 247 | |
---|
| 248 | G4ProcTableVector::iterator itr; |
---|
| 249 | G4int idxTbl=0; |
---|
| 250 | G4ProcTblElement* anElement=0; |
---|
| 251 | G4bool isFound = false; |
---|
| 252 | // loop over all elements |
---|
| 253 | for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) { |
---|
| 254 | anElement = (*itr); |
---|
| 255 | |
---|
| 256 | // check if this process is included |
---|
| 257 | if (aProcess == anElement->GetProcess()) { |
---|
| 258 | isFound = anElement->Contains(aProcMgr); |
---|
| 259 | // remove the process manager from the element |
---|
| 260 | anElement->Remove(aProcMgr); |
---|
| 261 | #ifdef G4VERBOSE |
---|
| 262 | if (verboseLevel>2){ |
---|
| 263 | G4cout << " This Process Manager is removed !! " << G4endl; |
---|
| 264 | } |
---|
| 265 | #endif |
---|
| 266 | break; |
---|
| 267 | } |
---|
| 268 | } |
---|
| 269 | // |
---|
| 270 | if (!isFound) { |
---|
| 271 | #ifdef G4VERBOSE |
---|
| 272 | if (verboseLevel>0){ |
---|
| 273 | G4cout << " This Process Manager is not registered !! " << G4endl; |
---|
| 274 | } |
---|
| 275 | #endif |
---|
| 276 | return -1; |
---|
| 277 | } |
---|
| 278 | // remove the element if it has no entry |
---|
| 279 | if (anElement->Length() == 0){ |
---|
| 280 | fProcTblVector->erase(itr); |
---|
| 281 | delete anElement; |
---|
| 282 | // check other prcesses with same name exist or not |
---|
| 283 | G4bool isSameName = false; |
---|
| 284 | for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr) { |
---|
| 285 | anElement = (*itr); |
---|
| 286 | if (anElement->GetProcessName() == aProcess->GetProcessName()) { |
---|
| 287 | isSameName = true; |
---|
| 288 | break; |
---|
| 289 | } |
---|
| 290 | } |
---|
| 291 | // remove from name vector |
---|
| 292 | if (!isSameName ) { |
---|
| 293 | G4ProcNameVector::iterator i; |
---|
| 294 | for (i=fProcNameVector->begin(); i!=fProcNameVector->end(); ++i) { |
---|
| 295 | if ( *i == aProcess->GetProcessName() ) { |
---|
| 296 | fProcNameVector->erase(i); |
---|
| 297 | break; |
---|
| 298 | } |
---|
| 299 | } |
---|
| 300 | } |
---|
| 301 | #ifdef G4VERBOSE |
---|
| 302 | if (verboseLevel>1){ |
---|
| 303 | G4cout << " This Process is removed !! " << G4endl; |
---|
| 304 | } |
---|
| 305 | #endif |
---|
| 306 | } |
---|
| 307 | return idxTbl; |
---|
| 308 | } |
---|
| 309 | |
---|
| 310 | ////////////////////////// |
---|
| 311 | G4VProcess* G4ProcessTable::FindProcess(const G4String& processName, |
---|
| 312 | const G4ProcessManager* processManager) |
---|
| 313 | const |
---|
| 314 | { |
---|
| 315 | G4ProcTableVector::iterator itr; |
---|
| 316 | G4int idxTbl = 0; |
---|
| 317 | G4bool isFound = false; |
---|
| 318 | G4ProcTblElement* anElement=0; |
---|
| 319 | for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) { |
---|
| 320 | anElement = (*itr); |
---|
| 321 | // check name |
---|
| 322 | if ( anElement->GetProcessName() == processName ) { |
---|
| 323 | // check if the processManage is included |
---|
| 324 | if ( anElement->Contains(processManager) ) { |
---|
| 325 | isFound = true; |
---|
| 326 | break; |
---|
| 327 | } |
---|
| 328 | } |
---|
| 329 | } |
---|
| 330 | #ifdef G4VERBOSE |
---|
| 331 | if (!isFound && verboseLevel>1){ |
---|
| 332 | G4cout << " G4ProcessTable::FindProcess :" ; |
---|
| 333 | G4cout << " The Process[" << processName << "] is not found "; |
---|
| 334 | G4cout << " for " << processManager->GetParticleType()->GetParticleName() << G4endl; |
---|
| 335 | } |
---|
| 336 | #endif |
---|
| 337 | |
---|
| 338 | if (isFound) return anElement->GetProcess(); |
---|
| 339 | else return 0; |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | /////////////// |
---|
| 343 | G4ProcessTable::G4ProcTableVector* G4ProcessTable::Find( |
---|
| 344 | G4ProcTableVector*, |
---|
| 345 | const G4String& processName ) |
---|
| 346 | { |
---|
| 347 | tmpTblVector->clear(); |
---|
| 348 | |
---|
| 349 | G4ProcTableVector::iterator itr; |
---|
| 350 | G4bool isFound = false; |
---|
| 351 | G4ProcTblElement* anElement; |
---|
| 352 | for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr) { |
---|
| 353 | anElement = (*itr); |
---|
| 354 | // check name |
---|
| 355 | if ( anElement->GetProcessName() == processName ) { |
---|
| 356 | isFound = true; |
---|
| 357 | tmpTblVector->push_back(anElement); |
---|
| 358 | } |
---|
| 359 | } |
---|
| 360 | |
---|
| 361 | #ifdef G4VERBOSE |
---|
| 362 | if (!isFound && verboseLevel>0){ |
---|
| 363 | G4cout << " G4ProcessTable::Find :" ; |
---|
| 364 | G4cout << " The Process[" << processName << "] is not found " << G4endl; |
---|
| 365 | } |
---|
| 366 | #endif |
---|
| 367 | |
---|
| 368 | return tmpTblVector; |
---|
| 369 | |
---|
| 370 | } |
---|
| 371 | /////////////// |
---|
| 372 | G4ProcessTable::G4ProcTableVector* G4ProcessTable::Find( |
---|
| 373 | G4ProcTableVector*, |
---|
| 374 | G4ProcessType processType ) |
---|
| 375 | { |
---|
| 376 | tmpTblVector->clear(); |
---|
| 377 | |
---|
| 378 | G4ProcTableVector::iterator itr; |
---|
| 379 | G4bool isFound = false; |
---|
| 380 | G4ProcTblElement* anElement; |
---|
| 381 | for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr) { |
---|
| 382 | anElement = (*itr); |
---|
| 383 | // check name |
---|
| 384 | if ( anElement->GetProcess()->GetProcessType() == processType ) { |
---|
| 385 | isFound = true; |
---|
| 386 | tmpTblVector->push_back(anElement); |
---|
| 387 | } |
---|
| 388 | } |
---|
| 389 | |
---|
| 390 | #ifdef G4VERBOSE |
---|
| 391 | if (!isFound && verboseLevel>0){ |
---|
| 392 | G4cout << " G4ProcessTable::Find :" ; |
---|
| 393 | G4cout << " The Process[" << anElement->GetProcessName() << "] is not found " << G4endl; |
---|
| 394 | } |
---|
| 395 | #endif |
---|
| 396 | |
---|
| 397 | return tmpTblVector; |
---|
| 398 | |
---|
| 399 | } |
---|
| 400 | |
---|
| 401 | /////////////// |
---|
| 402 | G4ProcessVector* G4ProcessTable::ExtractProcesses( G4ProcTableVector* procTblVector) |
---|
| 403 | { |
---|
| 404 | G4ProcessVector* procList = new G4ProcessVector(); |
---|
| 405 | G4ProcTableVector::iterator itr; |
---|
| 406 | // loop over all elements |
---|
| 407 | for (itr=procTblVector->begin(); itr!=procTblVector->end(); ++itr) { |
---|
| 408 | G4ProcTblElement* anElement = (*itr); |
---|
| 409 | procList->insert( anElement->GetProcess() ); |
---|
| 410 | } |
---|
| 411 | return procList; |
---|
| 412 | } |
---|
| 413 | |
---|
| 414 | /////////////// |
---|
| 415 | G4ProcessVector* G4ProcessTable::FindProcesses() |
---|
| 416 | { |
---|
| 417 | return ExtractProcesses(fProcTblVector); |
---|
| 418 | } |
---|
| 419 | |
---|
| 420 | /////////////// |
---|
| 421 | G4ProcessVector* G4ProcessTable::FindProcesses( const G4ProcessManager* pManager ) |
---|
| 422 | { |
---|
| 423 | G4ProcessVector* procList = pManager->GetProcessList(); |
---|
| 424 | return new G4ProcessVector(*procList); |
---|
| 425 | } |
---|
| 426 | |
---|
| 427 | /////////////// |
---|
| 428 | G4ProcessVector* G4ProcessTable::FindProcesses( const G4String& processName ) |
---|
| 429 | { |
---|
| 430 | G4ProcTableVector* pTblVector = Find(fProcTblVector, processName); |
---|
| 431 | return ExtractProcesses(pTblVector); |
---|
| 432 | } |
---|
| 433 | |
---|
| 434 | /////////////// |
---|
| 435 | G4ProcessVector* G4ProcessTable::FindProcesses( G4ProcessType processType) |
---|
| 436 | { |
---|
| 437 | G4ProcTableVector* pTblVector = Find(fProcTblVector, processType); |
---|
| 438 | return ExtractProcesses(pTblVector); |
---|
| 439 | } |
---|
| 440 | |
---|
| 441 | /////////////// |
---|
| 442 | void G4ProcessTable::SetProcessActivation( const G4String& processName, |
---|
| 443 | G4bool fActive ) |
---|
| 444 | { |
---|
| 445 | #ifdef G4VERBOSE |
---|
| 446 | if (verboseLevel>1){ |
---|
| 447 | G4cout << " G4ProcessTable::SetProcessActivation:" ; |
---|
| 448 | G4cout << " The Process[" << processName << "] "<< G4endl; |
---|
| 449 | } |
---|
| 450 | #endif |
---|
| 451 | |
---|
| 452 | G4ProcTableVector* pTblVector = Find(fProcTblVector, processName); |
---|
| 453 | G4ProcTableVector::iterator itr; |
---|
| 454 | G4ProcTblElement* anElement; |
---|
| 455 | // loop over all elements |
---|
| 456 | for (itr=pTblVector->begin(); itr!=pTblVector->end(); ++itr) { |
---|
| 457 | anElement = (*itr); |
---|
| 458 | G4VProcess* process = anElement->GetProcess(); |
---|
| 459 | for (G4int idx = 0 ; idx < anElement->Length(); idx++) { |
---|
| 460 | G4ProcessManager* manager = anElement->GetProcessManager(idx); |
---|
| 461 | manager->SetProcessActivation(process, fActive); |
---|
| 462 | #ifdef G4VERBOSE |
---|
| 463 | if (verboseLevel>1){ |
---|
| 464 | G4cout << " for " << manager->GetParticleType()->GetParticleName(); |
---|
| 465 | G4cout << " Index = " << manager->GetProcessIndex(process); |
---|
| 466 | G4cout << G4endl; |
---|
| 467 | } |
---|
| 468 | #endif |
---|
| 469 | } |
---|
| 470 | } |
---|
| 471 | } |
---|
| 472 | |
---|
| 473 | /////////////// |
---|
| 474 | void G4ProcessTable::SetProcessActivation( |
---|
| 475 | const G4String& processName, |
---|
| 476 | G4ProcessManager* processManager, |
---|
| 477 | G4bool fActive ) |
---|
| 478 | { |
---|
| 479 | #ifdef G4VERBOSE |
---|
| 480 | if (verboseLevel>1){ |
---|
| 481 | G4cout << " G4ProcessTable::SetProcessActivation:" ; |
---|
| 482 | G4cout << " The Process[" << processName << "] "<< G4endl; |
---|
| 483 | } |
---|
| 484 | #endif |
---|
| 485 | |
---|
| 486 | G4VProcess* process = FindProcess( processName, processManager); |
---|
| 487 | if ( process != 0) { |
---|
| 488 | processManager->SetProcessActivation(process, fActive); |
---|
| 489 | #ifdef G4VERBOSE |
---|
| 490 | if (verboseLevel>1){ |
---|
| 491 | G4cout << " for " << processManager->GetParticleType()->GetParticleName(); |
---|
| 492 | G4cout << " Index = " << processManager->GetProcessIndex(process) << G4endl; |
---|
| 493 | } |
---|
| 494 | #endif |
---|
| 495 | } |
---|
| 496 | } |
---|
| 497 | |
---|
| 498 | |
---|
| 499 | /////////////// |
---|
| 500 | void G4ProcessTable::SetProcessActivation( G4ProcessType processType, |
---|
| 501 | G4bool fActive ) |
---|
| 502 | { |
---|
| 503 | #ifdef G4VERBOSE |
---|
| 504 | if (verboseLevel>1){ |
---|
| 505 | G4cout << " G4ProcessTable::SetProcessActivation:" ; |
---|
| 506 | G4cout << " The ProcessType[" << G4int(processType) << "] "<< G4endl; |
---|
| 507 | } |
---|
| 508 | #endif |
---|
| 509 | |
---|
| 510 | G4ProcTableVector* pTblVector = Find(fProcTblVector, processType); |
---|
| 511 | G4ProcTableVector::iterator itr; |
---|
| 512 | G4ProcTblElement* anElement; |
---|
| 513 | // loop over all elements |
---|
| 514 | for (itr=pTblVector->begin(); itr!=pTblVector->end(); ++itr) { |
---|
| 515 | anElement = (*itr); |
---|
| 516 | G4VProcess* process = anElement->GetProcess(); |
---|
| 517 | #ifdef G4VERBOSE |
---|
| 518 | if (verboseLevel>1){ |
---|
| 519 | G4cout << " The Process[" << process->GetProcessName()<< "] "<< G4endl; |
---|
| 520 | } |
---|
| 521 | #endif |
---|
| 522 | for (G4int idx = 0 ; idx < anElement->Length(); idx++) { |
---|
| 523 | G4ProcessManager* manager = anElement->GetProcessManager(idx); |
---|
| 524 | manager->SetProcessActivation(process, fActive); |
---|
| 525 | #ifdef G4VERBOSE |
---|
| 526 | if (verboseLevel>1){ |
---|
| 527 | G4cout << " for " << manager->GetParticleType()->GetParticleName(); |
---|
| 528 | G4cout << " Index = " << manager->GetProcessIndex(process) << G4endl; |
---|
| 529 | } |
---|
| 530 | #endif |
---|
| 531 | } |
---|
| 532 | } |
---|
| 533 | } |
---|
| 534 | |
---|
| 535 | /////////////// |
---|
| 536 | void G4ProcessTable::SetProcessActivation( |
---|
| 537 | G4ProcessType processType, |
---|
| 538 | G4ProcessManager* processManager, |
---|
| 539 | G4bool fActive ) |
---|
| 540 | { |
---|
| 541 | #ifdef G4VERBOSE |
---|
| 542 | if (verboseLevel>1){ |
---|
| 543 | G4cout << " G4ProcessTable::SetProcessActivation:" ; |
---|
| 544 | G4cout << " The ProcessType[" << G4int(processType) << "] "<< G4endl; |
---|
| 545 | } |
---|
| 546 | #endif |
---|
| 547 | |
---|
| 548 | G4ProcessVector* procList = processManager->GetProcessList(); |
---|
| 549 | for (G4int idx = 0; idx < procList->length(); idx++) { |
---|
| 550 | G4VProcess* process = (*procList)(idx); |
---|
| 551 | if ( process->GetProcessType() == processType) { |
---|
| 552 | processManager->SetProcessActivation(process, fActive); |
---|
| 553 | #ifdef G4VERBOSE |
---|
| 554 | if (verboseLevel>1){ |
---|
| 555 | G4cout << " The Process[" << process->GetProcessName()<< "] "<< G4endl; |
---|
| 556 | G4cout << " for " << processManager->GetParticleType()->GetParticleName(); |
---|
| 557 | G4cout << " Index = " << idx << G4endl; |
---|
| 558 | } |
---|
| 559 | #endif |
---|
| 560 | } |
---|
| 561 | } |
---|
| 562 | } |
---|
| 563 | |
---|
| 564 | |
---|
| 565 | ///////////// |
---|
| 566 | void G4ProcessTable::DumpInfo(G4VProcess* process, |
---|
| 567 | G4ParticleDefinition* particle) |
---|
| 568 | { |
---|
| 569 | G4ProcTableVector::iterator itr; |
---|
| 570 | G4int idxTbl=0; |
---|
| 571 | G4ProcTblElement* anElement=0; |
---|
| 572 | G4bool isFoundInTbl = false; |
---|
| 573 | G4ProcessManager* manager=0; |
---|
| 574 | G4int idx; |
---|
| 575 | // loop over all elements |
---|
| 576 | for (itr=fProcTblVector->begin(); itr!=fProcTblVector->end(); ++itr, ++idxTbl) { |
---|
| 577 | anElement = (*itr); |
---|
| 578 | if (process == anElement->GetProcess() ){ |
---|
| 579 | if (particle!=0) { |
---|
| 580 | for (idx=0; idx<anElement->Length(); idx++){ |
---|
| 581 | manager = anElement->GetProcessManager(idx); |
---|
| 582 | if (particle == manager->GetParticleType()) { |
---|
| 583 | isFoundInTbl = true; |
---|
| 584 | break; |
---|
| 585 | } |
---|
| 586 | } |
---|
| 587 | } else { |
---|
| 588 | isFoundInTbl = true; |
---|
| 589 | } |
---|
| 590 | break; |
---|
| 591 | } |
---|
| 592 | } |
---|
| 593 | if (!isFoundInTbl ) return; |
---|
| 594 | |
---|
| 595 | G4int tmpVerbose = process->GetVerboseLevel(); |
---|
| 596 | process->SetVerboseLevel(verboseLevel); |
---|
| 597 | process->DumpInfo(); |
---|
| 598 | process->SetVerboseLevel(tmpVerbose); |
---|
| 599 | if (particle==0) { |
---|
| 600 | for (idx=0; idx<anElement->Length(); idx++){ |
---|
| 601 | manager = anElement->GetProcessManager(idx); |
---|
| 602 | G4cout << " for " << manager->GetParticleType()->GetParticleName(); |
---|
| 603 | G4cout << G4endl; |
---|
| 604 | #ifdef G4VERBOSE |
---|
| 605 | if (verboseLevel >2){ |
---|
| 606 | tmpVerbose = manager->GetVerboseLevel(); |
---|
| 607 | manager->SetVerboseLevel(verboseLevel); |
---|
| 608 | manager->DumpInfo(); |
---|
| 609 | manager->SetVerboseLevel(tmpVerbose); |
---|
| 610 | } |
---|
| 611 | #endif |
---|
| 612 | } |
---|
| 613 | } else { |
---|
| 614 | G4cout << " for " << manager->GetParticleType()->GetParticleName(); |
---|
| 615 | G4cout << G4endl; |
---|
| 616 | #ifdef G4VERBOSE |
---|
| 617 | if (verboseLevel >2){ |
---|
| 618 | tmpVerbose = manager->GetVerboseLevel(); |
---|
| 619 | manager->SetVerboseLevel(verboseLevel); |
---|
| 620 | manager->DumpInfo(); |
---|
| 621 | manager->SetVerboseLevel(tmpVerbose); |
---|
| 622 | } |
---|
| 623 | #endif |
---|
| 624 | } |
---|
| 625 | } |
---|
| 626 | |
---|
| 627 | |
---|
| 628 | |
---|
| 629 | |
---|
| 630 | |
---|
| 631 | |
---|