cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
hist_utils.h
Go to the documentation of this file.
1/*
2 * CepGen: a central exclusive processes event generator
3 * Copyright (C) 2022 Laurent Forthomme
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef CepGenAddOns_ROOTWrapper_utils_hist_utils_h
20#define CepGenAddOns_ROOTWrapper_utils_hist_utils_h
21
22#include "CepGen/Event/Event.h"
25
26typedef vector<TH1D*> hists_t;
27
28hists_t fill_histograms(const string& filename) {
29 hists_t out = {new TH1D("invm", ";m_{central} (GeV);d#sigma/dm", 200, 150., 550.),
30 new TH1D("ptpair", ";p_{T}^{central} (GeV);d#sigma/dp_{T}", 100, 0., 5.),
31 new TH1D("acop", ";1-|#Delta#phi/#pi|;d#sigma/d#Delta#phi)", 50, 0., 1.e-2)};
32 auto file = TFile::Open(filename.c_str(), "r");
34 run.attach(file);
35 cout << ">>> " << run.process_name << ": " << run.process_parameters << endl;
36
37 ROOT::CepGenEvent evt_tree;
38 evt_tree.attach(file);
39 cepgen::Event evt;
40 while (evt_tree.next(evt)) {
41 out[0]->Fill(evt(4).mass());
42 out[1]->Fill(evt(4).momentum().pt());
43 //out[2]->Fill(
44 }
45 return out;
46}
47
48#endif
All useful information about a generated event.
bool next(cepgen::Event &)
Read the next event in the file.
void attach()
Attach the event tree reader to a tree.
All useful information about a generation run.
std::string process_name
Unique name of the process generated in this run.
void attach(TFile *file, const std::string &run_tree=TREE_NAME)
Attach the run tree reader to a given tree Attach the run tree reader to a given file.
std::string process_parameters
Serialised process parameters.
Container for the information on the in- and outgoing particles' kinematics.
Definition Event.h:28
hists_t fill_histograms(const string &filename)
Definition hist_utils.h:28
vector< TH1D * > hists_t
Definition hist_utils.h:26