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

#include <G4CsvRNtupleManager.hh>

Inheritance diagram for G4CsvRNtupleManager:
Collaboration diagram for G4CsvRNtupleManager:

Protected Member Functions

 G4CsvRNtupleManager (const G4AnalysisManagerState &state)
 
virtual ~G4CsvRNtupleManager ()
 
G4bool IsEmpty () const
 
G4bool Reset ()
 
tools::rcsv::ntuple * GetNtuple () const
 
tools::rcsv::ntuple * GetNtuple (G4int ntupleId) const
 
G4int SetNtuple (G4CsvRNtupleDescription *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 G4CsvAnalysisReader
 

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 G4CsvRNtupleManager.hh.

Constructor & Destructor Documentation

G4CsvRNtupleManager::G4CsvRNtupleManager ( const G4AnalysisManagerState state)
explicitprotected

Definition at line 35 of file G4CsvRNtupleManager.cc.

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

Definition at line 42 of file G4CsvRNtupleManager.cc.

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

Member Function Documentation

G4int G4CsvRNtupleManager::GetNofNtuples ( ) const
inlineprotectedvirtual

Reimplemented from G4VRNtupleManager.

Definition at line 115 of file G4CsvRNtupleManager.hh.

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

Definition at line 99 of file G4CsvRNtupleManager.cc.

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

Definition at line 105 of file G4CsvRNtupleManager.cc.

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

Implements G4VRNtupleManager.

Definition at line 392 of file G4CsvRNtupleManager.cc.

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

Implements G4VRNtupleManager.

Definition at line 398 of file G4CsvRNtupleManager.cc.

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

Here is the call graph for this function:

G4bool G4CsvRNtupleManager::IsEmpty ( ) const
protected

Definition at line 78 of file G4CsvRNtupleManager.cc.

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

Definition at line 84 of file G4CsvRNtupleManager.cc.

85 {
86 // Reset ntuples
87 
88  std::vector<G4CsvRNtupleDescription*>::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 G4CsvRNtupleManager::SetNtuple ( G4CsvRNtupleDescription rntupleDescription)
protected

Definition at line 116 of file G4CsvRNtupleManager.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 G4CsvRNtupleManager::SetNtupleDColumn ( const G4String columnName,
G4double value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 140 of file G4CsvRNtupleManager.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 G4CsvRNtupleManager::SetNtupleDColumn ( const G4String columnName,
std::vector< G4double > &  vector 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 161 of file G4CsvRNtupleManager.cc.

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

Here is the call graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 237 of file G4CsvRNtupleManager.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  G4CsvRNtupleDescription* 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
tools::ntuple_binding * fNtupleBinding
const G4AnalysisVerbose * GetVerboseL2() const
const XML_Char int const XML_Char * value
Definition: expat.h:331
const G4AnalysisVerbose * GetVerboseL4() const
const G4AnalysisManagerState & fState

Here is the call graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 330 of file G4CsvRNtupleManager.cc.

333 {
334 #ifdef G4VERBOSE
335  if ( fState.GetVerboseL4() ) {
336  G4ExceptionDescription description;
337  description << " ntupleId " << ntupleId << " " << columnName;
338  fState.GetVerboseL4()->Message("set", "ntuple D column of vector", description);
339  }
340 #endif
341 
342  G4CsvRNtupleDescription* ntupleDescription
343  = GetNtupleInFunction(ntupleId, "SetNtupleDColumn");
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 D 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
tools::ntuple_binding * fNtupleBinding
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
const G4AnalysisManagerState & fState

Here is the call graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 133 of file G4CsvRNtupleManager.cc.

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

Here is the caller graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 154 of file G4CsvRNtupleManager.cc.

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

Here is the call graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 206 of file G4CsvRNtupleManager.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  G4CsvRNtupleDescription* 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
tools::ntuple_binding * fNtupleBinding
const G4AnalysisVerbose * GetVerboseL2() const
const XML_Char int const XML_Char * value
Definition: expat.h:331
const G4AnalysisVerbose * GetVerboseL4() const
const G4AnalysisManagerState & fState

Here is the call graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 299 of file G4CsvRNtupleManager.cc.

302 {
303 #ifdef G4VERBOSE
304  if ( fState.GetVerboseL4() ) {
305  G4ExceptionDescription description;
306  description << " ntupleId " << ntupleId << " " << columnName;
307  fState.GetVerboseL4()->Message("set", "ntuple F column of vector", description);
308  }
309 #endif
310 
311  G4CsvRNtupleDescription* ntupleDescription
312  = GetNtupleInFunction(ntupleId, "SetNtupleFColumn");
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 F 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
tools::ntuple_binding * fNtupleBinding
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
const G4AnalysisManagerState & fState

Here is the call graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 126 of file G4CsvRNtupleManager.cc.

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

Here is the caller graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 147 of file G4CsvRNtupleManager.cc.

149 {
150  return SetNtupleIColumn(fFirstId, columnName, vector);
151 }
virtual G4bool SetNtupleIColumn(const G4String &columnName, G4int &value)

Here is the call graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 175 of file G4CsvRNtupleManager.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  G4CsvRNtupleDescription* 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
tools::ntuple_binding * fNtupleBinding
const G4AnalysisVerbose * GetVerboseL2() const
const XML_Char int const XML_Char * value
Definition: expat.h:331
const G4AnalysisVerbose * GetVerboseL4() const
const G4AnalysisManagerState & fState

Here is the call graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 268 of file G4CsvRNtupleManager.cc.

271 {
272 #ifdef G4VERBOSE
273  if ( fState.GetVerboseL4() ) {
274  G4ExceptionDescription description;
275  description << " ntupleId " << ntupleId << " " << columnName;
276  fState.GetVerboseL4()->Message("set", "ntuple I column", description);
277  }
278 #endif
279 
280  G4CsvRNtupleDescription* ntupleDescription
281  = GetNtupleInFunction(ntupleId, "SetNtupleIColumn");
282  if ( ! ntupleDescription ) return false;
283 
284  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
285  ntupleBinding->add_column(columnName, vector);
286 
287 #ifdef G4VERBOSE
288  if ( fState.GetVerboseL2() ) {
289  G4ExceptionDescription description;
290  description << " ntupleId " << ntupleId << " " << columnName;
291  fState.GetVerboseL2()->Message("set", "ntuple I 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
tools::ntuple_binding * fNtupleBinding
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
const G4AnalysisManagerState & fState

Here is the call graph for this function:

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

Implements G4VRNtupleManager.

Definition at line 168 of file G4CsvRNtupleManager.cc.

170 {
171  return SetNtupleSColumn(fFirstId, columnName, value);
172 }
virtual G4bool SetNtupleSColumn(const G4String &columnName, G4String &value)
G4bool G4CsvRNtupleManager::SetNtupleSColumn ( G4int  ntupleId,
const G4String columnName,
G4String value 
)
protectedvirtual

Implements G4VRNtupleManager.

Definition at line 361 of file G4CsvRNtupleManager.cc.

364 {
365 #ifdef G4VERBOSE
366  if ( fState.GetVerboseL4() ) {
367  G4ExceptionDescription description;
368  description << " ntupleId " << ntupleId << " " << columnName;
369  fState.GetVerboseL4()->Message("set", "ntuple S column", description);
370  }
371 #endif
372 
373  G4CsvRNtupleDescription* ntupleDescription
374  = GetNtupleInFunction(ntupleId, "SetNtupleSColumn");
375  if ( ! ntupleDescription ) return false;
376 
377  tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
378  ntupleBinding->add_column(columnName, value);
379 
380 #ifdef G4VERBOSE
381  if ( fState.GetVerboseL2() ) {
382  G4ExceptionDescription description;
383  description << " ntupleId " << ntupleId << " " << columnName;
384  fState.GetVerboseL2()->Message("set", "ntuple S 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
tools::ntuple_binding * fNtupleBinding
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
const G4AnalysisManagerState & fState

Here is the call graph for this function:

Friends And Related Function Documentation

friend class G4CsvAnalysisReader
friend

Definition at line 47 of file G4CsvRNtupleManager.hh.


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