CMS 3D CMS Logo

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 "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::unique_ptr< Tcreate_impl (const std::string &fFile)
 
template<class T >
std::unique_ptr< Tget_impl (const std::string &fFile)
 
template<class T >
std::unique_ptr< Tget_impl_topo (const std::string &fFile, const HcalTopology *topo)
 
template<class T , template< class > class F>
std::unique_ptr< Tproduce_impl (const std::string &fFile, const HcalTopology *topo=0)
 

Function Documentation

template<class T >
std::unique_ptr<T> create_impl ( const std::string &  fFile)

Definition at line 206 of file HcalTextCalibrations.cc.

206 { return produce_impl<T,HcalTextCalibrations::CheckCreateObject>(fFile); }
template<class T >
std::unique_ptr<T> get_impl ( const std::string &  fFile)

Definition at line 204 of file HcalTextCalibrations.cc.

204 { return produce_impl<T,HcalTextCalibrations::CheckGetObject>(fFile); }
template<class T >
std::unique_ptr<T> get_impl_topo ( const std::string &  fFile,
const HcalTopology topo 
)

Definition at line 205 of file HcalTextCalibrations.cc.

205 { return produce_impl<T,HcalTextCalibrations::CheckGetObjectTopo>(fFile,topo); }
template<class T , template< class > class F>
std::unique_ptr<T> produce_impl ( const std::string &  fFile,
const HcalTopology topo = 0 
)

Definition at line 191 of file HcalTextCalibrations.cc.

References MessageLogger_cfi::cerr, Exception, and mps_fire::result.

191  {
192  std::ifstream inStream (fFile.c_str ());
193  if (!inStream.good ()) {
194  std::cerr << "HcalTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
195  throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
196  }
197  auto result = F<T>(topo)(inStream);
198  if (!result) {
199  std::cerr << "HcalTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
200  throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
201  }
202  return result;
203 }