G4VDecayChannel.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //
00030 // ------------------------------------------------------------
00031 //      GEANT 4 class header file
00032 //
00033 //      History: first implementation, based on object model of
00034 //      27 July 1996 H.Kurashige
00035 //      30 May  1997 H.Kurashige
00036 //      23 Mar. 2000 H.Weber      : add GetAngularMomentum()
00037 // ------------------------------------------------------------
00038 #ifndef G4VDecayChannel_h
00039 #define G4VDecayChannel_h 1
00040 
00041 #include "G4ios.hh"
00042 #include "globals.hh"
00043 #include <cmath>
00044 
00045 class    G4ParticleDefinition;
00046 class    G4DecayProducts;
00047 class    G4ParticleTable;
00048 
00049 class G4VDecayChannel
00050 {
00051  // Class Description
00052  // This class is a abstract class to describe decay kinematics
00053  //
00054 
00055   public:
00056     //Constructors 
00057       G4VDecayChannel(const G4String &aName, G4int Verbose = 1);
00058       G4VDecayChannel(const G4String  &aName, 
00059                      const G4String& theParentName,
00060                      G4double        theBR,
00061                      G4int           theNumberOfDaughters,
00062                      const G4String& theDaughterName1,
00063                      const G4String& theDaughterName2 = "",
00064                      const G4String& theDaughterName3 = "",
00065                      const G4String& theDaughterName4 = "" );
00066 
00067     //  Destructor
00068       virtual ~G4VDecayChannel();
00069 
00070   protected:
00071     //  default constructor
00072      G4VDecayChannel();
00073     //  copy constructor and assignment operatotr
00074      G4VDecayChannel(const G4VDecayChannel &);
00075      G4VDecayChannel & operator=(const G4VDecayChannel &);
00076 
00077   public:
00078     // equality operators
00079     G4int operator==(const G4VDecayChannel &right) const {return (this == &right);};
00080     G4int operator!=(const G4VDecayChannel &right) const {return (this != &right);};
00081 
00082     // less-than operator is defined for G4DecayTable
00083     G4int operator<(const G4VDecayChannel &right) const;
00084 
00085   public: // With Description
00086    virtual G4DecayProducts* DecayIt(G4double parentMass = -1.0) = 0;
00087 
00088   public: // With Description
00089      //get kinematics name
00090      const G4String&  GetKinematicsName() const;
00091      //get branching ratio
00092      G4double   GetBR() const;
00093      //get number of daughter particles
00094      G4int      GetNumberOfDaughters() const;     
00095 
00096      //get the pointer to the parent particle
00097      G4ParticleDefinition * GetParent();
00098      //get the pointer to a daughter particle 
00099      G4ParticleDefinition * GetDaughter(G4int anIndex);
00100 
00101      //get the angular momentum of the decay
00102      G4int GetAngularMomentum();
00103      //get the name of the parent particle
00104      const G4String& GetParentName() const;
00105      //get the name of a daughter particle
00106      const G4String& GetDaughterName(G4int anIndex) const;
00107 
00108      // get mass of parent
00109      G4double GetParentMass() const; 
00110      G4double GetDaughterMass(G4int anIndex) const; 
00111 
00112      //set the parent particle (by name or by pointer) 
00113      void SetParent(const G4ParticleDefinition * particle_type);
00114      void SetParent(const G4String &particle_name);
00115      //set branching ratio
00116      void SetBR(G4double value); 
00117      //set number of daughter particles
00118      void SetNumberOfDaughters(G4int value);     
00119      //set a daughter particle (by name or by pointer) 
00120      void SetDaughter(G4int anIndex, 
00121                       const G4ParticleDefinition * particle_type);
00122      void SetDaughter(G4int anIndex, 
00123                       const G4String &particle_name);
00124 
00125   protected: 
00126     // kinematics name
00127     G4String   kinematics_name;
00128     // branching ratio  [0.0 - 1.0]
00129     G4double   rbranch;
00130     // number of daughters
00131     G4int      numberOfDaughters;
00132     // parent particle
00133     G4String*  parent_name;
00134     //daughter particles
00135     G4String** daughters_name;
00136 
00137   protected: // With Description
00138     // celar daughters array
00139     void ClearDaughtersName();
00140 
00141   protected:
00142     // pointer to particle table
00143     G4ParticleTable*       particletable;
00144 
00145     // temporary buffers of pointers to G4ParticleDefinition
00146     G4ParticleDefinition*  parent;
00147     G4ParticleDefinition** daughters;
00148 
00149     // parent mass
00150     G4double               parent_mass;
00151     G4double*              daughters_mass;
00152     
00153 
00154     // fill daughters array
00155     void FillDaughters();
00156     // fill parent
00157     void FillParent();
00158 
00159   public:  // With Description
00160     void  SetVerboseLevel(G4int value);
00161     G4int GetVerboseLevel()  const;
00162     void  DumpInfo();
00163 
00164   private:
00165     const G4String& GetNoName() const;
00166 
00167   protected:  
00168     // controle flag for output message
00169     G4int verboseLevel;
00170     //  0: Silent
00171     //  1: Warning message
00172     //  2: More
00173 
00174     static const G4String   noName;
00175 };
00176 
00177 inline
00178  G4int G4VDecayChannel::operator<(const G4VDecayChannel &right) const
00179 {
00180   return (this->rbranch < right.rbranch);
00181 }
00182 
00183 inline 
00184   G4ParticleDefinition* G4VDecayChannel::GetDaughter(G4int anIndex)
00185  { 
00186   //pointers to daughter particles are filled, if they are not set yet 
00187   if (daughters == 0) FillDaughters();
00188 
00189   //get the pointer to a daughter particle
00190   if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
00191     return daughters[anIndex];
00192   } else {
00193     if (verboseLevel>0)
00194       G4cout << "G4VDecayChannel::GetDaughter  index out of range "<<anIndex<<G4endl;
00195     return 0;
00196   }
00197 }
00198 
00199 inline
00200  const G4String& G4VDecayChannel::GetDaughterName(G4int anIndex) const
00201 {
00202   if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
00203     return *daughters_name[anIndex];
00204   } else {
00205     if (verboseLevel>0){
00206       G4cout << "G4VDecayChannel::GetDaughterName ";
00207       G4cout << "index out of range " << anIndex << G4endl;
00208     }
00209     return GetNoName();
00210   }
00211 }
00212 
00213 inline
00214  G4double G4VDecayChannel::GetDaughterMass(G4int anIndex) const
00215 {
00216   if ( (anIndex>=0) && (anIndex<numberOfDaughters) ) {
00217     return daughters_mass[anIndex];
00218   } else {
00219     if (verboseLevel>0){
00220       G4cout << "G4VDecayChannel::GetDaughterMass ";
00221       G4cout << "index out of range " << anIndex << G4endl;
00222     }
00223     return 0.0;
00224   }
00225 }
00226 
00227 inline 
00228   G4ParticleDefinition* G4VDecayChannel::GetParent()
00229 { 
00230   //the pointer to the parent particle is filled, if it is not set yet 
00231    if (parent == 0) FillParent();
00232   //get the pointer to the parent particle
00233   return parent;
00234 }
00235 
00236 inline
00237  const G4String& G4VDecayChannel::GetParentName() const
00238 {
00239   return *parent_name;
00240 }
00241 
00242 inline
00243  G4double G4VDecayChannel::GetParentMass() const
00244 {
00245   return parent_mass;
00246 }
00247 
00248 
00249 inline
00250   void G4VDecayChannel::SetParent(const G4String &particle_name)
00251 {
00252   if (parent_name != 0) delete parent_name;
00253   parent_name = new G4String(particle_name);
00254   parent = 0;
00255 }
00256 
00257 inline
00258  G4int G4VDecayChannel::GetNumberOfDaughters() const 
00259 { 
00260   return  numberOfDaughters;
00261 }
00262 
00263 inline
00264  const G4String& G4VDecayChannel::GetKinematicsName() const { return kinematics_name; }
00265 
00266 inline
00267  void  G4VDecayChannel::SetBR(G4double value){ rbranch = value; }
00268 
00269 inline
00270  G4double G4VDecayChannel::GetBR() const { return rbranch; }
00271 
00272 inline
00273  void  G4VDecayChannel::SetVerboseLevel(G4int value){ verboseLevel = value; }
00274 
00275 inline
00276  G4int G4VDecayChannel::GetVerboseLevel() const { return verboseLevel; }
00277 
00278 
00279 
00280 #endif
00281 
00282 
00283 
00284 
00285 
00286 

Generated on Mon May 27 17:50:11 2013 for Geant4 by  doxygen 1.4.7