CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

cscdqm::Dispatcher Class Reference

CSCDQM Framework frontend and Histogram Cache controller. More...

#include <CSCDQM_Dispatcher.h>

List of all members.

Public Member Functions

 Dispatcher (Configuration *const p_config, MonitorObjectProvider *const p_provider)
 Constructor.
const bool getHisto (const HistoDef &histoD, MonitorObject *&me)
 Global get MO function. If request has reached this function it means that histo is not in cache!
void init ()
 Initialize Dispatcher: book histograms, init processor, etc.
unsigned int maskHWElements (std::vector< std::string > &tokens)
 Mask HW elements from the efficiency calculations. Can be applied on runtime!
void processStandby (HWStandbyType &standby)
 Set HW Standby modes.
void updateFractionAndEfficiencyHistos ()
 On demand update fraction and efficiency MOs.
 ~Dispatcher ()
 Destructor. Joins and waits to complete all threads.

Private Member Functions

void updateFractionAndEfficiencyHistosAuto ()
 Automatically called fraction and efficiency MOs update function.

Private Attributes

Cache cache
Collection collection
Configurationconfig
EventProcessor processor
EventProcessorMutex processorFract
MonitorObjectProviderprovider

Detailed Description

CSCDQM Framework frontend and Histogram Cache controller.

Definition at line 120 of file CSCDQM_Dispatcher.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
p_configPointer to Global Configuration
p_providerPointer to MonitorObjectProvider
Returns:

Save pointers to class properties

Link/share Cache methods to function pointers in configuration

Link/share local functions

Link/share getCSCDetId function

Link/share booking function

Definition at line 29 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::fnGetCacheFEDHisto, cscdqm::Configuration::fnGetCacheParHisto, cscdqm::Configuration::fnGetCSCDetId, cscdqm::Configuration::fnGetHisto, cscdqm::Configuration::fnIsBookedCSC, cscdqm::Configuration::fnIsBookedDDU, cscdqm::Configuration::fnIsBookedFED, cscdqm::Configuration::fnNextBookedCSC, cscdqm::Configuration::fnPutHisto, cscdqm::Cache::getCSC(), cscdqm::MonitorObjectProvider::getCSCDetId(), cscdqm::Cache::getDDU(), cscdqm::Cache::getEMU(), cscdqm::Cache::getFED(), getHisto(), cscdqm::Cache::getPar(), cscdqm::Cache::isBookedCSC(), cscdqm::Cache::isBookedDDU(), cscdqm::Cache::isBookedFED(), cscdqm::Cache::nextBookedCSC(), provider, and cscdqm::Cache::put().

                                                                                         : 
  collection(p_config), processor(p_config), processorFract(p_config) {

    config = p_config;
    provider = p_provider;

    config->fnGetCacheEMUHisto = boost::bind(&Cache::getEMU, &cache, _1, _2);
    config->fnGetCacheFEDHisto = boost::bind(&Cache::getFED, &cache, _1, _2, _3);
    config->fnGetCacheDDUHisto = boost::bind(&Cache::getDDU, &cache, _1, _2, _3);
    config->fnGetCacheCSCHisto = boost::bind(&Cache::getCSC, &cache, _1, _2, _3, _4, _5);
    config->fnGetCacheParHisto = boost::bind(&Cache::getPar, &cache, _1, _2);
    config->fnPutHisto = boost::bind(&Cache::put, &cache, _1, _2);
    config->fnNextBookedCSC = boost::bind(&Cache::nextBookedCSC, &cache, _1, _2, _3);
    config->fnIsBookedCSC = boost::bind(&Cache::isBookedCSC, &cache, _1, _2);
    config->fnIsBookedDDU = boost::bind(&Cache::isBookedDDU, &cache, _1);
    config->fnIsBookedFED = boost::bind(&Cache::isBookedFED, &cache, _1);

    config->fnGetHisto = boost::bind(&Dispatcher::getHisto, this, _1, _2);

    config->fnGetCSCDetId = boost::bind(&MonitorObjectProvider::getCSCDetId, provider, _1, _2, _3);

    config->fnBook = boost::bind(&MonitorObjectProvider::bookMonitorObject, provider, _1);

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

Destructor. Joins and waits to complete all threads.

Definition at line 129 of file CSCDQM_Dispatcher.h.

                    { 
#ifdef DQMMT      
        threads.join_all(); 
#endif      
      }

Member Function Documentation

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

Global get MO function. If request has reached this function it means that histo is not in cache!

Parameters:
histoDHistogram Definition to get
meMO to return
Returns:
true if me found and filled, false - otherwise

For the first FED - book general

For the first DDU - book general

For the first and specific CSCs - book general and specific

cache.printContent();

For the Parameters - book parameter histogram

If not found after booking - mark it as not existent

Definition at line 84 of file CSCDQM_Dispatcher.cc.

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

Referenced by Dispatcher().

                                                                            {

    if (typeid(histoD) == FEDHistoDefT && !cache.isBookedFED(histoD.getFEDId())) {
      collection.bookFEDHistos(histoD.getFEDId());
      if (cache.get(histoD, me)) return true;
    }

    if (typeid(histoD) == DDUHistoDefT && !cache.isBookedDDU(histoD.getDDUId())) {
      collection.bookDDUHistos(histoD.getDDUId());
      if (cache.get(histoD, me)) return true;
    }

    if (typeid(histoD) == CSCHistoDefT) {
      if (!cache.isBookedCSC(histoD.getCrateId(), histoD.getDMBId())) {
        collection.bookCSCHistos(histoD.getCrateId(), histoD.getDMBId());
      }
      if (collection.isOnDemand(histoD.getHistoName())) {
        collection.bookCSCHistos(histoD.getId(), histoD.getCrateId(), histoD.getDMBId(), histoD.getAddId());
      }
      if (cache.get(histoD, me)) return true;
    }

    if (typeid(histoD) == ParHistoDefT) {
      HistoBookRequest req(histoD, config->getFOLDER_PAR(), -1.0f);
      me = provider->bookMonitorObject(req);
      cache.put(histoD, me);
      return true;
    }

    cache.put(histoD, NULL);

    return false;
  }
void cscdqm::Dispatcher::init ( void  )

Initialize Dispatcher: book histograms, init processor, etc.

Returns:

Definition at line 63 of file CSCDQM_Dispatcher.cc.

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

Referenced by CSCMonitorModule::CSCMonitorModule(), and CSCOfflineClient::CSCOfflineClient().

                        {
    collection.load();
    collection.bookEMUHistos();
    processor.init();
  }
unsigned int cscdqm::Dispatcher::maskHWElements ( std::vector< std::string > &  tokens)

Mask HW elements from the efficiency calculations. Can be applied on runtime!

Parameters:
tokensString tokens of the HW elements
Returns:
elements masked

Definition at line 74 of file CSCDQM_Dispatcher.cc.

References cscdqm::EventProcessorMutex::maskHWElements(), and processorFract.

Referenced by CSCMonitorModule::CSCMonitorModule(), and CSCOfflineClient::CSCOfflineClient().

                                                                      {
    return processorFract.maskHWElements(tokens);
  }
void cscdqm::Dispatcher::processStandby ( HWStandbyType standby)

Set HW Standby modes.

Returns:

Definition at line 158 of file CSCDQM_Dispatcher.cc.

References config, CommonMethods::lock(), cscdqm::Lock::mutex, processorFract, and cscdqm::EventProcessorMutex::processStandby().

                                                        {
    LockType lock(processorFract.mutex);
    if (config->getFRAEFF_SEPARATE_THREAD()) { 
      boost::function<void (HWStandbyType&)> fnUpdate = boost::bind(&EventProcessorMutex::processStandby, &processorFract, _1);
#ifdef DQMMT
      threads.create_thread(boost::ref(fnUpdate));
#else
      fnUpdate(standby);
#endif 
    } else {
      processorFract.processStandby(standby);
    }
  }
void cscdqm::Dispatcher::updateFractionAndEfficiencyHistos ( )

On demand update fraction and efficiency MOs.

Returns:

Definition at line 140 of file CSCDQM_Dispatcher.cc.

References config, CommonMethods::lock(), cscdqm::Lock::mutex, processorFract, and cscdqm::EventProcessorMutex::updateFractionAndEfficiencyHistos().

Referenced by CSCMonitorModule::beginRun(), CSCOfflineClient::endRun(), and updateFractionAndEfficiencyHistosAuto().

                                                     {
    LockType lock(processorFract.mutex);
    if (config->getFRAEFF_SEPARATE_THREAD()) { 
      boost::function<void ()> fnUpdate = boost::bind(&EventProcessorMutex::updateFractionAndEfficiencyHistos, &processorFract);
#ifdef DQMMT
      threads.create_thread(boost::ref(fnUpdate));
#else
      fnUpdate();
#endif 
    } else {
      processorFract.updateFractionAndEfficiencyHistos();
    }
  }
void cscdqm::Dispatcher::updateFractionAndEfficiencyHistosAuto ( ) [private]

Automatically called fraction and efficiency MOs update function.

Returns:

Definition at line 128 of file CSCDQM_Dispatcher.cc.

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

                                                         {
    if ( config->getFRAEFF_AUTO_UPDATE() &&
        (config->getNEventsCSC() >= config->getFRAEFF_AUTO_UPDATE_START()) &&
        (config->getNEventsCSC() % config->getFRAEFF_AUTO_UPDATE_FREQ()) == 0) {
      updateFractionAndEfficiencyHistos();
    }
  }

Member Data Documentation

MO Cache object

Definition at line 158 of file CSCDQM_Dispatcher.h.

Referenced by Dispatcher(), and getHisto().

MO Collection object

Definition at line 152 of file CSCDQM_Dispatcher.h.

Referenced by getHisto(), and init().

Event Processor object

Definition at line 155 of file CSCDQM_Dispatcher.h.

Referenced by init().

Lockable Fractional and Efficiency MO update object

Definition at line 161 of file CSCDQM_Dispatcher.h.

Referenced by maskHWElements(), processStandby(), and updateFractionAndEfficiencyHistos().

Pointer to MO provider

Definition at line 149 of file CSCDQM_Dispatcher.h.

Referenced by Dispatcher(), and getHisto().