CMS 3D CMS Logo

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

void book ()
 
 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 commonConstruct (Configuration *const p_config, MonitorObjectProvider *const p_provider)
 
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 115 of file CSCDQM_Dispatcher.h.

Constructor & Destructor Documentation

◆ Dispatcher()

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

Constructor.

Parameters
p_configPointer to Global Configuration
p_providerPointer to MonitorObjectProvider
Returns

Definition at line 29 of file CSCDQM_Dispatcher.cc.

References commonConstruct().

30  : collection(p_config), processor(p_config), processorFract(p_config) {
31  commonConstruct(p_config, p_provider);
32  }
EventProcessorMutex processorFract
EventProcessor processor
void commonConstruct(Configuration *const p_config, MonitorObjectProvider *const p_provider)

◆ ~Dispatcher()

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

◆ book()

void cscdqm::Dispatcher::book ( )

For the first FED - book general



For the first DDU - book general


For the first and specific CSCs - book general and specific

No DMB in slot 6

For the Parameters - book parameter histograms

Definition at line 104 of file CSCDQM_Dispatcher.cc.

References cscdqm::Collection::bookCSCHistos(), cscdqm::Collection::bookDDUHistos(), cscdqm::Collection::bookEMUHistos(), cscdqm::Collection::bookFEDHistos(), cscdqm::MonitorObjectProvider::bookMonitorObject(), cache, collection, mps_fire::i, cscdqm::EventProcessor::init(), cscdqm::Cache::isBookedCSC(), cscdqm::Cache::isBookedDDU(), cscdqm::Cache::isBookedFED(), hlt_dqm_clientPB-live_cfg::me, cscdqm::h::PAR_CSC_SIDEMINUS, cscdqm::h::PAR_CSC_SIDEMINUS_STATION01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION01_RING01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION01_RING02, cscdqm::h::PAR_CSC_SIDEMINUS_STATION01_RING03, cscdqm::h::PAR_CSC_SIDEMINUS_STATION02, cscdqm::h::PAR_CSC_SIDEMINUS_STATION02_RING01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION02_RING02, cscdqm::h::PAR_CSC_SIDEMINUS_STATION03, cscdqm::h::PAR_CSC_SIDEMINUS_STATION03_RING01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION03_RING02, cscdqm::h::PAR_CSC_SIDEMINUS_STATION04, cscdqm::h::PAR_CSC_SIDEMINUS_STATION04_RING01, cscdqm::h::PAR_CSC_SIDEMINUS_STATION04_RING02, cscdqm::h::PAR_CSC_SIDEPLUS, cscdqm::h::PAR_CSC_SIDEPLUS_STATION01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION01_RING01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION01_RING02, cscdqm::h::PAR_CSC_SIDEPLUS_STATION01_RING03, cscdqm::h::PAR_CSC_SIDEPLUS_STATION02, cscdqm::h::PAR_CSC_SIDEPLUS_STATION02_RING01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION02_RING02, cscdqm::h::PAR_CSC_SIDEPLUS_STATION03, cscdqm::h::PAR_CSC_SIDEPLUS_STATION03_RING01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION03_RING02, cscdqm::h::PAR_CSC_SIDEPLUS_STATION04, cscdqm::h::PAR_CSC_SIDEPLUS_STATION04_RING01, cscdqm::h::PAR_CSC_SIDEPLUS_STATION04_RING02, cscdqm::h::PAR_REPORT_SUMMARY, processor, provider, and cscdqm::Cache::put().

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

104  {
106 
107  /*** FOr multi-threading pre-book all FED, DDU, CSC histograms ***/
108  if (config->getPREBOOK_ALL_HISTOS()) {
110  for (HwId FEDId = 750; FEDId < 758; FEDId++) {
111  if (!cache.isBookedFED(FEDId)) {
112  collection.bookFEDHistos(FEDId);
113  }
114  }
115 
116  if (config->getPROCESS_DDU()) {
118  for (HwId DDUId = 1; DDUId <= 36; DDUId++) {
119  if (!cache.isBookedDDU(DDUId)) {
120  collection.bookDDUHistos(DDUId);
121  }
122  }
123  }
124 
125  if (config->getPROCESS_CSC()) {
127  for (HwId CrateId = 1; CrateId <= 60; CrateId++) {
128  for (HwId DMBId = 1; DMBId <= 10; DMBId++) {
129  if (DMBId == 6)
130  continue;
131  if (!cache.isBookedCSC(CrateId, DMBId)) {
132  collection.bookCSCHistos(CrateId, DMBId);
133  }
134  }
135  }
136  }
137 
138  if (config->getPROCESS_EFF_PARAMETERS()) {
141  std::vector<HistoId> parameters;
155  parameters.push_back(h::PAR_CSC_SIDEPLUS);
169  parameters.push_back(h::PAR_CSC_SIDEMINUS);
171 
172  for (size_t i = 0; i < parameters.size(); i++) {
173  ParHistoDef histoD(parameters[i]);
174  auto histodef = HistoDef(parameters[i]);
175  HistoBookRequest req(histodef, config->getFOLDER_PAR(), -1.0f);
176  MonitorObject* me = provider->bookMonitorObject(req);
177  cache.put(histoD, me);
178  }
179  }
180  }
181 
182  processor.init();
183  }
unsigned int HwId
const bool isBookedFED(const HwId &fedId) const
Check if FED was booked on given identifier.
void bookEMUHistos() const
Book EMU histograms.
Definition: config.py:1
void init()
Initialize EventProcessor: reading out config information.
virtual MonitorObject * bookMonitorObject(const HistoBookRequest &p_req)=0
const bool isBookedCSC(const HwId &crateId, const HwId &dmbId) const
Check if CSC was booked on given identifiers.
EventProcessor processor
const bool isBookedDDU(const HwId &dduId) const
Check if DDU was booked on given identifier.
void bookDDUHistos(const HwId dduId) const
Book DDU histograms.
void put(const HistoDef &histo, MonitorObject *mo)
Put Monitoring Object into cache.
void bookFEDHistos(const HwId fedId) const
Book FED histograms.
MonitorObjectProvider * provider
void bookCSCHistos(const HwId crateId, const HwId dmbId) const
Book Chamber Histograms.

◆ commonConstruct()

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

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 54 of file CSCDQM_Dispatcher.cc.

References cscdqm::MonitorObjectProvider::bookMonitorObject(), cache, 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().

Referenced by Dispatcher().

54  {
56  config = p_config;
57  provider = p_provider;
58 
60  config->fnGetCacheEMUHisto = std::bind(&Cache::getEMU, &cache, std::placeholders::_1, std::placeholders::_2);
61  config->fnGetCacheFEDHisto =
62  std::bind(&Cache::getFED, &cache, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
63  config->fnGetCacheDDUHisto =
64  std::bind(&Cache::getDDU, &cache, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
65  config->fnGetCacheCSCHisto = std::bind(&Cache::getCSC,
66  &cache,
67  std::placeholders::_1,
68  std::placeholders::_2,
69  std::placeholders::_3,
70  std::placeholders::_4,
71  std::placeholders::_5);
72  config->fnGetCacheParHisto = std::bind(&Cache::getPar, &cache, std::placeholders::_1, std::placeholders::_2);
73  config->fnPutHisto = std::bind(&Cache::put, &cache, std::placeholders::_1, std::placeholders::_2);
74  config->fnNextBookedCSC =
75  std::bind(&Cache::nextBookedCSC, &cache, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
76  config->fnIsBookedCSC = std::bind(&Cache::isBookedCSC, &cache, std::placeholders::_1, std::placeholders::_2);
77  config->fnIsBookedDDU = std::bind(&Cache::isBookedDDU, &cache, std::placeholders::_1);
78  config->fnIsBookedFED = std::bind(&Cache::isBookedFED, &cache, std::placeholders::_1);
79 
81  config->fnGetHisto = std::bind(&Dispatcher::getHisto, this, std::placeholders::_1, std::placeholders::_2);
82 
84  config->fnGetCSCDetId = std::bind(&MonitorObjectProvider::getCSCDetId,
85  provider,
86  std::placeholders::_1,
87  std::placeholders::_2,
88  std::placeholders::_3);
89 
91  config->fnBook = std::bind(&MonitorObjectProvider::bookMonitorObject, provider, std::placeholders::_1);
92  }
const bool getFED(const HistoId &id, const HwId &fedId, MonitorObject *&mo)
Get FED MO on Histogram Id and FED Id.
Definition: CSCDQM_Cache.cc:66
const bool getEMU(const HistoId &id, MonitorObject *&mo)
Get EMU MO on Histogram Id.
Definition: CSCDQM_Cache.cc:51
const bool isBookedFED(const HwId &fedId) const
Check if FED was booked on given identifier.
Definition: config.py:1
const bool nextBookedCSC(unsigned int &n, unsigned int &crateId, unsigned int &dmbId) const
Iterator to get booked CSC identifiers on enumerator.
virtual MonitorObject * bookMonitorObject(const HistoBookRequest &p_req)=0
const bool isBookedCSC(const HwId &crateId, const HwId &dmbId) const
Check if CSC was booked on given identifiers.
const bool getPar(const HistoId &id, MonitorObject *&mo)
Get Parameter MO on Histogram Id.
virtual bool getCSCDetId(const unsigned int crateId, const unsigned int dmbId, CSCDetId &detId) const =0
const bool isBookedDDU(const HwId &dduId) const
Check if DDU was booked on given identifier.
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.
Definition: CSCDQM_Cache.cc:92
void put(const HistoDef &histo, MonitorObject *mo)
Put Monitoring Object into cache.
MonitorObjectProvider * provider
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.

◆ getHisto()

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 200 of file CSCDQM_Dispatcher.cc.

References cscdqm::Collection::bookCSCHistos(), cscdqm::Collection::bookDDUHistos(), cscdqm::Collection::bookFEDHistos(), cscdqm::MonitorObjectProvider::bookMonitorObject(), cache, collection, 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(), hlt_dqm_clientPB-live_cfg::me, cscdqm::ParHistoDefT, provider, and cscdqm::Cache::put().

Referenced by commonConstruct().

200  {
202  if (typeid(histoD) == FEDHistoDefT && !cache.isBookedFED(histoD.getFEDId())) {
203  collection.bookFEDHistos(histoD.getFEDId());
204  if (cache.get(histoD, me))
205  return true;
206  }
207 
209  if (typeid(histoD) == DDUHistoDefT && !cache.isBookedDDU(histoD.getDDUId())) {
210  collection.bookDDUHistos(histoD.getDDUId());
211  if (cache.get(histoD, me))
212  return true;
213  }
214 
216  if (typeid(histoD) == CSCHistoDefT) {
217  if (!cache.isBookedCSC(histoD.getCrateId(), histoD.getDMBId())) {
218  collection.bookCSCHistos(histoD.getCrateId(), histoD.getDMBId());
220  }
221  if (collection.isOnDemand(histoD.getHistoName())) {
222  collection.bookCSCHistos(histoD.getId(), histoD.getCrateId(), histoD.getDMBId(), histoD.getAddId());
223  }
224  if (cache.get(histoD, me))
225  return true;
226  }
227 
229  if (typeid(histoD) == ParHistoDefT) {
230  HistoBookRequest req(histoD, config->getFOLDER_PAR(), -1.0f);
231  me = provider->bookMonitorObject(req);
232  cache.put(histoD, me);
233  return true;
234  }
235 
237  cache.put(histoD, nullptr);
238 
239  return false;
240  }
static const std::type_info & FEDHistoDefT
const bool isBookedFED(const HwId &fedId) const
Check if FED was booked on given identifier.
const bool isOnDemand(const HistoName &name) const
Check if the histogram is on demand (by histogram name)
Definition: config.py:1
virtual MonitorObject * bookMonitorObject(const HistoBookRequest &p_req)=0
const bool isBookedCSC(const HwId &crateId, const HwId &dmbId) const
Check if CSC was booked on given identifiers.
static const std::type_info & CSCHistoDefT
static const std::type_info & ParHistoDefT
const bool isBookedDDU(const HwId &dduId) const
Check if DDU was booked on given identifier.
void bookDDUHistos(const HwId dduId) const
Book DDU histograms.
static const std::type_info & DDUHistoDefT
void put(const HistoDef &histo, MonitorObject *mo)
Put Monitoring Object into cache.
void bookFEDHistos(const HwId fedId) const
Book FED histograms.
const bool get(const HistoDef &histo, MonitorObject *&mo)
Get Monitoring Object on Histogram Definition.
Definition: CSCDQM_Cache.cc:29
MonitorObjectProvider * provider
void bookCSCHistos(const HwId crateId, const HwId dmbId) const
Book Chamber Histograms.

◆ init()

void cscdqm::Dispatcher::init ( void  )

Initialize Dispatcher: book histograms, init processor, etc.

Returns

Definition at line 98 of file CSCDQM_Dispatcher.cc.

References collection, and cscdqm::Collection::load().

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

98  {
99  collection.load();
100  // collection.bookEMUHistos();
101  // processor.init();
102  }
void load()
Load XML file and fill definition map(s)

◆ maskHWElements()

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 190 of file CSCDQM_Dispatcher.cc.

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

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

190  {
191  return processorFract.maskHWElements(tokens);
192  }
EventProcessorMutex processorFract
unsigned int maskHWElements(std::vector< std::string > &tokens)
Mask HW elements from the efficiency calculations. Can be applied on runtime!

◆ processStandby()

void cscdqm::Dispatcher::processStandby ( HWStandbyType standby)

Set HW Standby modes.

Returns

Definition at line 276 of file CSCDQM_Dispatcher.cc.

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

276  {
277  LockType lock(processorFract.mutex);
278  if (config->getFRAEFF_SEPARATE_THREAD()) {
279  std::function<void(HWStandbyType&)> fnUpdate =
280  std::bind(&EventProcessorMutex::processStandby, &processorFract, std::placeholders::_1);
281 #ifdef DQMMT
282  threads.create_thread(std::ref(fnUpdate));
283 #else
284  fnUpdate(standby);
285 #endif
286  } else {
288  }
289  }
EventProcessorMutex processorFract
Definition: config.py:1
void processStandby(HWStandbyType &standby)
Process standby information.

◆ updateFractionAndEfficiencyHistos()

void cscdqm::Dispatcher::updateFractionAndEfficiencyHistos ( )

On demand update fraction and efficiency MOs.

Returns

Definition at line 257 of file CSCDQM_Dispatcher.cc.

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

Referenced by CSCMonitorModule::bookHistograms(), CSCOfflineClient::dqmEndJob(), and updateFractionAndEfficiencyHistosAuto().

257  {
258  LockType lock(processorFract.mutex);
259  if (config->getFRAEFF_SEPARATE_THREAD()) {
260  std::function<void()> fnUpdate =
262 #ifdef DQMMT
263  threads.create_thread(std::ref(fnUpdate));
264 #else
265  fnUpdate();
266 #endif
267  } else {
269  }
270  }
EventProcessorMutex processorFract
Definition: config.py:1
void updateFractionAndEfficiencyHistos()
Update Fraction and Efficiency histograms.

◆ updateFractionAndEfficiencyHistosAuto()

void cscdqm::Dispatcher::updateFractionAndEfficiencyHistosAuto ( )
private

Automatically called fraction and efficiency MOs update function.

Returns

Definition at line 246 of file CSCDQM_Dispatcher.cc.

References updateFractionAndEfficiencyHistos().

246  {
247  if (config->getFRAEFF_AUTO_UPDATE() && (config->getNEventsCSC() >= config->getFRAEFF_AUTO_UPDATE_START()) &&
248  (config->getNEventsCSC() % config->getFRAEFF_AUTO_UPDATE_FREQ()) == 0) {
250  }
251  }
void updateFractionAndEfficiencyHistos()
On demand update fraction and efficiency MOs.
Definition: config.py:1

Member Data Documentation

◆ cache

Cache cscdqm::Dispatcher::cache
private

MO Cache object

Definition at line 161 of file CSCDQM_Dispatcher.h.

Referenced by book(), commonConstruct(), and getHisto().

◆ collection

Collection cscdqm::Dispatcher::collection
private

MO Collection object

Definition at line 155 of file CSCDQM_Dispatcher.h.

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

◆ config

Configuration* cscdqm::Dispatcher::config
private

◆ processor

EventProcessor cscdqm::Dispatcher::processor
private

◆ processorFract

EventProcessorMutex cscdqm::Dispatcher::processorFract
private

Lockable Fractional and Efficiency MO update object

Definition at line 164 of file CSCDQM_Dispatcher.h.

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

◆ provider

MonitorObjectProvider* cscdqm::Dispatcher::provider
private

Pointer to MO provider

Definition at line 152 of file CSCDQM_Dispatcher.h.

Referenced by book(), commonConstruct(), and getHisto().