Line data Source code
1 : #ifndef CRPROPA_CANDIDATEPLITTING_H
2 : #define CRPROPA_CANDIDATEPLITTING_H
3 :
4 : #include <string>
5 : #include <iostream>
6 : #include <cmath>
7 : #include <cstdlib>
8 : #include <sstream>
9 :
10 : #include "crpropa/Vector3.h"
11 : #include "crpropa/Module.h"
12 : #include "crpropa/Units.h"
13 : #include "kiss/logger.h"
14 :
15 :
16 : namespace crpropa {
17 : /** @addtogroup Acceleration
18 : * @{
19 : */
20 :
21 : /**
22 : @class CandidateSplitting
23 : @brief Candidates are split into n copies when they gain energy and cross specified energy bins. Weights are set accordingly.
24 : In case of Diffusice Shock Acceleration, splitting number can be adapted to expected spectral index to
25 : compensate for the loss of particles per magnitude in energy
26 : */
27 6 : class CandidateSplitting: public Module {
28 : private:
29 : double nSplit;
30 : double minWeight;
31 : std::vector<double> Ebins;
32 :
33 : public:
34 :
35 : CandidateSplitting();
36 :
37 : /** Constructor
38 : @param nSplit Number of copies candidates are split
39 : @param Emin Minimal energy for splitting
40 : @param Emax Maximal energy for splitting
41 : @param nBins Number of energy bins
42 : @param minWeight Mimimal Weight
43 : @param log Energy bins in log
44 : */
45 : CandidateSplitting(int nSplit, double Emin, double Emax, double nBins, double minWeight, bool log = false);
46 :
47 : /** Constructor
48 : @param spectralIndex Expected spectral index determines splitting numbe
49 : @param Emin Minimal energy for splitting
50 : @param nBins Number of bins in energy, with dE(spectralIndex) it determines Emax
51 : */
52 : CandidateSplitting(double spectralIndex, double Emin, int nBins);
53 :
54 : void process(Candidate *c) const;
55 :
56 : void setEnergyBins(double Emin, double Emax, double nBins, bool log);
57 :
58 : void setEnergyBinsDSA(double Emin, double dE, int n);
59 :
60 : void setNsplit(int n);
61 :
62 : void setMinimalWeight(double w);
63 :
64 : int getNsplit() const;
65 :
66 : double getMinimalWeight() const;
67 :
68 : const std::vector<double>& getEnergyBins() const;
69 :
70 : };
71 : /** @}*/
72 :
73 : } // namespace crpropa
74 : #endif // CRPROPA_CANDIDATESPLITTING_H
|