CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
39 //----------------------------------------------------------------------------------------------------
40 
41 using namespace std;
42 using namespace edm;
43 
44 //----------------------------------------------------------------------------------------------------
45 
47  : lhcInfoLabel_(iConfig.getParameter<std::string>("lhcInfoLabel")),
48  outputFile_(iConfig.getParameter<string>("outputFile")),
49 
50  h_beamEnergy_(new TH1D("h_beamEnergy", ";beam energy (GeV)", 81, -50., 8050.)),
51  h_xangle_(new TH1D("h_xangle", ";(half) crossing angle (#murad)", 201, -0.5, 200.5)),
52  h_betaStar_(new TH1D("h_betaStar", ";#beta^{*} (m)", 101, -0.005, 1.005)) {}
53 
54 //----------------------------------------------------------------------------------------------------
55 
57  edm::ESHandle<LHCInfo> hLHCInfo;
58  iSetup.get<LHCInfoRcd>().get(lhcInfoLabel_, hLHCInfo);
59 
60  h_beamEnergy_->Fill(hLHCInfo->energy());
61  h_xangle_->Fill(hLHCInfo->crossingAngle());
62  h_betaStar_->Fill(hLHCInfo->betaStar());
63 }
64 
65 //----------------------------------------------------------------------------------------------------
66 
68  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
69 
70  h_beamEnergy_->Write();
71  h_xangle_->Write();
72  h_betaStar_->Write();
73 }
74 
75 //----------------------------------------------------------------------------------------------------
76 
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 &)
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