34 #include "tools/wroot/file" 
   47   std::vector<G4RootNtupleDescription*>::iterator it;  
 
   58 tools::wroot::ntuple::column<int>*    
 
   63   if ( ! ntupleDecription ) 
return 0;
 
   65   std::map<G4int, tools::wroot::ntuple::column<int>* >& ntupleIColumnMap
 
   67   std::map<G4int, tools::wroot::ntuple::column<int>* >::const_iterator it
 
   68     = ntupleIColumnMap.find(columnId);
 
   70   if ( it == ntupleIColumnMap.end() ) {
 
   72     description << 
"      "  << 
"ntupleId " << ntupleId
 
   73                 << 
"column " << columnId << 
" does not exist.";
 
   74     G4Exception(
"G4RootNtupleManager::GetNtupleIColumn()",
 
   83 tools::wroot::ntuple::column<float>*  
 
   88   if ( ! ntupleDecription ) 
return 0;
 
   90   std::map<G4int, tools::wroot::ntuple::column<float>* >& ntupleFColumnMap
 
   92   std::map<G4int, tools::wroot::ntuple::column<float>* >::const_iterator it
 
   93     = ntupleFColumnMap.find(columnId);
 
   95   if ( it == ntupleFColumnMap.end() ) {
 
   97     description << 
"      "  << 
"ntupleId " << ntupleId
 
   98                 << 
"column " << columnId << 
" does not exist.";
 
   99     G4Exception(
"G4RootNtupleManager::GetNtupleFColumn()",
 
  109 tools::wroot::ntuple::column<double>* 
 
  114   if ( ! ntupleDecription ) 
return 0;
 
  116   std::map<G4int, tools::wroot::ntuple::column<double>* >& ntupleDColumnMap
 
  118   std::map<G4int, tools::wroot::ntuple::column<double>* >::const_iterator it
 
  119     = ntupleDColumnMap.find(columnId);
 
  121   if ( it == ntupleDColumnMap.end() ) {
 
  123     description << 
"      "  << 
"ntupleId " << ntupleId
 
  124                 << 
"column " << columnId << 
" does not exist.";
 
  125     G4Exception(
"G4RootNtupleManager::GetNtupleDColumn()",
 
  141       G4String inFunction = 
"G4RootNtupleManager::";
 
  142       inFunction += functionName;
 
  144       description << 
"      " << 
"ntuple " << 
id << 
" does not exist.";
 
  164   std::vector<G4RootNtupleDescription*>::iterator itn;  
 
  167     tools::ntuple_booking* ntupleBooking = (*itn)->fNtupleBooking;
 
  168     if ( ! ntupleBooking ) 
continue;
 
  173         ->
Message(
"create from booking", 
"ntuple", ntupleBooking->m_name);
 
  179     if ( ntupleBooking->m_columns.size() ) {
 
  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;
 
  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);
 
  190         else if ( (*it).second == tools::_cid(
float(0) ) ) {
 
  191           (*itn)->fNtupleFColumnMap[index++] 
 
  192             = (*itn)->fNtuple->find_column<
float>((*it).first);
 
  194         else if ( (*it).second== tools::_cid(
double(0))) {
 
  195           (*itn)->fNtupleDColumnMap[index++] 
 
  196             = (*itn)->fNtuple->find_column<
double>((*it).first);
 
  201                       << 
"Unsupported column type " << (*it).first;
 
  202           G4Exception(
"G4RootNtupleManager::CreateNtupleFromBooking()",
 
  210         ->
Message(
"create from booking", 
"ntuple", ntupleBooking->m_name);
 
  226   std::vector<G4RootNtupleDescription*>::iterator it;  
 
  248   return ntupleDescription->
fNtuple;  
 
  284     description << name << 
" ntupleId " << index + 
fFirstId;
 
  326     description << name << 
" ntupleId " << ntupleId; 
 
  333   tools::ntuple_booking* ntupleBooking
 
  336   if ( ! ntupleBooking ) {
 
  339                 << 
"Ntuple " << ntupleId << 
" has to be created first. ";
 
  340     G4Exception(
"G4RootNtupleManager::CreateNtupleIColumn()",
 
  346   G4int index = ntupleBooking->m_columns.size();
 
  347   ntupleBooking->add_column<
int>(
name);  
 
  350   if ( ntupleDescription->
fNtuple ) {
 
  351     tools::wroot::ntuple::column<int>* column 
 
  352       = ntupleDescription->
fNtuple->create_column<
int>(
name);  
 
  361     description << name << 
" ntupleId " << ntupleId; 
 
  375     description << name << 
" ntupleId " << ntupleId; 
 
  382   tools::ntuple_booking* ntupleBooking
 
  385   if ( ! ntupleBooking ) {
 
  388                 << 
"Ntuple " << ntupleId << 
" has to be created first. ";
 
  389     G4Exception(
"G4RootNtupleManager::CreateNtupleFColumn()",
 
  395   G4int index = ntupleBooking->m_columns.size();
 
  396   ntupleBooking->add_column<
float>(
name);  
 
  399   if ( ntupleDescription->
fNtuple ) {
 
  400     tools::wroot::ntuple::column<float>* column 
 
  401       = ntupleDescription->
fNtuple->create_column<
float>(
name);  
 
  410     description << name << 
" ntupleId " << ntupleId; 
 
  425     description << name << 
" ntupleId " << ntupleId; 
 
  432   tools::ntuple_booking* ntupleBooking
 
  435   if ( ! ntupleBooking ) {
 
  438                 << 
"Ntuple " << ntupleId << 
" has to be created first. ";
 
  439     G4Exception(
"G4RootNtupleManager::CreateNtupleDColumn()",
 
  445   G4int index = ntupleBooking->m_columns.size();
 
  446   ntupleBooking->add_column<
double>(
name);  
 
  449   if ( ntupleDescription->
fNtuple ) {
 
  450     tools::wroot::ntuple::column<double>* column 
 
  451       = ntupleDescription->
fNtuple->create_column<
double>(
name);  
 
  460     description << name << 
" ntupleId " << ntupleId; 
 
  502   tools::wroot::ntuple::column<int>* column 
 
  506     description << 
"      " << 
"ntupleId " <<  ntupleId
 
  507                 << 
"column " << columnId << 
" does not exist.";
 
  508     G4Exception(
"G4RootNtupleManager::FillNtupleIColumn()",
 
  517     description << 
" ntupleId " << ntupleId  
 
  518                 << 
" columnId " << columnId << 
" value " << value;
 
  528   tools::wroot::ntuple::column<float>* column 
 
  532     description << 
"      " << 
"ntupleId " <<  ntupleId
 
  533                 << 
"column " << columnId << 
" does not exist.";
 
  534     G4Exception(
"G4RootNtupleManager::FillNtupleFColumn()",
 
  543     description << 
" ntupleId " << ntupleId  
 
  544                 << 
" columnId " << columnId << 
" value " << value;
 
  554   tools::wroot::ntuple::column<double>* column 
 
  558     description << 
"      " << 
"ntupleId " <<  ntupleId
 
  559                 << 
"column " << columnId << 
" does not exist.";
 
  560     G4Exception(
"G4RootNtupleManager::FillNtupleDColumn()",
 
  569     description << 
" ntupleId " << ntupleId  
 
  570                 << 
" columnId " << columnId << 
" value " << value;
 
  583     description << 
" ntupleId " << ntupleId;  
 
  591   if ( ! ntupleDescription || ! ntupleDescription->
fNtuple ) {
 
  593     description << 
"      " << 
" ntupleId " << ntupleId 
 
  594                 << 
" does not exist. ";
 
  603     description << 
"      " << 
" ntupleId " << ntupleId 
 
  604                 << 
"adding row has failed.";
 
  611     description << 
" ntupleId " << ntupleId;  
 
tools::wroot::ntuple::column< int > * GetNtupleIColumn(G4int ntupleId, G4int columnId) const 
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const 
virtual G4bool FillNtupleFColumn(G4int columnId, G4float value)
virtual G4int CreateNtupleFColumn(const G4String &name)
std::map< G4int, tools::wroot::ntuple::column< float > * > fNtupleFColumnMap
std::ostringstream G4ExceptionDescription
tools::wroot::directory * fNtupleDirectory
std::map< G4int, tools::wroot::ntuple::column< int > * > fNtupleIColumnMap
virtual G4int CreateNtupleDColumn(const G4String &name)
tools::wroot::ntuple::column< float > * GetNtupleFColumn(G4int ntupleId, G4int columnId) const 
const G4AnalysisVerbose * GetVerboseL2() const 
virtual G4bool FillNtupleIColumn(G4int columnId, G4int value)
void CreateNtuplesFromBooking()
const G4AnalysisVerbose * GetVerboseL3() const 
virtual ~G4RootNtupleManager()
const G4AnalysisVerbose * GetVerboseL4() const 
std::map< G4int, tools::wroot::ntuple::column< double > * > fNtupleDColumnMap
std::vector< G4RootNtupleDescription * > fNtupleVector
virtual void FinishNtuple()
virtual G4RootNtupleDescription * GetNtupleInFunction(G4int id, G4String function, G4bool warn=true, G4bool onlyIfActive=true) const 
tools::wroot::ntuple * GetNtuple() const 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual G4int CreateNtupleIColumn(const G4String &name)
virtual G4bool AddNtupleRow()
tools::wroot::ntuple * fNtuple
tools::ntuple_booking * fNtupleBooking
tools::wroot::ntuple::column< double > * GetNtupleDColumn(G4int ntupleId, G4int columnId) const 
virtual G4int CreateNtuple(const G4String &name, const G4String &title)
G4bool fLockFirstNtupleColumnId
G4int fFirstNtupleColumnId
G4RootNtupleManager(const G4AnalysisManagerState &state)
virtual G4bool FillNtupleDColumn(G4int columnId, G4double value)
const G4AnalysisManagerState & fState