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 // 27 // ------------------------------------------- 28 // 29 // GEANT4 Class file 30 // 31 // File name: G4HadDataHandler 32 // 33 // Author: V. Ivanchenko 34 // 35 // Creation date: 05 July 2022 36 // 37 // Modifications: 38 // 39 // ------------------------------------------- 40 // 41 // 42 43 #include "G4HadDataHandler.hh" 44 45 //....oooOO0OOooo........oooOO0OOooo........oo 46 47 G4HadDataHandler::G4HadDataHandler(std::size_t 48 { 49 data.resize(n, nullptr); 50 } 51 52 //....oooOO0OOooo........oooOO0OOooo........oo 53 54 G4HadDataHandler::~G4HadDataHandler() 55 { 56 for(std::size_t i=0; i<tLength; ++i) { 57 for(std::size_t j = i+1; j<tLength; ++j) { 58 if(data[j] == data[i]) { data[j] = nullp 59 } 60 CleanTable(i); 61 } 62 } 63 64 //....oooOO0OOooo........oooOO0OOooo........oo 65 66 void G4HadDataHandler::AddTable(G4PhysicsTable 67 { 68 data.push_back(ptr); 69 ++tLength; 70 } 71 72 //....oooOO0OOooo........oooOO0OOooo........oo 73 74 void G4HadDataHandler::UpdateTable(G4PhysicsTa 75 { 76 // update table pointer but not delete previ 77 if(idx < tLength) { 78 if(ptr != data[idx]) { data[idx] = ptr; } 79 } else { 80 G4cout << "### G4HadDataHandler::UpdateTab 81 << " length=" << tLength << G4endl; 82 } 83 } 84 85 //....oooOO0OOooo........oooOO0OOooo........oo 86 87 void G4HadDataHandler::CleanTable(std::size_t 88 { 89 if(idx < tLength && nullptr != data[idx]) { 90 data[idx]->clearAndDestroy(); 91 delete data[idx]; 92 data[idx] = nullptr; 93 } 94 } 95 96 //....oooOO0OOooo........oooOO0OOooo........oo 97 98 void G4HadDataHandler::SetMasterProcess(const 99 { 100 masterProcess.push_back(ptr); 101 } 102 103 //....oooOO0OOooo........oooOO0OOooo........oo 104 105 const G4VProcess* G4HadDataHandler::GetMasterP 106 { 107 return (idx < masterProcess.size()) ? master 108 } 109 110 //....oooOO0OOooo........oooOO0OOooo........oo 111