00001 #include "JobControl/Module.h"
00002 #include "JobControl/Exception.h"
00003 #include <iostream>
00004 #include "Config/Config.h"
00005 #include "Config/Table.h"
00006 #include <unistd.h>
00007 using namespace jobc;
00008
00009
00010
00011 Module::Module(const char* name) :
00012 fName ( name ),
00013 fCfgVersion( "" ),
00014 fIsInit ( false )
00015 { }
00016
00017
00018
00019 Result Module::Reco(edm::EventHandle& ) {
00020 char msg[256];
00021 sprintf(msg, "Calling default %s::Reco()", fName.c_str());
00022
00023 assert_jobc(0, msg);
00024
00025 return kPassed;
00026 }
00027
00028
00029
00030 Result Module::Ana(const edm::EventHandle& )
00031 {
00032 char msg[256];
00033 sprintf(msg, "Calling default %s::Ana()", fName.c_str());
00034 assert_jobc(0, msg);
00035 return kPassed;
00036 }
00037
00038 void Module::NewFile(const char* ) { }
00039 void Module::EndFile(const char* ) { }
00040 void Module::NewRun(int , int ) { }
00041 void Module::EndRun(int , int ) { }
00042 void Module::NewSubrun(int , int ) { }
00043 void Module::EndSubrun(int , int ) { }
00044
00045
00046
00047 void Module::Reset() { this->SetCfgVersion("default"); }
00048
00049
00050
00051 void Module::SetCfgVersion(const char* cfgv)
00052 {
00053 if (fCfgVersion == cfgv) return;
00054 this->RemoveWatch(fCfgVersion.c_str());
00055 fCfgVersion = cfgv;
00056 this->SetWatch(fName.c_str(), fCfgVersion.c_str());
00057
00058 }
00059
00060
00061
00062 void Module::Report()
00063 {
00064 std::cout << fName << ": Nothing to report." << std::endl;
00065 }
00066
00067
00068
00069 void Module::CheckInit()
00070 {
00071 if (fIsInit) return;
00072 std::cout << "Module " << fName << "/" << fCfgVersion
00073 << " is not initialized. Stopping the job." << std::endl;
00074 exit(-1);
00075 }
00076