CMS 3D CMS Logo

CTPPSLHCInfoPlotter.cc
Go to the documentation of this file.
1 /****************************************************************************
2  * Authors:
3  * Jan Kašpar
4  ****************************************************************************/
5 
10 
13 
16 
17 #include "TFile.h"
18 #include "TH1D.h"
19 #include "TH2D.h"
20 
21 //----------------------------------------------------------------------------------------------------
22 
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 
34 
36 
37  TH1D *h_beamEnergy_;
38  TH1D *h_xangle_;
39  TH1D *h_betaStar_;
41 
42  TH1D *h_fill_;
43  TH1D *h_run_;
44 };
45 
46 //----------------------------------------------------------------------------------------------------
47 
48 using namespace std;
49 using namespace edm;
50 
51 //----------------------------------------------------------------------------------------------------
52 
54  : lhcInfoESToken_(esConsumes(ESInputTag("", 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 
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 
86  const auto &lhcInfo = iSetup.getData(lhcInfoESToken_);
87 
88  h_beamEnergy_->Fill(lhcInfo.energy());
89  h_xangle_->Fill(lhcInfo.crossingAngle());
90  h_betaStar_->Fill(lhcInfo.betaStar());
91  h2_betaStar_vs_xangle_->Fill(lhcInfo.crossingAngle(), lhcInfo.betaStar());
92 
93  h_fill_->Fill(lhcInfo.fillNumber());
94  h_run_->Fill(iEvent.id().run());
95 }
96 
97 //----------------------------------------------------------------------------------------------------
98 
100  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
101 
102  h_beamEnergy_->Write();
103  h_xangle_->Write();
104  h_betaStar_->Write();
105  h2_betaStar_vs_xangle_->Write();
106 
107  h_fill_->Write();
108  h_run_->Write();
109 }
110 
111 //----------------------------------------------------------------------------------------------------
112 
EDAnalyzer.h
edm::ESInputTag
Definition: ESInputTag.h:87
CTPPSLHCInfoPlotter::h_xangle_
TH1D * h_xangle_
Definition: CTPPSLHCInfoPlotter.cc:39
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
CTPPSLHCInfoPlotter::lhcInfoESToken_
edm::ESGetToken< LHCInfo, LHCInfoRcd > lhcInfoESToken_
Definition: CTPPSLHCInfoPlotter.cc:34
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
CTPPSLHCInfoPlotter::outputFile_
std::string outputFile_
Definition: CTPPSLHCInfoPlotter.cc:36
CTPPSLHCInfoPlotter::endJob
void endJob() override
Definition: CTPPSLHCInfoPlotter.cc:98
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
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:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< LHCInfo, LHCInfoRcd >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
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
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
CTPPSLHCInfoPlotter::h_beamEnergy_
TH1D * h_beamEnergy_
Definition: CTPPSLHCInfoPlotter.cc:38