Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:45

0001 #ifndef DQM_L1TMONITOR_L1TOMDSHELPER_H
0002 #define DQM_L1TMONITOR_L1TOMDSHELPER_H
0003 
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 
0006 #include "CondTools/L1Trigger/interface/OMDSReader.h"
0007 
0008 // ROOT includes
0009 #include "TString.h"
0010 
0011 // System includes
0012 #include <memory>
0013 #include <iostream>
0014 #include <string>
0015 #include <vector>
0016 #include <map>
0017 
0018 // Simplified structure for single object conditions information
0019 class BeamConfiguration {
0020 public:
0021   BeamConfiguration() {
0022     m_valid = false;
0023     nCollidingBunches = 0;
0024   }
0025 
0026   bool bxConfig(int iBx) {
0027     if (beam1[iBx] && beam2[iBx]) {
0028       return true;
0029     } else {
0030       return false;
0031     }
0032   }
0033 
0034   bool isValid() { return m_valid; }
0035 
0036   bool m_valid;
0037   int nCollidingBunches;
0038   std::vector<bool> beam1;
0039   std::vector<bool> beam2;
0040 };
0041 
0042 // Simplified structure for single object conditions information
0043 struct WbMTriggerXSecFit {
0044   TString bitName;        // Bit Name for which the fit refers to
0045   TString fitFunction;    // Fitting function (hard coded for now...)
0046   float bitNumber;        // Bit Number for which the fit refers to
0047   float pm1, p0, p1, p2;  // Fit parameters f(x)=pm1*x^(-1)+p0+p1*x+p2*x^2
0048 };
0049 
0050 class L1TOMDSHelper {
0051 public:
0052   enum Error { NO_ERROR = 0, WARNING_DB_CONN_FAILED, WARNING_DB_QUERY_FAILED, WARNING_DB_INCORRECT_NBUNCHES };
0053 
0054 public:
0055   L1TOMDSHelper();
0056   ~L1TOMDSHelper();  // Destructor
0057 
0058   bool connect(std::string iOracleDB, std::string iPathCondDB, int &error);
0059   std::map<std::string, WbMTriggerXSecFit> getWbMTriggerXsecFits(std::string iTable, int &error);
0060   std::map<std::string, WbMTriggerXSecFit> getWbMAlgoXsecFits(int &error);
0061   std::map<std::string, WbMTriggerXSecFit> getWbMTechXsecFits(int &error);
0062   int getNumberCollidingBunches(int lhcFillNumber, int &error);
0063   BeamConfiguration getBeamConfiguration(int lhcFillNumber, int &error);
0064   std::vector<bool> getBunchStructure(int lhcFillNumber, int &error);
0065   std::vector<float> getInitBunchLumi(int lhcFillNumber, int &error);
0066   std::vector<double> getRelativeBunchLumi(int lhcFillNumber, int &error);
0067 
0068   std::string enumToStringError(int);
0069 
0070 private:
0071   std::string m_oracleDB;
0072   std::string m_pathCondDB;
0073 
0074   l1t::OMDSReader *m_omdsReader;
0075 };
0076 
0077 #endif