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 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 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...
 
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
 
LookupMapType lookupData
 

Detailed Description

MonitorObject cache - list objects and routines to manage cache.

Definition at line 109 of file CSCDQM_Cache.h.

Constructor & Destructor Documentation

cscdqm::Cache::Cache ( )
inline

Cache Constructor

Initialize EMU and PAR static array with zero's

Initialize DDU and CSC cached pointers

Definition at line 134 of file CSCDQM_Cache.h.

References cscData, cscPointer, data, dduData, dduPointer, dduPointerValue, i, and h::namesSize.

134  {
135 
137  for (unsigned int i = 0; i < h::namesSize; i++) data[i] = 0;
138 
140  dduPointer = dduData.end();
141  dduPointerValue = 0;
142  cscPointer = cscData.end();
143  }
int i
Definition: DBlmapReader.cc:9
DDUMapType dduData
Definition: CSCDQM_Cache.h:117
MonitorObject * data[h::namesSize]
Definition: CSCDQM_Cache.h:114
HwId dduPointerValue
Definition: CSCDQM_Cache.h:121
DDUMapType::const_iterator dduPointer
Definition: CSCDQM_Cache.h:119
CSCMapType::const_iterator cscPointer
Definition: CSCDQM_Cache.h:126
CSCMapType cscData
Definition: CSCDQM_Cache.h:124
static const unsigned int namesSize
cscdqm::Cache::~Cache ( )
inline

Destructor

Clear DDU MO static arrays

Definition at line 146 of file CSCDQM_Cache.h.

References dduData.

146  {
148  while (dduData.begin() != dduData.end()) {
149  if (dduData.begin()->second) {
150  delete [] dduData.begin()->second;
151  }
152  dduData.erase(dduData.begin());
153  }
154  }
DDUMapType dduData
Definition: CSCDQM_Cache.h:117

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::HistoDef::getAddId(), cscdqm::HistoDef::getCrateId(), getCSC(), getDDU(), cscdqm::HistoDef::getDDUId(), cscdqm::HistoDef::getDMBId(), getEMU(), cscdqm::HistoDef::getId(), getPar(), and cscdqm::ParHistoDefT.

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

29  {
30 
31  if (typeid(histo) == EMUHistoDefT) {
32  return getEMU(histo.getId(), mo);
33  } else
34  if (typeid(histo) == DDUHistoDefT) {
35  return getDDU(histo.getId(), histo.getDDUId(), mo);
36  } else
37  if (typeid(histo) == CSCHistoDefT) {
38  return getCSC(histo.getId(), histo.getCrateId(), histo.getDMBId(), histo.getAddId(), mo);
39  } else
40  if (typeid(histo) == ParHistoDefT) {
41  return getPar(histo.getId(), mo);
42  }
43 
44  return false;
45  }
const bool getEMU(const HistoId &id, MonitorObject *&mo)
Get EMU MO on Histogram Id.
Definition: CSCDQM_Cache.cc:53
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.
Definition: CSCDQM_Cache.cc:68
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.
Definition: CSCDQM_Cache.cc:97
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 97 of file CSCDQM_Cache.cc.

References cscData, and cscPointer.

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

97  {
98 
100  if (cscPointer == cscData.end() || cscPointer->crateId != crateId || cscPointer->dmbId != dmbId) {
101  cscPointer = cscData.find(boost::make_tuple(crateId, dmbId));
102  }
103 
105  if (cscPointer != cscData.end()) {
106  CSCHistoMapType::const_iterator hit = cscPointer->mos.find(boost::make_tuple(id, addId));
107  if (hit != cscPointer->mos.end()) {
108  mo = const_cast<MonitorObject*>(hit->mo);
109  return true;
110  }
111  }
112  return false;
113  }
CSCMapType::const_iterator cscPointer
Definition: CSCDQM_Cache.h:126
CSCMapType cscData
Definition: CSCDQM_Cache.h:124
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 68 of file CSCDQM_Cache.cc.

References dduData, dduPointer, and dduPointerValue.

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

68  {
69 
71  if (dduPointerValue != dduId) {
72  dduPointer = dduData.find(dduId);
73  if (dduPointer == dduData.end()) {
74  dduPointerValue = 0;
75  return false;
76  }
77  dduPointerValue = dduId;
78  }
79 
81  if (dduPointer->second[id]) {
82  mo = dduPointer->second[id];
83  return true;
84  }
85  return false;
86 
87  }
DDUMapType dduData
Definition: CSCDQM_Cache.h:117
HwId dduPointerValue
Definition: CSCDQM_Cache.h:121
DDUMapType::const_iterator dduPointer
Definition: CSCDQM_Cache.h:119
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 53 of file CSCDQM_Cache.cc.

References data.

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

53  {
54  if (data[id]) {
55  mo = data[id];
56  return true;
57  }
58  return false;
59  }
MonitorObject * data[h::namesSize]
Definition: CSCDQM_Cache.h:114
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 121 of file CSCDQM_Cache.cc.

References data.

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

121  {
122  if (data[id]) {
123  mo = data[id];
124  return true;
125  }
126  return false;
127  }
MonitorObject * data[h::namesSize]
Definition: CSCDQM_Cache.h:114
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 241 of file CSCDQM_Cache.cc.

References cscData.

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

241  {
242  CSCMapType::const_iterator it = cscData.find(boost::make_tuple(crateId, dmbId));
243  if (it != cscData.end()) {
244  return true;
245  }
246  return false;
247  }
CSCMapType cscData
Definition: CSCDQM_Cache.h:124
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 254 of file CSCDQM_Cache.cc.

References dduData.

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

254  {
255  DDUMapType::const_iterator iter = dduData.find(dduId);
256  return (iter != dduData.end());
257  }
DDUMapType dduData
Definition: CSCDQM_Cache.h:117
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 206 of file CSCDQM_Cache.cc.

References cscData, and i.

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

206  {
207  if (n < cscData.size()) {
208  CSCMapType::const_iterator iter = cscData.begin();
209  for (unsigned int i = n; i > 0; i--) iter++;
210  crateId = iter->crateId;
211  dmbId = iter->dmbId;
212  n++;
213  return true;
214  }
215  return false;
216  }
int i
Definition: DBlmapReader.cc:9
CSCMapType cscData
Definition: CSCDQM_Cache.h:124
const bool cscdqm::Cache::nextBookedDDU ( unsigned int &  n,
unsigned int &  dduId 
) const

Iterator to get booked DDU identifier on enumerator.

Utility methods

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

Definition at line 224 of file CSCDQM_Cache.cc.

References dduData, and i.

224  {
225  if (n < dduData.size()) {
226  DDUMapType::const_iterator iter = dduData.begin();
227  for (unsigned int i = n; i > 0; i--) iter++;
228  dduId = iter->first;
229  n++;
230  return true;
231  }
232  return false;
233  }
int i
Definition: DBlmapReader.cc:9
DDUMapType dduData
Definition: CSCDQM_Cache.h:117
void cscdqm::Cache::put ( const HistoDef histo,
MonitorObject mo 
)

Put Monitoring Object into cache.

Parameters
histoHistogram Definition
moMonitoring Object to put
Returns

EMU MO

DDU MO

CSC MO

Parameter MO

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

Definition at line 135 of file CSCDQM_Cache.cc.

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

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

135  {
136 
137  HistoId id = histo.getId();
138 
140  if (typeid(histo) == EMUHistoDefT) {
141  data[id] = mo;
142  } else
143 
145  if (typeid(histo) == DDUHistoDefT) {
146 
147  HwId dduId = histo.getDDUId();
148 
149  if (dduPointerValue != dduId) {
150  dduPointer = dduData.find(dduId);
151  }
152 
153  if (dduPointer == dduData.end()) {
154  MonitorObject** mos = new MonitorObject*[h::namesSize];
155  for (unsigned int i = 0; i < h::namesSize; i++) mos[i] = 0;
156  dduPointer = dduData.insert(dduData.end(), std::make_pair(dduId, mos));
157  }
158 
159  dduPointer->second[id] = mo;
160  dduPointerValue = dduId;
161 
162  } else
163 
165  if (typeid(histo) == CSCHistoDefT) {
166 
167  HwId crateId = histo.getCrateId();
168  HwId dmbId = histo.getDMBId();
169  HwId addId = histo.getAddId();
170 
171  CSCHistoKeyType histoKey(id, addId, mo);
172 
173  if (cscPointer == cscData.end() || cscPointer->crateId != crateId || cscPointer->dmbId != dmbId) {
174  cscPointer = cscData.find(boost::make_tuple(crateId, dmbId));
175  }
176 
177  if (cscPointer == cscData.end()) {
178  CSCKeyType cscKey(crateId, dmbId);
179  cscPointer = cscData.insert(cscData.end(), cscKey);
180  }
181  CSCHistoMapType* mos = const_cast<CSCHistoMapType*>(&cscPointer->mos);
182  mos->insert(histoKey);
183 
184  } else
185 
187  if (typeid(histo) == ParHistoDefT) {
188  data[id] = mo;
189  }
190 
191 
193  if (mo) {
194  lookupData.insert(lookupData.end(), LookupKeyType(histo, mo));
195  }
196 
197  }
int i
Definition: DBlmapReader.cc:9
unsigned int HwId
DDUMapType dduData
Definition: CSCDQM_Cache.h:117
MonitorObject * data[h::namesSize]
Definition: CSCDQM_Cache.h:114
unsigned int HistoId
HwId dduPointerValue
Definition: CSCDQM_Cache.h:121
static const std::type_info & CSCHistoDefT
DDUMapType::const_iterator dduPointer
Definition: CSCDQM_Cache.h:119
CSCMapType::const_iterator cscPointer
Definition: CSCDQM_Cache.h:126
static const std::type_info & ParHistoDefT
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:124
static const std::type_info & EMUHistoDefT
static const unsigned int namesSize
LookupMapType lookupData
Definition: CSCDQM_Cache.h:129

Member Data Documentation

CSCMapType cscdqm::Cache::cscData
private

Chamber MO List

Definition at line 124 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 126 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 117 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 119 of file CSCDQM_Cache.h.

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

HwId cscdqm::Cache::dduPointerValue
private

Last DDU id used (cached)

Definition at line 121 of file CSCDQM_Cache.h.

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

LookupMapType cscdqm::Cache::lookupData
private

MO Lookup List

Definition at line 129 of file CSCDQM_Cache.h.

Referenced by put().