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) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef ANALYSISUTILITIES_H
19#define ANALYSISUTILITIES_H
20
21#include "Rtypes.h" // for classdef
22
23#include <string>
24#include <vector>
25
26class HistogramDef;
27class HistogramDef1D;
28class HistogramDef2D;
29class HistogramDef3D;
30
31class TH1;
32class TH1D;
33class TH2D;
34class TH3D;
35
47{
48public:
50 virtual ~AnalysisUtilities();
51
52 /* @brief Method to generate evenly spaced points on a log scale.
53 *
54 * Based on solution on StackOverFlow:
55 * https://stackoverflow.com/a/21429452
56 */
57 std::vector<double> LogSpace(double start,
58 double stop,
59 int nBins,
60 double base = 10,
61 bool includeLastPoint = true);
62
64 std::vector<double> LinSpace(double start,
65 double stop,
66 int nBins,
67 bool includeLastPoint = true);
68
70 void FillTH1D(TH1D&h1d,
71 const std::vector<float>& values,
72 const std::vector<float>& weights);
73
74 ClassDef(AnalysisUtilities,1);
75};
76
77namespace RBDS
78{
82 std::string DefaultOutputName(const std::string& inputFilePath,
83 const std::string& suffix);
84
85}
86
87#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.
Utility functions for data files.
std::string DefaultOutputName(const std::string &inputFilePath, const std::string &suffix)