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

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

Definition at line 196 of file HcalTextCalibrations.cc.

196 { 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 197 of file HcalTextCalibrations.cc.

197 { 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 183 of file HcalTextCalibrations.cc.

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

183  {
184  std::ifstream inStream (fFile.c_str ());
185  if (!inStream.good ()) {
186  std::cerr << "HcalTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
187  throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
188  }
189  auto result = F<T>(topo)(inStream);
190  if (!result) {
191  std::cerr << "HcalTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
192  throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
193  }
194  return result;
195 }