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