File indexing completed on 2024-04-06 12:09:35
0001 #include "DQMOffline/L1Trigger/interface/L1TFillWithinLimits.h"
0002
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004
0005 namespace dqmoffline {
0006 namespace l1t {
0007
0008
0009
0010
0011
0012 void fillWithinLimits(MonitorElement* mon, double value, double weight) {
0013 double min(mon->getAxisMin(1));
0014 double max(mon->getAxisMax(1));
0015
0016 double fillValue = getFillValueWithinLimits(value, min, max);
0017 mon->Fill(fillValue, weight);
0018 }
0019 void fill2DWithinLimits(MonitorElement* mon, double valueX, double valueY, double weight) {
0020 double minX(mon->getAxisMin(1));
0021 double minY(mon->getAxisMin(2));
0022
0023 double maxX(mon->getAxisMax(1));
0024 double maxY(mon->getAxisMax(2));
0025
0026 double fillValueX = getFillValueWithinLimits(valueX, minX, maxX);
0027 double fillValueY = getFillValueWithinLimits(valueY, minY, maxY);
0028 mon->Fill(fillValueX, fillValueY, weight);
0029 }
0030
0031 double getFillValueWithinLimits(double value, double min, double max) {
0032 if (value < min)
0033 return min;
0034
0035
0036 if (value > max)
0037 return max - 1e-6 * max;
0038
0039 return value;
0040 }
0041
0042 }
0043 }