1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
#ifndef DQMOffline_L1Trigger_L1TLSBlock_h
#define DQMOffline_L1Trigger_L1TLSBlock_h
/**
* \class L1TLSBlock
*
*
* Description: offline DQM class for LS blocking
*
* Implementation:
* <TODO: enter implementation details>
*
* \author: Pietro Vischia - LIP Lisbon pietro.vischia@gmail.com
*
* Changelog:
* 2012/10/23 12:01:01: Creation, infrastructure and blocking by statistics
*
* Todo:
* - Activate the "method" string usage instead of base one
* - improve the switch method (instead of calling functions one should define a template - it is probably an uberpain, but would be more neat)
* - in doBlocking, substitute the switch default case with a cms::Exception
* - Cleanup includes
* - Add other blocking methods
* -
*
*
*/
// System include files
//#include <memory>
//#include <unistd.h>
// User include files
//#include "FWCore/Framework/interface/Frameworkfwd.h"
//#include "FWCore/Framework/interface/ESHandle.h"
//#include "FWCore/Framework/interface/Event.h"
//#include "FWCore/Framework/interface/LuminosityBlock.h"
//#include "FWCore/Framework/interface/MakerMacros.h"
//
//#include "FWCore/ParameterSet/interface/ParameterSet.h"
//
//#include "DQMServices/Core/interface/DQMStore.h"
//#include "FWCore/ServiceRegistry/interface/Service.h"
//#include "FWCore/MessageLogger/interface/MessageLogger.h"
//
//#include "DQM/L1TMonitor/interface/L1TOMDSHelper.h"
//
//#include <TString.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
// Forward declarations
// Helper
template <class T1, class T2, class Pred = std::less<T1> >
struct sort_pair_first {
bool operator()(const std::pair<T1, T2>& left, const std::pair<T1, T2>& right) {
Pred p;
return p(left.first, right.first);
}
};
// Class declaration
class L1TLSBlock {
public:
// typedefs
typedef std::vector<std::pair<int, double> > LumiTestDoubleList;
typedef std::vector<std::pair<int, double> > LumiTestIntList;
typedef std::pair<int, int> LumiRange;
typedef std::vector<LumiRange> LumiRangeList;
enum BLOCKBY { STATISTICS, N_BLOCKINGBY };
public:
// Constructor
L1TLSBlock();
// Destructor
virtual ~L1TLSBlock();
LumiRangeList doBlocking(const LumiTestDoubleList&, double, BLOCKBY);
LumiRangeList doBlocking(const LumiTestIntList&, int, BLOCKBY);
// Private Methods
private:
void initializeIO(bool);
void blockByStatistics();
void orderTestDoubleList();
void orderTestIntList();
double computeErrorFromRange(LumiRange&);
// Variables
private:
LumiTestIntList inputIntList_;
LumiTestDoubleList inputDoubleList_;
LumiRangeList outputList_;
double thresholdD_;
int thresholdI_;
};
#endif
|