CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/EventFilter/StorageManager/src/FinishingDQM.cc

Go to the documentation of this file.
00001 // $Id: FinishingDQM.cc,v 1.12 2011/11/08 10:48:40 mommsen Exp $
00003 
00004 #include "EventFilter/StorageManager/interface/AlarmHandler.h"
00005 #include "EventFilter/StorageManager/interface/CommandQueue.h"
00006 #include "EventFilter/StorageManager/interface/DQMEventProcessorResources.h"
00007 #include "EventFilter/StorageManager/interface/SharedResources.h"
00008 #include "EventFilter/StorageManager/interface/StateMachine.h"
00009 #include "EventFilter/StorageManager/interface/TransitionRecord.h"
00010 
00011 #include <iostream>
00012 #include <unistd.h>
00013 
00014 using namespace std;
00015 using namespace stor;
00016 
00017 FinishingDQM::FinishingDQM( my_context c ): my_base(c)
00018 {
00019   safeEntryAction();
00020 }
00021 
00022 void FinishingDQM::do_entryActionWork()
00023 {
00024 
00025   TransitionRecord tr( stateName(), true );
00026   outermost_context().updateHistory( tr );
00027 
00028   SharedResourcesPtr sharedResources =
00029     outermost_context().getSharedResources();
00030 
00031   // request end-of-run processing in DQMEventProcessor
00032   sharedResources->dqmEventProcessorResources_->requestEndOfRun();
00033 
00034 }
00035 
00036 FinishingDQM::~FinishingDQM()
00037 {
00038   safeExitAction();
00039 }
00040 
00041 void FinishingDQM::do_exitActionWork()
00042 {
00043   TransitionRecord tr( stateName(), false );
00044   outermost_context().updateHistory( tr );
00045 }
00046 
00047 string FinishingDQM::do_stateName() const
00048 {
00049   return std::string( "FinishingDQM" );
00050 }
00051 
00052 void FinishingDQM::do_moveToFailedState( xcept::Exception& exception ) const
00053 {
00054   outermost_context().getSharedResources()->alarmHandler_->moveToFailedState( exception );
00055 }
00056 
00057 void
00058 FinishingDQM::do_noFragmentToProcess() const
00059 {
00060   if ( endOfRunProcessingIsDone() )
00061   {
00062     SharedResourcesPtr sharedResources =
00063       outermost_context().getSharedResources();
00064     EventPtr_t stMachEvent( new EndRun() );
00065     sharedResources->commandQueue_->enqWait( stMachEvent );
00066   }
00067 }
00068 
00069 bool
00070 FinishingDQM::endOfRunProcessingIsDone() const
00071 {
00072   SharedResourcesPtr sharedResources =
00073     outermost_context().getSharedResources();
00074 
00075   if ( sharedResources->dqmEventProcessorResources_->requestsOngoing() ) return false; 
00076 
00077   return true;
00078 }
00079