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

#include <G4RootNtupleManager.hh>

Inheritance diagram for G4RootNtupleManager:
G4VNtupleManager G4BaseAnalysisManager

Protected Member Functions

 G4RootNtupleManager (const G4AnalysisManagerState &state)
 
virtual ~G4RootNtupleManager ()
 
void CreateNtuplesFromBooking ()
 
G4bool IsEmpty () const
 
G4bool Reset ()
 
void SetNtupleDirectory (tools::wroot::directory *directory)
 
tools::wroot::ntuple * GetNtuple () const
 
tools::wroot::ntuple * GetNtuple (G4int ntupleId) 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 G4RootAnalysisManager
 

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 51 of file G4RootNtupleManager.hh.

Constructor & Destructor Documentation

G4RootNtupleManager::G4RootNtupleManager ( const G4AnalysisManagerState state)
protected

Definition at line 37 of file G4RootNtupleManager.cc.

38  : G4VNtupleManager(state),
39  fNtupleDirectory(0),
40  fNtupleVector()
41 {
42 }
G4VNtupleManager(const G4AnalysisManagerState &state)
G4RootNtupleManager::~G4RootNtupleManager ( )
protectedvirtual

Definition at line 45 of file G4RootNtupleManager.cc.

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

Member Function Documentation

G4bool G4RootNtupleManager::AddNtupleRow ( )
protectedvirtual

Implements G4VNtupleManager.

Definition at line 493 of file G4RootNtupleManager.cc.

494 {
495  return AddNtupleRow(fFirstId);
496 }
virtual G4bool AddNtupleRow()
G4bool G4RootNtupleManager::AddNtupleRow ( G4int  ntupleId)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 578 of file G4RootNtupleManager.cc.

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

579 {
580 #ifdef G4VERBOSE
581  if ( fState.GetVerboseL4() ) {
582  G4ExceptionDescription description;
583  description << " ntupleId " << ntupleId;
584  fState.GetVerboseL4()->Message("add", "ntuple row", description);
585  }
586 #endif
587 
588  G4RootNtupleDescription* ntupleDescription
589  = GetNtupleInFunction(ntupleId, "AddNtupleRow");
590 
591  if ( ! ntupleDescription || ! ntupleDescription->fNtuple ) {
592  G4ExceptionDescription description;
593  description << " " << " ntupleId " << ntupleId
594  << " does not exist. ";
595  G4Exception("G4RootNtupleManager::AddNtupleRow()",
596  "Analysis_W008", JustWarning, description);
597  return false;
598  }
599 
600  G4bool result = ntupleDescription->fNtuple->add_row();
601  if ( ! result ) {
602  G4ExceptionDescription description;
603  description << " " << " ntupleId " << ntupleId
604  << "adding row has failed.";
605  G4Exception("G4RootNtupleManager::AddNtupleRow()",
606  "Analysis_W004", JustWarning, description);
607  }
608 #ifdef G4VERBOSE
609  if ( fState.GetVerboseL4() ) {
610  G4ExceptionDescription description;
611  description << " ntupleId " << ntupleId;
612  fState.GetVerboseL4()->Message("add", "ntuple row", description, result);
613  }
614 #endif
615 
616  return result;
617 }
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
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
tools::wroot::ntuple * fNtuple
const G4AnalysisManagerState & fState
G4int G4RootNtupleManager::CreateNtuple ( const G4String name,
const G4String title 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 252 of file G4RootNtupleManager.cc.

References G4BaseAnalysisManager::fFirstId, G4BaseAnalysisManager::fLockFirstId, G4RootNtupleDescription::fNtuple, G4RootNtupleDescription::fNtupleBooking, G4BaseAnalysisManager::fState, G4AnalysisManagerState::GetVerboseL2(), G4AnalysisManagerState::GetVerboseL4(), G4AnalysisVerbose::Message(), and title().

254 {
255 #ifdef G4VERBOSE
256  if ( fState.GetVerboseL4() )
257  fState.GetVerboseL4()->Message("create", "ntuple", name);
258 #endif
259 
260  // Create ntuple description
261  G4int index = fNtupleVector.size();
262  G4RootNtupleDescription* ntupleDescription
263  = new G4RootNtupleDescription();
264  fNtupleVector.push_back(ntupleDescription);
265 
266  // Create ntuple booking
267  ntupleDescription->fNtupleBooking = new tools::ntuple_booking();
268  ntupleDescription->fNtupleBooking->m_name = name;
269  ntupleDescription->fNtupleBooking->m_title = title;
270  // ntuple booking object is deleted in destructor
271 
272  // Create ntuple if the file is open
273  if ( fNtupleDirectory ) {
274  ntupleDescription->fNtuple
275  = new tools::wroot::ntuple(*fNtupleDirectory, name, title);
276  // ntuple object is deleted automatically when closing a file
277  }
278 
279  fLockFirstId = true;
280 
281 #ifdef G4VERBOSE
282  if ( fState.GetVerboseL2() ) {
283  G4ExceptionDescription description;
284  description << name << " ntupleId " << index + fFirstId;
285  fState.GetVerboseL2()->Message("create", "ntuple", description);
286  }
287 #endif
288 
289  return index + fFirstId;
290 }
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
subroutine title(NA, NB, NCA, NCB)
Definition: dpm25nuc7.f:1744
tools::wroot::ntuple * fNtuple
tools::ntuple_booking * fNtupleBooking
const G4AnalysisManagerState & fState
G4int G4RootNtupleManager::CreateNtupleDColumn ( const G4String name)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 307 of file G4RootNtupleManager.cc.

308 {
309  G4int ntupleId = fNtupleVector.size() + fFirstId - 1;
310  return CreateNtupleDColumn(ntupleId, name);
311 }
virtual G4int CreateNtupleDColumn(const G4String &name)
int G4int
Definition: G4Types.hh:78
G4int G4RootNtupleManager::CreateNtupleDColumn ( G4int  ntupleId,
const G4String name 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 420 of file G4RootNtupleManager.cc.

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

421 {
422 #ifdef G4VERBOSE
423  if ( fState.GetVerboseL4() ) {
424  G4ExceptionDescription description;
425  description << name << " ntupleId " << ntupleId;
426  fState.GetVerboseL4()->Message("create", "ntuple D column", description);
427  }
428 #endif
429 
430  G4RootNtupleDescription* ntupleDescription
431  = GetNtupleInFunction(ntupleId, "CreateNtupleDColumn");
432  tools::ntuple_booking* ntupleBooking
433  = ntupleDescription->fNtupleBooking;
434 
435  if ( ! ntupleBooking ) {
436  G4ExceptionDescription description;
437  description << " "
438  << "Ntuple " << ntupleId << " has to be created first. ";
439  G4Exception("G4RootNtupleManager::CreateNtupleDColumn()",
440  "Analysis_W005", JustWarning, description);
441  return -1;
442  }
443 
444  // Save column info in booking
445  G4int index = ntupleBooking->m_columns.size();
446  ntupleBooking->add_column<double>(name);
447 
448  // Create column if ntuple already exists
449  if ( ntupleDescription->fNtuple ) {
450  tools::wroot::ntuple::column<double>* column
451  = ntupleDescription->fNtuple->create_column<double>(name);
452  ntupleDescription->fNtupleDColumnMap[index] = column;
453  }
454 
456 
457 #ifdef G4VERBOSE
458  if ( fState.GetVerboseL2() ) {
459  G4ExceptionDescription description;
460  description << name << " ntupleId " << ntupleId;
461  fState.GetVerboseL2()->Message("create", "ntuple D column", description);
462  }
463 #endif
464 
465  return index + fFirstNtupleColumnId;
466 }
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
std::map< G4int, tools::wroot::ntuple::column< double > * > fNtupleDColumnMap
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
tools::wroot::ntuple * fNtuple
tools::ntuple_booking * fNtupleBooking
G4bool fLockFirstNtupleColumnId
const G4AnalysisManagerState & fState
G4int G4RootNtupleManager::CreateNtupleFColumn ( const G4String name)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 300 of file G4RootNtupleManager.cc.

301 {
302  G4int ntupleId = fNtupleVector.size() + fFirstId - 1;
303  return CreateNtupleFColumn(ntupleId, name);
304 }
virtual G4int CreateNtupleFColumn(const G4String &name)
int G4int
Definition: G4Types.hh:78
G4int G4RootNtupleManager::CreateNtupleFColumn ( G4int  ntupleId,
const G4String name 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 370 of file G4RootNtupleManager.cc.

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

371 {
372 #ifdef G4VERBOSE
373  if ( fState.GetVerboseL4() ) {
374  G4ExceptionDescription description;
375  description << name << " ntupleId " << ntupleId;
376  fState.GetVerboseL4()->Message("create", "ntuple F column", description);
377  }
378 #endif
379 
380  G4RootNtupleDescription* ntupleDescription
381  = GetNtupleInFunction(ntupleId, "CreateNtupleFColumn");
382  tools::ntuple_booking* ntupleBooking
383  = ntupleDescription->fNtupleBooking;
384 
385  if ( ! ntupleBooking ) {
386  G4ExceptionDescription description;
387  description << " "
388  << "Ntuple " << ntupleId << " has to be created first. ";
389  G4Exception("G4RootNtupleManager::CreateNtupleFColumn()",
390  "Analysis_W005", JustWarning, description);
391  return -1;
392  }
393 
394  // Save column info in booking
395  G4int index = ntupleBooking->m_columns.size();
396  ntupleBooking->add_column<float>(name);
397 
398  // Create column if ntuple already exists
399  if ( ntupleDescription->fNtuple ) {
400  tools::wroot::ntuple::column<float>* column
401  = ntupleDescription->fNtuple->create_column<float>(name);
402  ntupleDescription->fNtupleFColumnMap[index] = column;
403  }
404 
406 
407 #ifdef G4VERBOSE
408  if ( fState.GetVerboseL2() ) {
409  G4ExceptionDescription description;
410  description << name << " ntupleId " << ntupleId;
411  fState.GetVerboseL2()->Message("create", "ntuple F column", description);
412  }
413 #endif
414 
415  return index + fFirstNtupleColumnId;
416 }
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::map< G4int, tools::wroot::ntuple::column< float > * > fNtupleFColumnMap
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
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
tools::wroot::ntuple * fNtuple
tools::ntuple_booking * fNtupleBooking
G4bool fLockFirstNtupleColumnId
const G4AnalysisManagerState & fState
G4int G4RootNtupleManager::CreateNtupleIColumn ( const G4String name)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 293 of file G4RootNtupleManager.cc.

294 {
295  G4int ntupleId = fNtupleVector.size() + fFirstId - 1;
296  return CreateNtupleIColumn(ntupleId, name);
297 }
int G4int
Definition: G4Types.hh:78
virtual G4int CreateNtupleIColumn(const G4String &name)
G4int G4RootNtupleManager::CreateNtupleIColumn ( G4int  ntupleId,
const G4String name 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 320 of file G4RootNtupleManager.cc.

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

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

Definition at line 158 of file G4RootNtupleManager.cc.

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

Referenced by G4RootAnalysisManager::OpenFileImpl().

159 {
160 // Create ntuple from ntuple_booking.
161 
162  if ( ! fNtupleVector.size() ) return;
163 
164  std::vector<G4RootNtupleDescription*>::iterator itn;
165  for (itn = fNtupleVector.begin(); itn != fNtupleVector.end(); itn++ ) {
166 
167  tools::ntuple_booking* ntupleBooking = (*itn)->fNtupleBooking;
168  if ( ! ntupleBooking ) continue;
169 
170 #ifdef G4VERBOSE
171  if ( fState.GetVerboseL4() )
173  ->Message("create from booking", "ntuple", ntupleBooking->m_name);
174 #endif
175 
176  (*itn)->fNtuple
177  = new tools::wroot::ntuple(*fNtupleDirectory, *ntupleBooking);
178 
179  if ( ntupleBooking->m_columns.size() ) {
180  // store ntuple columns in local maps
181  const std::vector<tools::ntuple_booking::col_t>& columns
182  = ntupleBooking->m_columns;
183  std::vector<tools::ntuple_booking::col_t>::const_iterator it;
184  G4int index = 0;
185  for ( it = columns.begin(); it!=columns.end(); ++it) {
186  if ( (*it).second == tools::_cid(int(0) ) ) {
187  (*itn)->fNtupleIColumnMap[index++]
188  = (*itn)->fNtuple->find_column<int>((*it).first);
189  }
190  else if ( (*it).second == tools::_cid(float(0) ) ) {
191  (*itn)->fNtupleFColumnMap[index++]
192  = (*itn)->fNtuple->find_column<float>((*it).first);
193  }
194  else if ( (*it).second== tools::_cid(double(0))) {
195  (*itn)->fNtupleDColumnMap[index++]
196  = (*itn)->fNtuple->find_column<double>((*it).first);
197  }
198  else {
199  G4ExceptionDescription description;
200  description << " "
201  << "Unsupported column type " << (*it).first;
202  G4Exception("G4RootNtupleManager::CreateNtupleFromBooking()",
203  "Analysis_W004", JustWarning, description);
204  }
205  }
206  }
207 #ifdef G4VERBOSE
208  if ( fState.GetVerboseL3() )
210  ->Message("create from booking", "ntuple", ntupleBooking->m_name);
211 #endif
212  }
213 }
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
const G4AnalysisManagerState & fState
G4bool G4RootNtupleManager::FillNtupleDColumn ( G4int  columnId,
G4double  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 487 of file G4RootNtupleManager.cc.

488 {
489  return FillNtupleDColumn(fFirstId, columnId, value);
490 }
const XML_Char int const XML_Char * value
virtual G4bool FillNtupleDColumn(G4int columnId, G4double value)
G4bool G4RootNtupleManager::FillNtupleDColumn ( G4int  ntupleId,
G4int  columnId,
G4double  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 551 of file G4RootNtupleManager.cc.

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

553 {
554  tools::wroot::ntuple::column<double>* column
555  = GetNtupleDColumn(ntupleId, columnId);
556  if ( ! column ) {
557  G4ExceptionDescription description;
558  description << " " << "ntupleId " << ntupleId
559  << "column " << columnId << " does not exist.";
560  G4Exception("G4RootNtupleManager::FillNtupleDColumn()",
561  "Analysis_W009", JustWarning, description);
562  return false;
563  }
564 
565  column->fill(value);
566 #ifdef G4VERBOSE
567  if ( fState.GetVerboseL4() ) {
568  G4ExceptionDescription description;
569  description << " ntupleId " << ntupleId
570  << " columnId " << columnId << " value " << value;
571  fState.GetVerboseL4()->Message("fill", "ntuple D column", description);
572  }
573 #endif
574  return true;
575 }
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 G4RootNtupleManager::FillNtupleFColumn ( G4int  columnId,
G4float  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 481 of file G4RootNtupleManager.cc.

482 {
483  return FillNtupleFColumn(fFirstId, columnId, value);
484 }
virtual G4bool FillNtupleFColumn(G4int columnId, G4float value)
const XML_Char int const XML_Char * value
G4bool G4RootNtupleManager::FillNtupleFColumn ( G4int  ntupleId,
G4int  columnId,
G4float  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 525 of file G4RootNtupleManager.cc.

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

527 {
528  tools::wroot::ntuple::column<float>* column
529  = GetNtupleFColumn(ntupleId, columnId);
530  if ( ! column ) {
531  G4ExceptionDescription description;
532  description << " " << "ntupleId " << ntupleId
533  << "column " << columnId << " does not exist.";
534  G4Exception("G4RootNtupleManager::FillNtupleFColumn()",
535  "Analysis_W009", JustWarning, description);
536  return false;
537  }
538 
539  column->fill(value);
540 #ifdef G4VERBOSE
541  if ( fState.GetVerboseL4() ) {
542  G4ExceptionDescription description;
543  description << " ntupleId " << ntupleId
544  << " columnId " << columnId << " value " << value;
545  fState.GetVerboseL4()->Message("fill", "ntuple F column", description);
546  }
547 #endif
548  return true;
549 }
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 G4RootNtupleManager::FillNtupleIColumn ( G4int  columnId,
G4int  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 475 of file G4RootNtupleManager.cc.

476 {
477  return FillNtupleIColumn(fFirstId, columnId, value);
478 }
virtual G4bool FillNtupleIColumn(G4int columnId, G4int value)
const XML_Char int const XML_Char * value
G4bool G4RootNtupleManager::FillNtupleIColumn ( G4int  ntupleId,
G4int  columnId,
G4int  value 
)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 499 of file G4RootNtupleManager.cc.

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

501 {
502  tools::wroot::ntuple::column<int>* column
503  = GetNtupleIColumn(ntupleId, columnId);
504  if ( ! column ) {
505  G4ExceptionDescription description;
506  description << " " << "ntupleId " << ntupleId
507  << "column " << columnId << " does not exist.";
508  G4Exception("G4RootNtupleManager::FillNtupleIColumn()",
509  "Analysis_W009", JustWarning, description);
510  return false;
511  }
512 
513  column->fill(value);
514 #ifdef G4VERBOSE
515  if ( fState.GetVerboseL4() ) {
516  G4ExceptionDescription description;
517  description << " ntupleId " << ntupleId
518  << " columnId " << columnId << " value " << value;
519  fState.GetVerboseL4()->Message("fill", "ntuple I column", description);
520  }
521 #endif
522  return true;
523 }
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 G4RootNtupleManager::FinishNtuple ( )
protectedvirtual

Implements G4VNtupleManager.

Definition at line 314 of file G4RootNtupleManager.cc.

315 {
316  // nothing to be done here
317 }
void G4RootNtupleManager::FinishNtuple ( G4int  ntupleId)
protectedvirtual

Implements G4VNtupleManager.

Definition at line 469 of file G4RootNtupleManager.cc.

470 {
471  // nothing to be done here
472 }
G4int G4RootNtupleManager::GetNofNtuples ( ) const
inlineprotectedvirtual

Implements G4VNtupleManager.

Definition at line 133 of file G4RootNtupleManager.hh.

134 { return fNtupleVector.size(); }
tools::wroot::ntuple * G4RootNtupleManager::GetNtuple ( ) const
protected

Definition at line 237 of file G4RootNtupleManager.cc.

238 {
239  return GetNtuple(fFirstId);
240 }
tools::wroot::ntuple * GetNtuple() const
tools::wroot::ntuple * G4RootNtupleManager::GetNtuple ( G4int  ntupleId) const
protected

Definition at line 243 of file G4RootNtupleManager.cc.

References G4RootNtupleDescription::fNtuple.

244 {
245  G4RootNtupleDescription* ntupleDescription
246  = GetNtupleInFunction(ntupleId, "GetNtuple");
247 
248  return ntupleDescription->fNtuple;
249 }
tools::wroot::ntuple * fNtuple
G4bool G4RootNtupleManager::IsEmpty ( ) const
protected

Definition at line 216 of file G4RootNtupleManager.cc.

Referenced by G4RootAnalysisManager::CloseFileImpl().

217 {
218  return ! fNtupleVector.size();
219 }
G4bool G4RootNtupleManager::Reset ( )
protected

Definition at line 222 of file G4RootNtupleManager.cc.

223 {
224 // Reset ntuples
225 
226  std::vector<G4RootNtupleDescription*>::iterator it;
227  for (it = fNtupleVector.begin(); it != fNtupleVector.end(); it++ ) {
228  // ntuple is deleted automatically when file is closed
229  // delete (*it)->fNtuple;
230  (*it)->fNtuple=0;
231  }
232 
233  return true;
234 }
void G4RootNtupleManager::SetNtupleDirectory ( tools::wroot::directory *  directory)
inlineprotected

Definition at line 128 of file G4RootNtupleManager.hh.

Referenced by G4RootAnalysisManager::OpenFileImpl().

129  {
130  fNtupleDirectory = directory;
131 }

Friends And Related Function Documentation

friend class G4RootAnalysisManager
friend

Definition at line 53 of file G4RootNtupleManager.hh.


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