CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/CalibCalorimetry/HcalPlugins/src/HcalTextCalibrations.cc File Reference

#include <memory>
#include <iostream>
#include <fstream>
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/ParameterSet/interface/FileInPath.h"
#include "FWCore/Framework/interface/ValidityInterval.h"
#include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
#include "CondFormats/DataRecord/interface/HcalAllRcds.h"
#include "HcalTextCalibrations.h"

Go to the source code of this file.

Functions

template<class T >
std::auto_ptr< Tproduce_impl (const std::string &fFile)

Function Documentation

template<class T >
std::auto_ptr<T> produce_impl ( const std::string &  fFile)

Definition at line 158 of file HcalTextCalibrations.cc.

References benchmark_cfg::cerr, Exception, HcalDbASCIIIO::getObject(), and query::result.

                                                     {
  std::auto_ptr<T> result (new T ());
  //  std::auto_ptr<T> result;
  std::ifstream inStream (fFile.c_str ());
  if (!inStream.good ()) {
    std::cerr << "HcalTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
    throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
  }
  if (!HcalDbASCIIIO::getObject (inStream, &*result)) {
    std::cerr << "HcalTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
    throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
  }
  return result;
}