CMS 3D CMS Logo

BoostIODBReader.h
Go to the documentation of this file.
1 #ifndef CondTools_Hcal_BoostIODBReader_h
2 #define CondTools_Hcal_BoostIODBReader_h
3 
4 // -*- C++ -*-
5 //
6 // Package: CondTools/Hcal
7 // Class: BoostIODBReader
8 //
16 //
17 // Original Author: Igor Volobouev
18 // Created: Fri Apr 25 18:17:13 CDT 2014
19 //
20 //
21 
22 #include <string>
23 #include <fstream>
24 #include <cassert>
25 
26 #include "CondFormats/Serialization/interface/eos/portable_oarchive.hpp"
27 
33 
35 
38 
39 //
40 // class declaration
41 //
42 template <class DataType, class RecordType>
44 public:
46  typedef RecordType record_type;
47 
48  explicit BoostIODBReader(const edm::ParameterSet&);
49  inline ~BoostIODBReader() override {}
50 
51 private:
52  void analyze(const edm::Event&, const edm::EventSetup&) override;
53 
55 };
56 
57 template <class DataType, class RecordType>
59  : outputFile_(ps.getParameter<std::string>("outputFile")) {}
60 
61 template <class DataType, class RecordType>
64  iSetup.get<RecordType>().get(p);
65 
66  std::ofstream of(outputFile_.c_str(), std::ios_base::binary);
67  if (!of.is_open())
68  throw cms::Exception("InvalidArgument") << "Failed to open file \"" << outputFile_ << '"' << std::endl;
69 
70  eos::portable_oarchive ar(of);
71  ar&* p;
72 }
73 
74 #endif // CondTools_Hcal_BoostIODBReader_h
int iEvent
Definition: GenABIO.cc:224
void analyze(const edm::Event &, const edm::EventSetup &) override
RecordType record_type
~BoostIODBReader() override
std::string outputFile_
T get() const
Definition: EventSetup.h:73
BoostIODBReader(const edm::ParameterSet &)