Geant4-11
G4NtupleBookingManager.icc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
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. *
10// * *
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. *
17// * *
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// ********************************************************************
25//
26
27#include "G4AnalysisManagerState.hh"
28#include "G4AnalysisUtilities.hh"
29
30//
31// private functions
32//
33
34//_____________________________________________________________________________
35template <typename T>
36G4int G4NtupleBookingManager::CreateNtupleTColumn(
37 G4int ntupleId, const G4String& name, std::vector<T>* vector)
38{
39 Message(G4Analysis::kVL4, "create", "ntuple T column",
40 " ntupleId " + std::to_string(ntupleId));
41
42 auto g4NtupleBooking
43 = GetNtupleBookingInFunction(ntupleId, "CreateNtupleTColumn");
44 if ( ! g4NtupleBooking ) return G4Analysis::kInvalidId;
45
46 // Save column info in booking
47 auto& ntupleBooking = g4NtupleBooking->fNtupleBooking;
48 auto index = ntupleBooking.columns().size();
49 if ( ! vector )
50 ntupleBooking.template add_column<T>(name);
51 else
52 ntupleBooking.template add_column<T>(name, *vector);
53
54 // Create column if ntuple already exists
55 // CreateTColumnInNtuple<T>(ntupleBooking, name, vector);
56 fLockFirstNtupleColumnId = true;
57
58 Message(G4Analysis::kVL2, "create", "ntuple T column",
59 name + " ntupleId " + std::to_string(ntupleId));
60
61 return G4int(index + fFirstNtupleColumnId);
62}
63
64//_____________________________________________________________________________
65inline G4int G4NtupleBookingManager::GetNofNtupleBookings() const
66{
67 return G4int(fNtupleBookingVector.size());
68}
69
70//_____________________________________________________________________________
71inline G4int G4NtupleBookingManager::GetCurrentNtupleId() const
72{
73 return GetNofNtupleBookings() + fFirstId - 1;
74}
75
76//
77// public functions
78//
79
80//_____________________________________________________________________________
81inline const std::vector<G4NtupleBooking*>&
82G4NtupleBookingManager::GetNtupleBookingVector() const
83{
84 return fNtupleBookingVector;
85}
86
87//_____________________________________________________________________________
88inline G4int G4NtupleBookingManager::GetFirstNtupleColumnId() const {
89 return fFirstNtupleColumnId;
90}
91
92//_____________________________________________________________________________
93inline G4String G4NtupleBookingManager::GetFileType() const
94{
95 return fFileType;
96}