32 #ifndef G4RootPNtupleManager_h
33 #define G4RootPNtupleManager_h 1
57 class mutex :
public virtual tools::wroot::imutex {
113 const G4String&
name, std::vector<int>* vector)
override;
115 const G4String&
name, std::vector<float>* vector)
override;
117 const G4String&
name, std::vector<double>* vector)
override;
154 tools::wroot::base_pntuple*
159 template <typename T>
163 template <typename T>
165 const
G4String& name, std::vector<T>* vector);
167 template <typename T>
170 template <typename T>
183 template <typename T>
185 G4int ntupleId, const
G4String& name, std::vector<T>* vector)
190 description << name <<
" ntupleId " << ntupleId;
199 auto& ntupleBooking = ntupleDescription->fNtupleBooking;
200 auto index = ntupleBooking.columns().size();
202 ntupleBooking.template add_column<T>(
name);
204 ntupleBooking.template add_column<T>(
name, *vector);
211 description << name <<
" ntupleId " << ntupleId;
221 template <
typename T>
226 return CreateNtupleTColumn<T>(ntupleId,
name, vector);
235 G4cout <<
"Skipping FillNtupleIColumn for " << ntupleId <<
G4endl;
242 description <<
" ntupleId " << ntupleId
243 <<
" columnId " << columnId <<
" value " <<
value;
249 if ( !
ntuple )
return false;
252 if ( index < 0 || index >=
G4int(
ntuple->columns().size()) ) {
254 description <<
" " <<
"ntupleId " << ntupleId
255 <<
" columnId " << columnId <<
" does not exist.";
256 G4Exception(
"G4RootNtupleManager::FillNtupleTColumn()",
261 auto icolumn =
ntuple->columns()[index];
262 auto column =
dynamic_cast<tools::wroot::base_pntuple::column_string*
>(icolumn);
265 description <<
" Column type does not match: "
266 <<
" ntupleId " << ntupleId
267 <<
" columnId " << columnId <<
" value " <<
value;
268 G4Exception(
"G4RootNtupleManager:FillNtupleColumn",
278 description <<
" ntupleId " << ntupleId
279 <<
" columnId " << columnId <<
" value " <<
value;
287 template <
typename T>
292 G4cout <<
"Skipping FillNtupleIColumn for " << ntupleId <<
G4endl;
299 description <<
" ntupleId " << ntupleId
300 <<
" columnId " << columnId <<
" value " <<
value;
307 if ( !
ntuple )
return false;
311 if ( index < 0 || index >=
G4int(
ntuple->columns().size()) ) {
313 description <<
" " <<
"ntupleId " << ntupleId
314 <<
" columnId " << columnId <<
" does not exist.";
315 G4Exception(
"G4TNtupleManager::FillNtupleTColumn()",
319 auto icolumn =
ntuple->columns()[index];
322 auto column =
dynamic_cast<tools::wroot::base_pntuple::column<T>*
>(icolumn);
325 description <<
" Column type does not match: "
326 <<
" ntupleId " << ntupleId
327 <<
" columnId " << columnId <<
" value " <<
value;
338 description <<
" ntupleId " << ntupleId
339 <<
" columnId " << columnId <<
" value " <<
value;
347 template <
typename T>
tools::wroot::ntuple * GetMainNtupleInFunction(G4int id, G4String function, G4bool warn=true) const
mutex & operator=(const mutex &)
const G4AnalysisVerbose * GetVerboseL2() const
G4double(* function)(G4double)
tools::wroot::base_pntuple * GetNtupleInFunction(G4int id, G4String function, G4bool warn=true) const
std::ostringstream G4ExceptionDescription
G4bool FillNtupleTColumn(G4int ntupleId, G4int columnId, const T &value)
virtual G4bool FillNtupleDColumn(G4int id, G4double value) final
virtual G4bool Merge() final
virtual G4bool Reset(G4bool deleteNtuple) final
virtual G4int CreateNtupleFColumn(G4int ntupleId, const G4String &name, std::vector< float > *vector) override
G4RootPNtupleManager(G4RootMainNtupleManager *main, const G4AnalysisManagerState &state)
G4bool GetIsActivation() const
G4RootMainNtupleManager * fMainNtupleManager
virtual G4int GetNofNtupleBookings() const final
virtual G4bool FillNtupleIColumn(G4int id, G4int value) final
virtual G4int CreateNtupleDColumn(G4int ntupleId, const G4String &name, std::vector< double > *vector) override
tools::wroot::imutex parent
G4PNtupleCreateMode fCreateMode
virtual G4bool FillNtupleFColumn(G4int ntupleId, G4int columnId, G4float value) final
G4int fFirstNtupleColumnId
virtual G4bool FillNtupleSColumn(G4int ntupleId, G4int columnId, const G4String &value) final
const XML_Char int const XML_Char * value
virtual G4int CreateNtupleIColumn(const G4String &name, std::vector< int > *vector) final
virtual G4bool FillNtupleSColumn(G4int id, const G4String &value) final
const G4AnalysisVerbose * GetVerboseL4() const
virtual void SetActivation(G4bool activation) final
virtual G4int CreateNtupleFColumn(const G4String &name, std::vector< float > *vector) final
std::vector< tools::wroot::imt_ntuple * > fNtupleVector
virtual G4bool GetActivation(G4int ntupleId) const final
virtual G4int CreateNtupleIColumn(G4int ntupleId, const G4String &name, std::vector< int > *vector) override
const G4ThreeVector const G4double const
virtual G4bool IsEmpty() const final
int main(int argc, char **argv)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
virtual G4bool AddNtupleRow() final
virtual G4int CreateNtupleSColumn(G4int ntupleId, const G4String &name) override
virtual void FinishNtuple() final
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4GLOB_DLL std::ostream G4cout
G4bool fLockFirstNtupleColumnId
mutex(const mutex &a_from)
mutex(G4AutoLock &a_mutex)
G4int CreateNtupleTColumn(G4int ntupleId, const G4String &name, std::vector< T > *vector)
virtual G4bool FillNtupleDColumn(G4int ntupleId, G4int columnId, G4double value) final
void CreateNtuple(G4RootPNtupleDescription *ntupleDescription, tools::wroot::ntuple *mainNtuple)
virtual G4int CreateNtupleSColumn(const G4String &name)
G4RootPNtupleDescription * GetNtupleDescriptionInFunction(G4int id, G4String function, G4bool warn=true) const
std::vector< G4RootPNtupleDescription * > fNtupleDescriptionVector
virtual G4bool FillNtupleFColumn(G4int id, G4float value) final
virtual G4int GetNofNtuples() const final
const G4AnalysisManagerState & fState
virtual G4bool FillNtupleIColumn(G4int ntupleId, G4int columnId, G4int value) final
void CreateNtuplesFromMain()
virtual G4int CreateNtupleDColumn(const G4String &name, std::vector< double > *vector) final