BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
ResultHistogram.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef COMPRESULTHISTOGRAM_H
20#define COMPRESULTHISTOGRAM_H
21
22#include "Result.hh"
23
24#include <iomanip>
25#include <sstream>
26#include <string>
27
35{
36public:
37 double h1Entries;
38 double h2Entries;
39 int h1NXBins;
40 int h2NXBins;
41 double h1XMean;
42 double h2XMean;
43 double h1XRms;
44 double h2XRms;
45 double h1Integral;
46 double h2Integral;
47 double chi2;
48 double tolerance;
49
50 virtual std::string print() const
51 {
52 const int nw = 15;
53 std::stringstream ss;
54 ss << Result::print();
55 ss << "Parameter" << std::setw(nw) << std::right << "file1" << " / "
56 << std::left << std::setw(nw) << "file2" << "\n";
57 ss << "Entries " << std::setw(nw) << std::right << h1Entries << " / "
58 << std::left << std::setw(nw) << h2Entries << "\n";
59 ss << "Bins " << std::setw(nw) << std::right << h1NXBins << " / "
60 << std::left << std::setw(nw) << h2NXBins << "\n";
61 ss << "X Mean " << std::setw(nw) << std::right << h1XMean << " / "
62 << std::left << std::setw(nw) << h2XMean << "\n";
63 ss << "X RMS " << std::setw(nw) << std::right << h1XRms << " / "
64 << std::left << std::setw(nw) << h2XRms << "\n";
65 ss << "Integral " << std::setw(nw) << std::right << h1Integral << " / "
66 << std::left << std::setw(nw) << h2Integral << "\n";
67 ss << "Chi^2 " << chi2 << " vs tolerance of " << tolerance;
68 return ss.str();
69 }
70
71 virtual ~ResultHistogram() {}
72};
73
74#endif
Result of comparing 2 histograms.
virtual std::string print() const
Print the result of the test - ie information store in the class.
Base class of a result.
Definition: Result.hh:37
virtual std::string print() const
Print the result of the test - ie information store in the class.
Definition: Result.hh:58