CMS 3D CMS Logo

L1TFillWithinLimits.cc
Go to the documentation of this file.
2 
4 
5 namespace dqmoffline {
6  namespace l1t {
7 
12  void fillWithinLimits(MonitorElement* mon, double value, double weight) {
13  double min(mon->getAxisMin(1));
14  double max(mon->getAxisMax(1));
15 
16  double fillValue = getFillValueWithinLimits(value, min, max);
17  mon->Fill(fillValue, weight);
18  }
19  void fill2DWithinLimits(MonitorElement* mon, double valueX, double valueY, double weight) {
20  double minX(mon->getAxisMin(1));
21  double minY(mon->getAxisMin(2));
22 
23  double maxX(mon->getAxisMax(1));
24  double maxY(mon->getAxisMax(2));
25 
26  double fillValueX = getFillValueWithinLimits(valueX, minX, maxX);
27  double fillValueY = getFillValueWithinLimits(valueY, minY, maxY);
28  mon->Fill(fillValueX, fillValueY, weight);
29  }
30 
31  double getFillValueWithinLimits(double value, double min, double max) {
32  if (value < min)
33  return min;
34 
35  // histograms are [min, max), hence fill with a slightly smaller value
36  if (value > max)
37  return max - 1e-6 * max;
38 
39  return value;
40  }
41 
42  } // namespace l1t
43 } // namespace dqmoffline
double getFillValueWithinLimits(double value, double min, double max)
virtual double getAxisMin(int axis=1) const
Definition: weight.py:1
delete x;
Definition: CaloConfig.h:22
void Fill(long long x)
Definition: value.py:1
T min(T a, T b)
Definition: MathUtil.h:58
void fill2DWithinLimits(MonitorElement *mon, double valueX, double valueY, double weight=1.)
void fillWithinLimits(MonitorElement *mon, double value, double weight=1.)
virtual double getAxisMax(int axis=1) const