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
#include "TH2D.h"
20
21
//----------------------------------------------------------------------------------------------------
22
23
class
CTPPSLHCInfoPlotter
:
public
edm::one::EDAnalyzer
<> {
24
public
:
25
explicit
CTPPSLHCInfoPlotter
(
const
edm::ParameterSet
&);
26
27
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
&descriptions);
28
29
private
:
30
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
31
void
endJob
()
override
;
32
33
std::string
lhcInfoLabel_
;
34
35
std::string
outputFile_
;
36
37
TH1D *
h_beamEnergy_
;
38
TH1D *
h_xangle_
;
39
TH1D *
h_betaStar_
;
40
TH2D *
h2_betaStar_vs_xangle_
;
41
42
TH1D *
h_fill_
;
43
TH1D *
h_run_
;
44
};
45
46
//----------------------------------------------------------------------------------------------------
47
48
using namespace
std
;
49
using namespace
edm
;
50
51
//----------------------------------------------------------------------------------------------------
52
53
CTPPSLHCInfoPlotter::CTPPSLHCInfoPlotter
(
const
edm::ParameterSet
&iConfig)
54
: lhcInfoLabel_(iConfig.getParameter<
std
::
string
>(
"lhcInfoLabel"
)),
55
outputFile_(iConfig.getParameter<
string
>(
"outputFile"
)),
56
57
h_beamEnergy_(new TH1D(
"h_beamEnergy"
,
";beam energy (GeV)"
, 81, -50., 8050.)),
58
h_xangle_(new TH1D(
"h_xangle"
,
";(half) crossing angle (#murad)"
, 201, -0.5, 200.5)),
59
h_betaStar_(new TH1D(
"h_betaStar"
,
";#beta^{*} (m)"
, 101, -0.005, 1.005)),
60
h2_betaStar_vs_xangle_(new TH2D(
"h2_betaStar_vs_xangle"
,
61
";(half) crossing angle (#murad);#beta^{*} (m)"
,
62
201,
63
-0.5,
64
200.5,
65
101,
66
-0.005,
67
1.005)),
68
69
h_fill_(new TH1D(
"h_fill"
,
";fill"
, 4001, 3999.5, 8000.5)),
70
h_run_(new TH1D(
"h_run"
,
";run"
, 6000, 270E3, 330E3)) {}
71
72
//----------------------------------------------------------------------------------------------------
73
74
void
CTPPSLHCInfoPlotter::fillDescriptions
(
edm::ConfigurationDescriptions
&descriptions) {
75
edm::ParameterSetDescription
desc
;
76
77
desc
.add<
std::string
>(
"lhcInfoLabel"
,
""
)->setComment(
"label of the LHCInfo record"
);
78
desc
.add<
std::string
>(
"outputFile"
,
""
)->setComment(
"output file"
);
79
80
descriptions.
add
(
"ctppsLHCInfoPlotter"
,
desc
);
81
}
82
83
//----------------------------------------------------------------------------------------------------
84
85
void
CTPPSLHCInfoPlotter::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup) {
86
edm::ESHandle<LHCInfo>
hLHCInfo;
87
iSetup.
get
<
LHCInfoRcd
>().
get
(
lhcInfoLabel_
, hLHCInfo);
88
89
h_beamEnergy_
->Fill(hLHCInfo->
energy
());
90
h_xangle_
->Fill(hLHCInfo->
crossingAngle
());
91
h_betaStar_
->Fill(hLHCInfo->
betaStar
());
92
h2_betaStar_vs_xangle_
->Fill(hLHCInfo->
crossingAngle
(), hLHCInfo->
betaStar
());
93
94
h_fill_
->Fill(hLHCInfo->
fillNumber
());
95
h_run_
->Fill(
iEvent
.id().run());
96
}
97
98
//----------------------------------------------------------------------------------------------------
99
100
void
CTPPSLHCInfoPlotter::endJob
() {
101
auto
f_out = std::make_unique<TFile>(
outputFile_
.c_str(),
"recreate"
);
102
103
h_beamEnergy_
->Write();
104
h_xangle_
->Write();
105
h_betaStar_
->Write();
106
h2_betaStar_vs_xangle_
->Write();
107
108
h_fill_
->Write();
109
h_run_
->Write();
110
}
111
112
//----------------------------------------------------------------------------------------------------
113
114
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:39
CTPPSLHCInfoPlotter::lhcInfoLabel_
std::string lhcInfoLabel_
Definition:
CTPPSLHCInfoPlotter.cc:34
ESHandle.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
CTPPSLHCInfoPlotter::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
CTPPSLHCInfoPlotter.cc:84
CTPPSLHCInfoPlotter::h2_betaStar_vs_xangle_
TH2D * h2_betaStar_vs_xangle_
Definition:
CTPPSLHCInfoPlotter.cc:41
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
LHCInfo.h
CTPPSLHCInfoPlotter::CTPPSLHCInfoPlotter
CTPPSLHCInfoPlotter(const edm::ParameterSet &)
Definition:
CTPPSLHCInfoPlotter.cc:52
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
CTPPSLHCInfoPlotter::outputFile_
std::string outputFile_
Definition:
CTPPSLHCInfoPlotter.cc:36
LHCInfo::fillNumber
unsigned const short fillNumber() const
Definition:
LHCInfo.cc:158
CTPPSLHCInfoPlotter::endJob
void endJob() override
Definition:
CTPPSLHCInfoPlotter.cc:99
MakerMacros.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
LHCInfo::crossingAngle
const float crossingAngle() const
Definition:
LHCInfo.cc:182
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
edm::ESHandle< LHCInfo >
LHCInfoRcd
Definition:
LHCInfoRcd.h:24
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSLHCInfoPlotter::h_betaStar_
TH1D * h_betaStar_
Definition:
CTPPSLHCInfoPlotter.cc:40
edm::ParameterSet
Definition:
ParameterSet.h:47
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:43
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
std
Definition:
JetResolutionObject.h:76
Frameworkfwd.h
CTPPSLHCInfoPlotter::h_run_
TH1D * h_run_
Definition:
CTPPSLHCInfoPlotter.cc:44
EventSetup.h
CTPPSLHCInfoPlotter::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
CTPPSLHCInfoPlotter.cc:73
CTPPSLHCInfoPlotter
Definition:
CTPPSLHCInfoPlotter.cc:22
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:38
Generated for CMSSW Reference Manual by
1.8.16