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 
20 //----------------------------------------------------------------------------------------------------
21 
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 
31 
33 
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 
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 
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 
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 
RunNumber_t run() const
Definition: EventID.h:39
void analyze(const edm::Event &, const edm::EventSetup &) override
float const crossingAngle() const
Definition: LHCInfo.cc:176
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CTPPSLHCInfoPlotter(const edm::ParameterSet &)
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
float const betaStar() const
Definition: LHCInfo.cc:180
T get() const
Definition: EventSetup.h:71
float const energy() const
Definition: LHCInfo.cc:192
unsigned short const fillNumber() const
Definition: LHCInfo.cc:144