CMS 3D CMS Logo

L1TFillWithinLimits.cc
Go to the documentation of this file.
2 
4 
5 namespace dqmoffline {
6 namespace l1t {
7 
13 {
14  TH1 * hist = mon->getTH1F();
15  double min(hist->GetXaxis()->GetXmin());
16  double max(hist->GetXaxis()->GetXmax());
17 
18  double fillValue = getFillValueWithinLimits(value, min, max);
19  mon->Fill(fillValue, weight);
20 
21 }
22 void fill2DWithinLimits(MonitorElement* mon, double valueX, double valueY, double weight)
23 {
24  TH1 * hist = mon->getTH2F();
25  double minX(hist->GetXaxis()->GetXmin());
26  double minY(hist->GetYaxis()->GetXmin());
27 
28  double maxX(hist->GetXaxis()->GetXmax());
29  double maxY(hist->GetYaxis()->GetXmax());
30 
31  double fillValueX = getFillValueWithinLimits(valueX, minX, maxX);
32  double fillValueY = getFillValueWithinLimits(valueY, minY, maxY);
33  mon->Fill(fillValueX, fillValueY, weight);
34 
35 }
36 
37 double getFillValueWithinLimits(double value, double min, double max)
38 {
39  if (value < min)
40  return min;
41 
42  // histograms are [min, max), hence fill with a slightly smaller value
43  if (value > max)
44  return max - 1e-6 * max;
45 
46  return value;
47 }
48 
49 }
50 }
double getFillValueWithinLimits(double value, double min, double max)
TH1F * getTH1F() 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
TH2F * getTH2F() const
void fill2DWithinLimits(MonitorElement *mon, double valueX, double valueY, double weight=1.)
void fillWithinLimits(MonitorElement *mon, double value, double weight=1.)