Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:27

0001 #ifndef CondFormats_PhysicsToolsObjects_TGraphWriter_h
0002 #define CondFormats_PhysicsToolsObjects_TGraphWriter_h
0003 
0004 /** \class TGraphWriter
0005  *
0006  * Read TGraph objects from ROOT file input
0007  * and store it in SQL-lite output file
0008  *
0009  * \author Christian Veelken, LLR
0010  *
0011  */
0012 
0013 #include "FWCore/Framework/interface/Frameworkfwd.h"
0014 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 
0018 #include <vector>
0019 #include <string>
0020 
0021 class TGraphWriter : public edm::one::EDAnalyzer<> {
0022 public:
0023   TGraphWriter(const edm::ParameterSet&);
0024   ~TGraphWriter();
0025 
0026 private:
0027   virtual void analyze(const edm::Event&, const edm::EventSetup&);
0028 
0029   std::string moduleLabel_;
0030 
0031   bool hasRun_;
0032 
0033   struct jobEntryType {
0034     jobEntryType(const edm::ParameterSet& cfg) {
0035       if (cfg.existsAs<edm::FileInPath>("inputFileName")) {
0036         edm::FileInPath inputFileName_fip = cfg.getParameter<edm::FileInPath>("inputFileName");
0037         if (inputFileName_fip.location() == edm::FileInPath::Unknown)
0038           throw cms::Exception("TGraphWriter") << " Failed to find File = " << inputFileName_fip << " !!\n";
0039         inputFileName_ = inputFileName_fip.fullPath();
0040       } else if (cfg.existsAs<std::string>("inputFileName")) {
0041         inputFileName_ = cfg.getParameter<std::string>("inputFileName");
0042       } else
0043         throw cms::Exception("TGraphWriter") << " Undefined Configuration Parameter 'inputFileName !!\n";
0044       graphName_ = cfg.getParameter<std::string>("graphName");
0045       outputRecord_ = cfg.getParameter<std::string>("outputRecord");
0046     }
0047     ~jobEntryType() {}
0048     std::string inputFileName_;
0049     std::string graphName_;
0050     std::string outputRecord_;
0051   };
0052   std::vector<jobEntryType*> jobs_;
0053 };
0054 
0055 #endif