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

ana.cc File Reference

"ana" is the main engine for running reconstruction and analysis jobs More...

#include <list>
#include <string>
#include <csignal>
#include <fstream>
#include "TROOT.h"
#include "TApplication.h"
#include "TRint.h"
#include "JobControl/jobc.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


Detailed Description

"ana" is the main engine for running reconstruction and analysis jobs

Author:
messier@indiana.edu
Version:
Id
ana.cc,v 1.6 2009/08/28 23:09:31 fmwk Exp

Definition in file ana.cc.


Function Documentation

void gsSIGHUPhandler int  s  )  [static]
 

Definition at line 26 of file ana.cc.

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

Referenced by main().

00027 {
00028   switch (s) {
00029   case SIGINT: case SIGQUIT: case SIGTERM: case SIGHUP:
00030     jobc::CmdLine::Instance().SetSIGHUP();
00031     break;
00032 
00033   case SIGUSR1:
00034     jobc::Sequence::PrintCurrentNode();
00035     break;
00036 
00037   default:
00038     break;
00039   }
00040 }

int main int  argc,
char **  argv
 

Definition at line 44 of file ana.cc.

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

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

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


Variable Documentation

TFile* gsHistoFile = 0
 

Definition at line 24 of file ana.cc.


Generated on Mon Nov 23 04:45:27 2009 for NOvA Offline by  doxygen 1.3.9.1