Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:33

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/ESHandle.h"
0036 //#include "FWCore/Framework/interface/Event.h"
0037 //#include "FWCore/Framework/interface/LuminosityBlock.h"
0038 //#include "FWCore/Framework/interface/MakerMacros.h"
0039 //
0040 //#include "FWCore/ParameterSet/interface/ParameterSet.h"
0041 //
0042 //#include "DQMServices/Core/interface/DQMStore.h"
0043 //#include "FWCore/ServiceRegistry/interface/Service.h"
0044 //#include "FWCore/MessageLogger/interface/MessageLogger.h"
0045 //
0046 //#include "DQM/L1TMonitor/interface/L1TOMDSHelper.h"
0047 //
0048 //#include <TString.h>
0049 
0050 #include <iostream>
0051 #include <fstream>
0052 #include <string>
0053 #include <vector>
0054 #include <algorithm>
0055 
0056 // Forward declarations
0057 
0058 // Helper
0059 template <class T1, class T2, class Pred = std::less<T1> >
0060 struct sort_pair_first {
0061   bool operator()(const std::pair<T1, T2>& left, const std::pair<T1, T2>& right) {
0062     Pred p;
0063     return p(left.first, right.first);
0064   }
0065 };
0066 
0067 // Class declaration
0068 class L1TLSBlock {
0069 public:
0070   // typedefs
0071   typedef std::vector<std::pair<int, double> > LumiTestDoubleList;
0072   typedef std::vector<std::pair<int, double> > LumiTestIntList;
0073   typedef std::pair<int, int> LumiRange;
0074   typedef std::vector<LumiRange> LumiRangeList;
0075 
0076   enum BLOCKBY { STATISTICS, N_BLOCKINGBY };
0077 
0078 public:
0079   // Constructor
0080   L1TLSBlock();
0081   // Destructor
0082   virtual ~L1TLSBlock();
0083   LumiRangeList doBlocking(const LumiTestDoubleList&, double, BLOCKBY);
0084   LumiRangeList doBlocking(const LumiTestIntList&, int, BLOCKBY);
0085 
0086   // Private Methods
0087 private:
0088   void initializeIO(bool);
0089   void blockByStatistics();
0090   void orderTestDoubleList();
0091   void orderTestIntList();
0092 
0093   double computeErrorFromRange(LumiRange&);
0094 
0095   // Variables
0096 private:
0097   LumiTestIntList inputIntList_;
0098   LumiTestDoubleList inputDoubleList_;
0099   LumiRangeList outputList_;
0100   double thresholdD_;
0101   int thresholdI_;
0102 };
0103 
0104 #endif