CMS 3D CMS Logo

statemachine::HandleFiles Class Reference

#include <FWCore/Framework/src/EPStates.h>

List of all members.

Public Types

typedef mpl::list
< sc::transition< Event, Error >,
sc::transition< Lumi, Error >,
sc::transition< Run, Error >,
sc::transition< File, Error >,
sc::transition< Stop,
EndingLoop >, sc::transition
< Restart, Error > > 
reactions

Public Member Functions

void closeFiles ()
void exit ()
void goToNewInputFile ()
 HandleFiles (my_context ctx)
bool shouldWeCloseOutput ()
 ~HandleFiles ()

Private Attributes

edm::IEventProcessorep_
bool exitCalled_


Detailed Description

Definition at line 120 of file EPStates.h.


Member Typedef Documentation

typedef mpl::list< sc::transition<Event, Error>, sc::transition<Lumi, Error>, sc::transition<Run, Error>, sc::transition<File, Error>, sc::transition<Stop, EndingLoop>, sc::transition<Restart, Error> > statemachine::HandleFiles::reactions

Definition at line 133 of file EPStates.h.


Constructor & Destructor Documentation

statemachine::HandleFiles::HandleFiles ( my_context  ctx  ) 

Definition at line 55 of file EPStates.cc.

00055                                          :
00056     my_base(ctx),
00057     ep_(context<Machine>().ep()),
00058     exitCalled_(false) { }

statemachine::HandleFiles::~HandleFiles (  ) 

Definition at line 66 of file EPStates.cc.

References closeFiles(), e, ep_, exception, exitCalled_, cms::Exception::explainSelf(), alivecheck_mergeAndRegister::msg, and edm::IEventProcessor::setExceptionMessageFiles().

00066                             {
00067     if (!exitCalled_) {
00068       try {
00069         closeFiles();
00070       }
00071       catch (cms::Exception& e) {
00072         std::ostringstream message;
00073         message << "------------------------------------------------------------\n"
00074                 << "Another exception was caught while trying to clean up files after\n" 
00075                 << "the primary exception.  We give up trying to clean up files at\n"
00076                 << "this point.  The description of this additional exception follows:\n" 
00077                 << "cms::Exception\n"
00078                 << e.explainSelf();
00079         std::string msg(message.str());
00080         ep_.setExceptionMessageFiles(msg);
00081       }
00082       catch (std::bad_alloc& e) {
00083         std::ostringstream message;
00084         message << "------------------------------------------------------------\n"
00085                 << "Another exception was caught while trying to clean up files\n" 
00086                 << "after the primary exception.  We give up trying to clean up files\n"
00087                 << "at this point.  This additional exception was a\n" 
00088                 << "std::bad_alloc exception thrown inside HandleFiles::closeFiles.\n"
00089                 << "The job has probably exhausted the virtual memory available\n"
00090                 << "to the process.\n";
00091         std::string msg(message.str());
00092         ep_.setExceptionMessageFiles(msg);
00093       }
00094       catch (std::exception& e) {
00095         std::ostringstream message;
00096         message << "------------------------------------------------------------\n"
00097                 << "Another exception was caught while trying to clean up files after\n" 
00098                 << "the primary exception.  We give up trying to clean up files at\n"
00099                 << "this point.  This additional exception was a\n" 
00100                 << "standard library exception thrown inside HandleFiles::closeFiles\n"
00101                 << e.what() << "\n";
00102         std::string msg(message.str());
00103         ep_.setExceptionMessageFiles(msg);
00104       }
00105       catch (...) {
00106         std::ostringstream message;
00107         message << "------------------------------------------------------------\n"
00108                 << "Another exception was caught while trying to clean up files after\n" 
00109                 << "the primary exception.  We give up trying to clean up files at\n"
00110                 << "this point.  This additional exception was of unknown type and\n" 
00111                 << "thrown inside HandleFiles::closeFiles\n";
00112         std::string msg(message.str());
00113         ep_.setExceptionMessageFiles(msg);
00114       }
00115     }
00116   }


Member Function Documentation

void statemachine::HandleFiles::closeFiles (  ) 

Definition at line 118 of file EPStates.cc.

References edm::IEventProcessor::closeInputFile(), edm::IEventProcessor::closeOutputFiles(), ep_, edm::IEventProcessor::respondToCloseInputFile(), edm::IEventProcessor::respondToCloseOutputFiles(), edm::IEventProcessor::writeLumiCache(), and edm::IEventProcessor::writeRunCache().

Referenced by exit(), and ~HandleFiles().

00118                                {
00119     ep_.respondToCloseInputFile();
00120     ep_.closeInputFile();
00121     ep_.writeLumiCache();
00122     ep_.writeRunCache();
00123     ep_.respondToCloseOutputFiles();
00124     ep_.closeOutputFiles();
00125   }

void statemachine::HandleFiles::exit (  ) 

Definition at line 60 of file EPStates.cc.

References edm::IEventProcessor::alreadyHandlingException(), closeFiles(), ep_, and exitCalled_.

00060                          {
00061     if (ep_.alreadyHandlingException()) return;
00062     exitCalled_ = true;
00063     closeFiles();
00064   }

void statemachine::HandleFiles::goToNewInputFile (  ) 

Definition at line 127 of file EPStates.cc.

References edm::IEventProcessor::closeInputFile(), ep_, edm::IEventProcessor::readFile(), edm::IEventProcessor::respondToCloseInputFile(), and edm::IEventProcessor::respondToOpenInputFile().

00127                                      {
00128     ep_.respondToCloseInputFile();
00129     ep_.closeInputFile();
00130 
00131     ep_.readFile();
00132     ep_.respondToOpenInputFile();
00133   }

bool statemachine::HandleFiles::shouldWeCloseOutput (  ) 

Definition at line 135 of file EPStates.cc.

References ep_, harvestingCosmics_cfg::fileMode, statemachine::NOMERGE, and edm::IEventProcessor::shouldWeCloseOutput().

00135                                         {
00136     if (context<Machine>().fileMode() == NOMERGE) return true;
00137     return ep_.shouldWeCloseOutput();
00138   }


Member Data Documentation

edm::IEventProcessor& statemachine::HandleFiles::ep_ [private]

Definition at line 139 of file EPStates.h.

Referenced by closeFiles(), exit(), goToNewInputFile(), shouldWeCloseOutput(), and ~HandleFiles().

bool statemachine::HandleFiles::exitCalled_ [private]

Definition at line 140 of file EPStates.h.

Referenced by exit(), and ~HandleFiles().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:52:37 2009 for CMSSW by  doxygen 1.5.4