#include <CmdLine.h>
Public Member Functions | |
| const std::list< std::string > & | InFileList () const |
| const std::list< std::string > & | XMLFileList () const |
| const std::list< std::string > & | XMLDirList () const |
| const std::list< std::string > & | EvtListFiles () const |
| const char * | OutFileName () const |
| const char * | XMLPath () const |
| const char * | HistoFileName () const |
| int | FirstRun () const |
| int | FirstEvent () const |
| int | Nevt () const |
| int | NSkip () const |
| int | NmemReport () const |
| int | SizeLimit () const |
| int | DumpOnException () const |
| void | Usage () const |
| void | Print () const |
| void | SetupIoModule (io::ReadWriteModule &iomod, int *nevent) const |
| void | Parse (int argc, char **argv) |
| void | SetSIGHUP () |
| bool | HaveSIGHUP () |
Static Public Member Functions | |
| CmdLine & | Instance () |
Private Member Functions | |
| CmdLine () | |
Private Attributes | |
| std::list< std::string > | fInFileList |
| Input data files. | |
| std::list< std::string > | fXMLFileList |
| Input XML files. | |
| std::list< std::string > | fXMLDir |
| XML directory to scan. | |
| std::list< std::string > | fEvtList |
| Files containing event lists. | |
| std::string | fXMLPath |
| XML path to search. | |
| std::string | fOutFileName |
| Output data file name. | |
| std::string | fHistoFileName |
| Histogram output file name. | |
| int | fFirstRun |
| First run to process. | |
| int | fFirstEvent |
| First event to process. | |
| int | fNevt |
| Number of events to process. | |
| int | fNskip |
| Number of events to skip. | |
| int | fNmemReport |
| Frequency of memory reporting. | |
| bool | fSIGHUP |
| Has SIGHUP signal been sent? | |
| int | fDumpOnException |
| Dump core on JobCExceptions? | |
| int | fSizeLimit |
| Max output file size. | |
Static Private Attributes | |
| CmdLine * | fInstance = 0 |
Definition at line 16 of file CmdLine.h.
|
|
Definition at line 44 of file CmdLine.cxx. Referenced by Instance().
00044 : 00045 fOutFileName(""), 00046 fFirstRun ( -1 ), 00047 fFirstEvent ( -1 ), 00048 fNevt ( INT_MAX ), 00049 fNskip ( 0 ), 00050 fNmemReport (-1 ), 00051 fSIGHUP (false), 00052 fDumpOnException(0), 00053 fSizeLimit ( 0 ) 00054 { } |
|
|
Definition at line 35 of file CmdLine.h. References fDumpOnException. Referenced by jobc::Job::Run().
00035 { return fDumpOnException; }
|
|
|
Definition at line 23 of file CmdLine.h. References fEvtList. Referenced by SetupIoModule().
00023 {return fEvtList; }
|
|
|
Definition at line 30 of file CmdLine.h. References fFirstEvent. Referenced by SetupIoModule().
00030 { return fFirstEvent; }
|
|
|
Definition at line 29 of file CmdLine.h. References fFirstRun. Referenced by SetupIoModule().
00029 { return fFirstRun; }
|
|
|
Definition at line 46 of file CmdLine.h. References fSIGHUP. Referenced by jobc::Job::Run().
00046 { return fSIGHUP; }
|
|
|
Definition at line 27 of file CmdLine.h. References fHistoFileName.
00027 { return fHistoFileName.c_str(); }
|
|
|
Definition at line 20 of file CmdLine.h. References fInFileList. Referenced by SetupIoModule().
00020 {return fInFileList; }
|
|
|
Definition at line 58 of file CmdLine.cxx. References CmdLine(), and fInstance. Referenced by gsSIGHUPhandler(), and main().
|
|
|
Definition at line 31 of file CmdLine.h. References fNevt. Referenced by SetupIoModule().
00031 { return fNevt; }
|
|
|
Definition at line 33 of file CmdLine.h. References fNmemReport. Referenced by jobc::Job::Run().
00033 { return fNmemReport; }
|
|
|
Definition at line 32 of file CmdLine.h. References fNskip. Referenced by SetupIoModule().
00032 { return fNskip; }
|
|
|
Definition at line 25 of file CmdLine.h. References fOutFileName. Referenced by jobc::Job::Run(), and SetupIoModule().
00025 { return fOutFileName.c_str();}
|
|
||||||||||||
|
Definition at line 66 of file CmdLine.cxx. References fDumpOnException, fEvtList, fFirstEvent, fFirstRun, fHistoFileName, fInFileList, fNevt, fNmemReport, fNskip, fOutFileName, fSizeLimit, fXMLDir, fXMLFileList, fXMLPath, and Usage().
00067 {
00068 static const int kXMLDirOpt = 'd';
00069 static const int kEvtOpt = 'e';
00070 static const int kHFileOpt = 'g';
00071 static const int kHelpOpt = 'h';
00072 static const int kInputOpt = 'i';
00073 static const int kNevtOpt = 'n';
00074 static const int kOutputOpt = 'o';
00075 static const int kXMLPathOpt = 'p';
00076 static const int kRunOpt = 'r';
00077 static const int kNskipOpt = 's';
00078 static const int kXMLOpt = 'x';
00079 static const int kMemReportOpt = 'm';
00080 static const int kEvtListOpt = 'l';
00081 static const int kSizeLimitOpt = 'L';
00082 static const int kCoreDumpOpt = 'D';
00083 static struct option long_options[] = {
00084 {"input", 1, 0, kInputOpt},
00085 {"output", 1, 0, kOutputOpt},
00086 {"help", 0, 0, kHelpOpt},
00087 {"histo", 1, 0, kHFileOpt},
00088 {"nevt", 1, 0, kNevtOpt},
00089 {"nskip", 1, 0, kNskipOpt},
00090 {"run", 1, 0, kRunOpt},
00091 {"evt", 1, 0, kEvtOpt},
00092 {"xml", 1, 0, kXMLOpt},
00093 {"xmlpath", 1, 0, kXMLPathOpt},
00094 {"xmldir", 1, 0, kXMLDirOpt},
00095 {"memory-report",1, 0, kMemReportOpt},
00096 {"event-list", 1, 0, kEvtListOpt},
00097 {"size-limit", 1, 0, kSizeLimitOpt},
00098 {"dump", 1, 0, kCoreDumpOpt},
00099 {0,0,0,0}
00100 };
00101 while (1) {
00102 int c;
00103 int optindx;
00104 c = getopt_long(argc, argv, "hg:i:o:n:s:r:e:x:p:d:m:l:L:D:",
00105 long_options, &optindx);
00106 if (c==-1) break;
00107 switch (c) {
00108 case kInputOpt: fInFileList.push_back(std::string(optarg)); break;
00109 case kOutputOpt: fOutFileName = optarg; break;
00110 case kHelpOpt: this->Usage(); exit(0); break;
00111 case kHFileOpt: fHistoFileName = optarg; break;
00112 case kNevtOpt: fNevt = atoi(optarg); break;
00113 case kNskipOpt: fNskip = atoi(optarg); break;
00114 case kRunOpt: fFirstRun = atoi(optarg); break;
00115 case kEvtOpt: fFirstEvent = atoi(optarg); break;
00116 case kXMLOpt: fXMLFileList.push_back(std::string(optarg)); break;
00117 case kXMLPathOpt: fXMLPath = std::string(optarg); break;
00118 case kXMLDirOpt: fXMLDir.push_back(std::string(optarg)); break;
00119 case kMemReportOpt: fNmemReport = atoi(optarg); break;
00120 case kEvtListOpt: fEvtList.push_back(std::string(optarg)); break;
00121 case kSizeLimitOpt: fSizeLimit = atoi(optarg); break;
00122 case kCoreDumpOpt: fDumpOnException = atoi(optarg) + 1; break;
00123 default:
00124 std::cerr << "Unknown option: " << optind << argv[optind] << std::endl;
00125 this->Usage();
00126 exit(1);
00127 }
00128 }
00129 for (; optind<argc; ++optind) {
00130 fInFileList.push_back(std::string(argv[optind]));
00131 }
00132 };
|
|
|
Definition at line 136 of file CmdLine.cxx. References fFirstEvent, fFirstRun, fInFileList, fNevt, fNmemReport, fNskip, fOutFileName, fXMLDir, fXMLFileList, and fXMLPath.
00137 {
00138 std::cerr <<
00139 "Command line options:" << std::endl <<
00140 " fFirstRun = " << fFirstRun << std::endl <<
00141 " fFirstEvent = " << fFirstEvent << std::endl <<
00142 " fNevt = " << fNevt << std::endl <<
00143 " fNskip = " << fNskip << std::endl <<
00144 " fNmemReport = " << fNmemReport << std::endl;
00145
00146 std::list<std::string>::const_iterator itr;
00147 std::list<std::string>::const_iterator itrEnd;
00148
00149 std::cerr << " Input files = " << std::endl;
00150 itr = fInFileList.begin();
00151 itrEnd = fInFileList.end();
00152 for (; itr!=itrEnd; ++itr) std::cerr << " " << (*itr) << std::endl;
00153
00154 std::cerr << " Output file = " << fOutFileName << std::endl;
00155 std::cerr << " XML path = " << fXMLPath << std::endl;
00156
00157 std::cerr << " XML files = " << std::endl;
00158 itr = fXMLFileList.begin();
00159 itrEnd = fXMLFileList.end();
00160 for (; itr!=itrEnd; ++itr) std::cerr << " " << (*itr) << std::endl;
00161
00162 std::cerr << " XML dirs = " << std::endl;
00163 itr = fXMLDir.begin();
00164 itrEnd = fXMLDir.end();
00165 for (; itr!=itrEnd; ++itr) std::cerr << " " << (*itr) << std::endl;
00166 }
|
|
|
Sets variable which terminates the executable "nicely". If we happen to receive the signal second time around, then we abort. Definition at line 224 of file CmdLine.cxx. References fSIGHUP.
|
|
||||||||||||
|
Definition at line 170 of file CmdLine.cxx. References io::ReadWriteModule::AddFile(), io::ReadWriteModule::AdoptInputFilter(), io::ReadWriteModule::Advance(), EvtListFiles(), FirstEvent(), FirstRun(), fSizeLimit, io::ReadWriteModule::GoTo(), InFileList(), Nevt(), NSkip(), OutFileName(), io::ReadWriteModule::RunNumber(), io::ReadWriteModule::SetOutputFileName(), and io::ReadWriteModule::SetOutSizeLimit(). Referenced by jobc::Job::Run().
00171 {
00172 //======================================================================
00173 // Setup and I/O module give parameters specified on the command line
00174 //======================================================================
00175 const std::list<std::string>& fileList = this->InFileList();
00176 std::list<std::string>::const_iterator itr(fileList.begin());
00177 std::list<std::string>::const_iterator itrEnd(fileList.end());
00178 for (; itr!=itrEnd; ++itr) iomod.AddFile(itr->c_str());
00179
00180 // Set output file limit
00181 iomod.SetOutSizeLimit(fSizeLimit);
00182
00183 // Add input file filters
00184 const std::list<std::string>& evtList = this->EvtListFiles();
00185 itr = evtList.begin();
00186 itrEnd = evtList.end();
00187 for (; itr!=itrEnd; ++itr) {
00188 io::EventFilter* iof = new io::EventFilter();
00189 iof->ReadEventFile(itr->c_str());
00190 iomod.AdoptInputFilter(iof);
00191 }
00192
00193 // Setup the output streams
00194 std::string outfile = this->OutFileName();
00195 if (outfile!="") iomod.SetOutputFileName(outfile.c_str());
00196
00197 int firstRun = this->FirstRun();
00198 int firstEvent = this->FirstEvent();
00199 int nevt = (*nevent);
00200 if (nevt==-1) nevt = this->Nevt(); // Fall back on command line
00201 if (nevt==-1) nevt = INT_MAX; // Then fall back on all events
00202 int nskip = this->NSkip();
00203 if (firstRun>=0) {
00204 if (firstEvent>=0) {
00205 iomod.GoTo(firstRun,firstEvent);
00206 }
00207 else {
00208 iomod.GoTo(firstRun,0);
00209 }
00210 }
00211 else {
00212 if (firstEvent>=0) {
00213 iomod.GoTo(iomod.RunNumber(),firstEvent);
00214 }
00215 }
00216 if (nskip>0) iomod.Advance(nskip);
00217 *nevent = nevt;
00218 }
|
|
|
Definition at line 34 of file CmdLine.h. References fSizeLimit.
00034 { return fSizeLimit; }
|
|
|
Definition at line 20 of file CmdLine.cxx. Referenced by Parse().
00021 {
00022 std::cerr <<
00023 "usage: anamipp [options] file1.root file2.root ...\n" <<
00024 "options are:\n" <<
00025 " -i file.root,--input=file.root : Add input data file\n"
00026 " -o file.root,--output=file.root : Set output data file\n"
00027 " -g file.root,--histo=file.root : Set output histogram file\n"
00028 " -n #, --nevt=# : Set number of events to process\n"
00029 " -s #, --nskip=# : Skip number of events at start\n"
00030 " -r #, --run=# : Skip to run number at start\n"
00031 " -e #, --event=# : Skip to event number at start\n"
00032 " -x #, --xml=file.xml : Parse XML file\n"
00033 " -p #, --xmlpath=dir : Add directory to XML serach path\n"
00034 " -d #, --xmldir=dir : Read all XML files in directory\n"
00035 " -m #, --memory-report=# : Summarize resources used energy n events\n"
00036 " -l file.txt,--evtent-list=file : Read event list from text file\n"
00037 " -L #, --size-limit=# : Largest acceptable file size (in MB)\n"
00038 " -D #, --dumpcore : If 0 stop cleanly, if 1 dump core on assert_jobc's\n";
00039 }
|
|
|
Definition at line 22 of file CmdLine.h. References fXMLDir.
00022 {return fXMLDir; }
|
|
|
Definition at line 21 of file CmdLine.h. References fXMLFileList.
00021 {return fXMLFileList;}
|
|
|
Definition at line 26 of file CmdLine.h. References fXMLPath.
00026 { return fXMLPath.c_str();}
|
|
|
Dump core on JobCExceptions?
Definition at line 67 of file CmdLine.h. Referenced by DumpOnException(), and Parse(). |
|
|
Files containing event lists.
Definition at line 57 of file CmdLine.h. Referenced by EvtListFiles(), and Parse(). |
|
|
First event to process.
Definition at line 62 of file CmdLine.h. Referenced by FirstEvent(), Parse(), and Print(). |
|
|
First run to process.
Definition at line 61 of file CmdLine.h. Referenced by FirstRun(), Parse(), and Print(). |
|
|
Histogram output file name.
Definition at line 60 of file CmdLine.h. Referenced by HistoFileName(), and Parse(). |
|
|
Input data files.
Definition at line 54 of file CmdLine.h. Referenced by InFileList(), Parse(), and Print(). |
|
|
Definition at line 18 of file CmdLine.cxx. Referenced by Instance(). |
|
|
Number of events to process.
|
|
|
Frequency of memory reporting.
Definition at line 65 of file CmdLine.h. Referenced by NmemReport(), Parse(), and Print(). |
|
|
Number of events to skip.
|
|
|
Output data file name.
Definition at line 59 of file CmdLine.h. Referenced by OutFileName(), Parse(), and Print(). |
|
|
Has SIGHUP signal been sent?
Definition at line 66 of file CmdLine.h. Referenced by HaveSIGHUP(), and SetSIGHUP(). |
|
|
Max output file size.
Definition at line 68 of file CmdLine.h. Referenced by Parse(), SetupIoModule(), and SizeLimit(). |
|
|
XML directory to scan.
Definition at line 56 of file CmdLine.h. Referenced by Parse(), Print(), and XMLDirList(). |
|
|
Input XML files.
Definition at line 55 of file CmdLine.h. Referenced by Parse(), Print(), and XMLFileList(). |
|
|
XML path to search.
|
1.3.5