anamipp.cc File Reference

#include <list>
#include <string>
#include <csignal>
#include "TROOT.h"
#include "JobControl/JobCmdLine.h"
#include "JobControl/JobCStack.h"
#include "JobControl/JobCHistoFile.h"
#include "JobControl/JobCSequence.h"
#include "MippXML/MXML.h"
#include "Config/CfgTable.h"

Go to the source code of this file.

Functions

static TROOT troot ("anamipp","anamipp")
static void gsSIGHUPhandler (int s)
int main (int argc, char **argv)

Variables

TFile * gsHistoFile = 0


Function Documentation

static void gsSIGHUPhandler ( int  s  )  [static]

Definition at line 16 of file anamipp.cc.

References JobCmdLine::Instance(), JobCSequence::PrintCurrentNode(), and JobCmdLine::SetSIGHUP().

Referenced by main().

00017 {
00018   switch (s) {
00019   case SIGINT: case SIGQUIT: case SIGTERM: case SIGHUP:
00020     JobCmdLine::Instance().SetSIGHUP();
00021     break;
00022 
00023   case SIGUSR1:
00024     JobCSequence::PrintCurrentNode();
00025     break;
00026 
00027   default:
00028     break;
00029   }
00030 }

int main ( int  argc,
char **  argv 
)

Definition at line 34 of file anamipp.cc.

References JobCStack::CleanUp(), JobCHistoFile::File(), gsSIGHUPhandler(), MXML::Initialize(), JobCStack::Instance(), JobCmdLine::Instance(), JobCmdLine::Parse(), MXML::ReadDirectory(), MXML::ReadFile(), JobCStack::Run(), JobCHistoFile::SetFileName(), JobCmdLine::XMLDirList(), and JobCmdLine::XMLFileList().

00035 {
00036   JobCmdLine::Instance().Parse(argc, argv);
00037   JobCHistoFile::SetFileName(JobCmdLine::Instance().HistoFileName());
00038 
00039   // Start the XML parser and load files and directories specified on
00040   // the command line
00041   MXML::Initialize();
00042 
00043   std::list<std::string>::const_iterator itr;
00044   std::list<std::string>::const_iterator itrEnd;
00045 
00046   itr    = JobCmdLine::Instance().XMLFileList().begin();
00047   itrEnd = JobCmdLine::Instance().XMLFileList().end();
00048   for (; itr!=itrEnd; ++itr) MXML::ReadFile((*itr).c_str());
00049 
00050   itr    = JobCmdLine::Instance().XMLDirList().begin();
00051   itrEnd = JobCmdLine::Instance().XMLDirList().end();
00052   for (; itr!=itrEnd; ++itr) MXML::ReadDirectory((*itr).c_str());
00053   
00054   // Set the handler for the SIGHUP signal. Signal ends the job
00055   // gracefully at end of event currently being processed
00056   signal(SIGINT,gsSIGHUPhandler);
00057   signal(SIGQUIT,gsSIGHUPhandler);
00058   signal(SIGTERM,gsSIGHUPhandler);
00059   signal(SIGHUP,gsSIGHUPhandler);
00060   signal(SIGUSR1,gsSIGHUPhandler);
00061 
00062   // Run all the jobs in the stack
00063   JobCStack::Instance().Run();
00064   JobCStack::Instance().CleanUp();
00065 
00066   // Clean up the histogram file
00067   if (JobCHistoFile::File()) {
00068     JobCHistoFile::File()->Write();
00069     JobCHistoFile::File()->Close();
00070   }
00071 
00072   return 0;
00073 }

static TROOT troot ( "anamipp"  ,
"anamipp"   
) [static]


Variable Documentation

TFile* gsHistoFile = 0

Definition at line 14 of file anamipp.cc.


Generated on Mon Nov 23 08:02:30 2009 for MIPP(E907) by  doxygen 1.4.7