/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/gen/include/RAT/DecayChain.hh Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/gen/include/RAT/DecayChain.hh Source File
Ratpac-two
DecayChain.hh
1 #ifndef __RAT_DecayChain__
2 #define __RAT_DecayChain__
3 
4 // 04-Jan-2006 WGS: Drag this code into the 21st century: use CLHEP,
5 // use strings, use STL.
6 
7 #include <CLHEP/Vector/LorentzVector.h>
8 
9 #include <RAT/BetaFunction.hh>
10 #include <cmath>
11 #include <cstdlib>
12 #include <cstring>
13 #include <iostream>
14 #include <map>
15 
16 namespace RAT {
17 
18 static const double N_A = 6.022e+23;
19 
20 class DecayChain {
21  public:
22  // Structure to hold (particle ID, four-vector):
23  typedef struct {
24  int ID;
25  CLHEP::HepLorentzVector vector;
27 
28  DecayChain();
29  DecayChain(const std::string Name);
30  ~DecayChain();
31 
32  void Reset();
33  void Show();
34 
35  void AddElement(const std::string Name, int iLocation = 1, int iDecay = DecayBeta, double tau = 1., double wt = 1.);
36  void RemoveElement(int iBranch);
37 
38  void SetElementName(int iBranch, const std::string Name);
39  void SetElementNumber(int iBranch);
40  void SetElementBranch(int iBranch, int iLocation);
41  void SetElementWt(int iBranch, double wt = 1.);
42  void SetElementDecay(int iBranch, int iDecay);
43  void SetLifetime(int iBranch, double tau);
44 
45  bool ReadInputFile(const std::string dName);
46 
47  const std::string GetElementName(int iBranch);
48  int GetElementBranch(int iBranch);
49  int GetElementDecay(int iBranch);
50  double GetElementWt(int iBranch);
51  double GetLifetime(int iBranch);
52  inline void SetInMiddleChain(bool inMiddle = false) { fInMiddleChain = inMiddle; };
53  inline void SetAlphaDecayStart(bool alphaStart = false) { fAlphaDecayStart = alphaStart; };
54  inline void SetGammaDecayStart(bool gammaStart = false) { fGammaDecayStart = gammaStart; };
55 
56  void GenerateDecayElement(int iBranch);
57  void GenerateDecayElement(const std::string iElement);
58 
59  void GenerateFullChain(const std::string iElement);
60  void GenerateFullChain(int iBranch = 0);
61 
62  void GenerateDecayChain(const std::string iNameStart);
63  void GenerateDecayChain(int iStart = 0);
64 
65  const std::string GetParentName(int iEvent);
66  const std::string GetDaughterName(int iEvent);
67  int GetEventID(int iEvent);
68  double GetEventEnergy(int iEvent);
69  double GetEventTime(int iEvent);
70 
71  bool CheckParentMatch(int iEvent);
72 
73  void SetDecaySequence();
74  void SetElementProb(int iBranch, double prob);
75  void SetEventTime(int iEvent, double time);
76  double GetElementProb(int iBranch);
77 
78  int CheckChainLevel(int iElement);
79  bool CheckInChain(int iElement, int jElement);
80 
81  void SetParticleInfo(int iTag, int jTag, int kTag);
82 
83  ParticleInfo_t AddDaughterInfo(int iTag);
84  ParticleInfo_t GetParticleInfo(int iEvent);
85 
86  double GetRandomNumber(double rmin = 0., double rmax = 1.);
87 
88  inline void SetVerbose(bool iSet = false) { isVerbose = iSet; };
89  inline void SetFileName(const std::string Name) { inputFileName = Name; };
90  inline void SetChainName(const std::string Name) { ChainName = Name; };
91  inline void SetEquilibrium(bool iEq = true) { isEquilibrium = iEq; };
92  inline void SelectParent(const std::string iElement = "ALL") { oneParent = iElement; };
93  inline void SetNGenerated(int nP) { NumberOfParticles = nP; };
94  inline void IncludeDaughter(bool iSelect = true) { CreateDaughter = iSelect; };
95 
96  inline bool GetEquilibrium() { return isEquilibrium; };
97 
98  inline int GetNElements() { return NumberOfElements; };
99  inline int GetElementNumber() { return ElementNumber; };
100  inline int GetNGenerated() { return NumberOfParticles; };
101 
102  inline const std::string GetFileName() { return inputFileName; };
103  inline const std::string GetChainName() { return ChainName; };
104 
105  private:
106  inline void SetParentName(int iParent, const std::string name) { ParentName[iParent] = name; };
107  inline void SetDaughterName(int iDaughter, const std::string name) { DaughterName[iDaughter] = name; };
108 
109  bool isVerbose;
110  bool isEquilibrium;
111  bool isChainElement;
112  bool fInMiddleChain; // to start chain at the isotope defined in *.mac
113  bool fAlphaDecayStart; // to start chain at the isotope with alpha decay
114  bool fGammaDecayStart; // to start chain at the isotope with gamma decay
115 
116  std::string ChainName;
117 
118  int NumberOfElements;
119  int ElementNumber;
120  std::map<size_t, std::string> ElementName;
121  std::map<size_t, int> ElementBranch;
122  std::map<size_t, int> ElementDecay;
123  std::map<size_t, double> ElementWeight;
124  std::map<size_t, double> ElementLife;
125  std::map<size_t, double> ElementProb;
126  double tstart;
127 
128  std::map<size_t, BetaFunction *> Element;
129 
130  bool CreateDaughter;
131 
132  std::string inputFileName;
133  std::string oneParent;
134 
135  int NumberOfParticles;
136  std::map<size_t, std::string> ParentName;
137  std::map<size_t, std::string> DaughterName;
138  std::map<size_t, int> ParticleID;
139  std::map<size_t, double> ParticleEnergy;
140  std::map<size_t, double> ParticleTime;
141 
142  std::map<size_t, ParticleInfo_t> theParticleInfo;
143 };
144 
145 } // end namespace RAT
146 
147 #endif
Definition: DecayChain.hh:20
Definition: CCCrossSecMessenger.hh:29
Definition: DecayChain.hh:23