CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Friends
edm::service::ELlimitsTable Class Reference

#include <ELlimitsTable.h>

Public Member Functions

bool add (const ELextendedID &xid)
 
 ELlimitsTable ()
 
ELlimitsTableoperator= (const ELlimitsTable &t)
 
void setInterval (const ELstring &id, int interval)
 
void setInterval (const ELseverityLevel &sev, int interval)
 
void setLimit (const ELstring &id, int n)
 
void setLimit (const ELseverityLevel &sev, int n)
 
void setTableLimit (int n)
 
void setTimespan (const ELstring &id, int n)
 
void setTimespan (const ELseverityLevel &sev, int n)
 
void wipe ()
 
void zero ()
 
 ~ELlimitsTable ()
 

Protected Attributes

ELmap_counts counts
 
ELmap_limits limits
 
int severityIntervals [ELseverityLevel::nLevels]
 
int severityLimits [ELseverityLevel::nLevels]
 
int severityTimespans [ELseverityLevel::nLevels]
 
int tableLimit
 
int wildcardInterval
 
int wildcardLimit
 
int wildcardTimespan
 

Friends

class ELdestination
 
class ELoutput
 

Detailed Description

Definition at line 56 of file ELlimitsTable.h.

Constructor & Destructor Documentation

edm::service::ELlimitsTable::ELlimitsTable ( )

Definition at line 38 of file ELlimitsTable.cc.

References MessageLogger_cfi::cerr, gen::k, edm::ELseverityLevel::nLevels, severityIntervals, severityLimits, and severityTimespans.

40 #ifdef ELlimitsTableCONSTRUCTOR_TRACE
41  std::cerr << "Constructor for ELlimitsTable\n";
42 #endif
43 
44  for (int k = 0; k < ELseverityLevel::nLevels; ++k) {
45  severityLimits[k] = -1; // JvR 99-06-10
46  severityIntervals[k] = -1;
47  severityTimespans[k] = -1;
48  }
49 
50  } // ELlimitsTable()
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:89
int severityLimits[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:88
int k[5][pyjets_maxn]
int severityIntervals[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:90
edm::service::ELlimitsTable::~ELlimitsTable ( )

Definition at line 52 of file ELlimitsTable.cc.

References MessageLogger_cfi::cerr.

52  {
53 #ifdef ELlimitsTableCONSTRUCTOR_TRACE
54  std::cerr << "Destructor for ELlimitsTable\n";
55 #endif
56 
57  } // ~ELlimitsTable()

Member Function Documentation

bool edm::service::ELlimitsTable::add ( const ELextendedID xid)

Definition at line 65 of file ELlimitsTable.cc.

References EnergyCorrector::c, MessageLogger_cfi::cerr, counts, edm::ELseverityLevel::getLevel(), edm::ELextendedID::id, checklumidiff::l, limits, edm::ELextendedID::severity, severityIntervals, severityLimits, severityTimespans, tableLimit, wildcardInterval, wildcardLimit, and wildcardTimespan.

Referenced by edm::service::ELoutput::log(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

65  {
66 #ifdef ELlimitsTableATRACE
67  std::cerr << "&&&--- adding to limits table: " << xid.id << '\n';
68 #endif
69 
70  ELmap_counts::iterator c = counts.find(xid);
71 
72  if (c == counts.end()) { // no such entry yet
73 
74 #ifdef ELlimitsTableATRACE
75  std::cerr << "&&& no such entry yet in counts \n";
76 #endif
77 
78  // if the counts table is "full", then this will never be rejected
79  // and info will not be kept so why go through significant work:
80  if (tableLimit > 0 && static_cast<int>(counts.size()) >= tableLimit) {
81  return true;
82  }
83  int lim;
84  int ivl;
85  int ts;
86  ELmap_limits::iterator l = limits.find(xid.id);
87 
88  if (l != limits.end()) { // use limits previously established for this id
89  lim = (*l).second.limit;
90  ivl = (*l).second.interval;
91  ts = (*l).second.timespan;
92  if (lim < 0) { // jvr 6/17/99
93  lim = severityLimits[xid.severity.getLevel()];
94  if (lim < 0) {
95  lim = wildcardLimit;
96  }
97  }
98  if (ivl < 0) {
99  ivl = severityIntervals[xid.severity.getLevel()];
100  if (ivl < 0) {
101  ivl = wildcardInterval; // mf 11/02/07
102  }
103  }
104  if (ts < 0) {
105  ts = severityTimespans[xid.severity.getLevel()];
106  if (ts < 0) {
107  ts = wildcardTimespan;
108  }
109  limits[xid.id] = LimitAndTimespan(lim, ts);
110  }
111 #ifdef ELlimitsTableATRACE
112  std::cerr << "&&& Entry found in limits: limit = " << lim << " interval = " << ivl << " timespan = " << ts
113  << '\n';
114 #endif
115  // change log 9/29/10: Do not put this into limits table
116  } else { // establish and use limits new to this id
117  lim = severityLimits[xid.severity.getLevel()];
118  ivl = severityIntervals[xid.severity.getLevel()];
119  ts = severityTimespans[xid.severity.getLevel()];
120 #ifdef ELlimitsTableATRACE
121  std::cerr << "&&& Limit taken from severityLimits: " << lim << '\n'
122  << "&&& Interval taken from severityLimits: " << ivl << '\n';
123 #endif
124  if (lim < 0) {
125  lim = wildcardLimit;
126 #ifdef ELlimitsTableATRACE
127  std::cerr << "&&& Limit reset to wildcard limit: " << lim << '\n';
128 #endif
129  }
130  if (ivl < 0) {
131  ivl = wildcardInterval;
132 #ifdef ELlimitsTableATRACE
133  std::cerr << "&&& Interval reset to wildcard interval: " << ivl << '\n';
134 #endif
135  }
136 #ifdef ELlimitsTableATRACE
137  std::cerr << "&&& Timespan taken from severityTimespans: " << ts << '\n';
138 #endif
139  if (ts < 0) {
140  ts = wildcardTimespan;
141 #ifdef ELlimitsTableATRACE
142  std::cerr << "&&& timespan reset to wildcard timespan: " << ts << '\n';
143 #endif
144  }
145 
146  // change log 9/29/10 DO not save id's future limits:
147  }
148 
149  // save, if possible, this xid's initial entry:
150  if (tableLimit < 0 || static_cast<int>(counts.size()) < tableLimit)
151  counts[xid] = CountAndLimit(lim, ts, ivl);
152  c = counts.find(xid);
153  }
154 
155  return (c == counts.end()) ? true // no limit filtering can be applied
156  : (*c).second.add() // apply limit filtering
157  ;
158 
159  } // add()
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:89
int severityLimits[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:88
int severityIntervals[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:90
ELlimitsTable & edm::service::ELlimitsTable::operator= ( const ELlimitsTable t)

Definition at line 229 of file ELlimitsTable.cc.

References limits, edm::ELseverityLevel::nLevels, severityTimespans, wildcardLimit, and wildcardTimespan.

229  {
230  if (this == &t) {
231  return *this; // self assignment
232  }
233  limits = t.limits; // The non-trivial operator= for a map!
234 
235  for (int lev = 0; lev < ELseverityLevel::nLevels; ++lev) {
236  severityTimespans[lev] = t.severityTimespans[lev];
237  severityTimespans[lev] = t.severityTimespans[lev];
238  }
239 
240  wildcardLimit = t.wildcardLimit;
241  wildcardTimespan = t.wildcardTimespan;
242 
243  return *this;
244 
245  } // operator=()
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:89
void edm::service::ELlimitsTable::setInterval ( const ELstring id,
int  interval 
)

Definition at line 205 of file ELlimitsTable.cc.

References triggerObjects_cff::id, limits, and wildcardInterval.

Referenced by edm::service::ELdestination::setInterval().

205  {
206  if (id[0] == '*')
207  wildcardInterval = interval;
208  else
209  limits[id].interval = interval;
210  }
void edm::service::ELlimitsTable::setInterval ( const ELseverityLevel sev,
int  interval 
)

Definition at line 212 of file ELlimitsTable.cc.

References edm::ELseverityLevel::getLevel(), and severityIntervals.

212  {
213  severityIntervals[sev.getLevel()] = interval;
214  }
int severityIntervals[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:90
void edm::service::ELlimitsTable::setLimit ( const ELstring id,
int  n 
)

Definition at line 196 of file ELlimitsTable.cc.

References triggerObjects_cff::id, limits, gen::n, and wildcardLimit.

Referenced by edm::service::ELdestination::setLimit().

196  {
197  if (id[0] == '*')
198  wildcardLimit = n;
199  else
200  limits[id].limit = n;
201  }
void edm::service::ELlimitsTable::setLimit ( const ELseverityLevel sev,
int  n 
)

Definition at line 203 of file ELlimitsTable.cc.

References edm::ELseverityLevel::getLevel(), gen::n, and severityLimits.

203 { severityLimits[sev.getLevel()] = n; }
int severityLimits[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:88
void edm::service::ELlimitsTable::setTableLimit ( int  n)

Definition at line 63 of file ELlimitsTable.cc.

References gen::n, and tableLimit.

Referenced by edm::service::ELdestination::setTableLimit().

void edm::service::ELlimitsTable::setTimespan ( const ELstring id,
int  n 
)

Definition at line 216 of file ELlimitsTable.cc.

References triggerObjects_cff::id, limits, gen::n, and wildcardTimespan.

Referenced by edm::service::ELdestination::setTimespan().

216  {
217  if (id[0] == '*')
219  else
220  limits[id].timespan = n;
221  }
void edm::service::ELlimitsTable::setTimespan ( const ELseverityLevel sev,
int  n 
)

Definition at line 223 of file ELlimitsTable.cc.

References edm::ELseverityLevel::getLevel(), gen::n, and severityTimespans.

223 { severityTimespans[sev.getLevel()] = n; }
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:89
void edm::service::ELlimitsTable::wipe ( )

Definition at line 165 of file ELlimitsTable.cc.

References counts, mps_fire::i, limits, edm::ELseverityLevel::nLevels, severityIntervals, severityLimits, severityTimespans, wildcardLimit, and wildcardTimespan.

Referenced by edm::service::ELstatistics::wipe(), and edm::service::ELdestination::wipe().

165  {
166  // This clears everything -- counts and aggregate counts for severity levels
167  // and for individual ID's, as well as any limits established, the limit
168  // for "*" all messages, and the collection of severity defaults. wipe()
169  // does not not affect thresholds.
170 
171  limits.erase(limits.begin(), limits.end());
172  ELmap_counts::iterator i;
173  for (i = counts.begin(); i != counts.end(); ++i) {
174  (*i).second.limit = -1;
175  (*i).second.n = (*i).second.aggregateN = 0;
176  }
177 
178  wildcardLimit = -1;
179  wildcardTimespan = -1;
180  for (int lev = 0; lev < ELseverityLevel::nLevels; ++lev) {
181  severityLimits[lev] = -1;
182  severityIntervals[lev] = -1;
183  severityTimespans[lev] = -1;
184  }
185  }
int severityTimespans[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:89
int severityLimits[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:88
int severityIntervals[ELseverityLevel::nLevels]
Definition: ELlimitsTable.h:90
void edm::service::ELlimitsTable::zero ( )

Definition at line 187 of file ELlimitsTable.cc.

References counts, and mps_fire::i.

Referenced by edm::service::ELstatistics::clearSummary(), edm::service::ELstatistics::zero(), and edm::service::ELdestination::zero().

187  {
188  // This clears counts but not aggregate counts for severity levels
189  // and for individual ID's.
190 
191  ELmap_counts::iterator i;
192  for (i = counts.begin(); i != counts.end(); ++i)
193  (*i).second.n = 0;
194  }

Friends And Related Function Documentation

friend class ELdestination
friend

Definition at line 57 of file ELlimitsTable.h.

friend class ELoutput
friend

Definition at line 58 of file ELlimitsTable.h.

Member Data Documentation

ELmap_counts edm::service::ELlimitsTable::counts
protected

Definition at line 97 of file ELlimitsTable.h.

Referenced by add(), wipe(), and zero().

ELmap_limits edm::service::ELlimitsTable::limits
protected

Definition at line 96 of file ELlimitsTable.h.

Referenced by add(), operator=(), setInterval(), setLimit(), setTimespan(), and wipe().

int edm::service::ELlimitsTable::severityIntervals[ELseverityLevel::nLevels]
protected

Definition at line 90 of file ELlimitsTable.h.

Referenced by add(), ELlimitsTable(), setInterval(), and wipe().

int edm::service::ELlimitsTable::severityLimits[ELseverityLevel::nLevels]
protected

Definition at line 88 of file ELlimitsTable.h.

Referenced by add(), ELlimitsTable(), setLimit(), and wipe().

int edm::service::ELlimitsTable::severityTimespans[ELseverityLevel::nLevels]
protected

Definition at line 89 of file ELlimitsTable.h.

Referenced by add(), ELlimitsTable(), operator=(), setTimespan(), and wipe().

int edm::service::ELlimitsTable::tableLimit
protected

Definition at line 95 of file ELlimitsTable.h.

Referenced by add(), and setTableLimit().

int edm::service::ELlimitsTable::wildcardInterval
protected

Definition at line 92 of file ELlimitsTable.h.

Referenced by add(), and setInterval().

int edm::service::ELlimitsTable::wildcardLimit
protected

Definition at line 91 of file ELlimitsTable.h.

Referenced by add(), operator=(), setLimit(), and wipe().

int edm::service::ELlimitsTable::wildcardTimespan
protected

Definition at line 93 of file ELlimitsTable.h.

Referenced by add(), operator=(), setTimespan(), and wipe().