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/HcalRecNumberingRecord.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 171 of file HcalTextCalibrations.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, Exception, HcalDbASCIIIO::getObject(), and query::result.

171  {
172  std::auto_ptr<T> result (new T (topo));
173  // std::auto_ptr<T> result;
174  std::ifstream inStream (fFile.c_str ());
175  if (!inStream.good ()) {
176  std::cerr << "HcalTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
177  throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
178  }
179  if (!HcalDbASCIIIO::getObject (inStream, &*result)) {
180  std::cerr << "HcalTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
181  throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
182  }
183  return result;
184 }
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 187 of file HcalTextCalibrations.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, Exception, HcalDbASCIIIO::getObject(), and query::result.

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