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.

30  : collection(p_config), processor(p_config), processorFract(p_config) {
31  commonConstruct(p_config, p_provider);
32  }

References commonConstruct().

◆ ~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 91 of file CSCDQM_Dispatcher.cc.

91  {
93 
94  /*** FOr multi-threading pre-book all FED, DDU, CSC histograms ***/
95  if (config->getPREBOOK_ALL_HISTOS()) {
97  for (HwId FEDId = 750; FEDId < 758; FEDId++) {
98  if (!cache.isBookedFED(FEDId)) {
100  }
101  }
102 
103  if (config->getPROCESS_DDU()) {
105  for (HwId DDUId = 1; DDUId <= 36; DDUId++) {
106  if (!cache.isBookedDDU(DDUId)) {
107  collection.bookDDUHistos(DDUId);
108  }
109  }
110  }
111 
112  if (config->getPROCESS_CSC()) {
114  for (HwId CrateId = 1; CrateId <= 60; CrateId++) {
115  for (HwId DMBId = 1; DMBId <= 10; DMBId++) {
116  if (DMBId == 6)
117  continue;
118  if (!cache.isBookedCSC(CrateId, DMBId)) {
119  collection.bookCSCHistos(CrateId, DMBId);
120  }
121  }
122  }
123  }
124 
125  if (config->getPROCESS_EFF_PARAMETERS()) {
128  std::vector<HistoId> parameters;
129  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION01_RING01);
130  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION01_RING02);
131  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION01_RING03);
132  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION01);
133  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION02_RING01);
134  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION02_RING02);
135  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION02);
136  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION03_RING01);
137  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION03_RING02);
138  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION03);
139  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION04_RING01);
140  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION04_RING02);
141  parameters.push_back(h::PAR_CSC_SIDEPLUS_STATION04);
142  parameters.push_back(h::PAR_CSC_SIDEPLUS);
143  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION01_RING01);
144  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION01_RING02);
145  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION01_RING03);
146  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION01);
147  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION02_RING01);
148  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION02_RING02);
149  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION02);
150  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION03_RING01);
151  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION03_RING02);
152  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION03);
153  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION04_RING01);
154  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION04_RING02);
155  parameters.push_back(h::PAR_CSC_SIDEMINUS_STATION04);
156  parameters.push_back(h::PAR_CSC_SIDEMINUS);
157  parameters.push_back(h::PAR_REPORT_SUMMARY);
158 
159  for (size_t i = 0; i < parameters.size(); i++) {
160  ParHistoDef histoD(parameters[i]);
161  auto histodef = HistoDef(parameters[i]);
162  HistoBookRequest req(histodef, config->getFOLDER_PAR(), -1.0f);
163  MonitorObject* me = provider->bookMonitorObject(req);
164  cache.put(histoD, me);
165  }
166  }
167  }
168 
169  processor.init();
170  }

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

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

◆ 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.

54  {
56  config = p_config;
57  provider = p_provider;
58 
60  config->fnGetCacheEMUHisto = boost::bind(&Cache::getEMU, &cache, _1, _2);
61  config->fnGetCacheFEDHisto = boost::bind(&Cache::getFED, &cache, _1, _2, _3);
62  config->fnGetCacheDDUHisto = boost::bind(&Cache::getDDU, &cache, _1, _2, _3);
63  config->fnGetCacheCSCHisto = boost::bind(&Cache::getCSC, &cache, _1, _2, _3, _4, _5);
64  config->fnGetCacheParHisto = boost::bind(&Cache::getPar, &cache, _1, _2);
65  config->fnPutHisto = boost::bind(&Cache::put, &cache, _1, _2);
66  config->fnNextBookedCSC = boost::bind(&Cache::nextBookedCSC, &cache, _1, _2, _3);
67  config->fnIsBookedCSC = boost::bind(&Cache::isBookedCSC, &cache, _1, _2);
68  config->fnIsBookedDDU = boost::bind(&Cache::isBookedDDU, &cache, _1);
69  config->fnIsBookedFED = boost::bind(&Cache::isBookedFED, &cache, _1);
70 
72  config->fnGetHisto = boost::bind(&Dispatcher::getHisto, this, _1, _2);
73 
75  config->fnGetCSCDetId = boost::bind(&MonitorObjectProvider::getCSCDetId, provider, _1, _2, _3);
76 
78  config->fnBook = boost::bind(&MonitorObjectProvider::bookMonitorObject, provider, _1);
79  }

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

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

187  {
189  if (typeid(histoD) == FEDHistoDefT && !cache.isBookedFED(histoD.getFEDId())) {
190  collection.bookFEDHistos(histoD.getFEDId());
191  if (cache.get(histoD, me))
192  return true;
193  }
194 
196  if (typeid(histoD) == DDUHistoDefT && !cache.isBookedDDU(histoD.getDDUId())) {
197  collection.bookDDUHistos(histoD.getDDUId());
198  if (cache.get(histoD, me))
199  return true;
200  }
201 
203  if (typeid(histoD) == CSCHistoDefT) {
204  if (!cache.isBookedCSC(histoD.getCrateId(), histoD.getDMBId())) {
205  collection.bookCSCHistos(histoD.getCrateId(), histoD.getDMBId());
207  }
208  if (collection.isOnDemand(histoD.getHistoName())) {
209  collection.bookCSCHistos(histoD.getId(), histoD.getCrateId(), histoD.getDMBId(), histoD.getAddId());
210  }
211  if (cache.get(histoD, me))
212  return true;
213  }
214 
216  if (typeid(histoD) == ParHistoDefT) {
217  HistoBookRequest req(histoD, config->getFOLDER_PAR(), -1.0f);
218  me = provider->bookMonitorObject(req);
219  cache.put(histoD, me);
220  return true;
221  }
222 
224  cache.put(histoD, nullptr);
225 
226  return false;
227  }

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

◆ init()

void cscdqm::Dispatcher::init ( void  )

Initialize Dispatcher: book histograms, init processor, etc.

Returns

Definition at line 85 of file CSCDQM_Dispatcher.cc.

85  {
86  collection.load();
87  // collection.bookEMUHistos();
88  // processor.init();
89  }

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

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

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

177  {
178  return processorFract.maskHWElements(tokens);
179  }

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

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

◆ processStandby()

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

Set HW Standby modes.

Returns

Definition at line 263 of file CSCDQM_Dispatcher.cc.

263  {
264  LockType lock(processorFract.mutex);
265  if (config->getFRAEFF_SEPARATE_THREAD()) {
266  boost::function<void(HWStandbyType&)> fnUpdate =
268 #ifdef DQMMT
269  threads.create_thread(boost::ref(fnUpdate));
270 #else
271  fnUpdate(standby);
272 #endif
273  } else {
275  }
276  }

References HiBiasedCentrality_cfi::function, CommonMethods::lock(), cscdqm::Lock::mutex, processorFract, cscdqm::EventProcessorMutex::processStandby(), and funct::void.

◆ updateFractionAndEfficiencyHistos()

void cscdqm::Dispatcher::updateFractionAndEfficiencyHistos ( )

On demand update fraction and efficiency MOs.

Returns

Definition at line 244 of file CSCDQM_Dispatcher.cc.

244  {
245  LockType lock(processorFract.mutex);
246  if (config->getFRAEFF_SEPARATE_THREAD()) {
247  boost::function<void()> fnUpdate =
249 #ifdef DQMMT
250  threads.create_thread(boost::ref(fnUpdate));
251 #else
252  fnUpdate();
253 #endif
254  } else {
256  }
257  }

References HiBiasedCentrality_cfi::function, CommonMethods::lock(), cscdqm::Lock::mutex, processorFract, cscdqm::EventProcessorMutex::updateFractionAndEfficiencyHistos(), and funct::void.

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

◆ updateFractionAndEfficiencyHistosAuto()

void cscdqm::Dispatcher::updateFractionAndEfficiencyHistosAuto ( )
private

Automatically called fraction and efficiency MOs update function.

Returns

Definition at line 233 of file CSCDQM_Dispatcher.cc.

233  {
234  if (config->getFRAEFF_AUTO_UPDATE() && (config->getNEventsCSC() >= config->getFRAEFF_AUTO_UPDATE_START()) &&
235  (config->getNEventsCSC() % config->getFRAEFF_AUTO_UPDATE_FREQ()) == 0) {
237  }
238  }

References updateFractionAndEfficiencyHistos().

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

Event Processor object

Definition at line 158 of file CSCDQM_Dispatcher.h.

Referenced by book().

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

mps_fire.i
i
Definition: mps_fire.py:355
cscdqm::Dispatcher::cache
Cache cache
Definition: CSCDQM_Dispatcher.h:161
cscdqm::Cache::getFED
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
cscdqm::Collection::bookCSCHistos
void bookCSCHistos(const HwId crateId, const HwId dmbId) const
Book Chamber Histograms.
Definition: CSCDQM_Collection.cc:372
cscdqm::Dispatcher::updateFractionAndEfficiencyHistos
void updateFractionAndEfficiencyHistos()
On demand update fraction and efficiency MOs.
Definition: CSCDQM_Dispatcher.cc:244
cscdqm::Cache::nextBookedCSC
const bool nextBookedCSC(unsigned int &n, unsigned int &crateId, unsigned int &dmbId) const
Iterator to get booked CSC identifiers on enumerator.
Definition: CSCDQM_Cache.cc:244
cscdqm::Cache::isBookedDDU
const bool isBookedDDU(const HwId &dduId) const
Check if DDU was booked on given identifier.
Definition: CSCDQM_Cache.cc:322
cscdqm::CSCHistoDefT
static const std::type_info & CSCHistoDefT
Definition: CSCDQM_HistoDef.h:453
HistoDef
Definition: HistoDef.h:17
cscdqm::Dispatcher::processorFract
EventProcessorMutex processorFract
Definition: CSCDQM_Dispatcher.h:164
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
cscdqm::Cache::isBookedCSC
const bool isBookedCSC(const HwId &crateId, const HwId &dmbId) const
Check if CSC was booked on given identifiers.
Definition: CSCDQM_Cache.cc:299
config
Definition: config.py:1
cscdqm::EventProcessor::init
void init()
Initialize EventProcessor: reading out config information.
Definition: CSCDQM_EventProcessor.cc:58
cscdqm::Cache::get
const bool get(const HistoDef &histo, MonitorObject *&mo)
Get Monitoring Object on Histogram Definition.
Definition: CSCDQM_Cache.cc:29
cscdqm::HwId
unsigned int HwId
Definition: CSCDQM_HistoDef.h:38
cscdqm::DDUHistoDefT
static const std::type_info & DDUHistoDefT
Definition: CSCDQM_HistoDef.h:452
cscdqm::EventProcessorMutex::processStandby
void processStandby(HWStandbyType &standby)
Process standby information.
Definition: CSCDQM_Dispatcher.h:95
cscdqm::Cache::getPar
const bool getPar(const HistoId &id, MonitorObject *&mo)
Get Parameter MO on Histogram Id.
Definition: CSCDQM_Cache.cc:143
cscdqm::Collection::bookDDUHistos
void bookDDUHistos(const HwId dduId) const
Book DDU histograms.
Definition: CSCDQM_Collection.cc:349
CommonMethods.lock
def lock()
Definition: CommonMethods.py:82
cscdqm::Cache::getDDU
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
cscdqm::Dispatcher::commonConstruct
void commonConstruct(Configuration *const p_config, MonitorObjectProvider *const p_provider)
Definition: CSCDQM_Dispatcher.cc:54
cscdqm::Dispatcher::collection
Collection collection
Definition: CSCDQM_Dispatcher.h:155
cscdqm::EventProcessorMutex::maskHWElements
unsigned int maskHWElements(std::vector< std::string > &tokens)
Mask HW elements from the efficiency calculations. Can be applied on runtime!
Definition: CSCDQM_Dispatcher.h:89
cscdqm::Collection::bookFEDHistos
void bookFEDHistos(const HwId fedId) const
Book FED histograms.
Definition: CSCDQM_Collection.cc:327
cscdqm::Collection::load
void load()
Load XML file and fill definition map(s)
Definition: CSCDQM_Collection.cc:37
cscdqm::Dispatcher::processor
EventProcessor processor
Definition: CSCDQM_Dispatcher.h:158
cscdqm::ParHistoDefT
static const std::type_info & ParHistoDefT
Definition: CSCDQM_HistoDef.h:454
cscdqm::FEDHistoDefT
static const std::type_info & FEDHistoDefT
Definition: CSCDQM_HistoDef.h:451
cscdqm::Collection::isOnDemand
const bool isOnDemand(const HistoName &name) const
Check if the histogram is on demand (by histogram name)
Definition: CSCDQM_Collection.cc:625
cscdqm::Dispatcher::provider
MonitorObjectProvider * provider
Definition: CSCDQM_Dispatcher.h:152
cscdqm::Cache::isBookedFED
const bool isBookedFED(const HwId &fedId) const
Check if FED was booked on given identifier.
Definition: CSCDQM_Cache.cc:312
cscdqm::Cache::put
void put(const HistoDef &histo, MonitorObject *mo)
Put Monitoring Object into cache.
Definition: CSCDQM_Cache.cc:157
cscdqm::Dispatcher::getHisto
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!
Definition: CSCDQM_Dispatcher.cc:187
cscdqm::Collection::bookEMUHistos
void bookEMUHistos() const
Book EMU histograms.
Definition: CSCDQM_Collection.cc:305
cscdqm::Cache::getEMU
const bool getEMU(const HistoId &id, MonitorObject *&mo)
Get EMU MO on Histogram Id.
Definition: CSCDQM_Cache.cc:51
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
funct::void
TEMPL(T2) struct Divides void
Definition: Factorize.h:29
cscdqm::Lock::mutex
bool mutex
Definition: CSCDQM_Lock.h:48
cscdqm::MonitorObjectProvider::bookMonitorObject
virtual MonitorObject * bookMonitorObject(const HistoBookRequest &p_req)=0
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
cscdqm::EventProcessorMutex::updateFractionAndEfficiencyHistos
void updateFractionAndEfficiencyHistos()
Update Fraction and Efficiency histograms.
Definition: CSCDQM_Dispatcher.h:72
cscdqm::Cache::getCSC
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.
Definition: CSCDQM_Cache.cc:119
cscdqm::MonitorObjectProvider::getCSCDetId
virtual bool getCSCDetId(const unsigned int crateId, const unsigned int dmbId, CSCDetId &detId) const =0