CondTools
Hcal
interface
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
28
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
29
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
30
#include "
FWCore/Framework/interface/Event.h
"
31
#include "
FWCore/Framework/interface/EventSetup.h
"
32
33
#include "
FWCore/Utilities/interface/Exception.h
"
34
35
#include "
FWCore/ServiceRegistry/interface/Service.h
"
36
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
37
38
//
39
// class declaration
40
//
41
template
<
class
DataType,
class
RecordType>
42
class
BoostIODBReader
:
public
edm::EDAnalyzer
{
43
public
:
44
typedef
DataType
data_type
;
45
typedef
RecordType
record_type
;
46
47
explicit
BoostIODBReader
(
const
edm::ParameterSet
&);
48
inline
~BoostIODBReader
()
override
{}
49
50
private
:
51
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
52
53
std::string
outputFile_
;
54
};
55
56
template
<
class
DataType,
class
RecordType>
57
BoostIODBReader<DataType, RecordType>::BoostIODBReader
(
const
edm::ParameterSet
& ps)
58
: outputFile_(ps.getParameter<
std
::
string
>(
"outputFile"
)) {}
59
60
template
<
class
DataType,
class
RecordType>
61
void
BoostIODBReader<DataType, RecordType>::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
62
edm::ESGetToken<DataType, RecordType>
tok = esConsumes<DataType, RecordType>();
63
const
DataType
*
p
= &iSetup.
getData
(tok);
64
65
std::ofstream of(outputFile_.c_str(), std::ios_base::binary);
66
if
(!of.is_open())
67
throw
cms::Exception
(
"InvalidArgument"
) <<
"Failed to open file \""
<< outputFile_ <<
'"'
<< std::endl;
68
69
eos::portable_oarchive ar(of);
70
ar&*
p
;
71
}
72
73
#endif // CondTools_Hcal_BoostIODBReader_h
BoostIODBReader::outputFile_
std::string outputFile_
Definition:
BoostIODBReader.h:53
EDAnalyzer.h
edm::EDAnalyzer
Definition:
EDAnalyzer.h:28
BoostIODBReader::~BoostIODBReader
~BoostIODBReader() override
Definition:
BoostIODBReader.h:48
BoostIODBReader::BoostIODBReader
BoostIODBReader(const edm::ParameterSet &)
Definition:
BoostIODBReader.h:57
Service.h
BoostIODBReader::data_type
DataType data_type
Definition:
BoostIODBReader.h:44
edm::ParameterSet
Definition:
ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
Event.h
BoostIODBReader
Definition:
BoostIODBReader.h:42
BoostIODBReader::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
BoostIODBReader.h:61
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:58
edm::ESGetToken
Definition:
EventSetup.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition:
EventSetup.h:127
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:45
HLT_FULL_cff.DataType
DataType
Definition:
HLT_FULL_cff.py:32781
Generated for CMSSW Reference Manual by
1.8.16