#include <Job.h>
Inheritance diagram for jobc::Job:

Public Member Functions | |
| Job (const char *name) | |
| int | Run (int nevent=0) |
| void | CheckStatus (const std::string &s, const edm::EventHandle *evt) |
Private Attributes | |
| bool | fInit |
| Have first-time initializations been done? | |
| int | fCurrentRun |
| Run number in progress. | |
| int | fCurrentSubrun |
| Subrun number in progress. | |
| std::string | fCurrentFile |
| File name in progress. | |
Definition at line 18 of file Job.h.
|
|
Definition at line 39 of file Job.cxx.
00039 : 00040 Sequence (name ), 00041 fInit (false), 00042 fCurrentRun (-1 ), 00043 fCurrentSubrun(-1 ), 00044 fCurrentFile ("" ) 00045 { } |
|
||||||||||||
|
Definition at line 136 of file Job.cxx. References jobc::Sequence::EndFile(), jobc::Sequence::EndRun(), jobc::Sequence::EndSubrun(), fCurrentFile, fCurrentRun, fCurrentSubrun, fInit, edm::EventHandle::Header(), jobc::Sequence::NewFile(), jobc::Sequence::NewRun(), jobc::Sequence::NewSubrun(), edm::EventHeader::Run(), and edm::EventHeader::Subrun(). Referenced by Run().
00138 {
00139 //======================================================================
00140 // Check the run status looking for things like new files, new run
00141 // numbers, etc.
00142 //======================================================================
00143 int run = -1;
00144 int subrun = -1;
00145
00146 if (evt) {
00147 const edm::EventHeader& head = evt->Header();
00148 run = head.Run();
00149 subrun = head.Subrun();
00150 }
00151
00152 // Very first time we should issue a begin file, run, and subrun in
00153 // that order. All other times we need to check the status.
00154 switch (fInit) {
00155
00156 case false:
00157 //------------------------------------------------------------------
00158 if (run>=0 && subrun>=0) {
00159 this->NewRun(run, subrun);
00160 this->NewSubrun(run, subrun);
00161 this->NewFile(file.c_str());
00162 }
00163 break;
00164
00165 case true:
00166 //------------------------------------------------------------------
00167 // Check status changes in order of most frequent to least frequent
00168 if (fCurrentSubrun != subrun) {
00169 if (fCurrentSubrun!=-1) this->EndSubrun(fCurrentRun, fCurrentSubrun);
00170 if (subrun!=-1) this->NewSubrun(run, subrun);
00171 }
00172 if (fCurrentRun != run) {
00173 if (fCurrentRun!=-1) this->EndRun(fCurrentRun, fCurrentSubrun);
00174 if (run!=-1) this->NewRun(run, subrun);
00175 }
00176 if (fCurrentFile != file) {
00177 if (fCurrentFile!="") this->EndFile(fCurrentFile.c_str());
00178 if (file!="") this->NewFile(file.c_str());
00179 }
00180 break;
00181 }
00182 fCurrentRun = run;
00183 fCurrentSubrun = subrun;
00184 fCurrentFile = file;
00185 fInit = true;
00186 }
|
|
|
Definition at line 49 of file Job.cxx. References io::ReadWriteModule::Advance(), CheckStatus(), io::ReadWriteModule::CurrentFile(), jobc::CmdLine::DumpOnException(), io::ReadWriteModule::EventNumber(), jobc::Sequence::Exec(), io::ReadWriteModule::GetEvent(), jobc::CmdLine::HaveSIGHUP(), jobc::Node::Name(), jobc::CmdLine::NmemReport(), jobc::CmdLine::OutFileName(), jobc::Sequence::Print(), io::ReadWriteModule::ReadOK(), io::ReadWriteModule::Report(), jobc::Sequence::ResourceReport(), io::ReadWriteModule::RunNumber(), jobc::CmdLine::SetupIoModule(), tstamp(), and io::ReadWriteModule::WriteEvent().
00050 {
00051 //======================================================================
00052 // Process the next nevents in the queue through this job Use
00053 // nevent=-1 to process all events
00054 //======================================================================
00055 int nMemReport = 0;
00056 bool printFlag = (nevent!=0);
00057
00058 // Print begin run status
00059 if (printFlag) {
00060 std::cout << "** Start job '" << this->Name() << "' "
00061 << tstamp() << " **" << std::endl;
00062 }
00063
00066 //
00067 // Setup the I/O module
00068 //
00069 int nevt = nevent;
00070 CmdLine& opt = CmdLine::Instance();
00071
00072 io::ReadWriteModule iomod;
00073 opt.SetupIoModule(iomod, &nevt);
00074 bool outfile = !(opt.OutFileName()==std::string(""));
00075 if (printFlag) iomod.Report();
00076
00077 // Event loop
00078 if (nevt==0) {
00079 edm::EventHandle& evt = iomod.GetEvent();
00080 this->CheckStatus(iomod.CurrentFile(), &evt);
00081 this->Exec(evt);
00082 }
00083 else {
00084 int n = 0;
00085 nMemReport = opt.NmemReport();
00086 for (; (iomod.ReadOK() && n<nevt); iomod.Advance()) {
00087 edm::EventHandle& evt = iomod.GetEvent();
00088 try {
00089 this->CheckStatus(iomod.CurrentFile(), &evt);
00090 bool passed = this->Exec(evt);
00091 if (passed && outfile) iomod.WriteEvent();
00092 }
00093 catch(Exception jce) {
00094 std::cout << "Job assertion '" << jce.fExpression
00095 << "' failed:\n";
00096 if (!jce.fMessage.empty()) std::cout<<" | "<<jce.fMessage<<"\n";
00097 std::cout << " | in " << jce.fFile << ":" << jce.fLine
00098 << "\n |- Run "<<iomod.RunNumber() << " event "
00099 << iomod.EventNumber() << ": " << iomod.CurrentFile()
00100 << std::endl;
00101 if (opt.DumpOnException()) break;
00102 }
00103 ++n;
00104 if (n>0 && nMemReport>0 && n%nMemReport==0) {
00105 this->ResourceReport(true);
00106 }
00107 if (n%1000==0) {
00108 std::cout << "[" << n << "] "
00109 << tstamp() << " /"
00110 << iomod.RunNumber() << ":" << iomod.EventNumber()
00111 << "/ " << iomod.CurrentFile()
00112 << std::endl;
00113 }
00114 // Check for sighup signal
00115 if (CmdLine::Instance().HaveSIGHUP()==true) {
00116 std::cout << "** Job ending on SIGHUP " << std::endl;
00117 break;
00118 }
00119 }
00120 }
00121 this->CheckStatus(std::string(""),0);
00122
00123 // Print end run status
00124 if (printFlag) {
00125 std::cout << "** " << tstamp() << " End job " << this->Name()
00126 << " **" << std::endl;
00127 this->Print();
00128 }
00129 if (nMemReport>0) this->ResourceReport(true);
00130
00131 return 1;
00132 }
|
|
|
File name in progress.
Definition at line 30 of file Job.h. Referenced by CheckStatus(). |
|
|
Run number in progress.
Definition at line 28 of file Job.h. Referenced by CheckStatus(). |
|
|
Subrun number in progress.
Definition at line 29 of file Job.h. Referenced by CheckStatus(). |
|
|
Have first-time initializations been done?
Definition at line 27 of file Job.h. Referenced by CheckStatus(). |
1.3.5