TGraphWriter

jobEntryType

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
#ifndef CondFormats_PhysicsToolsObjects_TGraphWriter_h
#define CondFormats_PhysicsToolsObjects_TGraphWriter_h

/** \class TGraphWriter
 *
 * Read TGraph objects from ROOT file input
 * and store it in SQL-lite output file
 *
 * \author Christian Veelken, LLR
 *
 */

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include <vector>
#include <string>

class TGraphWriter : public edm::one::EDAnalyzer<> {
public:
  TGraphWriter(const edm::ParameterSet&);
  ~TGraphWriter();

private:
  virtual void analyze(const edm::Event&, const edm::EventSetup&);

  std::string moduleLabel_;

  bool hasRun_;

  struct jobEntryType {
    jobEntryType(const edm::ParameterSet& cfg) {
      if (cfg.existsAs<edm::FileInPath>("inputFileName")) {
        edm::FileInPath inputFileName_fip = cfg.getParameter<edm::FileInPath>("inputFileName");
        if (inputFileName_fip.location() == edm::FileInPath::Unknown)
          throw cms::Exception("TGraphWriter") << " Failed to find File = " << inputFileName_fip << " !!\n";
        inputFileName_ = inputFileName_fip.fullPath();
      } else if (cfg.existsAs<std::string>("inputFileName")) {
        inputFileName_ = cfg.getParameter<std::string>("inputFileName");
      } else
        throw cms::Exception("TGraphWriter") << " Undefined Configuration Parameter 'inputFileName !!\n";
      graphName_ = cfg.getParameter<std::string>("graphName");
      outputRecord_ = cfg.getParameter<std::string>("outputRecord");
    }
    ~jobEntryType() {}
    std::string inputFileName_;
    std::string graphName_;
    std::string outputRecord_;
  };
  std::vector<jobEntryType*> jobs_;
};

#endif