CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DQMOffline/L1Trigger/interface/L1TLSBlock.h

Go to the documentation of this file.
00001 #ifndef DQMOffline_L1Trigger_L1TLSBlock_h
00002 #define DQMOffline_L1Trigger_L1TLSBlock_h
00003 
00004 /*
00005  * \class L1TLSBlock
00006  *
00007  *
00008  * Description: offline DQM class for LS blocking
00009  * 
00010  * Implementation:
00011  *   <TODO: enter implementation details>
00012  *
00013  * \author: Pietro Vischia - LIP Lisbon pietro.vischia@gmail.com
00014  *
00015  * Changelog:
00016  *    2012/10/23 12:01:01: Creation, infrastructure and blocking by statistics
00017  *
00018  * Todo:
00019  *  - Activate the "method" string usage instead of base one
00020  *  - improve the switch method (instead of calling functions one should define a template - it is probably an uberpain, but would be more neat)
00021  *  - in doBlocking, substitute the switch default case with a cms::Exception
00022  *  - Cleanup includes
00023  *  - Add other blocking methods
00024  *  - 
00025  *
00026  * $Date: 2012/11/27 14:56:18 $
00027  * $Revision: 1.1 $
00028  *
00029  */
00030 
00031 // System include files
00032 //#include <memory>
00033 //#include <unistd.h>
00034 
00035 // User include files
00036 //#include "FWCore/Framework/interface/Frameworkfwd.h"
00037 //#include "FWCore/Framework/interface/EDAnalyzer.h"
00038 //#include "FWCore/Framework/interface/ESHandle.h"
00039 //#include "FWCore/Framework/interface/Event.h"
00040 //#include "FWCore/Framework/interface/LuminosityBlock.h"
00041 //#include "FWCore/Framework/interface/MakerMacros.h"
00042 //
00043 //#include "FWCore/ParameterSet/interface/ParameterSet.h"
00044 //
00045 //#include "DQMServices/Core/interface/DQMStore.h"
00046 //#include "DQMServices/Core/interface/MonitorElement.h"
00047 //#include "FWCore/ServiceRegistry/interface/Service.h"
00048 //#include "FWCore/MessageLogger/interface/MessageLogger.h"
00049 //
00050 //#include "DQM/L1TMonitor/interface/L1TOMDSHelper.h"
00051 //
00052 //#include <TString.h>
00053 
00054 #include <iostream>
00055 #include <fstream>
00056 #include <string>
00057 #include <vector>
00058 #include <algorithm>
00059 
00060 // Forward declarations
00061 
00062 
00063 
00064 // Helper
00065 template<class T1, class T2, class Pred = std::less<T1> >
00066 struct sort_pair_first {
00067   bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
00068     Pred p;
00069     return p(left.first, right.first);
00070   }
00071 };
00072 
00073 // Class declaration
00074 class L1TLSBlock {
00075   
00076  public: 
00077   // typedefs
00078   typedef std::vector<std::pair<int,double> > LumiTestDoubleList;
00079   typedef std::vector<std::pair<int,double> > LumiTestIntList;
00080   typedef std::pair<int,int> LumiRange;
00081   typedef std::vector<LumiRange> LumiRangeList;
00082   
00083   enum BLOCKBY{STATISTICS, N_BLOCKINGBY};
00084  public:
00085   // Constructor
00086   L1TLSBlock();   
00087   // Destructor
00088   virtual ~L1TLSBlock();                     
00089   LumiRangeList doBlocking(LumiTestDoubleList, double, BLOCKBY);
00090   LumiRangeList doBlocking(LumiTestIntList, int,    BLOCKBY);
00091   
00092   // Private Methods
00093  private:
00094   void initializeIO(bool);
00095   void blockByStatistics();
00096   void orderTestDoubleList();
00097   void orderTestIntList();
00098   
00099   double computeErrorFromRange(LumiRange&);
00100   
00101   // Variables
00102  private:
00103   LumiTestIntList inputIntList_;
00104   LumiTestDoubleList inputDoubleList_;
00105   LumiRangeList outputList_;
00106   double thresholdD_;
00107   int thresholdI_;
00108  
00109 };
00110 
00111 #endif