test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
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/ESHandle.h"
#include "FWCore/Framework/interface/ValidityInterval.h"
#include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
#include "Geometry/Records/interface/IdealGeometryRecord.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 HcalTopology *topo, const std::string &fFile)
 
template<class T >
std::auto_ptr< Tproduce_impl (const std::string &fFile)
 

Function Documentation

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

Definition at line 163 of file HcalTextCalibrations.cc.

References dtNoiseDBValidation_cfg::cerr, edm::hlt::Exception, HcalDbASCIIIO::getObject(), and query::result.

163  {
164  std::auto_ptr<T> result (new T (topo));
165  // std::auto_ptr<T> result;
166  std::ifstream inStream (fFile.c_str ());
167  if (!inStream.good ()) {
168  std::cerr << "HcalTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
169  throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
170  }
171  if (!HcalDbASCIIIO::getObject (inStream, &*result)) {
172  std::cerr << "HcalTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
173  throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
174  }
175  return result;
176 }
tuple result
Definition: query.py:137
bool getObject(std::istream &fInput, HcalPedestals *fObject)
long double T
template<class T >
std::auto_ptr<T> produce_impl ( const std::string &  fFile)

Definition at line 179 of file HcalTextCalibrations.cc.

References dtNoiseDBValidation_cfg::cerr, edm::hlt::Exception, HcalDbASCIIIO::getObject(), and query::result.

179  {
180  std::auto_ptr<T> result (new T ());
181  // std::auto_ptr<T> result;
182  std::ifstream inStream (fFile.c_str ());
183  if (!inStream.good ()) {
184  std::cerr << "HcalTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
185  throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
186  }
187  if (!HcalDbASCIIIO::getObject (inStream, &*result)) {
188  std::cerr << "HcalTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
189  throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
190  }
191  return result;
192 }
tuple result
Definition: query.py:137
bool getObject(std::istream &fInput, HcalPedestals *fObject)
long double T