Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Protected Member Functions | Friends
G4CsvNtupleManager Class Reference

#include <G4CsvNtupleManager.hh>

Inheritance diagram for G4CsvNtupleManager:
G4VNtupleManager G4BaseAnalysisManager

Protected Member Functions

 G4CsvNtupleManager (const G4AnalysisManagerState &state)
 
 ~G4CsvNtupleManager ()
 
void CreateNtuplesFromBooking ()
 
G4bool IsEmpty () const
 
G4bool Reset ()
 
void SetFileManager (G4CsvFileManager *fileManager)
 
tools::wcsv::ntuple * GetNtuple () const
 
tools::wcsv::ntuple * GetNtuple (G4int ntupleId) const
 
const std::vector
< G4CsvNtupleDescription * > & 
GetNtupleVector () const
 
virtual G4int CreateNtuple (const G4String &name, const G4String &title)
 
virtual G4int CreateNtupleIColumn (const G4String &name)
 
virtual G4int CreateNtupleFColumn (const G4String &name)
 
virtual G4int CreateNtupleDColumn (const G4String &name)
 
virtual void FinishNtuple ()
 
virtual G4int CreateNtupleIColumn (G4int ntupleId, const G4String &name)
 
virtual G4int CreateNtupleFColumn (G4int ntupleId, const G4String &name)
 
virtual G4int CreateNtupleDColumn (G4int ntupleId, const G4String &name)
 
virtual void FinishNtuple (G4int ntupleId)
 
virtual G4bool FillNtupleIColumn (G4int columnId, G4int value)
 
virtual G4bool FillNtupleFColumn (G4int columnId, G4float value)
 
virtual G4bool FillNtupleDColumn (G4int columnId, G4double value)
 
virtual G4bool AddNtupleRow ()
 
virtual G4bool FillNtupleIColumn (G4int ntupleId, G4int columnId, G4int value)
 
virtual G4bool FillNtupleFColumn (G4int ntupleId, G4int columnId, G4float value)
 
virtual G4bool FillNtupleDColumn (G4int ntupleId, G4int columnId, G4double value)
 
virtual G4bool AddNtupleRow (G4int ntupleId)
 
virtual G4int GetNofNtuples () const
 
- Protected Member Functions inherited from G4VNtupleManager
 G4VNtupleManager (const G4AnalysisManagerState &state)
 
virtual ~G4VNtupleManager ()
 
G4bool SetFirstNtupleColumnId (G4int firstId)
 
- Protected Member Functions inherited from G4BaseAnalysisManager
void ExceptionForHistograms (const G4String &functionName) const
 

Friends

class G4CsvAnalysisManager
 

Additional Inherited Members

- Public Member Functions inherited from G4BaseAnalysisManager
 G4BaseAnalysisManager (const G4AnalysisManagerState &state)
 
virtual ~G4BaseAnalysisManager ()
 
G4bool SetFirstId (G4int firstId)
 
- Protected Attributes inherited from G4VNtupleManager
G4int fFirstNtupleColumnId
 
G4bool fLockFirstNtupleColumnId
 
- Protected Attributes inherited from G4BaseAnalysisManager
const G4AnalysisManagerStatefState
 
G4int fFirstId
 
G4bool fLockFirstId
 

Detailed Description

Definition at line 46 of file G4CsvNtupleManager.hh.

Constructor & Destructor Documentation

G4CsvNtupleManager::G4CsvNtupleManager ( const G4AnalysisManagerState state)
protected

Definition at line 38 of file G4CsvNtupleManager.cc.

39  : G4VNtupleManager(state),
40  fFileManager(0),
41  fNtupleVector()
42 {
43 }
G4VNtupleManager(const G4AnalysisManagerState &state)
G4CsvNtupleManager::~G4CsvNtupleManager ( )
protected

Definition at line 46 of file G4CsvNtupleManager.cc.

47 {
48  std::vector<G4CsvNtupleDescription*>::iterator it;
49  for (it = fNtupleVector.begin(); it != fNtupleVector.end(); it++ ) {
50  delete (*it);
51  }
52 }

Member Function Documentation

G4bool G4CsvNtupleManager::AddNtupleRow ( )
protectedvirtual

Implements G4VNtupleManager.

Definition at line 503 of file G4CsvNtupleManager.cc.

504 {
505  return AddNtupleRow(fFirstId);
506 }
virtual G4bool AddNtupleRow()
G4bool G4CsvNtupleManager::AddNtupleRow ( G4int  ntupleId)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 589 of file G4CsvNtupleManager.cc.

References G4CsvNtupleDescription::fNtuple, G4BaseAnalysisManager::fState, G4Exception(), G4AnalysisManagerState::GetVerboseL4(), JustWarning, and G4AnalysisVerbose::Message().

590 {
591 #ifdef G4VERBOSE
592  if ( fState.GetVerboseL4() ) {
593  G4ExceptionDescription description;
594  description << " ntupleId " << ntupleId;
595  fState.GetVerboseL4()->Message("add", "ntuple row", description);
596  }
597 #endif
598 
599  G4CsvNtupleDescription* ntupleDescription
600  = GetNtupleInFunction(ntupleId, "AddNtupleRow");
601 
602  if ( ! ntupleDescription || ! ntupleDescription->fNtuple ) {
603  G4ExceptionDescription description;
604  description << " " << "ntuple does not exist. ";
605  G4Exception("G4CsvNtupleManager::AddNtupleRow()",
606  "Analysis_W008", JustWarning, description);
607  return false;
608  }
609 
610  ntupleDescription->fNtuple->add_row();
611 #ifdef G4VERBOSE
612  if ( fState.GetVerboseL4() ) {
613  G4ExceptionDescription description;
614  description << " ntupleId " << ntupleId;
615  fState.GetVerboseL4()->Message("add", "ntuple row", description);
616  }
617 #endif
618 
619  return true;
620 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
tools::wcsv::ntuple * fNtuple
const G4AnalysisManagerState & fState
G4int G4CsvNtupleManager::CreateNtuple ( const G4String name,
const G4String title 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 261 of file G4CsvNtupleManager.cc.

References G4CsvFileManager::CreateNtupleFile(), G4CsvNtupleDescription::fFile, G4BaseAnalysisManager::fFirstId, G4BaseAnalysisManager::fLockFirstId, G4CsvNtupleDescription::fNtuple, G4CsvNtupleDescription::fNtupleBooking, G4BaseAnalysisManager::fState, G4VFileManager::GetFileName(), G4AnalysisManagerState::GetVerboseL2(), G4AnalysisManagerState::GetVerboseL4(), G4AnalysisVerbose::Message(), and title().

263 {
264 #ifdef G4VERBOSE
265  if ( fState.GetVerboseL4() )
266  fState.GetVerboseL4()->Message("create", "ntuple", name);
267 #endif
268 
269  // Create ntuple description
270  G4int index = fNtupleVector.size();
271  G4CsvNtupleDescription* ntupleDescription
272  = new G4CsvNtupleDescription();
273  fNtupleVector.push_back(ntupleDescription);
274 
275  // Create ntuple booking
276  ntupleDescription->fNtupleBooking = new tools::ntuple_booking();
277  ntupleDescription->fNtupleBooking->m_name = name;
278  ntupleDescription->fNtupleBooking->m_title = title;
279  // ntuple booking object is deleted in destructor
280 
281  // Create ntuple if the file is open (what means here that
282  // a filename was already set)
283  if ( fFileManager->GetFileName().size() ) {
284  if ( fFileManager->CreateNtupleFile(ntupleDescription) ) {
285  ntupleDescription->fNtuple
286  = new tools::wcsv::ntuple(*(ntupleDescription->fFile));
287  // ntuple object is deleted when closing a file
288  }
289  }
290 
291  fLockFirstId = true;
292 
293 #ifdef G4VERBOSE
294  if ( fState.GetVerboseL2() ) {
295  G4ExceptionDescription description;
296  description << name << " ntupleId " << index + fFirstId;
297  fState.GetVerboseL2()->Message("create", "ntuple", description);
298  }
299 #endif
300 
301  return index + fFirstId;
302 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const XML_Char * name
int G4int
Definition: G4Types.hh:78
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
G4String GetFileName() const
tools::ntuple_booking * fNtupleBooking
G4bool CreateNtupleFile(G4CsvNtupleDescription *ntupleDescription)
subroutine title(NA, NB, NCA, NCB)
Definition: dpm25nuc7.f:1744
tools::wcsv::ntuple * fNtuple
const G4AnalysisManagerState & fState
G4int G4CsvNtupleManager::CreateNtupleDColumn ( const G4String name)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 319 of file G4CsvNtupleManager.cc.

320 {
321  G4int ntupleId = fNtupleVector.size() + fFirstId - 1;
322  return CreateNtupleDColumn(ntupleId, name);
323 }
int G4int
Definition: G4Types.hh:78
virtual G4int CreateNtupleDColumn(const G4String &name)
G4int G4CsvNtupleManager::CreateNtupleDColumn ( G4int  ntupleId,
const G4String name 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 430 of file G4CsvNtupleManager.cc.

References G4VNtupleManager::fFirstNtupleColumnId, G4VNtupleManager::fLockFirstNtupleColumnId, G4CsvNtupleDescription::fNtuple, G4CsvNtupleDescription::fNtupleBooking, G4CsvNtupleDescription::fNtupleDColumnMap, G4BaseAnalysisManager::fState, G4Exception(), G4AnalysisManagerState::GetVerboseL2(), G4AnalysisManagerState::GetVerboseL4(), JustWarning, and G4AnalysisVerbose::Message().

431 {
432 #ifdef G4VERBOSE
433  if ( fState.GetVerboseL4() ) {
434  G4ExceptionDescription description;
435  description << name << " ntupleId " << ntupleId;
436  fState.GetVerboseL4()->Message("create", "ntuple D column", description);
437  }
438 #endif
439 
440  G4CsvNtupleDescription* ntupleDescription
441  = GetNtupleInFunction(ntupleId, "CreateNtupleDColumn");
442  tools::ntuple_booking* ntupleBooking
443  = ntupleDescription->fNtupleBooking;
444 
445  if ( ! ntupleBooking ) {
446  G4ExceptionDescription description;
447  description << " "
448  << "Ntuple " << ntupleId << " has to be created first. ";
449  G4Exception("G4CsvNtupleManager::CreateNtupleDColumn()",
450  "Analysis_W005", JustWarning, description);
451  return -1;
452  }
453 
454  // Save column info in booking
455  G4int index = ntupleBooking->m_columns.size();
456  ntupleBooking->add_column<double>(name);
457 
458  // Create column if ntuple already exists
459  if ( ntupleDescription->fNtuple ) {
460  tools::wcsv::ntuple::column<double>* column
461  = ntupleDescription->fNtuple->create_column<double>(name);
462  ntupleDescription->fNtupleDColumnMap[index] = column;
463  }
464 
466 
467 #ifdef G4VERBOSE
468  if ( fState.GetVerboseL2() ) {
469  G4ExceptionDescription description;
470  description << name << " ntupleId " << ntupleId;
471  fState.GetVerboseL2()->Message("create", "ntuple D column", description);
472  }
473 #endif
474 
475  return index + fFirstNtupleColumnId;
476 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const XML_Char * name
int G4int
Definition: G4Types.hh:78
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_booking * fNtupleBooking
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
tools::wcsv::ntuple * fNtuple
std::map< G4int, tools::wcsv::ntuple::column< double > * > fNtupleDColumnMap
G4bool fLockFirstNtupleColumnId
const G4AnalysisManagerState & fState
G4int G4CsvNtupleManager::CreateNtupleFColumn ( const G4String name)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 312 of file G4CsvNtupleManager.cc.

313 {
314  G4int ntupleId = fNtupleVector.size() + fFirstId - 1;
315  return CreateNtupleFColumn(ntupleId, name);
316 }
int G4int
Definition: G4Types.hh:78
virtual G4int CreateNtupleFColumn(const G4String &name)
G4int G4CsvNtupleManager::CreateNtupleFColumn ( G4int  ntupleId,
const G4String name 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 381 of file G4CsvNtupleManager.cc.

References G4VNtupleManager::fFirstNtupleColumnId, G4VNtupleManager::fLockFirstNtupleColumnId, G4CsvNtupleDescription::fNtuple, G4CsvNtupleDescription::fNtupleBooking, G4CsvNtupleDescription::fNtupleFColumnMap, G4BaseAnalysisManager::fState, G4Exception(), G4AnalysisManagerState::GetVerboseL2(), G4AnalysisManagerState::GetVerboseL4(), JustWarning, and G4AnalysisVerbose::Message().

382 {
383 #ifdef G4VERBOSE
384  if ( fState.GetVerboseL4() ) {
385  G4ExceptionDescription description;
386  description << name << " ntupleId " << ntupleId;
387  fState.GetVerboseL4()->Message("create", "ntuple F column", description);
388  }
389 #endif
390 
391  G4CsvNtupleDescription* ntupleDescription
392  = GetNtupleInFunction(ntupleId, "CreateNtupleFColumn");
393  tools::ntuple_booking* ntupleBooking
394  = ntupleDescription->fNtupleBooking;
395 
396  if ( ! ntupleBooking ) {
397  G4ExceptionDescription description;
398  description << " "
399  << "Ntuple " << ntupleId << " has to be created first. ";
400  G4Exception("G4CsvNtupleManager::CreateNtupleFColumn()",
401  "Analysis_W005", JustWarning, description);
402  return -1;
403  }
404 
405  // Save column info in booking
406  G4int index = ntupleBooking->m_columns.size();
407  ntupleBooking->add_column<float>(name);
408 
409  // Create column if ntuple already exists
410  if ( ntupleDescription->fNtuple ) {
411  tools::wcsv::ntuple::column<float>* column
412  = ntupleDescription->fNtuple->create_column<float>(name);
413  ntupleDescription->fNtupleFColumnMap[index] = column;
414  }
415 
417 
418 #ifdef G4VERBOSE
419  if ( fState.GetVerboseL2() ) {
420  G4ExceptionDescription description;
421  description << name << " ntupleId " << ntupleId;
422  fState.GetVerboseL2()->Message("create", "ntuple F column", description);
423  }
424 #endif
425 
426  return index + fFirstNtupleColumnId;
427 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const XML_Char * name
int G4int
Definition: G4Types.hh:78
const G4AnalysisVerbose * GetVerboseL2() const
std::map< G4int, tools::wcsv::ntuple::column< float > * > fNtupleFColumnMap
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_booking * fNtupleBooking
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
tools::wcsv::ntuple * fNtuple
G4bool fLockFirstNtupleColumnId
const G4AnalysisManagerState & fState
G4int G4CsvNtupleManager::CreateNtupleIColumn ( const G4String name)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 305 of file G4CsvNtupleManager.cc.

306 {
307  G4int ntupleId = fNtupleVector.size() + fFirstId - 1;
308  return CreateNtupleIColumn(ntupleId, name);
309 }
int G4int
Definition: G4Types.hh:78
virtual G4int CreateNtupleIColumn(const G4String &name)
G4int G4CsvNtupleManager::CreateNtupleIColumn ( G4int  ntupleId,
const G4String name 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 332 of file G4CsvNtupleManager.cc.

References G4VNtupleManager::fFirstNtupleColumnId, G4VNtupleManager::fLockFirstNtupleColumnId, G4CsvNtupleDescription::fNtuple, G4CsvNtupleDescription::fNtupleBooking, G4CsvNtupleDescription::fNtupleIColumnMap, G4BaseAnalysisManager::fState, G4Exception(), G4AnalysisManagerState::GetVerboseL2(), G4AnalysisManagerState::GetVerboseL4(), JustWarning, and G4AnalysisVerbose::Message().

333 {
334 #ifdef G4VERBOSE
335  if ( fState.GetVerboseL4() ) {
336  G4ExceptionDescription description;
337  description << name << " ntupleId " << ntupleId;
338  fState.GetVerboseL4()->Message("create", "ntuple I column", description);
339  }
340 #endif
341 
342  G4CsvNtupleDescription* ntupleDescription
343  = GetNtupleInFunction(ntupleId, "CreateNtupleIColumn");
344  tools::ntuple_booking* ntupleBooking
345  = ntupleDescription->fNtupleBooking;
346 
347  if ( ! ntupleBooking ) {
348  G4ExceptionDescription description;
349  description << " "
350  << "Ntuple " << ntupleId << " has to be created first. ";
351  G4Exception("G4CsvNtupleManager::CreateNtupleIColumn()",
352  "Analysis_W005", JustWarning, description);
353  return -1;
354  }
355 
356  // Save column info in booking
357  G4int index = ntupleBooking->m_columns.size();
358  ntupleBooking->add_column<int>(name);
359 
360  // Create column if ntuple already exists
361  if ( ntupleDescription->fNtuple ) {
362  tools::wcsv::ntuple::column<int>* column
363  = ntupleDescription->fNtuple->create_column<int>(name);
364  ntupleDescription->fNtupleIColumnMap[index] = column;
365  }
366 
368 
369 #ifdef G4VERBOSE
370  if ( fState.GetVerboseL2() ) {
371  G4ExceptionDescription description;
372  description << name << " ntupleId " << ntupleId;
373  fState.GetVerboseL2()->Message("create", "ntuple I column", description);
374  }
375 #endif
376 
377  return index + fFirstNtupleColumnId;
378 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const XML_Char * name
int G4int
Definition: G4Types.hh:78
const G4AnalysisVerbose * GetVerboseL2() const
const G4AnalysisVerbose * GetVerboseL4() const
tools::ntuple_booking * fNtupleBooking
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
tools::wcsv::ntuple * fNtuple
G4bool fLockFirstNtupleColumnId
std::map< G4int, tools::wcsv::ntuple::column< int > * > fNtupleIColumnMap
const G4AnalysisManagerState & fState
void G4CsvNtupleManager::CreateNtuplesFromBooking ( )
protected

Definition at line 165 of file G4CsvNtupleManager.cc.

References G4CsvFileManager::CreateNtupleFile(), G4BaseAnalysisManager::fState, G4cerr, G4Exception(), G4AnalysisManagerState::GetIsMaster(), G4AnalysisManagerState::GetVerboseL3(), G4AnalysisManagerState::GetVerboseL4(), G4AnalysisManagerState::IsMT(), JustWarning, and G4AnalysisVerbose::Message().

Referenced by G4CsvAnalysisManager::OpenFileImpl().

166 {
167 // Create ntuple from ntuple_booking.
168 
169  // Do not create ntuples on master thread
170  if ( G4AnalysisManagerState::IsMT() && fState.GetIsMaster() ) return;
171 
172  std::vector<G4CsvNtupleDescription*>::iterator itn;
173  for (itn = fNtupleVector.begin(); itn != fNtupleVector.end(); itn++ ) {
174 
175  tools::ntuple_booking* ntupleBooking = (*itn)->fNtupleBooking;
176  if ( ! ntupleBooking ) continue;
177 
178 #ifdef G4VERBOSE
179  if ( fState.GetVerboseL4() )
181  ->Message("create from booking", "ntuple", ntupleBooking->m_name);
182 #endif
183 
184  // create a file for this ntuple
185  if ( ! fFileManager->CreateNtupleFile((*itn)) ) continue;
186 
187  // create ntuple
188  (*itn)->fNtuple
189  = new tools::wcsv::ntuple(*((*itn)->fFile), G4cerr, *ntupleBooking);
190 
191  if ( ntupleBooking->m_columns.size() ) {
192  // store ntuple columns in local maps
193  const std::vector<tools::ntuple_booking::col_t>& columns
194  = ntupleBooking->m_columns;
195  std::vector<tools::ntuple_booking::col_t>::const_iterator it;
196  G4int index = 0;
197  for ( it = columns.begin(); it!=columns.end(); ++it) {
198  if ( (*it).second == tools::_cid(int(0) ) ) {
199  (*itn)->fNtupleIColumnMap[index++]
200  = (*itn)->fNtuple->find_column<int>((*it).first);
201  }
202  else if ( (*it).second == tools::_cid(float(0) ) ) {
203  (*itn)->fNtupleFColumnMap[index++]
204  = (*itn)->fNtuple->find_column<float>((*it).first);
205  }
206  else if ( (*it).second== tools::_cid(double(0))) {
207  (*itn)->fNtupleDColumnMap[index++]
208  = (*itn)->fNtuple->find_column<double>((*it).first);
209  }
210  else {
211  G4ExceptionDescription description;
212  description << " "
213  << "Unsupported column type " << (*it).first;
214  G4Exception("G4CsvNtupleManager::CreateNtupleFromBooking()",
215  "Analysis_W004", JustWarning, description);
216  }
217  }
218  }
219 #ifdef G4VERBOSE
220  if ( fState.GetVerboseL3() )
222  ->Message("create from booking", "ntuple", ntupleBooking->m_name);
223 #endif
224  }
225 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
int G4int
Definition: G4Types.hh:78
const G4AnalysisVerbose * GetVerboseL3() const
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool CreateNtupleFile(G4CsvNtupleDescription *ntupleDescription)
const G4AnalysisManagerState & fState
G4GLOB_DLL std::ostream G4cerr
G4bool G4CsvNtupleManager::FillNtupleDColumn ( G4int  columnId,
G4double  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 497 of file G4CsvNtupleManager.cc.

498 {
499  return FillNtupleDColumn(fFirstId, columnId, value);
500 }
const XML_Char int const XML_Char * value
virtual G4bool FillNtupleDColumn(G4int columnId, G4double value)
G4bool G4CsvNtupleManager::FillNtupleDColumn ( G4int  ntupleId,
G4int  columnId,
G4double  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 562 of file G4CsvNtupleManager.cc.

References G4BaseAnalysisManager::fState, G4Exception(), G4AnalysisManagerState::GetVerboseL4(), JustWarning, and G4AnalysisVerbose::Message().

564 {
565  tools::wcsv::ntuple::column<double>* column
566  = GetNtupleDColumn(ntupleId, columnId);
567  if ( ! column ) {
568  G4ExceptionDescription description;
569  description << " " << "ntupleId " << ntupleId
570  << "column " << columnId << " does not exist.";
571  G4Exception("G4CsvNtupleManager::FillNtupleDColumn()",
572  "Analysis_W009", JustWarning, description);
573  return false;
574  }
575 
576  column->fill(value);
577 #ifdef G4VERBOSE
578  if ( fState.GetVerboseL4() ) {
579  G4ExceptionDescription description;
580  description << " ntupleId " << ntupleId
581  << " columnId " << columnId << " value " << value;
582  fState.GetVerboseL4()->Message("fill", "ntuple D column", description);
583  }
584 #endif
585  return true;
586 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const XML_Char int const XML_Char * value
const G4AnalysisManagerState & fState
G4bool G4CsvNtupleManager::FillNtupleFColumn ( G4int  columnId,
G4float  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 491 of file G4CsvNtupleManager.cc.

492 {
493  return FillNtupleFColumn(fFirstId, columnId, value);
494 }
virtual G4bool FillNtupleFColumn(G4int columnId, G4float value)
const XML_Char int const XML_Char * value
G4bool G4CsvNtupleManager::FillNtupleFColumn ( G4int  ntupleId,
G4int  columnId,
G4float  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 535 of file G4CsvNtupleManager.cc.

References G4BaseAnalysisManager::fState, G4Exception(), G4AnalysisManagerState::GetVerboseL4(), JustWarning, and G4AnalysisVerbose::Message().

537 {
538  tools::wcsv::ntuple::column<float>* column
539  = GetNtupleFColumn(ntupleId, columnId);
540  if ( ! column ) {
541  G4ExceptionDescription description;
542  description << " " << "ntupleId " << ntupleId
543  << "column " << columnId << " does not exist.";
544  G4Exception("G4CsvNtupleManager::FillNtupleFColumn()",
545  "Analysis_W009", JustWarning, description);
546  return false;
547  }
548 
549  column->fill(value);
550 #ifdef G4VERBOSE
551  if ( fState.GetVerboseL4() ) {
552  G4ExceptionDescription description;
553  description << " ntupleId " << ntupleId
554  << " columnId " << columnId << " value " << value;
555  fState.GetVerboseL4()->Message("fill", "ntuple F column", description);
556  }
557 #endif
558  return true;
559 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const XML_Char int const XML_Char * value
const G4AnalysisManagerState & fState
G4bool G4CsvNtupleManager::FillNtupleIColumn ( G4int  columnId,
G4int  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 485 of file G4CsvNtupleManager.cc.

486 {
487  return FillNtupleIColumn(fFirstId, columnId, value);
488 }
virtual G4bool FillNtupleIColumn(G4int columnId, G4int value)
const XML_Char int const XML_Char * value
G4bool G4CsvNtupleManager::FillNtupleIColumn ( G4int  ntupleId,
G4int  columnId,
G4int  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 509 of file G4CsvNtupleManager.cc.

References G4BaseAnalysisManager::fState, G4Exception(), G4AnalysisManagerState::GetVerboseL4(), JustWarning, and G4AnalysisVerbose::Message().

511 {
512  tools::wcsv::ntuple::column<int>* column
513  = GetNtupleIColumn(ntupleId, columnId);
514  if ( ! column ) {
515  G4ExceptionDescription description;
516  description << " " << "ntupleId " << ntupleId
517  << "column " << columnId << " does not exist.";
518  G4Exception("G4CsvNtupleManager::FillNtupleIColumn()",
519  "Analysis_W009", JustWarning, description);
520  return false;
521  }
522 
523  column->fill(value);
524 #ifdef G4VERBOSE
525  if ( fState.GetVerboseL4() ) {
526  G4ExceptionDescription description;
527  description << " ntupleId " << ntupleId
528  << " columnId " << columnId << " value " << value;
529  fState.GetVerboseL4()->Message("fill", "ntuple I column", description);
530  }
531 #endif
532  return true;
533 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4AnalysisVerbose * GetVerboseL4() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const XML_Char int const XML_Char * value
const G4AnalysisManagerState & fState
void G4CsvNtupleManager::FinishNtuple ( )
protectedvirtual

Implements G4VNtupleManager.

Definition at line 326 of file G4CsvNtupleManager.cc.

327 {
328  // nothing to be done here
329 }
void G4CsvNtupleManager::FinishNtuple ( G4int  ntupleId)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 479 of file G4CsvNtupleManager.cc.

480 {
481  // nothing to be done here
482 }
G4int G4CsvNtupleManager::GetNofNtuples ( ) const
inlineprotectedvirtual

Implements G4VNtupleManager.

Definition at line 129 of file G4CsvNtupleManager.hh.

130 { return fNtupleVector.size(); }
tools::wcsv::ntuple * G4CsvNtupleManager::GetNtuple ( ) const
protected

Definition at line 246 of file G4CsvNtupleManager.cc.

247 {
248  return GetNtuple(fFirstId);
249 }
tools::wcsv::ntuple * GetNtuple() const
tools::wcsv::ntuple * G4CsvNtupleManager::GetNtuple ( G4int  ntupleId) const
protected

Definition at line 252 of file G4CsvNtupleManager.cc.

References G4CsvNtupleDescription::fNtuple.

253 {
254  G4CsvNtupleDescription* ntupleDescription
255  = GetNtupleInFunction(ntupleId, "GetNtuple");
256 
257  return ntupleDescription->fNtuple;
258 }
tools::wcsv::ntuple * fNtuple
const std::vector< G4CsvNtupleDescription * > & G4CsvNtupleManager::GetNtupleVector ( ) const
inlineprotected

Definition at line 132 of file G4CsvNtupleManager.hh.

133 { return fNtupleVector; }
G4bool G4CsvNtupleManager::IsEmpty ( ) const
protected

Definition at line 228 of file G4CsvNtupleManager.cc.

229 {
230  return ! fNtupleVector.size();
231 }
G4bool G4CsvNtupleManager::Reset ( )
protected

Definition at line 234 of file G4CsvNtupleManager.cc.

Referenced by G4CsvAnalysisManager::CloseFileImpl().

235 {
236  std::vector<G4CsvNtupleDescription*>::iterator it;
237  for (it = fNtupleVector.begin(); it != fNtupleVector.end(); it++ ) {
238  delete (*it)->fNtuple;
239  (*it)->fNtuple = 0;
240  }
241 
242  return true;
243 }
void G4CsvNtupleManager::SetFileManager ( G4CsvFileManager fileManager)
inlineprotected

Definition at line 126 of file G4CsvNtupleManager.hh.

Referenced by G4CsvAnalysisManager::G4CsvAnalysisManager().

127 { fFileManager = fileManager; }

Friends And Related Function Documentation

friend class G4CsvAnalysisManager
friend

Definition at line 48 of file G4CsvNtupleManager.hh.


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