Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
UAEDF-tomc committed Apr 29, 2014
1 parent a26361d commit 6ab50c1
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 359 deletions.
40 changes: 4 additions & 36 deletions JetMETCorrections/Modules/interface/QGLikelihoodESProducer.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
#ifndef JetMETCorrections_Modules_QGLikelihoodESProducer_h
#define JetMETCorrections_Modules_QGLikelihoodESProducer_h

// -*- C++ -*-
//
// Package: JetMETCorrections/QGLikelihoodESProducer
// Class: QGLikelihoodESProducer
//
/**\class QGLikelihoodESProducer QGLikelihoodESProducer.h JetMETCorrections/QGLikelihoodESProducer/plugins/QGLikelihoodESProducer.cc
Description: ESProducer to get the quark-gluon likelihood object "QGLikelihoodObject"
from record "QGLikelihoodRcd".
Implementation:
Completely trivial, simply returns the QGLikelihoodObject to the user. There is only
one QGLikelihoodObject object in each record.
*/
//
// Original Author: Salvatore Rappoccio
// Created: Thu, 13 Mar 2014 15:02:39 GMT
//
//


// system include files
#include <memory>
#include <iostream>
#include "boost/shared_ptr.hpp"

// user include files
Expand All @@ -39,25 +17,15 @@
#include "CondFormats/DataRecord/interface/QGLikelihoodRcd.h"


//
// class declaration
//

class QGLikelihoodESProducer : public edm::ESProducer { //, public edm::EventSetupRecordIntervalFinder {
class QGLikelihoodESProducer : public edm::ESProducer{
public:
QGLikelihoodESProducer(const edm::ParameterSet&);
~QGLikelihoodESProducer();

typedef boost::shared_ptr<QGLikelihoodObject> ReturnType;
~QGLikelihoodESProducer(){};

ReturnType produce(const QGLikelihoodRcd&);
boost::shared_ptr<QGLikelihoodObject> produce(const QGLikelihoodRcd&);
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &);

/// set validity interval
void setIntervalFor( const edm::eventsetup::EventSetupRecordKey &,
const edm::IOVSyncValue &,
edm::ValidityInterval & );
private:
// ----------member data ---------------------------
std::string mAlgo;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
#ifndef JetMETCorrections_Modules_QGLikelihoodSystematicsESProducer_h
#define JetMETCorrections_Modules_QGLikelihoodSystematicsESProducer_h

// -*- C++ -*-
//
// Package: JetMETCorrections/QGLikelihoodSystematicsESProducer
// Class: QGLikelihoodSystematicsESProducer
//
/**\class QGLikelihoodSystematicsESProducer QGLikelihoodSystematicsESProducer.h JetMETCorrections/QGLikelihoodSystematicsESProducer/plugins/QGLikelihoodSystematicsESProducer.cc
Description: ESProducer to get the quark-gluon likelihood object "QGLikelihoodObject"
from record "QGLikelihoodRcd".
Implementation:
Completely trivial, simply returns the QGLikelihoodObject to the user. There is only
one QGLikelihoodObject object in each record.
*/
//
// Original Author: Salvatore Rappoccio
// Created: Thu, 13 Mar 2014 15:02:39 GMT
//
//


// system include files
#include <memory>
#include <iostream>
#include "boost/shared_ptr.hpp"

// user include files
Expand All @@ -36,28 +14,17 @@

#include "FWCore/Framework/interface/ESProducts.h"
#include "CondFormats/JetMETObjects/interface/QGLikelihoodObject.h"
#include "CondFormats/DataRecord/interface/QGLikelihoodRcd.h"
#include "CondFormats/DataRecord/interface/QGLikelihoodSystematicsRcd.h"


//
// class declaration
//

class QGLikelihoodSystematicsESProducer : public edm::ESProducer { //, public edm::EventSetupRecordIntervalFinder {
class QGLikelihoodSystematicsESProducer : public edm::ESProducer{
public:
QGLikelihoodSystematicsESProducer(const edm::ParameterSet&);
~QGLikelihoodSystematicsESProducer();

typedef boost::shared_ptr<QGLikelihoodSystematicsObject> ReturnType;

ReturnType produce(const QGLikelihoodRcd&);
~QGLikelihoodSystematicsESProducer(){};

/// set validity interval
void setIntervalFor( const edm::eventsetup::EventSetupRecordKey &,
const edm::IOVSyncValue &,
edm::ValidityInterval & );
boost::shared_ptr<QGLikelihoodSystematicsObject> produce(const QGLikelihoodSystematicsRcd&);
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &);
private:
// ----------member data ---------------------------
std::string mAlgo;
};

Expand Down
105 changes: 0 additions & 105 deletions JetMETCorrections/Modules/plugins/QGLikelihoodDBReader.cc

This file was deleted.

12 changes: 3 additions & 9 deletions JetMETCorrections/Modules/plugins/QGLikelihoodDBWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@

#include "TFile.h"
#include "TList.h"
#include "TString.h"
#include "TKey.h"
#include "TH1.h"
#include <sstream>
#include <stdlib.h>
#include <vector>
#include <iterator>
#include <algorithm>
#include <sstream>
#include <memory>
#include <string>
#include <fstream>
#include <iostream>
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
Expand Down Expand Up @@ -62,7 +56,7 @@ void QGLikelihoodDBWriter::beginJob(){

// Get the ROOT files and the keys to the histogram
TFile *f = TFile::Open(edm::FileInPath(inputRootFile.c_str()).fullPath().c_str());
TList * keys = f->GetListOfKeys();
TList *keys = f->GetListOfKeys();
if(!keys){
edm::LogError("NoKeys") << "There are no keys in the input file." << std::endl;
return;
Expand Down Expand Up @@ -147,7 +141,7 @@ void QGLikelihoodDBWriter::beginJob(){
entry.category = category;
entry.histogram = histogram;
entry.mean = th1hist->GetMean();
payload->data.push_back( entry );
payload->data.push_back(entry);
}
}

Expand All @@ -166,7 +160,7 @@ void QGLikelihoodDBWriter::beginJob(){

edm::Service<cond::service::PoolDBOutputService> s;
if(s.isAvailable()){
edm::LogInfo ("UserOutput") << "Setting up payload with " << payload->data.size() << " entries and tag " << payloadTag << std::endl;
edm::LogInfo("UserOutput") << "Setting up payload with " << payload->data.size() << " entries and tag " << payloadTag << std::endl;
if (s->isNewTagRequest(payloadTag)) s->createNewIOV<QGLikelihoodObject>(payload, s->beginOfTime(), s->endOfTime(), payloadTag);
else s->appendSinceTime<QGLikelihoodObject>(payload, 111, payloadTag);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
// Author: Benedikt Hegner, Tom Cornelis
// Email: [email protected], [email protected]

#include <sstream>
#include <stdlib.h>
#include <vector>
#include <iterator>
#include <algorithm>
#include <sstream>
#include <memory>
#include <string>
#include <fstream>
#include <iostream>
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
Expand Down
64 changes: 10 additions & 54 deletions JetMETCorrections/Modules/src/QGLikelihoodESProducer.cc
Original file line number Diff line number Diff line change
@@ -1,78 +1,34 @@
// -*- C++ -*-
//
// Package: JetMETCorrections/QGLikelihoodESProducer
// Class: QGLikelihoodESProducer
//
/**\class QGLikelihoodESProducer QGLikelihoodESProducer.h JetMETCorrections/QGLikelihoodESProducer/plugins/QGLikelihoodESProducer.cc
/*
Description: ESProducer to get the quark-gluon likelihood object "QGLikelihoodObject"
from record "QGLikelihoodRcd".
Implementation:
Completely trivial, simply returns the QGLikelihoodObject to the user. There is only
one QGLikelihoodObject object in each record.
*/
//
// Original Author: Salvatore Rappoccio
// Created: Thu, 13 Mar 2014 15:02:39 GMT
//
//


#include "JetMETCorrections/Modules/interface/QGLikelihoodESProducer.h"

//
// constants, enums and typedefs
//

//
// static data member definitions
//

//
// constructors and destructor
//
QGLikelihoodESProducer::QGLikelihoodESProducer(const edm::ParameterSet& iConfig)
{
QGLikelihoodESProducer::QGLikelihoodESProducer(const edm::ParameterSet& iConfig){
//the following line is needed to tell the framework what
// data is being produced
std::string label(iConfig.getParameter<std::string>("@module_label"));
mAlgo = iConfig.getParameter<std::string>("algo");
std::string label = iConfig.getParameter<std::string>("@module_label");
mAlgo = iConfig.getParameter<std::string>("algo");
setWhatProduced(this, label);
//findingRecordWithKey<QGLikelihoodRcd>();
}


QGLikelihoodESProducer::~QGLikelihoodESProducer()
{
// The same PDF's are valid for any time
void QGLikelihoodESProducer::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue&, edm::ValidityInterval& oInterval){
oInterval = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime());
}


//
// member functions
//

void
QGLikelihoodESProducer::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
const edm::IOVSyncValue&,
edm::ValidityInterval& oInterval ) {
// the same PDF's is valid for any time
oInterval = edm::ValidityInterval (edm::IOVSyncValue::beginOfTime (),
edm::IOVSyncValue::endOfTime ()) ;
}

// ------------ method called to produce the data ------------
QGLikelihoodESProducer::ReturnType
QGLikelihoodESProducer::produce(const QGLikelihoodRcd& iRecord)
{
using namespace edm::es;
// boost::shared_ptr<QGLikelihoodObject> pQGLikelihoodObject;
// return products(pQGLikelihoodObject);

// Produce the data
boost::shared_ptr<QGLikelihoodObject> QGLikelihoodESProducer::produce(const QGLikelihoodRcd& iRecord){
edm::ESHandle<QGLikelihoodObject> qglObj;
iRecord.get(mAlgo, qglObj);

boost::shared_ptr<QGLikelihoodObject> pMyType( new QGLikelihoodObject(*qglObj) );
boost::shared_ptr<QGLikelihoodObject> pMyType(new QGLikelihoodObject(*qglObj));
return pMyType;

}
Loading

0 comments on commit 6ab50c1

Please sign in to comment.