CondTools
RunInfo
plugins
RunSummaryESAnalyzer.cc
Go to the documentation of this file.
1
#include <stdexcept>
2
#include <string>
3
#include <iostream>
4
#include <map>
5
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
6
#include "
FWCore/Framework/interface/Event.h
"
7
#include "
FWCore/Framework/interface/ESHandle.h
"
8
#include "
FWCore/Framework/interface/MakerMacros.h
"
9
10
#include "
FWCore/Framework/interface/EventSetup.h
"
11
12
#include "
CondFormats/RunInfo/interface/RunSummary.h
"
13
14
#include "
CondFormats/DataRecord/interface/RunSummaryRcd.h
"
15
16
using namespace
std
;
17
18
namespace
edmtest
{
19
class
RunSummaryESAnalyzer
:
public
edm::EDAnalyzer
{
20
public
:
21
explicit
RunSummaryESAnalyzer
(
edm::ParameterSet
const
&
p
) {
std::cout
<<
"RunSummaryESAnalyzer"
<< std::endl; }
22
explicit
RunSummaryESAnalyzer
(
int
i
) {
std::cout
<<
"RunSummaryESAnalyzer "
<<
i
<< std::endl; }
23
~RunSummaryESAnalyzer
()
override
{
std::cout
<<
"~RunSummaryESAnalyzer "
<< std::endl; }
24
// virtual void beginJob();
25
// virtual void beginRun(const edm::Run&, const edm::EventSetup& context);
26
void
analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
&
c
)
override
;
27
28
private
:
29
};
30
31
/* void
32
RunSummaryESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context){
33
std::cout<<"###RunSummaryESAnalyzer::beginRun"<<std::endl;
34
edm::ESHandle<RunSummary> RunSummary_lumiarray;
35
std::cout<<"got eshandle"<<std::endl;
36
context.get<RunSummaryRcd>().get(RunSummary_lumiarray);
37
std::cout<<"got data"<<std::endl;
38
}
39
40
void
41
RunSummaryESAnalyzer::beginJob(){
42
std::cout<<"###RunSummaryESAnalyzer::beginJob"<<std::endl;
43
44
}
45
46
*/
47
void
RunSummaryESAnalyzer::analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
& context) {
48
using namespace
edm::eventsetup
;
49
std::cout
<<
"###RunSummaryESAnalyzer::analyze"
<< std::endl;
50
51
// Context is not used.
52
std::cout
<<
" I AM IN RUN NUMBER "
<<
e
.id().run() << std::endl;
53
std::cout
<<
" ---EVENT NUMBER "
<<
e
.id().event() << std::endl;
54
edm::eventsetup::EventSetupRecordKey
recordKey(
55
edm::eventsetup::EventSetupRecordKey::TypeTag::findType
(
"RunSummaryRcd"
));
56
if
(recordKey.
type
() ==
edm::eventsetup::EventSetupRecordKey::TypeTag
()) {
57
//record not found
58
std::cout
<<
"Record \"RunSummaryRcd"
59
<<
"\" does not exist "
<< std::endl;
60
}
61
edm::ESHandle<RunSummary>
sum;
62
std::cout
<<
"got eshandle"
<< std::endl;
63
context.
get
<
RunSummaryRcd
>().
get
(sum);
64
std::cout
<<
"got context"
<< std::endl;
65
const
RunSummary
*
summary
= sum.
product
();
66
std::cout
<<
"got RunSummary* "
<< std::endl;
67
68
std::cout
<<
"print result"
<< std::endl;
69
summary
->printAllValues();
70
std::vector<std::string> subdet =
summary
->getSubdtIn();
71
std::cout
<<
"subdetector in the run "
<< std::endl;
72
for
(
size_t
i
= 0;
i
< subdet.size();
i
++) {
73
std::cout
<<
"--> "
<< subdet[
i
] << std::endl;
74
}
75
}
76
DEFINE_FWK_MODULE
(
RunSummaryESAnalyzer
);
77
}
// namespace edmtest
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
edm::eventsetup::heterocontainer::HCTypeTag::findType
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition:
HCTypeTag.cc:121
mps_fire.i
i
Definition:
mps_fire.py:428
RunSummary
Definition:
RunSummary.h:18
RunSummaryRcd
Definition:
RunSummaryRcd.h:24
RunSummaryRcd.h
ESHandle.h
edmtest
Definition:
AlignPCLThresholdsReader.cc:12
AlCaHLTBitMon_ParallelJobs.p
p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
EDAnalyzer.h
edmtest::RunSummaryESAnalyzer::RunSummaryESAnalyzer
RunSummaryESAnalyzer(int i)
Definition:
RunSummaryESAnalyzer.cc:22
edm::eventsetup::EventSetupRecordKey
Definition:
EventSetupRecordKey.h:30
edm::EDAnalyzer
Definition:
EDAnalyzer.h:28
MakerMacros.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ESHandle
Definition:
DTSurvey.h:22
edm::eventsetup::EventSetupRecordKey::TypeTag
heterocontainer::HCTypeTag TypeTag
Definition:
EventSetupRecordKey.h:32
edmtest::RunSummaryESAnalyzer::RunSummaryESAnalyzer
RunSummaryESAnalyzer(edm::ParameterSet const &p)
Definition:
RunSummaryESAnalyzer.cc:21
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
edm::eventsetup::EventSetupRecordKey::type
const TypeTag & type() const
Definition:
EventSetupRecordKey.h:40
edmLumisInFiles.summary
summary
Definition:
edmLumisInFiles.py:39
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition:
EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition:
HltBtagPostValidation_cff.py:31
get
#define get
RunSummary.h
std
Definition:
JetResolutionObject.h:76
edmtest::RunSummaryESAnalyzer::~RunSummaryESAnalyzer
~RunSummaryESAnalyzer() override
Definition:
RunSummaryESAnalyzer.cc:23
EventSetup.h
edm::Event
Definition:
Event.h:73
edm::eventsetup
Definition:
ES_DDDetector.cc:16
edmtest::RunSummaryESAnalyzer
Definition:
RunSummaryESAnalyzer.cc:19
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16