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 Attributes
cscdqm::Cache Class Reference

MonitorObject cache - list objects and routines to manage cache. More...

#include <CSCDQM_Cache.h>

Public Member Functions

 Cache ()
 
const bool get (const HistoDef &histo, MonitorObject *&mo)
 Get Monitoring Object on Histogram Definition. More...
 
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. More...
 
const bool getDDU (const HistoId &id, const HwId &dduId, MonitorObject *&mo)
 Get DDU MO on Histogram Id and DDU Id. More...
 
const bool getEMU (const HistoId &id, MonitorObject *&mo)
 Get EMU MO on Histogram Id. More...
 
const bool getFED (const HistoId &id, const HwId &fedId, MonitorObject *&mo)
 Get FED MO on Histogram Id and FED Id. More...
 
const bool getPar (const HistoId &id, MonitorObject *&mo)
 Get Parameter MO on Histogram Id. More...
 
const bool isBookedCSC (const HwId &crateId, const HwId &dmbId) const
 Check if CSC was booked on given identifiers. More...
 
const bool isBookedDDU (const HwId &dduId) const
 Check if DDU was booked on given identifier. More...
 
const bool isBookedFED (const HwId &fedId) const
 Check if FED was booked on given identifier. More...
 
const bool nextBookedCSC (unsigned int &n, unsigned int &crateId, unsigned int &dmbId) const
 Iterator to get booked CSC identifiers on enumerator. More...
 
const bool nextBookedDDU (unsigned int &n, unsigned int &dduId) const
 Iterator to get booked DDU identifier on enumerator. More...
 
const bool nextBookedFED (unsigned int &n, unsigned int &fedId) const
 Iterator to get booked FED identifier on enumerator. More...
 
void put (const HistoDef &histo, MonitorObject *mo)
 Put Monitoring Object into cache. More...
 
 ~Cache ()
 

Private Attributes

CSCMapType cscData
 
CSCMapType::const_iterator cscPointer
 
MonitorObjectdata [h::namesSize]
 
DDUMapType dduData
 
DDUMapType::const_iterator dduPointer
 
HwId dduPointerValue
 
FEDMapType fedData
 
FEDMapType::const_iterator fedPointer
 
HwId fedPointerValue
 
LookupMapType lookupData
 

Detailed Description

MonitorObject cache - list objects and routines to manage cache.

Definition at line 112 of file CSCDQM_Cache.h.

Constructor & Destructor Documentation

cscdqm::Cache::Cache ( )
inline

Cache Constructor

Initialize EMU and PAR static array with zero's

Initialize FED cached pointers

Initialize DDU and CSC cached pointers

Definition at line 145 of file CSCDQM_Cache.h.

References cscData, cscPointer, data, dduData, dduPointer, dduPointerValue, fedData, fedPointer, fedPointerValue, i, and cscdqm::h::namesSize.

145  {
146 
148  for (unsigned int i = 0; i < h::namesSize; i++) data[i] = 0;
149 
151  fedPointer = fedData.end();
152  fedPointerValue = 0;
153 
155  dduPointer = dduData.end();
156  dduPointerValue = 0;
157  cscPointer = cscData.end();
158  }
int i
Definition: DBlmapReader.cc:9
DDUMapType dduData
Definition: CSCDQM_Cache.h:128
MonitorObject * data[h::namesSize]
Definition: CSCDQM_Cache.h:117
static const unsigned int namesSize
HwId dduPointerValue
Definition: CSCDQM_Cache.h:132
DDUMapType::const_iterator dduPointer
Definition: CSCDQM_Cache.h:130
CSCMapType::const_iterator cscPointer
Definition: CSCDQM_Cache.h:137
FEDMapType::const_iterator fedPointer
Definition: CSCDQM_Cache.h:122
FEDMapType fedData
Definition: CSCDQM_Cache.h:120
CSCMapType cscData
Definition: CSCDQM_Cache.h:135
HwId fedPointerValue
Definition: CSCDQM_Cache.h:124
cscdqm::Cache::~Cache ( )
inline

Destructor

Clear FED MO static arrays

Clear DDU MO static arrays

Definition at line 161 of file CSCDQM_Cache.h.

References dduData, and fedData.

161  {
163  while (fedData.begin() != fedData.end()) {
164  if (fedData.begin()->second) {
165  delete [] fedData.begin()->second;
166  }
167  fedData.erase(fedData.begin());
168  }
169 
171  while (dduData.begin() != dduData.end()) {
172  if (dduData.begin()->second) {
173  delete [] dduData.begin()->second;
174  }
175  dduData.erase(dduData.begin());
176  }
177  }
DDUMapType dduData
Definition: CSCDQM_Cache.h:128
FEDMapType fedData
Definition: CSCDQM_Cache.h:120

Member Function Documentation

const bool cscdqm::Cache::get ( const HistoDef histo,
MonitorObject *&  mo 
)

Get Monitoring Object on Histogram Definition.

Native Cache methods

Parameters
histoHistogram definition
moMonitoring Object to return
Returns
true if MO was found in cache and false otherwise

Definition at line 29 of file CSCDQM_Cache.cc.

References cscdqm::CSCHistoDefT, cscdqm::DDUHistoDefT, cscdqm::EMUHistoDefT, cscdqm::FEDHistoDefT, cscdqm::HistoDef::getAddId(), cscdqm::HistoDef::getCrateId(), getCSC(), getDDU(), cscdqm::HistoDef::getDDUId(), cscdqm::HistoDef::getDMBId(), getEMU(), getFED(), cscdqm::HistoDef::getFEDId(), cscdqm::HistoDef::getId(), getPar(), and cscdqm::ParHistoDefT.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), cscdqm::Dispatcher::getHisto(), and betterConfigParser.BetterConfigParser::getResultingSection().

29  {
30 
31  if (typeid(histo) == EMUHistoDefT) {
32  return getEMU(histo.getId(), mo);
33  } else
34  if (typeid(histo) == FEDHistoDefT) {
35  return getFED(histo.getId(), histo.getFEDId(), mo);
36  } else
37  if (typeid(histo) == DDUHistoDefT) {
38  return getDDU(histo.getId(), histo.getDDUId(), mo);
39  } else
40  if (typeid(histo) == CSCHistoDefT) {
41  return getCSC(histo.getId(), histo.getCrateId(), histo.getDMBId(), histo.getAddId(), mo);
42  } else
43  if (typeid(histo) == ParHistoDefT) {
44  return getPar(histo.getId(), mo);
45  }
46 
47  return false;
48  }
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
static const std::type_info & FEDHistoDefT
const bool getEMU(const HistoId &id, MonitorObject *&mo)
Get EMU MO on Histogram Id.
Definition: CSCDQM_Cache.cc:56
const bool getPar(const HistoId &id, MonitorObject *&mo)
Get Parameter MO on Histogram Id.
static const std::type_info & CSCHistoDefT
static const std::type_info & ParHistoDefT
const bool getDDU(const HistoId &id, const HwId &dduId, MonitorObject *&mo)
Get DDU MO on Histogram Id and DDU Id.
static const std::type_info & DDUHistoDefT
static const std::type_info & EMUHistoDefT
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 cscdqm::Cache::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.

Parameters
idHistogram identifier
crateIdCSC Crate identifier
dmbIdCSC DMB identifier
moMonitoring Object to return
Returns
true if MO was found in cache and false otherwise

If not cached (last CSC) - find CSC

Get Monitor object from multi_index List

Definition at line 129 of file CSCDQM_Cache.cc.

References cscData, and cscPointer.

Referenced by cscdqm::Dispatcher::Dispatcher(), and get().

129  {
130 
132  if (cscPointer == cscData.end() || cscPointer->crateId != crateId || cscPointer->dmbId != dmbId) {
133  cscPointer = cscData.find(boost::make_tuple(crateId, dmbId));
134  }
135 
137  if (cscPointer != cscData.end()) {
138  CSCHistoMapType::const_iterator hit = cscPointer->mos.find(boost::make_tuple(id, addId));
139  if (hit != cscPointer->mos.end()) {
140  mo = const_cast<MonitorObject*>(hit->mo);
141  return true;
142  }
143  }
144  return false;
145  }
CSCMapType::const_iterator cscPointer
Definition: CSCDQM_Cache.h:137
CSCMapType cscData
Definition: CSCDQM_Cache.h:135
const bool cscdqm::Cache::getDDU ( const HistoId id,
const HwId dduId,
MonitorObject *&  mo 
)

Get DDU MO on Histogram Id and DDU Id.

Parameters
idHistogram identifier
dduIdDDU identifier
moMonitoring Object to return
Returns
true if MO was found in cache and false otherwise

If not cached (last DDU) - find DDU

Get MO from static array

Definition at line 100 of file CSCDQM_Cache.cc.

References dduData, dduPointer, dduPointerValue, and errorMatrix2Lands_multiChannel::id.

Referenced by cscdqm::Dispatcher::Dispatcher(), and get().

100  {
101 
103  if (dduPointerValue != dduId) {
104  dduPointer = dduData.find(dduId);
105  if (dduPointer == dduData.end()) {
106  dduPointerValue = 0;
107  return false;
108  }
109  dduPointerValue = dduId;
110  }
111 
113  if (dduPointer->second[id]) {
114  mo = dduPointer->second[id];
115  return true;
116  }
117  return false;
118 
119  }
DDUMapType dduData
Definition: CSCDQM_Cache.h:128
HwId dduPointerValue
Definition: CSCDQM_Cache.h:132
DDUMapType::const_iterator dduPointer
Definition: CSCDQM_Cache.h:130
const bool cscdqm::Cache::getEMU ( const HistoId id,
MonitorObject *&  mo 
)

Get EMU MO on Histogram Id.

Parameters
idHistogram identifier
moMonitoring Object to return
Returns
true if MO was found in cache and false otherwise

Definition at line 56 of file CSCDQM_Cache.cc.

References data, and errorMatrix2Lands_multiChannel::id.

Referenced by cscdqm::Dispatcher::Dispatcher(), and get().

56  {
57  if (data[id]) {
58  mo = data[id];
59  return true;
60  }
61  return false;
62  }
MonitorObject * data[h::namesSize]
Definition: CSCDQM_Cache.h:117
const bool cscdqm::Cache::getFED ( const HistoId id,
const HwId fedId,
MonitorObject *&  mo 
)

Get FED MO on Histogram Id and FED Id.

Parameters
idHistogram identifier
fedIdFED identifier
moMonitoring Object to return
Returns
true if MO was found in cache and false otherwise

If not cached (last FED) - find FED

Get MO from static array

Definition at line 71 of file CSCDQM_Cache.cc.

References fedData, fedPointer, fedPointerValue, and errorMatrix2Lands_multiChannel::id.

Referenced by cscdqm::Dispatcher::Dispatcher(), and get().

71  {
72 
74  if (fedPointerValue != fedId) {
75  fedPointer = fedData.find(fedId);
76  if (fedPointer == fedData.end()) {
77  fedPointerValue = 0;
78  return false;
79  }
80  fedPointerValue = fedId;
81  }
82 
84  if (fedPointer->second[id]) {
85  mo = fedPointer->second[id];
86  return true;
87  }
88  return false;
89 
90  }
FEDMapType::const_iterator fedPointer
Definition: CSCDQM_Cache.h:122
FEDMapType fedData
Definition: CSCDQM_Cache.h:120
HwId fedPointerValue
Definition: CSCDQM_Cache.h:124
const bool cscdqm::Cache::getPar ( const HistoId id,
MonitorObject *&  mo 
)

Get Parameter MO on Histogram Id.

Parameters
idHistogram identifier
moMonitoring Object to return
Returns
true if MO was found in cache and false otherwise

Definition at line 153 of file CSCDQM_Cache.cc.

References data, and errorMatrix2Lands_multiChannel::id.

Referenced by cscdqm::Dispatcher::Dispatcher(), and get().

153  {
154  if (data[id]) {
155  mo = data[id];
156  return true;
157  }
158  return false;
159  }
MonitorObject * data[h::namesSize]
Definition: CSCDQM_Cache.h:117
const bool cscdqm::Cache::isBookedCSC ( const HwId crateId,
const HwId dmbId 
) const

Check if CSC was booked on given identifiers.

Parameters
crateIdCSC Crate Id
dmbIdCSC DMB Id
Returns
true if CSC was booked, false - otherwise

Definition at line 311 of file CSCDQM_Cache.cc.

References cscData.

Referenced by cscdqm::Dispatcher::Dispatcher(), and cscdqm::Dispatcher::getHisto().

311  {
312  CSCMapType::const_iterator it = cscData.find(boost::make_tuple(crateId, dmbId));
313  if (it != cscData.end()) {
314  return true;
315  }
316  return false;
317  }
CSCMapType cscData
Definition: CSCDQM_Cache.h:135
const bool cscdqm::Cache::isBookedDDU ( const HwId dduId) const

Check if DDU was booked on given identifier.

Parameters
dduIdDDU Id
Returns
true if DDU was booked, false - otherwise

Definition at line 334 of file CSCDQM_Cache.cc.

References dduData.

Referenced by cscdqm::Dispatcher::Dispatcher(), and cscdqm::Dispatcher::getHisto().

334  {
335  DDUMapType::const_iterator iter = dduData.find(dduId);
336  return (iter != dduData.end());
337  }
DDUMapType dduData
Definition: CSCDQM_Cache.h:128
const bool cscdqm::Cache::isBookedFED ( const HwId fedId) const

Check if FED was booked on given identifier.

Parameters
fedIdFED Id
Returns
true if FED was booked, false - otherwise

Definition at line 324 of file CSCDQM_Cache.cc.

References fedData.

Referenced by cscdqm::Dispatcher::Dispatcher(), and cscdqm::Dispatcher::getHisto().

324  {
325  FEDMapType::const_iterator iter = fedData.find(fedId);
326  return (iter != fedData.end());
327  }
FEDMapType fedData
Definition: CSCDQM_Cache.h:120
const bool cscdqm::Cache::nextBookedCSC ( unsigned int &  n,
unsigned int &  crateId,
unsigned int &  dmbId 
) const

Iterator to get booked CSC identifiers on enumerator.

Parameters
niterator (0 and up)
crateIdCSC Crate Id returned
dmbIdCSC DMB Id returned
Returns
true if CSC on n found, false - otherwise

Definition at line 258 of file CSCDQM_Cache.cc.

References cscData, and i.

Referenced by cscdqm::Dispatcher::Dispatcher().

258  {
259  if (n < cscData.size()) {
260  CSCMapType::const_iterator iter = cscData.begin();
261  for (unsigned int i = n; i > 0; i--) iter++;
262  crateId = iter->crateId;
263  dmbId = iter->dmbId;
264  n++;
265  return true;
266  }
267  return false;
268  }
int i
Definition: DBlmapReader.cc:9
CSCMapType cscData
Definition: CSCDQM_Cache.h:135
const bool cscdqm::Cache::nextBookedDDU ( unsigned int &  n,
unsigned int &  dduId 
) const

Iterator to get booked DDU identifier on enumerator.

Parameters
niterator (0 and up)
dduIdDDU Id returned
Returns
true if DDU on n found, false - otherwise

Definition at line 294 of file CSCDQM_Cache.cc.

References dduData, and i.

294  {
295  if (n < dduData.size()) {
296  DDUMapType::const_iterator iter = dduData.begin();
297  for (unsigned int i = n; i > 0; i--) iter++;
298  dduId = iter->first;
299  n++;
300  return true;
301  }
302  return false;
303  }
int i
Definition: DBlmapReader.cc:9
DDUMapType dduData
Definition: CSCDQM_Cache.h:128
const bool cscdqm::Cache::nextBookedFED ( unsigned int &  n,
unsigned int &  fedId 
) const

Iterator to get booked FED identifier on enumerator.

Utility methods

Parameters
niterator (0 and up)
fedIdFED Id returned
Returns
true if FED on n found, false - otherwise

Definition at line 276 of file CSCDQM_Cache.cc.

References fedData, and i.

276  {
277  if (n < fedData.size()) {
278  FEDMapType::const_iterator iter = fedData.begin();
279  for (unsigned int i = n; i > 0; i--) iter++;
280  fedId = iter->first;
281  n++;
282  return true;
283  }
284  return false;
285  }
int i
Definition: DBlmapReader.cc:9
FEDMapType fedData
Definition: CSCDQM_Cache.h:120
void cscdqm::Cache::put ( const HistoDef histo,
MonitorObject mo 
)

Put Monitoring Object into cache.

Parameters
histoHistogram Definition
moMonitoring Object to put
Returns

EMU MO

FED MO

DDU MO

CSC MO

Parameter MO

Add histo (if mo is not null!) into lookup list

Definition at line 167 of file CSCDQM_Cache.cc.

References cscData, cscdqm::CSCHistoDefT, cscPointer, data, dduData, cscdqm::DDUHistoDefT, dduPointer, dduPointerValue, cscdqm::EMUHistoDefT, fedData, cscdqm::FEDHistoDefT, fedPointer, fedPointerValue, cscdqm::HistoDef::getAddId(), cscdqm::HistoDef::getCrateId(), cscdqm::HistoDef::getDDUId(), cscdqm::HistoDef::getDMBId(), cscdqm::HistoDef::getFEDId(), cscdqm::HistoDef::getId(), i, errorMatrix2Lands_multiChannel::id, lookupData, cscdqm::h::namesSize, and cscdqm::ParHistoDefT.

Referenced by cscdqm::Dispatcher::Dispatcher(), and cscdqm::Dispatcher::getHisto().

167  {
168 
169  HistoId id = histo.getId();
170 
172  if (typeid(histo) == EMUHistoDefT) {
173  data[id] = mo;
174  } else
175 
177  if (typeid(histo) == FEDHistoDefT) {
178 
179  HwId fedId = histo.getFEDId();
180 
181  if (fedPointerValue != fedId) {
182  fedPointer = fedData.find(fedId);
183  }
184 
185  if (fedPointer == fedData.end()) {
186  MonitorObject** mos = new MonitorObject*[h::namesSize];
187  for (unsigned int i = 0; i < h::namesSize; i++) mos[i] = 0;
188  fedPointer = fedData.insert(fedData.end(), std::make_pair(fedId, mos));
189  }
190 
191  fedPointer->second[id] = mo;
192  fedPointerValue = fedId;
193 
194  } else
195 
197  if (typeid(histo) == DDUHistoDefT) {
198 
199  HwId dduId = histo.getDDUId();
200 
201  if (dduPointerValue != dduId) {
202  dduPointer = dduData.find(dduId);
203  }
204 
205  if (dduPointer == dduData.end()) {
206  MonitorObject** mos = new MonitorObject*[h::namesSize];
207  for (unsigned int i = 0; i < h::namesSize; i++) mos[i] = 0;
208  dduPointer = dduData.insert(dduData.end(), std::make_pair(dduId, mos));
209  }
210 
211  dduPointer->second[id] = mo;
212  dduPointerValue = dduId;
213 
214  } else
215 
217  if (typeid(histo) == CSCHistoDefT) {
218 
219  HwId crateId = histo.getCrateId();
220  HwId dmbId = histo.getDMBId();
221  HwId addId = histo.getAddId();
222 
223  CSCHistoKeyType histoKey(id, addId, mo);
224 
225  if (cscPointer == cscData.end() || cscPointer->crateId != crateId || cscPointer->dmbId != dmbId) {
226  cscPointer = cscData.find(boost::make_tuple(crateId, dmbId));
227  }
228 
229  if (cscPointer == cscData.end()) {
230  CSCKeyType cscKey(crateId, dmbId);
231  cscPointer = cscData.insert(cscData.end(), cscKey);
232  }
233  CSCHistoMapType* mos = const_cast<CSCHistoMapType*>(&cscPointer->mos);
234  mos->insert(histoKey);
235 
236  } else
237 
239  if (typeid(histo) == ParHistoDefT) {
240  data[id] = mo;
241  }
242 
243 
245  if (mo) {
246  lookupData.insert(lookupData.end(), LookupKeyType(histo, mo));
247  }
248 
249  }
int i
Definition: DBlmapReader.cc:9
unsigned int HwId
static const std::type_info & FEDHistoDefT
DDUMapType dduData
Definition: CSCDQM_Cache.h:128
MonitorObject * data[h::namesSize]
Definition: CSCDQM_Cache.h:117
static const unsigned int namesSize
unsigned int HistoId
HwId dduPointerValue
Definition: CSCDQM_Cache.h:132
static const std::type_info & CSCHistoDefT
DDUMapType::const_iterator dduPointer
Definition: CSCDQM_Cache.h:130
CSCMapType::const_iterator cscPointer
Definition: CSCDQM_Cache.h:137
static const std::type_info & ParHistoDefT
FEDMapType::const_iterator fedPointer
Definition: CSCDQM_Cache.h:122
FEDMapType fedData
Definition: CSCDQM_Cache.h:120
boost::multi_index_container< CSCHistoKeyType, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::composite_key< CSCHistoKeyType, boost::multi_index::member< CSCHistoKeyType, HistoId,&CSCHistoKeyType::id >, boost::multi_index::member< CSCHistoKeyType, HwId,&CSCHistoKeyType::addId > > > > > CSCHistoMapType
Definition: CSCDQM_Cache.h:59
static const std::type_info & DDUHistoDefT
CSCMapType cscData
Definition: CSCDQM_Cache.h:135
static const std::type_info & EMUHistoDefT
LookupMapType lookupData
Definition: CSCDQM_Cache.h:140
HwId fedPointerValue
Definition: CSCDQM_Cache.h:124

Member Data Documentation

CSCMapType cscdqm::Cache::cscData
private

Chamber MO List

Definition at line 135 of file CSCDQM_Cache.h.

Referenced by Cache(), getCSC(), isBookedCSC(), nextBookedCSC(), and put().

CSCMapType::const_iterator cscdqm::Cache::cscPointer
private

Pointer to the Last Chamber object used (cached)

Definition at line 137 of file CSCDQM_Cache.h.

Referenced by Cache(), getCSC(), and put().

MonitorObject* cscdqm::Cache::data[h::namesSize]
private
DDUMapType cscdqm::Cache::dduData
private

DDU MO List

Definition at line 128 of file CSCDQM_Cache.h.

Referenced by Cache(), getDDU(), isBookedDDU(), nextBookedDDU(), put(), and ~Cache().

DDUMapType::const_iterator cscdqm::Cache::dduPointer
private

Pointer to the Last DDU object used (cached)

Definition at line 130 of file CSCDQM_Cache.h.

Referenced by Cache(), getDDU(), and put().

HwId cscdqm::Cache::dduPointerValue
private

Last DDU id used (cached)

Definition at line 132 of file CSCDQM_Cache.h.

Referenced by Cache(), getDDU(), and put().

FEDMapType cscdqm::Cache::fedData
private

FED MO List

Definition at line 120 of file CSCDQM_Cache.h.

Referenced by Cache(), getFED(), isBookedFED(), nextBookedFED(), put(), and ~Cache().

FEDMapType::const_iterator cscdqm::Cache::fedPointer
private

Pointer to the Last FED object used (cached)

Definition at line 122 of file CSCDQM_Cache.h.

Referenced by Cache(), getFED(), and put().

HwId cscdqm::Cache::fedPointerValue
private

Last FED id used (cached)

Definition at line 124 of file CSCDQM_Cache.h.

Referenced by Cache(), getFED(), and put().

LookupMapType cscdqm::Cache::lookupData
private

MO Lookup List

Definition at line 140 of file CSCDQM_Cache.h.

Referenced by put().