GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
gSplineAdd.cxx File Reference
#include <cassert>
#include <sstream>
#include <string>
#include <vector>
#include <TSystem.h>
#include "Framework/EventGen/XSecAlgorithmI.h"
#include "Framework/Conventions/XmlParserStatus.h"
#include "Framework/Messenger/Messenger.h"
#include "Framework/Utils/RunOpt.h"
#include "Framework/Utils/AppInit.h"
#include "Framework/Utils/XSecSplineList.h"
#include "Framework/Utils/StringUtils.h"
#include "Framework/Utils/SystemUtils.h"
#include "Framework/Utils/CmdLnArgParser.h"
Include dependency graph for gSplineAdd.cxx:

Go to the source code of this file.

Functions

vector< string > GetAllInputFiles (void)
 
void GetCommandLineArgs (int argc, char **argv)
 
void PrintSyntax (void)
 
int main (int argc, char **argv)
 

Variables

string gOutFile
 output XML file More...
 
vector< string > gInpFiles
 list of input XML files More...
 
vector< string > gInpDirs
 list of input dirs (to look for XML files) More...
 
vector< string > gAllFiles
 list of all input files More...
 

Function Documentation

vector< string > GetAllInputFiles ( void  )

Definition at line 112 of file gSplineAdd.cxx.

References genie::utils::system::GetAllFilesInPath(), gInpDirs, and gInpFiles.

113 {
114  vector<string> files;
115 
116  vector<string>::const_iterator file_iter;
117  vector<string>::const_iterator dir_iter;
118 
119  // add all files that were input explictly
120  file_iter = gInpFiles.begin();
121  for( ; file_iter != gInpFiles.end(); ++file_iter) {
122  string filename = *file_iter;
123  files.push_back(filename);
124  } // file_iter
125 
126  // loop over input directories
127  dir_iter = gInpDirs.begin();
128  for( ; dir_iter != gInpDirs.end(); ++dir_iter) {
129  string path = *dir_iter;
130  // get all XML files in this dir
131  vector<string> path_files = utils::system::GetAllFilesInPath(path,"xml");
132  // add these files too
133  file_iter = path_files.begin();
134  for( ; file_iter != path_files.end(); ++file_iter) {
135  string filename = *file_iter;
136  files.push_back(filename);
137  }//file_iter
138  }//dir_iter
139 
140  return files;
141 }
vector< string > gInpFiles
list of input XML files
Definition: gSplineAdd.cxx:82
vector< string > GetAllFilesInPath(string path, string extension="")
Definition: SystemUtils.cxx:29
vector< string > gInpDirs
list of input dirs (to look for XML files)
Definition: gSplineAdd.cxx:83
void GetCommandLineArgs ( int  argc,
char **  argv 
)
int main ( int  argc,
char **  argv 
)

Definition at line 87 of file gSplineAdd.cxx.

References gAllFiles, GetCommandLineArgs(), gOutFile, genie::RunOpt::Instance(), genie::XSecSplineList::Instance(), genie::kXmlOK, genie::XSecSplineList::LoadFromXml(), LOG, genie::utils::app_init::MesgThresholds(), pDEBUG, pNOTICE, and genie::XSecSplineList::SaveAsXml().

88 {
89  GetCommandLineArgs(argc,argv);
90 
91  utils::app_init::MesgThresholds(RunOpt::Instance()->MesgThresholdFiles());
92 
93  XSecSplineList * xspl = XSecSplineList::Instance();
94 
95  vector<string>::const_iterator file_iter = gAllFiles.begin();
96  for( ; file_iter != gAllFiles.end(); ++file_iter) {
97  string filename = *file_iter;
98  LOG("gspladd", pNOTICE) << " ---- >> Loading file : " << filename;
99  XmlParserStatus_t ist = xspl->LoadFromXml(filename, true);
100  assert(ist==kXmlOK);
101  }
102 
103  LOG("gspladd",pDEBUG) << *xspl ;
104 
105  LOG("gspladd", pNOTICE)
106  << " ****** Saving all loaded splines into : " << gOutFile;
107  xspl->SaveAsXml(gOutFile);
108 
109  return 0;
110 }
vector< string > gAllFiles
list of all input files
Definition: gSplineAdd.cxx:84
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
void SaveAsXml(const string &filename, bool save_init=true) const
void MesgThresholds(string inpfile)
Definition: AppInit.cxx:99
#define pNOTICE
Definition: Messenger.h:61
void GetCommandLineArgs(int argc, char **argv)
Definition: gAtmoEvGen.cxx:563
enum genie::EXmlParseStatus XmlParserStatus_t
List of cross section vs energy splines.
XmlParserStatus_t LoadFromXml(const string &filename, bool keep=false)
string gOutFile
output XML file
Definition: gSplineAdd.cxx:81
#define pDEBUG
Definition: Messenger.h:63
void PrintSyntax ( void  )

Variable Documentation

vector<string> gAllFiles

list of all input files

Definition at line 84 of file gSplineAdd.cxx.

Referenced by main().

vector<string> gInpDirs

list of input dirs (to look for XML files)

Definition at line 83 of file gSplineAdd.cxx.

Referenced by GetAllInputFiles().

vector<string> gInpFiles

list of input XML files

Definition at line 82 of file gSplineAdd.cxx.

Referenced by GetAllInputFiles().

string gOutFile

output XML file

Definition at line 81 of file gSplineAdd.cxx.

Referenced by main().