Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 26 27 #include "G4AnalysisManagerState.hh" 27 #include "G4AnalysisManagerState.hh" 28 #include "G4AnalysisUtilities.hh" 28 #include "G4AnalysisUtilities.hh" 29 29 30 // 30 // 31 // private functions 31 // private functions 32 // 32 // 33 33 34 //____________________________________________ 34 //_____________________________________________________________________________ 35 template <typename T> 35 template <typename T> 36 G4int G4NtupleBookingManager::CreateNtupleTCol 36 G4int G4NtupleBookingManager::CreateNtupleTColumn( 37 G4int ntupleId, const G4String& name, std::v 37 G4int ntupleId, const G4String& name, std::vector<T>* vector) 38 { 38 { 39 if (! CheckName(name, "NtupleColumn")) retur << 39 #ifdef G4VERBOSE 40 << 40 if ( fState.GetVerboseL4() ) { 41 Message(G4Analysis::kVL4, "create", "ntuple << 41 G4ExceptionDescription description; 42 " ntupleId " + std::to_string(ntupleId)); << 42 description << name << " ntupleId " << ntupleId; 43 << 43 fState.GetVerboseL4()->Message("create", "ntuple T column", description); 44 auto g4NtupleBooking << 44 } >> 45 #endif >> 46 >> 47 auto g4NtupleBooking 45 = GetNtupleBookingInFunction(ntupleId, "Cr 48 = GetNtupleBookingInFunction(ntupleId, "CreateNtupleTColumn"); 46 if ( ! g4NtupleBooking ) return G4Analysis: << 49 if ( ! g4NtupleBooking ) return G4Analysis::kInvalidId; 47 << 50 48 // Save column info in booking 51 // Save column info in booking 49 auto& ntupleBooking = g4NtupleBooking->fNtup 52 auto& ntupleBooking = g4NtupleBooking->fNtupleBooking; 50 auto index = ntupleBooking.columns().size(); 53 auto index = ntupleBooking.columns().size(); 51 if (! vector) { << 54 if ( ! vector ) 52 ntupleBooking.template add_column<T>(name) 55 ntupleBooking.template add_column<T>(name); 53 } << 56 else 54 else { << 55 ntupleBooking.template add_column<T>(name, 57 ntupleBooking.template add_column<T>(name, *vector); 56 } << 58 57 << 58 // Create column if ntuple already exists 59 // Create column if ntuple already exists 59 // CreateTColumnInNtuple<T>(ntupleBooking, n 60 // CreateTColumnInNtuple<T>(ntupleBooking, name, vector); 60 fLockFirstNtupleColumnId = true; 61 fLockFirstNtupleColumnId = true; 61 62 62 Message(G4Analysis::kVL2, "create", "ntuple << 63 #ifdef G4VERBOSE 63 name + " ntupleId " + std::to_string(ntupl << 64 if ( fState.GetVerboseL2() ) { >> 65 G4ExceptionDescription description; >> 66 description << name << " ntupleId " << ntupleId; >> 67 fState.GetVerboseL2()->Message("create", "ntuple T column", description); >> 68 } >> 69 #endif 64 70 65 return G4int(index + fFirstNtupleColumnId); 71 return G4int(index + fFirstNtupleColumnId); 66 } 72 } 67 73 68 //____________________________________________ 74 //_____________________________________________________________________________ 69 inline G4int G4NtupleBookingManager::GetNofNtu << 75 inline G4int G4NtupleBookingManager::GetNofNtupleBookings() const 70 { 76 { 71 return (onlyIfExist) ? G4int(fNtupleBookingV << 77 return G4int(fNtupleBookingVector.size()); 72 : G4int(fNtupleBookingV << 73 } 78 } 74 79 75 //____________________________________________ 80 //_____________________________________________________________________________ 76 inline G4int G4NtupleBookingManager::GetCurre 81 inline G4int G4NtupleBookingManager::GetCurrentNtupleId() const 77 { 82 { 78 return fCurrentNtupleId; << 83 return GetNofNtupleBookings() + fFirstId - 1; 79 } 84 } 80 85 81 // 86 // 82 // public functions 87 // public functions 83 // 88 // 84 89 85 //____________________________________________ 90 //_____________________________________________________________________________ 86 inline const std::vector<G4NtupleBooking*>& << 91 inline const std::vector<G4NtupleBooking*>& 87 G4NtupleBookingManager::GetNtupleBookingVector 92 G4NtupleBookingManager::GetNtupleBookingVector() const 88 { 93 { 89 return fNtupleBookingVector; 94 return fNtupleBookingVector; 90 } 95 } 91 96 92 //____________________________________________ 97 //_____________________________________________________________________________ 93 inline G4int G4NtupleBookingManager::GetFirstN 98 inline G4int G4NtupleBookingManager::GetFirstNtupleColumnId() const { 94 return fFirstNtupleColumnId; 99 return fFirstNtupleColumnId; 95 } 100 } 96 101 97 //____________________________________________ 102 //_____________________________________________________________________________ 98 inline G4String G4NtupleBookingManager::GetFil 103 inline G4String G4NtupleBookingManager::GetFileType() const 99 { 104 { 100 return fFileType; 105 return fFileType; 101 } 106 } 102 107