CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
cscdqm::Dispatcher Class Reference

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

#include <CSCDQM_Dispatcher.h>

Public Member Functions

 Dispatcher (Configuration *const p_config, MonitorObjectProvider *const p_provider)
 Constructor. More...
 
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! More...
 
void init ()
 Initialize Dispatcher: book histograms, init processor, etc. More...
 
unsigned int maskHWElements (std::vector< std::string > &tokens)
 Mask HW elements from the efficiency calculations. Can be applied on runtime! More...
 
void processStandby (HWStandbyType &standby)
 Set HW Standby modes. More...
 
void updateFractionAndEfficiencyHistos ()
 On demand update fraction and efficiency MOs. More...
 
 ~Dispatcher ()
 Destructor. Joins and waits to complete all threads. More...
 

Private Member Functions

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

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().

29  :
30  collection(p_config), processor(p_config), processorFract(p_config) {
31 
33  config = p_config;
34  provider = p_provider;
35 
37  config->fnGetCacheEMUHisto = boost::bind(&Cache::getEMU, &cache, _1, _2);
38  config->fnGetCacheFEDHisto = boost::bind(&Cache::getFED, &cache, _1, _2, _3);
39  config->fnGetCacheDDUHisto = boost::bind(&Cache::getDDU, &cache, _1, _2, _3);
40  config->fnGetCacheCSCHisto = boost::bind(&Cache::getCSC, &cache, _1, _2, _3, _4, _5);
41  config->fnGetCacheParHisto = boost::bind(&Cache::getPar, &cache, _1, _2);
42  config->fnPutHisto = boost::bind(&Cache::put, &cache, _1, _2);
43  config->fnNextBookedCSC = boost::bind(&Cache::nextBookedCSC, &cache, _1, _2, _3);
44  config->fnIsBookedCSC = boost::bind(&Cache::isBookedCSC, &cache, _1, _2);
45  config->fnIsBookedDDU = boost::bind(&Cache::isBookedDDU, &cache, _1);
46  config->fnIsBookedFED = boost::bind(&Cache::isBookedFED, &cache, _1);
47 
49  config->fnGetHisto = boost::bind(&Dispatcher::getHisto, this, _1, _2);
50 
53 
56 
57  }
const bool getFED(const HistoId &id, const HwId &fedId, MonitorObject *&mo)
Get FED MO on Histogram Id and FED Id.
Definition: CSCDQM_Cache.cc:71
boost::function< bool(unsigned int &, unsigned int &) > fnIsBookedCSC
const bool isBookedDDU(const HwId &dduId) const
Check if DDU was booked on given identifier.
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheParHisto
const bool getEMU(const HistoId &id, MonitorObject *&mo)
Get EMU MO on Histogram Id.
Definition: CSCDQM_Cache.cc:56
const bool nextBookedCSC(unsigned int &n, unsigned int &crateId, unsigned int &dmbId) const
Iterator to get booked CSC identifiers on enumerator.
EventProcessorMutex processorFract
boost::function< bool(const HistoId id, const HwId &id1, const HwId &id2, const HwId &id3, MonitorObject *&mo) > fnGetCacheCSCHisto
virtual MonitorObject * bookMonitorObject(const HistoBookRequest &p_req)=0
const bool getPar(const HistoId &id, MonitorObject *&mo)
Get Parameter MO on Histogram Id.
boost::function< bool(unsigned int &, unsigned int &, unsigned int &) > fnNextBookedCSC
boost::function< bool(const HistoDef &histoT, MonitorObject *&) > fnGetHisto
virtual bool getCSCDetId(const unsigned int crateId, const unsigned int dmbId, CSCDetId &detId) const =0
boost::function< bool(const unsigned int, const unsigned int, CSCDetId &) > fnGetCSCDetId
EventProcessor processor
boost::function< MonitorObject *(const HistoBookRequest &) > fnBook
Configuration * config
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! ...
const bool getDDU(const HistoId &id, const HwId &dduId, MonitorObject *&mo)
Get DDU MO on Histogram Id and DDU Id.
boost::function< bool(unsigned int &) > fnIsBookedDDU
void put(const HistoDef &histo, MonitorObject *mo)
Put Monitoring Object into cache.
boost::function< bool(unsigned int &) > fnIsBookedFED
boost::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo) > fnGetCacheFEDHisto
boost::function< void(const HistoDef &histoT, MonitorObject *&) > fnPutHisto
const bool isBookedCSC(const HwId &crateId, const HwId &dmbId) const
Check if CSC was booked on given identifiers.
MonitorObjectProvider * provider
boost::function< bool(const HistoId id, const HwId &id1, MonitorObject *&mo) > fnGetCacheDDUHisto
const bool getCSC(const HistoId &id, const HwId &crateId, const HwId &dmbId, const HwId &addId, MonitorObject *&mo)
Get CSC MO on Histogram Id and CSC Crate and DMB Ids.
const bool isBookedFED(const HwId &fedId) const
Check if FED was booked on given identifier.
boost::function< bool(const HistoId id, MonitorObject *&mo) > fnGetCacheEMUHisto
cscdqm::Dispatcher::~Dispatcher ( )
inline

Destructor. Joins and waits to complete all threads.

Definition at line 129 of file CSCDQM_Dispatcher.h.

129  {
130 #ifdef DQMMT
131  threads.join_all();
132 #endif
133  }

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, and cscdqm::Cache::put().

Referenced by Dispatcher().

84  {
85 
87  if (typeid(histoD) == FEDHistoDefT && !cache.isBookedFED(histoD.getFEDId())) {
88  collection.bookFEDHistos(histoD.getFEDId());
89  if (cache.get(histoD, me)) return true;
90  }
91 
93  if (typeid(histoD) == DDUHistoDefT && !cache.isBookedDDU(histoD.getDDUId())) {
94  collection.bookDDUHistos(histoD.getDDUId());
95  if (cache.get(histoD, me)) return true;
96  }
97 
99  if (typeid(histoD) == CSCHistoDefT) {
100  if (!cache.isBookedCSC(histoD.getCrateId(), histoD.getDMBId())) {
101  collection.bookCSCHistos(histoD.getCrateId(), histoD.getDMBId());
103  }
104  if (collection.isOnDemand(histoD.getHistoName())) {
105  collection.bookCSCHistos(histoD.getId(), histoD.getCrateId(), histoD.getDMBId(), histoD.getAddId());
106  }
107  if (cache.get(histoD, me)) return true;
108  }
109 
111  if (typeid(histoD) == ParHistoDefT) {
112  HistoBookRequest req(histoD, config->getFOLDER_PAR(), -1.0f);
113  me = provider->bookMonitorObject(req);
114  cache.put(histoD, me);
115  return true;
116  }
117 
119  cache.put(histoD, NULL);
120 
121  return false;
122  }
static const std::type_info & FEDHistoDefT
const bool isBookedDDU(const HwId &dduId) const
Check if DDU was booked on given identifier.
#define NULL
Definition: scimark2.h:8
const bool isOnDemand(const HistoName &name) const
Check if the histogram is on demand (by histogram name)
virtual MonitorObject * bookMonitorObject(const HistoBookRequest &p_req)=0
static const std::type_info & CSCHistoDefT
static const std::type_info & ParHistoDefT
Configuration * config
void bookFEDHistos(const HwId fedId) const
Book FED histograms.
static const std::type_info & DDUHistoDefT
void bookDDUHistos(const HwId dduId) const
Book DDU histograms.
void put(const HistoDef &histo, MonitorObject *mo)
Put Monitoring Object into cache.
const bool isBookedCSC(const HwId &crateId, const HwId &dmbId) const
Check if CSC was booked on given identifiers.
void bookCSCHistos(const HwId crateId, const HwId dmbId) const
Book Chamber Histograms.
const bool get(const HistoDef &histo, MonitorObject *&mo)
Get Monitoring Object on Histogram Definition.
Definition: CSCDQM_Cache.cc:29
MonitorObjectProvider * provider
const bool isBookedFED(const HwId &fedId) const
Check if FED was booked on given identifier.
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().

63  {
64  collection.load();
66  processor.init();
67  }
void bookEMUHistos() const
Book EMU histograms.
void init()
Initialize EventProcessor: reading out config information.
void load()
Load XML file and fill definition map(s)
EventProcessor processor
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().

74  {
75  return processorFract.maskHWElements(tokens);
76  }
EventProcessorMutex processorFract
unsigned int maskHWElements(std::vector< std::string > &tokens)
Mask HW elements from the efficiency calculations. Can be applied on runtime!
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().

158  {
159  LockType lock(processorFract.mutex);
160  if (config->getFRAEFF_SEPARATE_THREAD()) {
161  boost::function<void (HWStandbyType&)> fnUpdate = boost::bind(&EventProcessorMutex::processStandby, &processorFract, _1);
162 #ifdef DQMMT
163  threads.create_thread(boost::ref(fnUpdate));
164 #else
165  fnUpdate(standby);
166 #endif
167  } else {
169  }
170  }
EventProcessorMutex processorFract
void processStandby(HWStandbyType &standby)
Process standby information.
Configuration * config
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().

140  {
141  LockType lock(processorFract.mutex);
142  if (config->getFRAEFF_SEPARATE_THREAD()) {
143  boost::function<void ()> fnUpdate = boost::bind(&EventProcessorMutex::updateFractionAndEfficiencyHistos, &processorFract);
144 #ifdef DQMMT
145  threads.create_thread(boost::ref(fnUpdate));
146 #else
147  fnUpdate();
148 #endif
149  } else {
151  }
152  }
EventProcessorMutex processorFract
Configuration * config
void updateFractionAndEfficiencyHistos()
Update Fraction and Efficiency histograms.
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().

128  {
129  if ( config->getFRAEFF_AUTO_UPDATE() &&
130  (config->getNEventsCSC() >= config->getFRAEFF_AUTO_UPDATE_START()) &&
131  (config->getNEventsCSC() % config->getFRAEFF_AUTO_UPDATE_FREQ()) == 0) {
133  }
134  }
void updateFractionAndEfficiencyHistos()
On demand update fraction and efficiency MOs.
const unsigned long getNEventsCSC() const
Configuration * config

Member Data Documentation

Cache cscdqm::Dispatcher::cache
private

MO Cache object

Definition at line 158 of file CSCDQM_Dispatcher.h.

Referenced by Dispatcher(), and getHisto().

Collection cscdqm::Dispatcher::collection
private

MO Collection object

Definition at line 152 of file CSCDQM_Dispatcher.h.

Referenced by getHisto(), and init().

Configuration* cscdqm::Dispatcher::config
private
EventProcessor cscdqm::Dispatcher::processor
private

Event Processor object

Definition at line 155 of file CSCDQM_Dispatcher.h.

Referenced by init().

EventProcessorMutex cscdqm::Dispatcher::processorFract
private

Lockable Fractional and Efficiency MO update object

Definition at line 161 of file CSCDQM_Dispatcher.h.

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

MonitorObjectProvider* cscdqm::Dispatcher::provider
private

Pointer to MO provider

Definition at line 149 of file CSCDQM_Dispatcher.h.

Referenced by Dispatcher(), and getHisto().