CondTools
RunInfo
plugins
RunInfoESAnalyzer.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/RunInfo.h
"
13
14
#include "
CondFormats/DataRecord/interface/RunSummaryRcd.h
"
15
16
using namespace
std
;
17
18
namespace
edmtest
{
19
class
RunInfoESAnalyzer
:
public
edm::EDAnalyzer
{
20
public
:
21
explicit
RunInfoESAnalyzer
(
edm::ParameterSet
const
&
p
) {
std::cout
<<
"RunInfoESAnalyzer"
<< std::endl; }
22
explicit
RunInfoESAnalyzer
(
int
i
) {
std::cout
<<
"RunInfoESAnalyzer "
<<
i
<< std::endl; }
23
~RunInfoESAnalyzer
()
override
{
std::cout
<<
"~RunInfoESAnalyzer "
<< 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
RunInfoESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context){
33
std::cout<<"###RunInfoESAnalyzer::beginRun"<<std::endl;
34
edm::ESHandle<RunInfo> RunInfo_lumiarray;
35
std::cout<<"got eshandle"<<std::endl;
36
context.get<RunInfoRcd>().get(RunInfo_lumiarray);
37
std::cout<<"got data"<<std::endl;
38
}
39
40
void
41
RunInfoESAnalyzer::beginJob(){
42
std::cout<<"###RunInfoESAnalyzer::beginJob"<<std::endl;
43
44
}
45
46
*/
47
void
RunInfoESAnalyzer::analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
&
context
) {
48
using namespace
edm::eventsetup
;
49
std::cout
<<
"###RunInfoESAnalyzer::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
(
"RunInfoRcd"
));
56
if
(recordKey.
type
() ==
edm::eventsetup::EventSetupRecordKey::TypeTag
()) {
57
//record not found
58
std::cout
<<
"Record \"RunInfoRcd"
59
<<
"\" does not exist "
<< std::endl;
60
}
61
edm::ESHandle<RunInfo>
sum;
62
std::cout
<<
"got eshandle"
<< std::endl;
63
context
.get<
RunInfoRcd
>().
get
(sum);
64
std::cout
<<
"got context"
<< std::endl;
65
const
RunInfo
*
summary
= sum.
product
();
66
std::cout
<<
"got RunInfo* "
<< 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
}
77
DEFINE_FWK_MODULE
(
RunInfoESAnalyzer
);
78
}
// 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
edmtest::RunInfoESAnalyzer::~RunInfoESAnalyzer
~RunInfoESAnalyzer() override
Definition:
RunInfoESAnalyzer.cc:23
RunSummaryRcd.h
ESHandle.h
edmtest
Definition:
AlignPCLThresholdsReader.cc:11
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
EDAnalyzer.h
edm::eventsetup::EventSetupRecordKey
Definition:
EventSetupRecordKey.h:30
edm::EDAnalyzer
Definition:
EDAnalyzer.h:28
visDQMUpload.context
context
Definition:
visDQMUpload.py:37
MakerMacros.h
RunInfo
Definition:
RunInfo.h:18
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::RunInfoESAnalyzer::RunInfoESAnalyzer
RunInfoESAnalyzer(int i)
Definition:
RunInfoESAnalyzer.cc:22
RunInfoRcd
Definition:
RunSummaryRcd.h:26
edmtest::RunInfoESAnalyzer::RunInfoESAnalyzer
RunInfoESAnalyzer(edm::ParameterSet const &p)
Definition:
RunInfoESAnalyzer.cc:21
edm::ParameterSet
Definition:
ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
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:58
get
#define get
RunInfo.h
std
Definition:
JetResolutionObject.h:76
EventSetup.h
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition:
Event.h:73
edm::eventsetup
Definition:
ES_DDDetector.cc:16
edmtest::RunInfoESAnalyzer
Definition:
RunInfoESAnalyzer.cc:19
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16