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 167 of file HcalTextCalibrations.cc.

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

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

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

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