ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VDecayChannel.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4VDecayChannel.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //
29 // ------------------------------------------------------------
30 // GEANT 4 class header file
31 //
32 // History: first implementation, based on object model of
33 // 27 July 1996 H.Kurashige
34 // 30 May 1997 H.Kurashige
35 // 23 Mar. 2000 H.Weber : add GetAngularMomentum()
36 // ------------------------------------------------------------
37 #ifndef G4VDecayChannel_h
38 #define G4VDecayChannel_h 1
39 
40 #include <cmath>
41 
42 #include "G4ios.hh"
43 #include "globals.hh"
44 #include "G4ThreeVector.hh"
45 #include "G4Threading.hh"
46 #include "G4AutoLock.hh"
47 
49 class G4DecayProducts;
50 class G4ParticleTable;
51 
53 {
54  // Class Description:
55  //
56  // Abstract class to describe decay kinematics
57 
58  public: // with description
59 
60  // Constructors
61  G4VDecayChannel(const G4String &aName, G4int Verbose = 1);
62  G4VDecayChannel(const G4String &aName,
63  const G4String& theParentName,
64  G4double theBR,
65  G4int theNumberOfDaughters,
66  const G4String& theDaughterName1,
67  const G4String& theDaughterName2 = "",
68  const G4String& theDaughterName3 = "",
69  const G4String& theDaughterName4 = "" );
70 
71  // Destructor
72  virtual ~G4VDecayChannel();
73 
74  // equality operators
75  G4bool operator==(const G4VDecayChannel &right) const {return (this == &right);}
76  G4bool operator!=(const G4VDecayChannel &right) const {return (this != &right);}
77 
78  // less-than operator is defined for G4DecayTable
79  G4bool operator<(const G4VDecayChannel &right) const;
80 
81  virtual G4DecayProducts* DecayIt(G4double parentMass = -1.0) = 0;
82 
83  // get kinematics name
84  const G4String& GetKinematicsName() const;
85  // get branching ratio
86  G4double GetBR() const;
87  // get number of daughter particles
88  G4int GetNumberOfDaughters() const;
89 
90  // get the pointer to the parent particle
92  // get the pointer to a daughter particle
94 
95  // get the angular momentum of the decay
97  // get the name of the parent particle
98  const G4String& GetParentName() const;
99  //get the name of a daughter particle
100  const G4String& GetDaughterName(G4int anIndex) const;
101 
102  // get mass of parent
103  G4double GetParentMass() const;
104  G4double GetDaughterMass(G4int anIndex) const;
105 
106  // set the parent particle (by name or by pointer)
107  void SetParent(const G4ParticleDefinition * particle_type);
108  void SetParent(const G4String &particle_name);
109  // set branching ratio
110  void SetBR(G4double value);
111  // set number of daughter particles
113  // set a daughter particle (by name or by pointer)
114  void SetDaughter(G4int anIndex,
115  const G4ParticleDefinition * particle_type);
116  void SetDaughter(G4int anIndex,
117  const G4String &particle_name);
118 
120  G4int GetVerboseLevel() const;
121  void DumpInfo();
122 
123  G4double GetRangeMass() const;
124  void SetRangeMass(G4double val);
125  virtual G4bool IsOKWithParentMass(G4double parentMass);
126 
127  void SetPolarization(const G4ThreeVector&);
128  const G4ThreeVector& GetPolarization() const;
129 
130  protected: // with description
131 
132  // clear daughters array
133  void ClearDaughtersName();
134 
135  protected:
136  inline void CheckAndFillDaughters();
137  inline void CheckAndFillParent();
138 
139  private:
140  // fill daughters array
141  void FillDaughters();
142  // fill parent
143  void FillParent();
144 
145  protected: // without description
146 
147  // default constructor
148  G4VDecayChannel();
149 
150  // copy constructor and assignment operator
153 
154  private:
155 
156  const G4String& GetNoName() const;
157 
158  protected:
159  G4double DynamicalMass(G4double massPDG, G4double width, G4double maxDev = +1.) const;
160 
161  protected:
162 
163  // kinematics name
165  // branching ratio [0.0 - 1.0]
167  // number of daughters
169  // parent particle
171  // daughter particles
173 
174  // range of mass allowed in decay
176 
177  // polarization of the parent particle
179 
180  // pointer to particle table
182 
183  // control flag for output message
185  // 0: Silent
186  // 1: Warning message
187  // 2: More
188 
189  static const G4String noName;
190 
198 };
199 
200 // ------------------------------------------------------------
201 // Inline methods
202 // ------------------------------------------------------------
203 
204 inline
206 {
207  return (this->rbranch < right.rbranch);
208 }
209 
210 inline
212  {
213  // pointers to daughter particles are filled, if they are not set yet
215 
216  // get the pointer to a daughter particle
217  if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
218  return G4MT_daughters[anIndex];
219  } else {
220  if (verboseLevel>0)
221  G4cout << "G4VDecayChannel::GetDaughter index out of range "<<anIndex<<G4endl;
222  return 0;
223  }
224 }
225 
226 inline
228 {
229  if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
230  return *daughters_name[anIndex];
231  } else {
232  if (verboseLevel>0){
233  G4cout << "G4VDecayChannel::GetDaughterName ";
234  G4cout << "index out of range " << anIndex << G4endl;
235  }
236  return GetNoName();
237  }
238 }
239 
240 inline
242 {
243  if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
244  return G4MT_daughters_mass[anIndex];
245  } else {
246  if (verboseLevel>0){
247  G4cout << "G4VDecayChannel::GetDaughterMass ";
248  G4cout << "index out of range " << anIndex << G4endl;
249  }
250  return 0.0;
251  }
252 }
253 
254 inline
256 {
257  // the pointer to the parent particle is filled, if it is not set yet
259  // get the pointer to the parent particle
260  return G4MT_parent;
261 }
262 
263 inline
265 {
266  return *parent_name;
267 }
268 
269 inline
271 {
272  return G4MT_parent_mass;
273 }
274 
275 inline
276  void G4VDecayChannel::SetParent(const G4String &particle_name)
277 {
278  if (parent_name != 0) delete parent_name;
279  parent_name = new G4String(particle_name);
280  G4MT_parent = 0;
281 }
282 
283 inline
285 {
286  return numberOfDaughters;
287 }
288 
289 inline
291 
292 inline
294 
295 inline
297 
298 inline
300 
301 inline
303 
304 inline
305  void G4VDecayChannel::SetRangeMass(G4double val){ if(val>=0.) rangeMass=val; }
306 
307 inline
309 {
310  parent_polarization = polar;
311 }
312 
313 inline
315 {
316  return parent_polarization;
317 }
318 
319 inline
322  if ( G4MT_daughters ==0 ) {
323  l.unlock();
324  FillDaughters();
325  }
326 }
327 
330  if ( G4MT_parent == 0 ) {
331  l.unlock();
332  FillParent();
333  }
334 }
335 #endif