BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
AnalysisUtilities.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 ANALYSISUTILITIES_H
20#define ANALYSISUTILITIES_H
21
22#include "Rtypes.h" // for classdef
23
24#include <string>
25#include <vector>
26
27class HistogramDef;
28class HistogramDef1D;
29class HistogramDef2D;
30class HistogramDef3D;
31
32class TH1;
33class TH1D;
34class TH2D;
35class TH3D;
36
48{
49public:
51 virtual ~AnalysisUtilities();
52
53 /* @brief Method to generate evenly spaced points on a log scale.
54 *
55 * Based on solution on StackOverFlow:
56 * https://stackoverflow.com/a/21429452
57 */
58 std::vector<double> LogSpace(double start,
59 double stop,
60 int nBins,
61 double base = 10,
62 bool includeLastPoint = true);
63
65 std::vector<double> LinSpace(double start,
66 double stop,
67 int nBins,
68 bool includeLastPoint = true);
69
71 void FillTH1D(TH1D&h1d,
72 const std::vector<float>& values,
73 const std::vector<float>& weights);
74
75 ClassDef(AnalysisUtilities,1);
76};
77
78namespace RBDS
79{
83 std::string DefaultOutputName(const std::string& inputFilePath,
84 const std::string& suffix);
85
86}
87
88#endif
Simple class to hold all unbound functions for ROOT.
void FillTH1D(TH1D &h1d, const std::vector< float > &values, const std::vector< float > &weights)
Fill a vector of entries and weights into a TH1 histogram.
std::vector< double > LinSpace(double start, double stop, int nBins, bool includeLastPoint=true)
Linear range of values.
Specification for 1D histogram.
Specification for 2D histogram.
Specification for 3D Histogram.
Common specification for a histogram.
Definition: HistogramDef.hh:34
Utility functions for data files.
std::string DefaultOutputName(const std::string &inputFilePath, const std::string &suffix)