Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
#include "
FWCore/Framework/interface/ESHandle.h
"
33
34
#include "
FWCore/Utilities/interface/Exception.h
"
35
36
#include "
FWCore/ServiceRegistry/interface/Service.h
"
37
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
38
39
//
40
// class declaration
41
//
42
template
<
class
DataType,
class
RecordType>
43
class
BoostIODBReader
:
public
edm::EDAnalyzer
44
{
45
public
:
46
typedef
DataType
data_type
;
47
typedef
RecordType
record_type
;
48
49
explicit
BoostIODBReader
(
const
edm::ParameterSet
&);
50
inline
virtual
~BoostIODBReader
() {}
51
52
private
:
53
virtual
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
54
55
std::string
outputFile_
;
56
};
57
58
template
<
class
DataType,
class
RecordType>
59
BoostIODBReader<DataType,RecordType>::BoostIODBReader
(
const
edm::ParameterSet
& ps)
60
: outputFile_(ps.getParameter<std::
string
>(
"outputFile"
))
61
{
62
}
63
64
template
<
class
DataType,
class
RecordType>
65
void
BoostIODBReader<DataType,RecordType>::analyze
(
const
edm::Event
&
iEvent
,
66
const
edm::EventSetup
& iSetup)
67
{
68
edm::ESHandle<DataType>
p
;
69
iSetup.
get
<RecordType>().
get
(p);
70
71
std::ofstream of(outputFile_.c_str(), std::ios_base::binary);
72
if
(!of.is_open())
73
throw
cms::Exception
(
"InvalidArgument"
)
74
<<
"Failed to open file \""
<< outputFile_ <<
'"'
<< std::endl;
75
76
eos::portable_oarchive ar(of);
77
ar & *
p
;
78
}
79
80
#endif // CondTools_Hcal_BoostIODBReader_h
BoostIODBReader
Definition:
BoostIODBReader.h:43
Event.h
EventSetup.h
BoostIODBReader::data_type
DataType data_type
Definition:
BoostIODBReader.h:46
Frameworkfwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
ParameterSet.h
iEvent
int iEvent
Definition:
GenABIO.cc:230
edm::ESHandle
Definition:
DTSurvey.h:22
BoostIODBReader::analyze
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
BoostIODBReader.h:65
ESHandle.h
Service.h
edm::EventSetup
Definition:
EventSetup.h:44
edm::EDAnalyzer
Definition:
EDAnalyzer.h:27
EDAnalyzer.h
BoostIODBReader::record_type
RecordType record_type
Definition:
BoostIODBReader.h:47
Exception.h
cms::Exception
Definition:
Exception.h:68
edm::EventSetup::get
const T & get() const
Definition:
EventSetup.h:55
AlCaHLTBitMon_ParallelJobs.p
tuple p
Definition:
AlCaHLTBitMon_ParallelJobs.py:152
BoostIODBReader::outputFile_
std::string outputFile_
Definition:
BoostIODBReader.h:55
edm::ParameterSet
Definition:
ParameterSet.h:35
edm::Event
Definition:
Event.h:59
BoostIODBReader::BoostIODBReader
BoostIODBReader(const edm::ParameterSet &)
Definition:
BoostIODBReader.h:59
BoostIODBReader::~BoostIODBReader
virtual ~BoostIODBReader()
Definition:
BoostIODBReader.h:50
Generated for CMSSW Reference Manual by
1.8.5