BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
ParticleSetAccumulator.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 PARTICLESETACCUMULATOR_H
19#define PARTICLESETACCUMULATOR_H
20
21#include <string>
22
23#include "Rtypes.h" // for classdef
24
25class ParticleSet;
26
34{
35public:
38
43 const std::string& resultHistName,
44 const std::string& resultHistTitle);
45
49
53 virtual void Accumulate(ParticleSet* newValue);
54
57 virtual ParticleSet* Terminate();
58
60 inline ParticleSet* Result() const {return result;}
61
64 inline void AddNEmptyEntries(unsigned long i){n += i;}
65
66protected:
72 virtual void AccumulateSingleValue(double oldMean,
73 double oldVari,
74 double x,
75 double xVari,
76 unsigned long nEntriesAccumulated,
77 unsigned long nEntriesToAccumulate,
78 double& newMean,
79 double& newVari) const;
80
81 unsigned long n;
83 const std::string resultHistName;
84 const std::string resultHistTitle;
85 ParticleSet* mean;
86 ParticleSet* variance;
87 ParticleSet* result;
88
89 ClassDef(ParticleSetAccumulator,1);
90};
91
92#endif
Class to accumulate and merge ParticleSets in different ways.
virtual ParticleSet * Terminate()
bool terminated
Whether this instance has been finished.
const std::string resultHistTitle
Title for resultant histogram.
void AddNEmptyEntries(unsigned long i)
virtual void AccumulateSingleValue(double oldMean, double oldVari, double x, double xVari, unsigned long nEntriesAccumulated, unsigned long nEntriesToAccumulate, double &newMean, double &newVari) const
ParticleSetAccumulator()
Default constructor only for ROOT reflexivity - not intended for use.
virtual void Accumulate(ParticleSet *newValue)
ParticleSet * Result() const
Accessor.
const std::string resultHistName
Name for resultant histogram.
A very simple 'map' type histogram axis.