File indexing completed on 2021-02-14 13:12:55
0001 #ifndef DQMOffline_L1Trigger_L1TLSBlock_h
0002 #define DQMOffline_L1Trigger_L1TLSBlock_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 #include <iostream>
0052 #include <fstream>
0053 #include <string>
0054 #include <vector>
0055 #include <algorithm>
0056
0057
0058
0059
0060 template <class T1, class T2, class Pred = std::less<T1> >
0061 struct sort_pair_first {
0062 bool operator()(const std::pair<T1, T2>& left, const std::pair<T1, T2>& right) {
0063 Pred p;
0064 return p(left.first, right.first);
0065 }
0066 };
0067
0068
0069 class L1TLSBlock {
0070 public:
0071
0072 typedef std::vector<std::pair<int, double> > LumiTestDoubleList;
0073 typedef std::vector<std::pair<int, double> > LumiTestIntList;
0074 typedef std::pair<int, int> LumiRange;
0075 typedef std::vector<LumiRange> LumiRangeList;
0076
0077 enum BLOCKBY { STATISTICS, N_BLOCKINGBY };
0078
0079 public:
0080
0081 L1TLSBlock();
0082
0083 virtual ~L1TLSBlock();
0084 LumiRangeList doBlocking(const LumiTestDoubleList&, double, BLOCKBY);
0085 LumiRangeList doBlocking(const LumiTestIntList&, int, BLOCKBY);
0086
0087
0088 private:
0089 void initializeIO(bool);
0090 void blockByStatistics();
0091 void orderTestDoubleList();
0092 void orderTestIntList();
0093
0094 double computeErrorFromRange(LumiRange&);
0095
0096
0097 private:
0098 LumiTestIntList inputIntList_;
0099 LumiTestDoubleList inputDoubleList_;
0100 LumiRangeList outputList_;
0101 double thresholdD_;
0102 int thresholdI_;
0103 };
0104
0105 #endif