Back to home page

Project CMSSW displayed by LXR

 
 

    


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  * \class L1TLSBlock
0006  *
0007  *
0008  * Description: offline DQM class for LS blocking
0009  * 
0010  * Implementation:
0011  *   <TODO: enter implementation details>
0012  *
0013  * \author: Pietro Vischia - LIP Lisbon pietro.vischia@gmail.com
0014  *
0015  * Changelog:
0016  *    2012/10/23 12:01:01: Creation, infrastructure and blocking by statistics
0017  *
0018  * Todo:
0019  *  - Activate the "method" string usage instead of base one
0020  *  - improve the switch method (instead of calling functions one should define a template - it is probably an uberpain, but would be more neat)
0021  *  - in doBlocking, substitute the switch default case with a cms::Exception
0022  *  - Cleanup includes
0023  *  - Add other blocking methods
0024  *  - 
0025  *
0026  *
0027  */
0028 
0029 // System include files
0030 //#include <memory>
0031 //#include <unistd.h>
0032 
0033 // User include files
0034 //#include "FWCore/Framework/interface/Frameworkfwd.h"
0035 //#include "FWCore/Framework/interface/EDAnalyzer.h"
0036 //#include "FWCore/Framework/interface/ESHandle.h"
0037 //#include "FWCore/Framework/interface/Event.h"
0038 //#include "FWCore/Framework/interface/LuminosityBlock.h"
0039 //#include "FWCore/Framework/interface/MakerMacros.h"
0040 //
0041 //#include "FWCore/ParameterSet/interface/ParameterSet.h"
0042 //
0043 //#include "DQMServices/Core/interface/DQMStore.h"
0044 //#include "FWCore/ServiceRegistry/interface/Service.h"
0045 //#include "FWCore/MessageLogger/interface/MessageLogger.h"
0046 //
0047 //#include "DQM/L1TMonitor/interface/L1TOMDSHelper.h"
0048 //
0049 //#include <TString.h>
0050 
0051 #include <iostream>
0052 #include <fstream>
0053 #include <string>
0054 #include <vector>
0055 #include <algorithm>
0056 
0057 // Forward declarations
0058 
0059 // Helper
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 // Class declaration
0069 class L1TLSBlock {
0070 public:
0071   // typedefs
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   // Constructor
0081   L1TLSBlock();
0082   // Destructor
0083   virtual ~L1TLSBlock();
0084   LumiRangeList doBlocking(const LumiTestDoubleList&, double, BLOCKBY);
0085   LumiRangeList doBlocking(const LumiTestIntList&, int, BLOCKBY);
0086 
0087   // Private Methods
0088 private:
0089   void initializeIO(bool);
0090   void blockByStatistics();
0091   void orderTestDoubleList();
0092   void orderTestIntList();
0093 
0094   double computeErrorFromRange(LumiRange&);
0095 
0096   // Variables
0097 private:
0098   LumiTestIntList inputIntList_;
0099   LumiTestDoubleList inputDoubleList_;
0100   LumiRangeList outputList_;
0101   double thresholdD_;
0102   int thresholdI_;
0103 };
0104 
0105 #endif