Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:21

0001 #ifndef RecoLuminosity_LumiProducer_LumiCorrectionSource_h
0002 #define RecoLuminosity_LumiProducer_LumiCorrectionSource_h
0003 
0004 #include "FWCore/Framework/interface/ESProducer.h"
0005 #include "FWCore/Framework/interface/ModuleFactory.h"
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
0009 #include <memory>
0010 #include <xercesc/dom/DOM.hpp>
0011 #include <xercesc/parsers/XercesDOMParser.hpp>
0012 #include "Utilities/Xerces/interface/Xerces.h"
0013 #include <xercesc/util/XMLString.hpp>
0014 namespace coral {
0015   class ISchema;
0016 }
0017 namespace edm {
0018   class IOVSyncValue;
0019 }
0020 class LumiCorrectionParamRcd;
0021 class LumiCorrectionParam;
0022 /**
0023    retrieve lumi corrections and perrun parameters needed by the correction funcs 
0024  **/
0025 class LumiCorrectionSource : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
0026 public:
0027   LumiCorrectionSource(const edm::ParameterSet&);
0028   typedef std::shared_ptr<const LumiCorrectionParam> ReturnParamType;
0029   ReturnParamType produceLumiCorrectionParam(const LumiCorrectionParamRcd&);
0030   ~LumiCorrectionSource() override;
0031 
0032 protected:
0033   void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
0034                       const edm::IOVSyncValue&,
0035                       edm::ValidityInterval&) override;
0036 
0037 private:
0038   std::string translateFrontierConnect(const std::string& connectStr);
0039   void reloadAuth();
0040   const std::string servletTranslation(const std::string& servlet) const;
0041   std::string x2s(const XMLCh* input) const;
0042   XMLCh* s2x(const std::string& input) const;
0043   std::string toParentString(const xercesc::DOMNode& nodeToConvert) const;
0044 
0045 private:
0046   std::string m_connectStr;
0047   std::string m_authfilename;
0048   std::string m_datatag;
0049   std::string m_globaltag;
0050   std::string m_normtag;
0051   std::string m_siteconfpath;
0052   std::map<unsigned int, std::shared_ptr<const LumiCorrectionParam> > m_paramcache;
0053   bool m_isNullRun;  //if lumi data exist for this run
0054   unsigned int m_paramcachedrun;
0055   unsigned int m_cachesize;
0056   std::shared_ptr<const LumiCorrectionParam> m_paramresult;
0057   const edm::IOVSyncValue* m_pcurrentTime;
0058 
0059 private:
0060   void fillparamcache(unsigned int runnumber);
0061   void parseGlobaltagForLumi(coral::ISchema& schema, const std::string& globaltag);
0062   float fetchIntglumi(coral::ISchema& schema, unsigned int runnumber);
0063 };
0064 #endif