2// ********************************************************************
3// * License and Disclaimer *
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. *
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. *
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// ********************************************************************
27#include "G4AnalysisManagerState.hh"
28#include "G4AnalysisUtilities.hh"
34//_____________________________________________________________________________
36G4int G4NtupleBookingManager::CreateNtupleTColumn(
37 G4int ntupleId, const G4String& name, std::vector<T>* vector)
39 Message(G4Analysis::kVL4, "create", "ntuple T column",
40 " ntupleId " + std::to_string(ntupleId));
43 = GetNtupleBookingInFunction(ntupleId, "CreateNtupleTColumn");
44 if ( ! g4NtupleBooking ) return G4Analysis::kInvalidId;
46 // Save column info in booking
47 auto& ntupleBooking = g4NtupleBooking->fNtupleBooking;
48 auto index = ntupleBooking.columns().size();
50 ntupleBooking.template add_column<T>(name);
52 ntupleBooking.template add_column<T>(name, *vector);
54 // Create column if ntuple already exists
55 // CreateTColumnInNtuple<T>(ntupleBooking, name, vector);
56 fLockFirstNtupleColumnId = true;
58 Message(G4Analysis::kVL2, "create", "ntuple T column",
59 name + " ntupleId " + std::to_string(ntupleId));
61 return G4int(index + fFirstNtupleColumnId);
64//_____________________________________________________________________________
65inline G4int G4NtupleBookingManager::GetNofNtupleBookings() const
67 return G4int(fNtupleBookingVector.size());
70//_____________________________________________________________________________
71inline G4int G4NtupleBookingManager::GetCurrentNtupleId() const
73 return GetNofNtupleBookings() + fFirstId - 1;
80//_____________________________________________________________________________
81inline const std::vector<G4NtupleBooking*>&
82G4NtupleBookingManager::GetNtupleBookingVector() const
84 return fNtupleBookingVector;
87//_____________________________________________________________________________
88inline G4int G4NtupleBookingManager::GetFirstNtupleColumnId() const {
89 return fFirstNtupleColumnId;
92//_____________________________________________________________________________
93inline G4String G4NtupleBookingManager::GetFileType() const