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/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< Tproduce_impl (const HcalTopology *topo, const std::string &fFile)
 
template<class T >
std::unique_ptr< Tproduce_impl (const std::string &fFile)
 

Function Documentation

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

Definition at line 184 of file HcalTextCalibrations.cc.

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

184  {
185  auto result = std::make_unique<T>(topo);
186  // std::unique_ptr<T> result;
187  std::ifstream inStream (fFile.c_str ());
188  if (!inStream.good ()) {
189  std::cerr << "HcalTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
190  throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
191  }
192  if (!HcalDbASCIIIO::getObject (inStream, &*result)) {
193  std::cerr << "HcalTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
194  throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
195  }
196  return result;
197 }
tuple result
Definition: mps_fire.py:84
bool getObject(std::istream &fInput, HcalPedestals *fObject)
template<class T >
std::unique_ptr<T> produce_impl ( const std::string &  fFile)

Definition at line 200 of file HcalTextCalibrations.cc.

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

200  {
201  auto result = std::make_unique<T>();
202  // std::unique_ptr<T> result;
203  std::ifstream inStream (fFile.c_str ());
204  if (!inStream.good ()) {
205  std::cerr << "HcalTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
206  throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
207  }
208  if (!HcalDbASCIIIO::getObject (inStream, &*result)) {
209  std::cerr << "HcalTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
210  throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
211  }
212  return result;
213 }
tuple result
Definition: mps_fire.py:84
bool getObject(std::istream &fInput, HcalPedestals *fObject)