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
ESHandle.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BoostIODBReader::outputFile_
std::string outputFile_
Definition: BoostIODBReader.h:54
EDAnalyzer.h
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
BoostIODBReader::~BoostIODBReader
~BoostIODBReader() override
Definition: BoostIODBReader.h:49
BoostIODBReader::BoostIODBReader
BoostIODBReader(const edm::ParameterSet &)
Definition: BoostIODBReader.h:58
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
Service.h
BoostIODBReader::data_type
DataType data_type
Definition: BoostIODBReader.h:45
edm::ESHandle
Definition: DTSurvey.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
BoostIODBReader
Definition: BoostIODBReader.h:43
BoostIODBReader::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: BoostIODBReader.h:62
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
EventSetup.h
Exception.h
cms::Exception
Definition: Exception.h:70
ParameterSet.h
edm::Event
Definition: Event.h:73
BoostIODBReader::record_type
RecordType record_type
Definition: BoostIODBReader.h:46
HLT_FULL_cff.DataType
DataType
Definition: HLT_FULL_cff.py:32765