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 // G4VScoreNtupleWriter 27 // 28 // Author: Ivana Hrivnacova, 11/09/2018 29 // ------------------------------------------- 30 31 #include "G4VScoreNtupleWriter.hh" 32 33 //____________________________________________ 34 G4VScoreNtupleWriter* G4VScoreNtupleWriter::fg 35 G4ThreadLocal G4VScoreNtupleWriter* G4VScoreNt 36 37 //____________________________________________ 38 G4VScoreNtupleWriter* G4VScoreNtupleWriter::In 39 { 40 // This function invokes creating the object 41 // The master instance should be created by 42 // via the concrete class constructor 43 44 G4bool isMaster = !G4Threading::IsWorkerThre 45 46 if((!isMaster) && (fgInstance == nullptr)) 47 { 48 if(fgMasterInstance != nullptr) 49 { 50 fgInstance = fgMasterInstance->CreateIns 51 } 52 } 53 54 return fgInstance; 55 } 56 57 //____________________________________________ 58 G4VScoreNtupleWriter::G4VScoreNtupleWriter() 59 { 60 G4bool isMaster = !G4Threading::IsWorkerThre 61 62 if(isMaster && (fgMasterInstance != nullptr) 63 { 64 G4ExceptionDescription description; 65 description << " " 66 << "G4VScoreNtupleWriter on ma 67 << "Cannot create another inst 68 G4Exception("G4VScoreNtupleWriter::G4VScor 69 FatalException, description); 70 } 71 if(fgInstance != nullptr) 72 { 73 G4ExceptionDescription description; 74 description << " " 75 << "G4VScoreNtupleWriter on wo 76 << "Cannot create another inst 77 G4Exception("G4VScoreNtupleWriter::G4VScor 78 FatalException, description); 79 } 80 if(isMaster) 81 fgMasterInstance = this; 82 fgInstance = this; 83 } 84 85 //____________________________________________ 86 G4VScoreNtupleWriter::~G4VScoreNtupleWriter() 87