Geant4  10.01.p02
G4VDecayChannel.hh
Go to the documentation of this file.
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 // $Id: G4VDecayChannel.hh 83920 2014-09-23 09:00:36Z gcosmo $
28 //
29 //
30 // ------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 // History: first implementation, based on object model of
34 // 27 July 1996 H.Kurashige
35 // 30 May 1997 H.Kurashige
36 // 23 Mar. 2000 H.Weber : add GetAngularMomentum()
37 // ------------------------------------------------------------
38 #ifndef G4VDecayChannel_h
39 #define G4VDecayChannel_h 1
40 
41 #include <cmath>
42 
43 #include "G4ios.hh"
44 #include "globals.hh"
46 
48 class G4DecayProducts;
49 class G4ParticleTable;
50 
105 {
106  // Class Description:
107  //
108  // Abstract class to describe decay kinematics
109 
110  public: // with description
111 
112  // Constructors
113  G4VDecayChannel(const G4String &aName, G4int Verbose = 1);
114  G4VDecayChannel(const G4String &aName,
115  const G4String& theParentName,
116  G4double theBR,
117  G4int theNumberOfDaughters,
118  const G4String& theDaughterName1,
119  const G4String& theDaughterName2 = "",
120  const G4String& theDaughterName3 = "",
121  const G4String& theDaughterName4 = "" );
122 
123  // Destructor
124  virtual ~G4VDecayChannel();
125 
126  // equality operators
127  G4int operator==(const G4VDecayChannel &right) const {return (this == &right);}
128  G4int operator!=(const G4VDecayChannel &right) const {return (this != &right);}
129 
130  // less-than operator is defined for G4DecayTable
131  G4int operator<(const G4VDecayChannel &right) const;
132 
133  virtual G4DecayProducts* DecayIt(G4double parentMass = -1.0) = 0;
134 
135  // get kinematics name
136  const G4String& GetKinematicsName() const;
137  // get branching ratio
138  G4double GetBR() const;
139  // get number of daughter particles
140  G4int GetNumberOfDaughters() const;
141 
142  // get the pointer to the parent particle
144  // get the pointer to a daughter particle
146 
147  // get the angular momentum of the decay
149  // get the name of the parent particle
150  const G4String& GetParentName() const;
151  //get the name of a daughter particle
152  const G4String& GetDaughterName(G4int anIndex) const;
153 
154  // get mass of parent
155  G4double GetParentMass() const;
156  G4double GetDaughterMass(G4int anIndex) const;
157 
158  // set the parent particle (by name or by pointer)
159  void SetParent(const G4ParticleDefinition * particle_type);
160  void SetParent(const G4String &particle_name);
161  // set branching ratio
162  void SetBR(G4double value);
163  // set number of daughter particles
164  void SetNumberOfDaughters(G4int value);
165  // set a daughter particle (by name or by pointer)
166  void SetDaughter(G4int anIndex,
167  const G4ParticleDefinition * particle_type);
168  void SetDaughter(G4int anIndex,
169  const G4String &particle_name);
170 
171  void SetVerboseLevel(G4int value);
172  G4int GetVerboseLevel() const;
173  void DumpInfo();
174 
175  G4double GetRangeMass() const;
176  void SetRangeMass(G4double val);
177 
184 
185  protected: // with description
186 
187  // clear daughters array
188  void ClearDaughtersName();
189 
190  // fill daughters array
191  void FillDaughters();
192  // fill parent
193  void FillParent();
194 
195  protected: // without description
196 
197  // default constructor
198  G4VDecayChannel();
199 
200  // copy constructor and assignment operator
203 
204  private:
205 
206  const G4String& GetNoName() const;
207 
208  protected:
209  G4double DynamicalMass(G4double massPDG, G4double width, G4double maxDev = +1.) const;
210 
211  protected:
212 
213  // kinematics name
215  // branching ratio [0.0 - 1.0]
217  // number of daughters
219  // parent particle
221  // daughter particles
223 
224  // range of mass allowed in decay
226 
227  // pointer to particle table
229 
230  // control flag for output message
232  // 0: Silent
233  // 1: Warning message
234  // 2: More
235 
236  static const G4String noName;
237 
247 };
248 
249 // ------------------------------------------------------------
250 // Inline methods
251 // ------------------------------------------------------------
252 
253 inline
255 {
256  return (this->rbranch < right.rbranch);
257 }
258 
259 inline
261  {
262  // pointers to daughter particles are filled, if they are not set yet
263  if (G4MT_daughters == 0) FillDaughters();
264 
265  // get the pointer to a daughter particle
266  if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
267  return G4MT_daughters[anIndex];
268  } else {
269  if (verboseLevel>0)
270  G4cout << "G4VDecayChannel::GetDaughter index out of range "<<anIndex<<G4endl;
271  return 0;
272  }
273 }
274 
275 inline
277 {
278  if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
279  return *daughters_name[anIndex];
280  } else {
281  if (verboseLevel>0){
282  G4cout << "G4VDecayChannel::GetDaughterName ";
283  G4cout << "index out of range " << anIndex << G4endl;
284  }
285  return GetNoName();
286  }
287 }
288 
289 inline
291 {
292  if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
293  return G4MT_daughters_mass[anIndex];
294  } else {
295  if (verboseLevel>0){
296  G4cout << "G4VDecayChannel::GetDaughterMass ";
297  G4cout << "index out of range " << anIndex << G4endl;
298  }
299  return 0.0;
300  }
301 }
302 
303 inline
305 {
306  // the pointer to the parent particle is filled, if it is not set yet
307  if (G4MT_parent == 0) FillParent();
308  // get the pointer to the parent particle
309  return G4MT_parent;
310 }
311 
312 inline
314 {
315  return *parent_name;
316 }
317 
318 inline
320 {
321  return G4MT_parent_mass;
322 }
323 
324 inline
325  void G4VDecayChannel::SetParent(const G4String &particle_name)
326 {
327  if (parent_name != 0) delete parent_name;
328  parent_name = new G4String(particle_name);
329  G4MT_parent = 0;
330 }
331 
332 inline
334 {
335  return numberOfDaughters;
336 }
337 
338 inline
340 
341 inline
342  void G4VDecayChannel::SetBR(G4double value){ rbranch = value; }
343 
344 inline
346 
347 inline
349 
350 inline
352 
353 inline
355 
356 inline
357  void G4VDecayChannel::SetRangeMass(G4double val){ if(val>=0.) rangeMass=val; }
358 
361 
362 #endif
G4double GetBR() const
const G4String & GetNoName() const
static const G4String noName
void SetBR(G4double value)
G4double * G4MT_daughters_mass
const G4String & GetParentName() const
G4int GetNumberOfDaughters() const
G4ParticleDefinition * G4MT_parent
G4ParticleDefinition * GetDaughter(G4int anIndex)
G4ParticleDefinition ** G4MT_daughters
const G4String & GetKinematicsName() const
#define width
G4double G4MT_parent_mass
G4int operator!=(const G4VDecayChannel &right) const
G4int operator<(const G4VDecayChannel &right) const
G4ParticleTable * particletable
void SetRangeMass(G4double val)
int G4int
Definition: G4Types.hh:78
G4int GetAngularMomentum()
G4int operator==(const G4VDecayChannel &right) const
G4GLOB_DLL std::ostream G4cout
void SetVerboseLevel(G4int value)
G4String kinematics_name
void SetNumberOfDaughters(G4int value)
G4double GetParentMass() const
G4String * parent_name
G4VDecayChannel & operator=(const G4VDecayChannel &)
G4double GetDaughterMass(G4int anIndex) const
const G4String & GetDaughterName(G4int anIndex) const
virtual ~G4VDecayChannel()
G4int GetVerboseLevel() const
G4double * G4MT_daughters_width
void SetParent(const G4ParticleDefinition *particle_type)
void SetDaughter(G4int anIndex, const G4ParticleDefinition *particle_type)
#define G4endl
Definition: G4ios.hh:61
G4double GetRangeMass() const
virtual G4DecayProducts * DecayIt(G4double parentMass=-1.0)=0
G4double DynamicalMass(G4double massPDG, G4double width, G4double maxDev=+1.) const
double G4double
Definition: G4Types.hh:76
G4ParticleDefinition * GetParent()
G4String ** daughters_name