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) 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 PARTICLESETACCUMULATOR_H
20#define PARTICLESETACCUMULATOR_H
21
22#include <string>
23
24#include "Rtypes.h" // for classdef
25
26class ParticleSet;
27
35{
36public:
39
44 const std::string& resultHistName,
45 const std::string& resultHistTitle);
46
50
54 virtual void Accumulate(ParticleSet* newValue);
55
58 virtual ParticleSet* Terminate();
59
61 inline ParticleSet* Result() const {return result;}
62
65 inline void AddNEmptyEntries(unsigned long i){n += i;}
66
67protected:
73 virtual void AccumulateSingleValue(double oldMean,
74 double oldVari,
75 double x,
76 double xVari,
77 unsigned long nEntriesAccumulated,
78 unsigned long nEntriesToAccumulate,
79 double& newMean,
80 double& newVari) const;
81
82 unsigned long n;
84 const std::string resultHistName;
85 const std::string resultHistTitle;
86 ParticleSet* mean;
87 ParticleSet* variance;
88 ParticleSet* result;
89
90 ClassDef(ParticleSetAccumulator,1);
91};
92
93#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.
Definition: ParticleSet.hh:63