Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ana.cc File Reference

#include <list>
#include <string>
#include <csignal>
#include "TROOT.h"
#include "TApplication.h"
#include "TRint.h"
#include "JobControl/CmdLine.h"
#include "JobControl/Stack.h"
#include "JobControl/HistoFile.h"
#include "JobControl/Sequence.h"
#include "XMLInterface/xmli.h"
#include "Config/Table.h"

Go to the source code of this file.

Functions

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

Variables

TFile * gsHistoFile = 0


Function Documentation

void gsSIGHUPhandler int  s  )  [static]
 

Definition at line 18 of file ana.cc.

References jobc::CmdLine::Instance(), and jobc::Sequence::PrintCurrentNode().

Referenced by main().

00019 {
00020   switch (s) {
00021   case SIGINT: case SIGQUIT: case SIGTERM: case SIGHUP:
00022     jobc::CmdLine::Instance().SetSIGHUP();
00023     break;
00024 
00025   case SIGUSR1:
00026     jobc::Sequence::PrintCurrentNode();
00027     break;
00028 
00029   default:
00030     break;
00031   }
00032 }

int main int  argc,
char **  argv
 

Definition at line 36 of file ana.cc.

References jobc::HistoFile::File(), gsSIGHUPhandler(), xmli::Initialize(), jobc::Stack::Instance(), jobc::CmdLine::Instance(), xmli::ReadDirectory(), xmli::ReadFile(), jobc::HistoFile::SaveHistos(), and jobc::HistoFile::SetFileName().

00037 {
00038   /* TRint* theApp = */ new TRint("ana",0,0);
00039 
00040   jobc::CmdLine::Instance().Parse(argc, argv);
00041   jobc::HistoFile::SetFileName(jobc::CmdLine::Instance().HistoFileName());
00042 
00043   // Start the XML parser and load files and directories specified on
00044   // the command line
00045   xmli::Initialize();
00046 
00047   std::list<std::string>::const_iterator itr;
00048   std::list<std::string>::const_iterator itrEnd;
00049 
00050   itr    = jobc::CmdLine::Instance().XMLFileList().begin();
00051   itrEnd = jobc::CmdLine::Instance().XMLFileList().end();
00052   for (; itr!=itrEnd; ++itr) xmli::ReadFile((*itr).c_str());
00053 
00054   itr    = jobc::CmdLine::Instance().XMLDirList().begin();
00055   itrEnd = jobc::CmdLine::Instance().XMLDirList().end();
00056   for (; itr!=itrEnd; ++itr) xmli::ReadDirectory((*itr).c_str());
00057   
00058   // Set the handler for the SIGHUP signal. Signal ends the job
00059   // gracefully at end of event currently being processed
00060   signal(SIGINT, gsSIGHUPhandler);
00061   signal(SIGQUIT,gsSIGHUPhandler);
00062   signal(SIGTERM,gsSIGHUPhandler);
00063   signal(SIGHUP, gsSIGHUPhandler);
00064   signal(SIGUSR1,gsSIGHUPhandler);
00065 
00066   // Run all the jobs in the stack
00067   jobc::Stack::Instance().Run();
00068   jobc::Stack::Instance().CleanUp();
00069 
00070   // Clean up the histogram file
00071   if (jobc::HistoFile::File()) {
00072     jobc::HistoFile::File()->Write();
00073     jobc::HistoFile::File()->Close();
00074     if (! jobc::HistoFile::SaveHistos()) {  // JMP: this is a total hack;
00075       // if someone else knows how to nicely avoid writing out the histograms
00076       // and ntuples owned by the modules, please make the change to the code.
00077       std::string cmd("rm -f ");
00078       cmd += std::string(jobc::HistoFile::FileName());
00079       system(cmd.c_str());
00080     }
00081   }
00082   
00083   return 0;
00084 }

TROOT troot "ana"  ,
"ana" 
[static]
 


Variable Documentation

TFile* gsHistoFile = 0
 

Definition at line 16 of file ana.cc.


Generated on Thu Sep 4 02:05:29 2008 for NOvA Offline by doxygen 1.3.5