Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RootRNtupleManager Class Reference

#include <G4RootRNtupleManager.hh>

Inheritance diagram for G4RootRNtupleManager:
Collaboration diagram for G4RootRNtupleManager:

Protected Member Functions

 G4RootRNtupleManager (const G4AnalysisManagerState &state)
 
virtual ~G4RootRNtupleManager ()
 
G4bool IsEmpty () const
 
G4bool Reset ()
 
tools::rroot::ntuple * GetNtuple () const
 
tools::rroot::ntuple * GetNtuple (G4int ntupleId) const
 
G4int SetNtuple (G4RootRNtupleDescription *rntupleDescription)
 
virtual G4bool SetNtupleIColumn (const G4String &columnName, G4int &value)
 
virtual G4bool SetNtupleFColumn (const G4String &columnName, G4float &value)
 
virtual G4bool SetNtupleDColumn (const G4String &columnName, G4double &value)
 
virtual G4bool SetNtupleSColumn (const G4String &columnName, G4String &value)
 
virtual G4bool SetNtupleIColumn (const G4String &columnName, std::vector< G4int > &vector)
 
virtual G4bool SetNtupleFColumn (const G4String &columnName, std::vector< G4float > &vector)
 
virtual G4bool SetNtupleDColumn (const G4String &columnName, std::vector< G4double > &vector)
 
virtual G4bool SetNtupleIColumn (G4int ntupleId, const G4String &columnName, G4int &value)
 
virtual G4bool SetNtupleFColumn (G4int ntupleId, const G4String &columnName, G4float &value)
 
virtual G4bool SetNtupleDColumn (G4int ntupleId, const G4String &columnName, G4double &value)
 
virtual G4bool SetNtupleSColumn (G4int ntupleId, const G4String &columnName, G4String &value)
 
virtual G4bool SetNtupleIColumn (G4int ntupleId, const G4String &columnName, std::vector< G4int > &vector)
 
virtual G4bool SetNtupleFColumn (G4int ntupleId, const G4String &columnName, std::vector< G4float > &vector)
 
virtual G4bool SetNtupleDColumn (G4int ntupleId, const G4String &columnName, std::vector< G4double > &vector)
 
virtual G4bool GetNtupleRow ()
 
virtual G4bool GetNtupleRow (G4int ntupleId)
 
virtual G4int GetNofNtuples () const
 

Friends

class G4RootAnalysisReader
 

Additional Inherited Members

- Public Member Functions inherited from G4VRNtupleManager
 G4VRNtupleManager (const G4AnalysisManagerState &state)
 
virtual ~G4VRNtupleManager ()
 
 G4VRNtupleManager (const G4VRNtupleManager &rhs)=delete
 
G4VRNtupleManageroperator= (const G4VRNtupleManager &rhs)=delete
 
- Public Member Functions inherited from G4BaseAnalysisManager
 G4BaseAnalysisManager (const G4AnalysisManagerState &state)
 
virtual ~G4BaseAnalysisManager ()
 
G4bool SetFirstId (G4int firstId)
 
void SetLockFirstId (G4bool lockFirstId)
 
G4int GetFirstId () const
 
- Protected Attributes inherited from G4BaseAnalysisManager
const G4AnalysisManagerStatefState
 
G4int fFirstId
 
G4bool fLockFirstId
 

Detailed Description

Definition at line 45 of file G4RootRNtupleManager.hh.

Constructor & Destructor Documentation

G4RootRNtupleManager::G4RootRNtupleManager ( const G4AnalysisManagerState state)
explicitprotected

Definition at line 35 of file G4RootRNtupleManager.cc.

36  : G4VRNtupleManager(state),
37  fNtupleVector()
38 {
39 }
G4VRNtupleManager(const G4AnalysisManagerState &state)
G4RootRNtupleManager::~G4RootRNtupleManager ( )
protectedvirtual

Definition at line 42 of file G4RootRNtupleManager.cc.

43 {
44  std::vector<G4RootRNtupleDescription*>::iterator it;
45  for (it = fNtupleVector.begin(); it != fNtupleVector.end(); it++ ) {
46  delete (*it);
47  }
48 }

Member Function Documentation

G4int G4RootRNtupleManager::GetNofNtuples ( ) const
inlineprotectedvirtual

Reimplemented from G4VRNtupleManager.

Definition at line 115 of file G4RootRNtupleManager.hh.

116 { return fNtupleVector.size(); }
tools::rroot::ntuple * G4RootRNtupleManager::GetNtuple ( ) const
protected

Definition at line 99 of file G4RootRNtupleManager.cc.

100 {
101  return GetNtuple(fFirstId);
102 }
tools::rroot::ntuple * GetNtuple() const
tools::rroot::ntuple * G4RootRNtupleManager::GetNtuple ( G4int  ntupleId) const
protected

Definition at line 105 of file G4RootRNtupleManager.cc.

106 {
107  G4RootRNtupleDescription* rntupleDescription
108  = GetNtupleInFunction(ntupleId, "GetRNtuple");
109 
110  if ( ! rntupleDescription ) return nullptr;
111 
112  return rntupleDescription->fNtuple;
113 }
tools::rroot::ntuple * fNtuple
G4bool G4RootRNtupleManager::GetNtupleRow ( )
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 392 of file G4RootRNtupleManager.cc.

393 {
394  return GetNtupleRow(fFirstId);
395 }
virtual G4bool GetNtupleRow()
G4bool G4RootRNtupleManager::GetNtupleRow ( G4int  ntupleId)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 398 of file G4RootRNtupleManager.cc.

399 {
400 #ifdef G4VERBOSE
401  if ( fState.GetVerboseL4() ) {
402  G4ExceptionDescription description;
403  description << " ntupleId " << ntupleId;
404  fState.GetVerboseL4()->Message("get", "ntuple row", description);
405  }
406 #endif
407 
408  G4RootRNtupleDescription* ntupleDescription
409  = GetNtupleInFunction(ntupleId, "GetNtupleRow");
410  if ( ! ntupleDescription ) return false;
411 
412  tools::rroot::ntuple* ntuple = ntupleDescription->fNtuple;
413  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
414 
415  G4bool isInitialized = ntupleDescription->fIsInitialized;
416  if ( ! isInitialized ) {
417 
418 #ifdef G4VERBOSE
419  if ( fState.GetVerboseL4() ) {
420  G4ExceptionDescription description;
421  description << " ntupleId " << ntupleId;
422  fState.GetVerboseL4()->Message("initialize", "ntuple", description);
423  }
424 #endif
425  if ( ! ntuple->initialize(G4cout, *ntupleBinding) ) {
426  G4ExceptionDescription description;
427  description
428  << " "
429  << "Ntuple initialization failed !!";
430  G4Exception("G4RootRNtuple::GetNtupleRow()",
431  "Analysis_WR021", JustWarning, description);
432  return false;
433  }
434  ntupleDescription->fIsInitialized = true;
435  ntuple->start();
436  }
437 
438  G4bool next = ntuple->next();
439  if ( next ) {
440  if ( ! ntuple->get_row() ) {
441  G4ExceptionDescription description;
442  description
443  << " "
444  << "Ntuple get_row() failed !!";
445  G4Exception("G4RootRNtuple::GetNtupleRow()",
446  "Analysis_WR021", JustWarning, description);
447  return false;
448  }
449  }
450 
451 #ifdef G4VERBOSE
452  if ( fState.GetVerboseL2() ) {
453  G4ExceptionDescription description;
454  description << " ntupleId " << ntupleId;
455  fState.GetVerboseL2()->Message("get", "ntuple row", description, true);
456  }
457 #endif
458 
459  return next;
460 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL2() const
G4GLOB_DLL std::ostream G4cout
const G4AnalysisVerbose * GetVerboseL4() const
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
tools::rroot::ntuple * fNtuple
tools::ntuple_binding * fNtupleBinding
G4bool isInitialized()
const G4AnalysisManagerState & fState

Here is the call graph for this function:

G4bool G4RootRNtupleManager::IsEmpty ( ) const
protected

Definition at line 78 of file G4RootRNtupleManager.cc.

79 {
80  return ! fNtupleVector.size();
81 }
G4bool G4RootRNtupleManager::Reset ( )
protected

Definition at line 84 of file G4RootRNtupleManager.cc.

85 {
86 // Reset ntuples
87 
88  std::vector<G4RootRNtupleDescription*>::iterator it;
89  for (it = fNtupleVector.begin(); it != fNtupleVector.end(); it++ ) {
90  // ntuple is deleted automatically when file is closed
91  // delete (*it)->fNtuple;
92  (*it)->fNtuple=0;
93  }
94 
95  return true;
96 }
G4int G4RootRNtupleManager::SetNtuple ( G4RootRNtupleDescription rntupleDescription)
protected

Definition at line 116 of file G4RootRNtupleManager.cc.

117 {
118  G4int id = fNtupleVector.size() + fFirstId;
119 
120  fNtupleVector.push_back(rntupleDescription);
121 
122  return id;
123 }
int G4int
Definition: G4Types.hh:78

Here is the caller graph for this function:

G4bool G4RootRNtupleManager::SetNtupleDColumn ( const G4String columnName,
G4double value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 140 of file G4RootRNtupleManager.cc.

142 {
143  return SetNtupleDColumn(fFirstId, columnName, value);
144 }
const XML_Char int const XML_Char * value
Definition: expat.h:331
virtual G4bool SetNtupleDColumn(const G4String &columnName, G4double &value)

Here is the caller graph for this function:

G4bool G4RootRNtupleManager::SetNtupleDColumn ( const G4String columnName,
std::vector< G4double > &  vector 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 168 of file G4RootRNtupleManager.cc.

170 {
171  return SetNtupleDColumn(fFirstId, columnName, vector);
172 }
virtual G4bool SetNtupleDColumn(const G4String &columnName, G4double &value)

Here is the call graph for this function:

G4bool G4RootRNtupleManager::SetNtupleDColumn ( G4int  ntupleId,
const G4String columnName,
G4double value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 237 of file G4RootRNtupleManager.cc.

240 {
241 #ifdef G4VERBOSE
242  if ( fState.GetVerboseL4() ) {
243  G4ExceptionDescription description;
244  description << " ntupleId " << ntupleId << " " << columnName;
245  fState.GetVerboseL4()->Message("set", "ntuple D column", description);
246  }
247 #endif
248 
249  G4RootRNtupleDescription* ntupleDescription
250  = GetNtupleInFunction(ntupleId, "SetNtupleDColumn");
251  if ( ! ntupleDescription ) return false;
252 
253  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
254  ntupleBinding->add_column(columnName, value);
255 
256 #ifdef G4VERBOSE
257  if ( fState.GetVerboseL2() ) {
258  G4ExceptionDescription description;
259  description << " ntupleId " << ntupleId << " " << columnName;
260  fState.GetVerboseL2()->Message("set", "ntuple D colum", description, true);
261  }
262 #endif
263 
264  return true;
265 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL2() const
const XML_Char int const XML_Char * value
Definition: expat.h:331
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_binding * fNtupleBinding
const G4AnalysisManagerState & fState

Here is the call graph for this function:

G4bool G4RootRNtupleManager::SetNtupleDColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< G4double > &  vector 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 361 of file G4RootRNtupleManager.cc.

364 {
365 #ifdef G4VERBOSE
366  if ( fState.GetVerboseL4() ) {
367  G4ExceptionDescription description;
368  description << " ntupleId " << ntupleId << " " << columnName;
369  fState.GetVerboseL4()->Message("set", "ntuple D column of vector", description);
370  }
371 #endif
372 
373  G4RootRNtupleDescription* ntupleDescription
374  = GetNtupleInFunction(ntupleId, "SetNtupleDColumn");
375  if ( ! ntupleDescription ) return false;
376 
377  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
378  ntupleBinding->add_column(columnName, vector);
379 
380 #ifdef G4VERBOSE
381  if ( fState.GetVerboseL2() ) {
382  G4ExceptionDescription description;
383  description << " ntupleId " << ntupleId << " " << columnName;
384  fState.GetVerboseL2()->Message("set", "ntuple D colum", description, true);
385  }
386 #endif
387 
388  return true;
389 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_binding * fNtupleBinding
const G4AnalysisManagerState & fState

Here is the call graph for this function:

G4bool G4RootRNtupleManager::SetNtupleFColumn ( const G4String columnName,
G4float value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 133 of file G4RootRNtupleManager.cc.

135 {
136  return SetNtupleFColumn(fFirstId, columnName, value);
137 }
const XML_Char int const XML_Char * value
Definition: expat.h:331
virtual G4bool SetNtupleFColumn(const G4String &columnName, G4float &value)

Here is the caller graph for this function:

G4bool G4RootRNtupleManager::SetNtupleFColumn ( const G4String columnName,
std::vector< G4float > &  vector 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 161 of file G4RootRNtupleManager.cc.

163 {
164  return SetNtupleFColumn(fFirstId, columnName, vector);
165 }
virtual G4bool SetNtupleFColumn(const G4String &columnName, G4float &value)

Here is the call graph for this function:

G4bool G4RootRNtupleManager::SetNtupleFColumn ( G4int  ntupleId,
const G4String columnName,
G4float value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 206 of file G4RootRNtupleManager.cc.

209 {
210 #ifdef G4VERBOSE
211  if ( fState.GetVerboseL4() ) {
212  G4ExceptionDescription description;
213  description << " ntupleId " << ntupleId << " " << columnName;
214  fState.GetVerboseL4()->Message("set", "ntuple F column", description);
215  }
216 #endif
217 
218  G4RootRNtupleDescription* ntupleDescription
219  = GetNtupleInFunction(ntupleId, "SetNtupleFColumn");
220  if ( ! ntupleDescription ) return false;
221 
222  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
223  ntupleBinding->add_column(columnName, value);
224 
225 #ifdef G4VERBOSE
226  if ( fState.GetVerboseL2() ) {
227  G4ExceptionDescription description;
228  description << " ntupleId " << ntupleId << " " << columnName;
229  fState.GetVerboseL2()->Message("set", "ntuple F colum", description, true);
230  }
231 #endif
232 
233  return true;
234 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL2() const
const XML_Char int const XML_Char * value
Definition: expat.h:331
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_binding * fNtupleBinding
const G4AnalysisManagerState & fState

Here is the call graph for this function:

G4bool G4RootRNtupleManager::SetNtupleFColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< G4float > &  vector 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 330 of file G4RootRNtupleManager.cc.

333 {
334 #ifdef G4VERBOSE
335  if ( fState.GetVerboseL4() ) {
336  G4ExceptionDescription description;
337  description << " ntupleId " << ntupleId << " " << columnName;
338  fState.GetVerboseL4()->Message("set", "ntuple F column of vector", description);
339  }
340 #endif
341 
342  G4RootRNtupleDescription* ntupleDescription
343  = GetNtupleInFunction(ntupleId, "SetNtupleFColumn");
344  if ( ! ntupleDescription ) return false;
345 
346  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
347  ntupleBinding->add_column(columnName, vector);
348 
349 #ifdef G4VERBOSE
350  if ( fState.GetVerboseL2() ) {
351  G4ExceptionDescription description;
352  description << " ntupleId " << ntupleId << " " << columnName;
353  fState.GetVerboseL2()->Message("set", "ntuple F colum", description, true);
354  }
355 #endif
356 
357  return true;
358 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_binding * fNtupleBinding
const G4AnalysisManagerState & fState

Here is the call graph for this function:

G4bool G4RootRNtupleManager::SetNtupleIColumn ( const G4String columnName,
G4int value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 126 of file G4RootRNtupleManager.cc.

128 {
129  return SetNtupleIColumn(fFirstId, columnName, value);
130 }
virtual G4bool SetNtupleIColumn(const G4String &columnName, G4int &value)
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the caller graph for this function:

G4bool G4RootRNtupleManager::SetNtupleIColumn ( const G4String columnName,
std::vector< G4int > &  vector 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 154 of file G4RootRNtupleManager.cc.

156 {
157  return SetNtupleIColumn(fFirstId, columnName, vector);
158 }
virtual G4bool SetNtupleIColumn(const G4String &columnName, G4int &value)

Here is the call graph for this function:

G4bool G4RootRNtupleManager::SetNtupleIColumn ( G4int  ntupleId,
const G4String columnName,
G4int value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 175 of file G4RootRNtupleManager.cc.

178 {
179 #ifdef G4VERBOSE
180  if ( fState.GetVerboseL4() ) {
181  G4ExceptionDescription description;
182  description << " ntupleId " << ntupleId << " " << columnName;
183  fState.GetVerboseL4()->Message("set", "ntuple I column", description);
184  }
185 #endif
186 
187  G4RootRNtupleDescription* ntupleDescription
188  = GetNtupleInFunction(ntupleId, "SetNtupleIColumn");
189  if ( ! ntupleDescription ) return false;
190 
191  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
192  ntupleBinding->add_column(columnName, value);
193 
194 #ifdef G4VERBOSE
195  if ( fState.GetVerboseL2() ) {
196  G4ExceptionDescription description;
197  description << " ntupleId " << ntupleId << " " << columnName;
198  fState.GetVerboseL2()->Message("set", "ntuple I colum", description, true);
199  }
200 #endif
201 
202  return true;
203 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL2() const
const XML_Char int const XML_Char * value
Definition: expat.h:331
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_binding * fNtupleBinding
const G4AnalysisManagerState & fState

Here is the call graph for this function:

G4bool G4RootRNtupleManager::SetNtupleIColumn ( G4int  ntupleId,
const G4String columnName,
std::vector< G4int > &  vector 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 299 of file G4RootRNtupleManager.cc.

302 {
303 #ifdef G4VERBOSE
304  if ( fState.GetVerboseL4() ) {
305  G4ExceptionDescription description;
306  description << " ntupleId " << ntupleId << " " << columnName;
307  fState.GetVerboseL4()->Message("set", "ntuple I column", description);
308  }
309 #endif
310 
311  G4RootRNtupleDescription* ntupleDescription
312  = GetNtupleInFunction(ntupleId, "SetNtupleIColumn");
313  if ( ! ntupleDescription ) return false;
314 
315  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
316  ntupleBinding->add_column(columnName, vector);
317 
318 #ifdef G4VERBOSE
319  if ( fState.GetVerboseL2() ) {
320  G4ExceptionDescription description;
321  description << " ntupleId " << ntupleId << " " << columnName;
322  fState.GetVerboseL2()->Message("set", "ntuple I colum", description, true);
323  }
324 #endif
325 
326  return true;
327 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_binding * fNtupleBinding
const G4AnalysisManagerState & fState

Here is the call graph for this function:

G4bool G4RootRNtupleManager::SetNtupleSColumn ( const G4String columnName,
G4String value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 147 of file G4RootRNtupleManager.cc.

149 {
150  return SetNtupleSColumn(fFirstId, columnName, value);
151 }
virtual G4bool SetNtupleSColumn(const G4String &columnName, G4String &value)
G4bool G4RootRNtupleManager::SetNtupleSColumn ( G4int  ntupleId,
const G4String columnName,
G4String value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 268 of file G4RootRNtupleManager.cc.

271 {
272 #ifdef G4VERBOSE
273  if ( fState.GetVerboseL4() ) {
274  G4ExceptionDescription description;
275  description << " ntupleId " << ntupleId << " " << columnName;
276  fState.GetVerboseL4()->Message("set", "ntuple S column", description);
277  }
278 #endif
279 
280  G4RootRNtupleDescription* ntupleDescription
281  = GetNtupleInFunction(ntupleId, "SetNtupleSColumn");
282  if ( ! ntupleDescription ) return false;
283 
284  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
285  ntupleBinding->add_column(columnName, value);
286 
287 #ifdef G4VERBOSE
288  if ( fState.GetVerboseL2() ) {
289  G4ExceptionDescription description;
290  description << " ntupleId " << ntupleId << " " << columnName;
291  fState.GetVerboseL2()->Message("set", "ntuple S colum", description, true);
292  }
293 #endif
294 
295  return true;
296 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_binding * fNtupleBinding
const G4AnalysisManagerState & fState

Here is the call graph for this function:

Friends And Related Function Documentation

friend class G4RootAnalysisReader
friend

Definition at line 47 of file G4RootRNtupleManager.hh.


The documentation for this class was generated from the following files: