CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/EventFilter/Utilities/src/MicroStateService.cc

Go to the documentation of this file.
00001 
00002 
00003 #include "EventFilter/Utilities/interface/MicroStateService.h"
00004 
00005 
00006 namespace evf{
00007 
00008 
00009   MicroStateService::MicroStateService(const edm::ParameterSet& iPS, 
00010                                        edm::ActivityRegistry& reg) : 
00011     init("INIT")
00012     ,done("done")
00013     ,input("INPUT")
00014     ,fwkovh("FWKOVH")
00015     ,microstate2_(&init)
00016   {
00017   
00018     reg.watchPostBeginJob(this,&MicroStateService::postBeginJob);
00019     reg.watchPostEndJob(this,&MicroStateService::postEndJob);
00020   
00021     reg.watchPreProcessEvent(this,&MicroStateService::preEventProcessing);
00022     reg.watchPostProcessEvent(this,&MicroStateService::postEventProcessing);
00023     reg.watchPreSource(this,&MicroStateService::preSource);
00024     reg.watchPostSource(this,&MicroStateService::postSource);
00025   
00026     reg.watchPreModule(this,&MicroStateService::preModule);
00027     reg.watchPostModule(this,&MicroStateService::postModule);
00028     microstate1_ = "BJ";
00029   }
00030 
00031 
00032   MicroStateService::~MicroStateService()
00033   {
00034   }
00035 
00036   void MicroStateService::postBeginJob()
00037   {
00038     boost::mutex::scoped_lock sl(lock_);
00039     microstate1_ = "BJD";
00040   }
00041 
00042   void MicroStateService::postEndJob()
00043   {
00044     boost::mutex::scoped_lock sl(lock_);
00045     microstate1_ = "EJ";
00046     microstate2_ = &done;
00047   }
00048 
00049   void MicroStateService::preEventProcessing(const edm::EventID& iID,
00050                                              const edm::Timestamp& iTime)
00051   {
00052     boost::mutex::scoped_lock sl(lock_);
00053     microstate1_ = "PRO";
00054   }
00055 
00056   void MicroStateService::postEventProcessing(const edm::Event& e, const edm::EventSetup&)
00057   {
00058     boost::mutex::scoped_lock sl(lock_);
00059     microstate2_ = &input;
00060   }
00061   void MicroStateService::preSource()
00062   {
00063     boost::mutex::scoped_lock sl(lock_);
00064     microstate2_ = &input;
00065   }
00066 
00067   void MicroStateService::postSource()
00068   {
00069     boost::mutex::scoped_lock sl(lock_);
00070     microstate2_ = &fwkovh;
00071   }
00072 
00073   void MicroStateService::preModule(const edm::ModuleDescription& desc)
00074   {
00075     boost::mutex::scoped_lock sl(lock_);
00076     microstate2_ = &(desc.moduleLabel());
00077   }
00078 
00079   void MicroStateService::postModule(const edm::ModuleDescription& desc)
00080   {
00081     boost::mutex::scoped_lock sl(lock_);
00082     microstate2_ = &fwkovh;
00083   }
00084   
00085   std::string MicroStateService::getMicroState1()
00086   { 
00087         boost::mutex::scoped_lock sl(lock_);
00088         return microstate1_;
00089   }
00090 
00091   std::string const &MicroStateService::getMicroState2()
00092   { 
00093         boost::mutex::scoped_lock sl(lock_);
00094         return *microstate2_;
00095   }
00096 
00097   void MicroStateService::setMicroState(std::string const *in)
00098   {
00099         boost::mutex::scoped_lock sl(lock_);
00100         microstate2_ = in;
00101   }
00102 
00103 } //end namespace evf
00104