Validation
CTPPS
plugins
CTPPSLHCInfoPlotter.cc
Go to the documentation of this file.
1
/****************************************************************************
2
* Authors:
3
* Jan Kašpar
4
****************************************************************************/
5
6
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
7
#include "
FWCore/Framework/interface/EventSetup.h
"
8
#include "
FWCore/Framework/interface/ESHandle.h
"
9
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
10
11
#include "
FWCore/Framework/interface/Event.h
"
12
#include "
FWCore/Framework/interface/MakerMacros.h
"
13
14
#include "
CondFormats/RunInfo/interface/LHCInfo.h
"
15
#include "
CondFormats/DataRecord/interface/LHCInfoRcd.h
"
16
17
#include "TFile.h"
18
#include "TH1D.h"
19
20
//----------------------------------------------------------------------------------------------------
21
22
class
CTPPSLHCInfoPlotter
:
public
edm::one::EDAnalyzer
<> {
23
public
:
24
explicit
CTPPSLHCInfoPlotter
(
const
edm::ParameterSet
&);
25
26
private
:
27
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
28
void
endJob
()
override
;
29
30
std::string
lhcInfoLabel_
;
31
32
std::string
outputFile_
;
33
34
TH1D *
h_beamEnergy_
;
35
TH1D *
h_xangle_
;
36
TH1D *
h_betaStar_
;
37
38
TH1D *
h_fill_
;
39
TH1D *
h_run_
;
40
};
41
42
//----------------------------------------------------------------------------------------------------
43
44
using namespace
std
;
45
using namespace
edm
;
46
47
//----------------------------------------------------------------------------------------------------
48
49
CTPPSLHCInfoPlotter::CTPPSLHCInfoPlotter
(
const
edm::ParameterSet
&iConfig)
50
: lhcInfoLabel_(iConfig.getParameter<
std
::
string
>(
"lhcInfoLabel"
)),
51
outputFile_(iConfig.getParameter<
string
>(
"outputFile"
)),
52
53
h_beamEnergy_(new TH1D(
"h_beamEnergy"
,
";beam energy (GeV)"
, 81, -50., 8050.)),
54
h_xangle_(new TH1D(
"h_xangle"
,
";(half) crossing angle (#murad)"
, 201, -0.5, 200.5)),
55
h_betaStar_(new TH1D(
"h_betaStar"
,
";#beta^{*} (m)"
, 101, -0.005, 1.005)),
56
57
h_fill_(new TH1D(
"h_fill"
,
";fill"
, 4001, 3999.5, 8000.5)),
58
h_run_(new TH1D(
"h_run"
,
";run"
, 6000, 270E3, 330E3)) {}
59
60
//----------------------------------------------------------------------------------------------------
61
62
void
CTPPSLHCInfoPlotter::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup) {
63
edm::ESHandle<LHCInfo>
hLHCInfo;
64
iSetup.
get
<
LHCInfoRcd
>().
get
(
lhcInfoLabel_
, hLHCInfo);
65
66
h_beamEnergy_
->Fill(hLHCInfo->
energy
());
67
h_xangle_
->Fill(hLHCInfo->
crossingAngle
());
68
h_betaStar_
->Fill(hLHCInfo->
betaStar
());
69
70
h_fill_
->Fill(hLHCInfo->
fillNumber
());
71
h_run_
->Fill(
iEvent
.id().run());
72
}
73
74
//----------------------------------------------------------------------------------------------------
75
76
void
CTPPSLHCInfoPlotter::endJob
() {
77
auto
f_out = std::make_unique<TFile>(
outputFile_
.c_str(),
"recreate"
);
78
79
h_beamEnergy_
->Write();
80
h_xangle_
->Write();
81
h_betaStar_
->Write();
82
83
h_fill_
->Write();
84
h_run_
->Write();
85
}
86
87
//----------------------------------------------------------------------------------------------------
88
89
DEFINE_FWK_MODULE
(
CTPPSLHCInfoPlotter
);
LHCInfo::energy
const float energy() const
Definition:
LHCInfo.cc:190
EDAnalyzer.h
CTPPSLHCInfoPlotter::h_xangle_
TH1D * h_xangle_
Definition:
CTPPSLHCInfoPlotter.cc:36
CTPPSLHCInfoPlotter::lhcInfoLabel_
std::string lhcInfoLabel_
Definition:
CTPPSLHCInfoPlotter.cc:31
ESHandle.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
CTPPSLHCInfoPlotter::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
CTPPSLHCInfoPlotter.cc:61
LHCInfo.h
CTPPSLHCInfoPlotter::CTPPSLHCInfoPlotter
CTPPSLHCInfoPlotter(const edm::ParameterSet &)
Definition:
CTPPSLHCInfoPlotter.cc:48
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
CTPPSLHCInfoPlotter::outputFile_
std::string outputFile_
Definition:
CTPPSLHCInfoPlotter.cc:33
LHCInfo::fillNumber
unsigned const short fillNumber() const
Definition:
LHCInfo.cc:158
CTPPSLHCInfoPlotter::endJob
void endJob() override
Definition:
CTPPSLHCInfoPlotter.cc:75
MakerMacros.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
LHCInfo::crossingAngle
const float crossingAngle() const
Definition:
LHCInfo.cc:182
edm::ESHandle< LHCInfo >
LHCInfoRcd
Definition:
LHCInfoRcd.h:24
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSLHCInfoPlotter::h_betaStar_
TH1D * h_betaStar_
Definition:
CTPPSLHCInfoPlotter.cc:37
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
CTPPSLHCInfoPlotter::h_fill_
TH1D * h_fill_
Definition:
CTPPSLHCInfoPlotter.cc:39
std
Definition:
JetResolutionObject.h:76
Frameworkfwd.h
CTPPSLHCInfoPlotter::h_run_
TH1D * h_run_
Definition:
CTPPSLHCInfoPlotter.cc:40
EventSetup.h
CTPPSLHCInfoPlotter
Definition:
CTPPSLHCInfoPlotter.cc:21
LHCInfoRcd.h
LHCInfo::betaStar
const float betaStar() const
Definition:
LHCInfo.cc:184
edm::Event
Definition:
Event.h:73
CTPPSLHCInfoPlotter::h_beamEnergy_
TH1D * h_beamEnergy_
Definition:
CTPPSLHCInfoPlotter.cc:35
Generated for CMSSW Reference Manual by
1.8.16