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 << 40 << 41 Message(G4Analysis::kVL4, "create", "ntuple 39 Message(G4Analysis::kVL4, "create", "ntuple T column", 42 " ntupleId " + std::to_string(ntupleId)); 40 " ntupleId " + std::to_string(ntupleId)); 43 41 44 auto g4NtupleBooking 42 auto g4NtupleBooking 45 = GetNtupleBookingInFunction(ntupleId, "Cr 43 = GetNtupleBookingInFunction(ntupleId, "CreateNtupleTColumn"); 46 if ( ! g4NtupleBooking ) return G4Analysis: 44 if ( ! g4NtupleBooking ) return G4Analysis::kInvalidId; 47 45 48 // Save column info in booking 46 // Save column info in booking 49 auto& ntupleBooking = g4NtupleBooking->fNtup 47 auto& ntupleBooking = g4NtupleBooking->fNtupleBooking; 50 auto index = ntupleBooking.columns().size(); 48 auto index = ntupleBooking.columns().size(); 51 if (! vector) { << 49 if ( ! vector ) 52 ntupleBooking.template add_column<T>(name) 50 ntupleBooking.template add_column<T>(name); 53 } << 51 else 54 else { << 55 ntupleBooking.template add_column<T>(name, 52 ntupleBooking.template add_column<T>(name, *vector); 56 } << 57 53 58 // Create column if ntuple already exists 54 // Create column if ntuple already exists 59 // CreateTColumnInNtuple<T>(ntupleBooking, n 55 // CreateTColumnInNtuple<T>(ntupleBooking, name, vector); 60 fLockFirstNtupleColumnId = true; 56 fLockFirstNtupleColumnId = true; 61 57 62 Message(G4Analysis::kVL2, "create", "ntuple 58 Message(G4Analysis::kVL2, "create", "ntuple T column", 63 name + " ntupleId " + std::to_string(ntupl 59 name + " ntupleId " + std::to_string(ntupleId)); 64 60 65 return G4int(index + fFirstNtupleColumnId); 61 return G4int(index + fFirstNtupleColumnId); 66 } 62 } 67 63 68 //____________________________________________ 64 //_____________________________________________________________________________ 69 inline G4int G4NtupleBookingManager::GetNofNtu << 65 inline G4int G4NtupleBookingManager::GetNofNtupleBookings() const 70 { 66 { 71 return (onlyIfExist) ? G4int(fNtupleBookingV << 67 return G4int(fNtupleBookingVector.size()); 72 : G4int(fNtupleBookingV << 73 } 68 } 74 69 75 //____________________________________________ 70 //_____________________________________________________________________________ 76 inline G4int G4NtupleBookingManager::GetCurre 71 inline G4int G4NtupleBookingManager::GetCurrentNtupleId() const 77 { 72 { 78 return fCurrentNtupleId; << 73 return GetNofNtupleBookings() + fFirstId - 1; 79 } 74 } 80 75 81 // 76 // 82 // public functions 77 // public functions 83 // 78 // 84 79 85 //____________________________________________ 80 //_____________________________________________________________________________ 86 inline const std::vector<G4NtupleBooking*>& 81 inline const std::vector<G4NtupleBooking*>& 87 G4NtupleBookingManager::GetNtupleBookingVector 82 G4NtupleBookingManager::GetNtupleBookingVector() const 88 { 83 { 89 return fNtupleBookingVector; 84 return fNtupleBookingVector; 90 } 85 } 91 86 92 //____________________________________________ 87 //_____________________________________________________________________________ 93 inline G4int G4NtupleBookingManager::GetFirstN 88 inline G4int G4NtupleBookingManager::GetFirstNtupleColumnId() const { 94 return fFirstNtupleColumnId; 89 return fFirstNtupleColumnId; 95 } 90 } 96 91 97 //____________________________________________ 92 //_____________________________________________________________________________ 98 inline G4String G4NtupleBookingManager::GetFil 93 inline G4String G4NtupleBookingManager::GetFileType() const 99 { 94 { 100 return fFileType; 95 return fFileType; 101 } 96 } 102 97