G4MoleculeDefinition.cc

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 // $Id: G4MoleculeDefinition.cc 64057 2012-10-30 15:04:49Z gcosmo $
00027 //
00028 // ----------------------------------------------------------------------
00029 //      GEANT 4 class implementation file
00030 //
00031 //      21 Oct 2009 first implementation by A. Mantero and M.Karamitros
00032 //                  Based on prototype of A.Mantero
00033 // **********************************************************************
00034 
00035 
00036 #include "G4MoleculeDefinition.hh"
00037 #include "G4MolecularConfiguration.hh"
00038 
00039 using namespace std;
00040 
00041 // ######################################################################
00042 // ###                       MoleculeDefinition                       ###
00043 // ######################################################################
00044 
00045 G4MoleculeDefinition::G4MoleculeDefinition(const G4String& name,
00046                                            G4double mass,
00047                                            G4int    electronsNumber,
00048                                            G4int    electronicLevels,
00049                                            G4double diffCoeff,
00050                                            G4int atomsNumber,
00051                                            G4double radius,
00052                                            G4double lifetime,
00053                                            G4String aType ,
00054                                            G4MoleculeID ID
00055                                            ):
00056     G4ParticleDefinition(name, mass, 0., 0., 0, 0, 0, 0, 0, 0, "Molecule",
00057                          0, 0, ID, false, lifetime, NULL, false, aType, 0, 0.0),
00058     fMass(mass),
00059     fNbOfElectrons(electronsNumber), fNbOfMolecularShells(electronicLevels), fDiffusionCoefficient(diffCoeff),
00060     fAtomsNb(atomsNumber), fVanDerVaalsRadius(radius)
00061 
00062 {
00063     fElectronOccupancy = new G4ElectronOccupancy(fNbOfMolecularShells);
00064     fDecayTable = NULL;
00065 }
00066 //___________________________________________________________________________
00067 G4MoleculeDefinition::~G4MoleculeDefinition()
00068 {
00069     if (fElectronOccupancy)
00070     {
00071         delete fElectronOccupancy;
00072         fElectronOccupancy = 0;
00073     }
00074     if (fDecayTable)
00075     {
00076         delete fDecayTable;
00077         fDecayTable = 0;
00078     }
00079     // fMolecularConfiguration = 0;
00080 }
00081 //___________________________________________________________________________
00082 void G4MoleculeDefinition::AddeConfToExcitedState(const G4String& exStId,
00083                                                   const G4ElectronOccupancy& conf,
00084                                                   double decayTime)
00085 {
00086     if (!fDecayTable)
00087     {
00088         fDecayTable = new G4MolecularDecayTable();
00089     }
00090     fDecayTable->AddeConfToExcitedState(exStId, conf);
00091     G4MolecularConfiguration::GetMolecularConfiguration(this,conf)->SetDecayTime(decayTime);
00092 }
00093 //___________________________________________________________________________
00094 void G4MoleculeDefinition::SetLevelOccupation(G4int shell, G4int eNb)
00095 {
00096     G4int levelOccupancy = fElectronOccupancy->GetOccupancy(shell);
00097 
00098     if (levelOccupancy)
00099     {
00100 
00101         fElectronOccupancy->RemoveElectron(shell, levelOccupancy);
00102     }
00103 
00104     fElectronOccupancy->AddElectron(shell,eNb);
00105 
00106 }
00107 //___________________________________________________________________________
00108 void G4MoleculeDefinition::AddExcitedState(const G4String& val)
00109 {
00110     if (!fDecayTable)
00111     {
00112         fDecayTable = new G4MolecularDecayTable();
00113     }
00114 
00115     fDecayTable->AddExcitedState(val);
00116 
00117 }
00118 //___________________________________________________________________________
00119 const G4String& G4MoleculeDefinition::GetExcitedState(const G4ElectronOccupancy* occ) const
00120 {
00121     if (fDecayTable)
00122     {
00123         return fDecayTable->GetExcitedState(occ);
00124     }
00125     else
00126     {
00127         G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
00128         G4Exception("G4MoleculeDefinition::GetExcitedState","",FatalErrorInArgument,errMsg);
00129     }
00130     return *(new G4String(""));
00131 }
00132 //___________________________________________________________________________
00133 void G4MoleculeDefinition::AddDecayChannel(const G4String& chanId,
00134                                            const G4MolecularDecayChannel* chan)
00135 {
00136     if (!fDecayTable)
00137     {
00138         fDecayTable = new G4MolecularDecayTable();
00139     }
00140     fDecayTable->AddDecayChannel(chanId, chan);
00141 }
00142 //___________________________________________________________________________
00143 const vector<const G4MolecularDecayChannel*>* G4MoleculeDefinition::GetDecayChannels(const G4String& ExState) const
00144 {
00145     if (fDecayTable)
00146     {
00147         const vector<const G4MolecularDecayChannel*>* output = fDecayTable->GetDecayChannels(ExState);
00148         return output;
00149     }
00150     else
00151     {
00152         G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
00153         G4Exception("G4MoleculeDefinition::GetDecayChannels","",FatalErrorInArgument,errMsg);
00154     }
00155     return 0;
00156 }
00157 //___________________________________________________________________________
00158 const vector<const G4MolecularDecayChannel*>* G4MoleculeDefinition::GetDecayChannels(const G4ElectronOccupancy* occ) const
00159 {
00160     if (fDecayTable)
00161     {
00162         const vector<const G4MolecularDecayChannel*>* output = fDecayTable->GetDecayChannels(occ);
00163         return output;
00164     }
00165     else
00166     {
00167         G4String const errMsg = ": no Excited States and Decays for"+ GetName() + " are defined.";
00168         G4Exception("G4MoleculeDefinition::GetDecayChannels","",FatalErrorInArgument,errMsg);
00169     }
00170     return 0;
00171 }
00172 
00174 // Protected
00176 
00177 G4MoleculeDefinition::G4MoleculeDefinition(const G4MoleculeDefinition& right):
00178     G4ParticleDefinition((const G4ParticleDefinition &)right),
00179     fMass(right.fMass),
00180     fNbOfElectrons (right.fNbOfElectrons),
00181     fNbOfMolecularShells(right.fNbOfMolecularShells),
00182     fDiffusionCoefficient( right.fDiffusionCoefficient),
00183     fAtomsNb( right.fAtomsNb),
00184     fVanDerVaalsRadius (right.fVanDerVaalsRadius)
00185 {
00186     if(right.fElectronOccupancy!=0)
00187     {
00188         fElectronOccupancy= new G4ElectronOccupancy(*(right.fElectronOccupancy));
00189     }
00190     else fElectronOccupancy = 0;
00191 
00192     if(right.fDecayTable!=0)
00193     {
00194         fDecayTable = new G4MolecularDecayTable(*(right.fDecayTable));
00195     }
00196     else fDecayTable =0;
00197 }
00198 
00199 //___________________________________________________________________________
00200 
00201 const G4MoleculeDefinition & G4MoleculeDefinition::operator=(const G4MoleculeDefinition &right)
00202 {
00203   if (this != &right)  {
00204   }
00205   return *this;
00206 }

Generated on Mon May 27 17:48:53 2013 for Geant4 by  doxygen 1.4.7