CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FFTJetCorrectorDBWriter Class Reference

#include <JetMETCorrections/FFTJetModules/plugins/FFTJetCorrectorDBWriter.cc>

Inheritance diagram for FFTJetCorrectorDBWriter:
edm::EDAnalyzer edm::EDConsumerBase

List of all members.

Public Member Functions

 FFTJetCorrectorDBWriter (const edm::ParameterSet &)
virtual ~FFTJetCorrectorDBWriter ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 FFTJetCorrectorDBWriter (const FFTJetCorrectorDBWriter &)
 FFTJetCorrectorDBWriter ()
FFTJetCorrectorDBWriteroperator= (const FFTJetCorrectorDBWriter &)

Private Attributes

std::string inputFile
std::string record

Detailed Description

Description: writes a blob from a file into a database

Implementation: [Notes on implementation]

Definition at line 43 of file FFTJetCorrectorDBWriter.cc.


Constructor & Destructor Documentation

FFTJetCorrectorDBWriter::FFTJetCorrectorDBWriter ( const edm::ParameterSet ps) [explicit]
virtual FFTJetCorrectorDBWriter::~FFTJetCorrectorDBWriter ( ) [inline, virtual]

Definition at line 47 of file FFTJetCorrectorDBWriter.cc.

{}
FFTJetCorrectorDBWriter::FFTJetCorrectorDBWriter ( ) [private]
FFTJetCorrectorDBWriter::FFTJetCorrectorDBWriter ( const FFTJetCorrectorDBWriter ) [private]

Member Function Documentation

void FFTJetCorrectorDBWriter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 66 of file FFTJetCorrectorDBWriter.cc.

References Exception, LaserDQM_cfg::input, inputFile, edm::Service< T >::isAvailable(), and record.

{
    std::auto_ptr<FFTJetCorrectorParameters> fcp;

    {
        std::ifstream input(inputFile.c_str(), std::ios_base::binary);
        if (!input.is_open())
            throw cms::Exception("InvalidArgument")
                << "Failed to open file \"" << inputFile << '"' << std::endl;

        struct stat st;
        if (stat(inputFile.c_str(), &st))
            throw cms::Exception("SystemError")
                << "Failed to stat file \"" << inputFile << '"' << std::endl;

        const std::size_t len = st.st_size;
        fcp = std::auto_ptr<FFTJetCorrectorParameters>(
            new FFTJetCorrectorParameters(len));
        assert(fcp->length() == len);
        if (len)
            input.read(fcp->getBuffer(), len);
        if (input.fail())
            throw cms::Exception("SystemError")
                << "Input stream failure while reading file \""
                << inputFile << '"' << std::endl;
    }

    edm::Service<cond::service::PoolDBOutputService> poolDbService;
    if (poolDbService.isAvailable())
        poolDbService->writeOne(fcp.release(),
                                poolDbService->currentTime(),
                                record);
    else
        throw cms::Exception("ConfigurationError")
            << "PoolDBOutputService is not available, "
            << "please configure it properly" << std::endl;
}
FFTJetCorrectorDBWriter& FFTJetCorrectorDBWriter::operator= ( const FFTJetCorrectorDBWriter ) [private]

Member Data Documentation

std::string FFTJetCorrectorDBWriter::inputFile [private]

Definition at line 56 of file FFTJetCorrectorDBWriter.cc.

Referenced by analyze().

std::string FFTJetCorrectorDBWriter::record [private]

Definition at line 57 of file FFTJetCorrectorDBWriter.cc.

Referenced by analyze().