CMS 3D CMS Logo

cscdqm::Dispatcher Class Reference

Framework frontend and Histogram Cache controller. More...

#include <DQM/CSCMonitorModule/interface/CSCDQM_Dispatcher.h>

List of all members.

Public Member Functions

 Dispatcher (Configuration *const p_config, MonitorObjectProvider *const p_provider)
CollectiongetCollection ()
const bool getHisto (const HistoDef &histoD, MonitorObject *&me)
void init ()
const bool nextBookedCSC (unsigned int &n, unsigned int &crateId, unsigned int &dmbId) const
void updateFractionAndEfficiencyHistos ()
 ~Dispatcher ()

Private Member Functions

void updateFractionAndEfficiencyHistosAuto ()

Private Attributes

Cache cache
Collection collection
Configurationconfig
boost::function< void()> fnUpdate
EventProcessor processor
EventProcessorMutex processorFract
MonitorObjectProviderprovider
boost::thread_group threads


Detailed Description

Framework frontend and Histogram Cache controller.

Definition at line 56 of file CSCDQM_Dispatcher.h.


Constructor & Destructor Documentation

cscdqm::Dispatcher::Dispatcher ( Configuration *const   p_config,
MonitorObjectProvider *const   p_provider 
)

Definition at line 23 of file CSCDQM_Dispatcher.cc.

References cscdqm::MonitorObjectProvider::bookMonitorObject(), cache, config, cscdqm::Configuration::fnBook, cscdqm::Configuration::fnGetCacheCSCHisto, cscdqm::Configuration::fnGetCacheDDUHisto, cscdqm::Configuration::fnGetCacheEMUHisto, cscdqm::Configuration::fnGetCacheParHisto, cscdqm::Configuration::fnGetCSCDetId, cscdqm::Configuration::fnGetHisto, cscdqm::Configuration::fnIsBookedCSC, cscdqm::Configuration::fnIsBookedDDU, cscdqm::Configuration::fnNextBookedCSC, cscdqm::Configuration::fnPutHisto, fnUpdate, cscdqm::Cache::getCSC(), cscdqm::MonitorObjectProvider::getCSCDetId(), cscdqm::Cache::getDDU(), cscdqm::Cache::getEMU(), getHisto(), cscdqm::Cache::getPar(), cscdqm::Cache::isBookedCSC(), cscdqm::Cache::isBookedDDU(), cscdqm::Cache::nextBookedCSC(), processorFract, provider, cscdqm::Cache::put(), and cscdqm::EventProcessorMutex::updateFractionAndEfficiencyHistos().

00023                                                                                          : 
00024   collection(p_config), processor(p_config), processorFract(p_config) {
00025 
00026     config = p_config;
00027     provider = p_provider;
00028 
00029     config->fnGetHisto = boost::bind(&Dispatcher::getHisto, this, _1, _2);
00030     config->fnGetCacheEMUHisto = boost::bind(&Cache::getEMU, &cache, _1, _2);
00031     config->fnGetCacheDDUHisto = boost::bind(&Cache::getDDU, &cache, _1, _2, _3);
00032     config->fnGetCacheCSCHisto = boost::bind(&Cache::getCSC, &cache, _1, _2, _3, _4, _5);
00033     config->fnGetCacheParHisto = boost::bind(&Cache::getPar, &cache, _1, _2);
00034     config->fnPutHisto = boost::bind(&Cache::put, &cache, _1, _2);
00035     config->fnBook = boost::bind(&MonitorObjectProvider::bookMonitorObject, provider, _1);
00036     config->fnGetCSCDetId = boost::bind(&MonitorObjectProvider::getCSCDetId, provider, _1, _2);
00037     config->fnNextBookedCSC = boost::bind(&Cache::nextBookedCSC, &cache, _1, _2, _3);
00038     config->fnIsBookedCSC = boost::bind(&Cache::isBookedCSC, &cache, _1, _2);
00039     config->fnIsBookedDDU = boost::bind(&Cache::isBookedDDU, &cache, _1);
00040 
00041     fnUpdate = boost::bind(&EventProcessorMutex::updateFractionAndEfficiencyHistos, &processorFract);
00042 
00043   }

cscdqm::Dispatcher::~Dispatcher (  )  [inline]

Definition at line 61 of file CSCDQM_Dispatcher.h.

References threads.

00061 { threads.join_all(); }


Member Function Documentation

Collection* cscdqm::Dispatcher::getCollection (  )  [inline]

Definition at line 68 of file CSCDQM_Dispatcher.h.

References collection.

00068 { return &collection; }

const bool cscdqm::Dispatcher::getHisto ( const HistoDef histoD,
MonitorObject *&  me 
)

Definition at line 67 of file CSCDQM_Dispatcher.cc.

References cscdqm::Collection::bookCSCHistos(), cscdqm::Collection::bookDDUHistos(), cscdqm::MonitorObjectProvider::bookMonitorObject(), cache, collection, config, cscdqm::CSCHistoDefT, cscdqm::DDUHistoDefT, cscdqm::Cache::get(), cscdqm::HistoDef::getAddId(), cscdqm::HistoDef::getCrateId(), cscdqm::HistoDef::getDDUId(), cscdqm::HistoDef::getDMBId(), cscdqm::HistoDef::getHistoName(), cscdqm::HistoDef::getId(), cscdqm::Cache::isBookedCSC(), cscdqm::Cache::isBookedDDU(), cscdqm::Collection::isOnDemand(), NULL, cscdqm::ParHistoDefT, provider, and cscdqm::Cache::put().

Referenced by Dispatcher().

00067                                                                             {
00068 
00069     //Look at the cache - if found - return it 
00070     //if (cache.get(histoD, me)) return true;
00071 
00072     //LOG_DEBUG << "DISPATCHER: need to book histo on " << histoD;
00073 
00074     //For the first DDU - book general
00075     if (typeid(histoD) == DDUHistoDefT && !cache.isBookedDDU(histoD.getDDUId())) {
00076       collection.bookDDUHistos(histoD.getDDUId());
00077       if (cache.get(histoD, me)) return true;
00078     }
00079 
00080     //For the first and specific CSCs - book general and specific
00081     if (typeid(histoD) == CSCHistoDefT) {
00082       //LOG_DEBUG << "DISPATCHER: looking for " << cscId;
00083       if (!cache.isBookedCSC(histoD.getCrateId(), histoD.getDMBId())) {
00084         collection.bookCSCHistos(histoD.getCrateId(), histoD.getDMBId());
00085         //LOG_DEBUG << "DISPATCHER: booked histos for " << cscId;
00086         //cache.printContent();
00087       }
00088       if (collection.isOnDemand(histoD.getHistoName())) {
00089         //LOG_DEBUG << "DISPATCHER: booking on demand " << histoD;
00090         collection.bookCSCHistos(histoD.getId(), histoD.getCrateId(), histoD.getDMBId(), histoD.getAddId());
00091       }
00092       if (cache.get(histoD, me)) return true;
00093     }
00094 
00095     //For the Parameters - book parameter histogram
00096     if (typeid(histoD) == ParHistoDefT) {
00097       HistoBookRequest req(histoD, config->getFOLDER_PAR(), -1.0f);
00098       me = provider->bookMonitorObject(req);
00099       cache.put(histoD, me);
00100       return true;
00101     }
00102 
00103     //If not found after booking - mark it as not existent
00104     cache.put(histoD, NULL);
00105 
00106     return false;
00107   }

void cscdqm::Dispatcher::init ( void   ) 

Definition at line 45 of file CSCDQM_Dispatcher.cc.

References cscdqm::Collection::bookEMUHistos(), collection, cscdqm::EventProcessor::init(), and processor.

00045                         {
00046     collection.bookEMUHistos();
00047     processor.init();
00048   }

const bool cscdqm::Dispatcher::nextBookedCSC ( unsigned int n,
unsigned int crateId,
unsigned int dmbId 
) const

void cscdqm::Dispatcher::updateFractionAndEfficiencyHistos (  ) 

Definition at line 117 of file CSCDQM_Dispatcher.cc.

References config, fnUpdate, cscdqm::Lock::isLockedByOther(), processorFract, and threads.

Referenced by updateFractionAndEfficiencyHistosAuto().

00117                                                      {
00118     if (!processorFract.isLockedByOther()) {
00119       if (config->getFRAEFF_SEPARATE_THREAD()) { 
00120         threads.create_thread(boost::ref(fnUpdate));
00121       } else {
00122         fnUpdate();
00123       }
00124     }
00125   }

void cscdqm::Dispatcher::updateFractionAndEfficiencyHistosAuto (  )  [private]

Definition at line 109 of file CSCDQM_Dispatcher.cc.

References config, cscdqm::Configuration::getNEventsCSC(), and updateFractionAndEfficiencyHistos().

00109                                                          {
00110     if ( config->getFRAEFF_AUTO_UPDATE() &&
00111         (config->getNEventsCSC() >= config->getFRAEFF_AUTO_UPDATE_START()) &&
00112         (config->getNEventsCSC() % config->getFRAEFF_AUTO_UPDATE_FREQ()) == 0) {
00113       updateFractionAndEfficiencyHistos();
00114     }
00115   }


Member Data Documentation

Cache cscdqm::Dispatcher::cache [private]

Definition at line 80 of file CSCDQM_Dispatcher.h.

Referenced by Dispatcher(), and getHisto().

Collection cscdqm::Dispatcher::collection [private]

Definition at line 78 of file CSCDQM_Dispatcher.h.

Referenced by getCollection(), getHisto(), and init().

Configuration* cscdqm::Dispatcher::config [private]

Definition at line 76 of file CSCDQM_Dispatcher.h.

Referenced by Dispatcher(), getHisto(), updateFractionAndEfficiencyHistos(), and updateFractionAndEfficiencyHistosAuto().

boost::function<void ()> cscdqm::Dispatcher::fnUpdate [private]

Definition at line 84 of file CSCDQM_Dispatcher.h.

Referenced by Dispatcher(), and updateFractionAndEfficiencyHistos().

EventProcessor cscdqm::Dispatcher::processor [private]

Definition at line 79 of file CSCDQM_Dispatcher.h.

Referenced by init().

EventProcessorMutex cscdqm::Dispatcher::processorFract [private]

Definition at line 82 of file CSCDQM_Dispatcher.h.

Referenced by Dispatcher(), and updateFractionAndEfficiencyHistos().

MonitorObjectProvider* cscdqm::Dispatcher::provider [private]

Definition at line 77 of file CSCDQM_Dispatcher.h.

Referenced by Dispatcher(), and getHisto().

boost::thread_group cscdqm::Dispatcher::threads [private]

Definition at line 83 of file CSCDQM_Dispatcher.h.

Referenced by updateFractionAndEfficiencyHistos(), and ~Dispatcher().


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