Ignore:
Timestamp:
Apr 6, 2009, 12:30:29 PM (15 years ago)
Author:
garnier
Message:

update processes

Location:
trunk/source/processes/hadronic/models/photolepton_hadron/muon_nuclear/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/photolepton_hadron/muon_nuclear/src/G4MuNuclearInteraction.cc

    r819 r962  
    2424// ********************************************************************
    2525//
    26 //
    27 // $Id: G4MuNuclearInteraction.cc,v 1.7 2006/11/04 02:15:05 vnivanch Exp $
    28 // GEANT4 tag $Name:  $
     26// $Id: G4MuNuclearInteraction.cc,v 1.12 2009/01/24 11:59:37 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2928//
    3029// $Id:
     
    3837//      added simple model for hadronic vertex, J.P. Wellisch, November 1998
    3938// --------------------------------------------------------------
    40 // 26/10/98: new corr.s from R.Kokoulin + cleanup , L.Urban
     39// 26/10/1998: new corr.s from R.Kokoulin + cleanup , L.Urban
     40// 23/01/2009  V.Ivanchenko Add deregistration
    4141//
     42
    4243#include "G4MuNuclearInteraction.hh"
    4344#include "G4UnitsTable.hh"
     45#include "G4HadronicProcessStore.hh"
    4446
    4547// static members ........
     
    6668    theMuonPlus ( G4MuonPlus::MuonPlus() ),
    6769    thePionZero (G4PionZero::PionZero() )
    68 {  }
     70
     71  SetProcessSubType(fHadronInelastic);
     72  G4HadronicProcessStore::Instance()->RegisterExtraProcess(this);
     73}
    6974 
    7075G4MuNuclearInteraction::~G4MuNuclearInteraction()
    7176{
    72    if (theMeanFreePathTable) {
    73       theMeanFreePathTable->clearAndDestroy();
    74       delete theMeanFreePathTable;
    75    }
    76    if (theCrossSectionTable) {
    77       theCrossSectionTable->clearAndDestroy();
    78       delete theCrossSectionTable;
    79    }
    80 
    81    if (&PartialSumSigma) {
    82       PartialSumSigma.clearAndDestroy();
    83    }
     77  G4HadronicProcessStore::Instance()->DeRegisterExtraProcess(this);
     78
     79  if (theMeanFreePathTable) {
     80    theMeanFreePathTable->clearAndDestroy();
     81    delete theMeanFreePathTable;
     82  }
     83  if (theCrossSectionTable) {
     84    theCrossSectionTable->clearAndDestroy();
     85    delete theCrossSectionTable;
     86  }
     87
     88  if (&PartialSumSigma) {
     89    PartialSumSigma.clearAndDestroy();
     90  }
    8491}
    8592 
    8693void G4MuNuclearInteraction::SetPhysicsTableBining(G4double lowE,
    87                                                   G4double highE, G4int nBins)
     94                                                   G4double highE, G4int nBins)
    8895{
    8996  LowestKineticEnergy = lowE; HighestKineticEnergy = highE ; TotBin = nBins ;
     97}
     98
     99void G4MuNuclearInteraction::PreparePhysicsTable(
     100                                    const G4ParticleDefinition& aParticleType)
     101{
     102  G4HadronicProcessStore::Instance()
     103    ->RegisterParticleForExtraProcess(this, &aParticleType);
    90104}
    91105
     
    93107                                    const G4ParticleDefinition& aParticleType)
    94108{
     109  G4HadronicProcessStore::Instance()->PrintInfo(&aParticleType);
     110
    95111  G4double LowEdgeEnergy , Value;
    96112  G4PhysicsLogVector* ptrVector;
    97113   
    98114  if (theCrossSectionTable) {
    99       theCrossSectionTable->clearAndDestroy() ;
    100       delete theCrossSectionTable ;
     115    theCrossSectionTable->clearAndDestroy() ;
     116    delete theCrossSectionTable ;
    101117  }
    102118
     
    111127  {
    112128    ptrVector = new G4PhysicsLogVector(LowestKineticEnergy,
    113                                          HighestKineticEnergy,TotBin) ;
     129                                       HighestKineticEnergy,TotBin) ;
    114130    AtomicNumber = (*theElementTable )[J]->GetZ() ;
    115131    AtomicWeight = (*theElementTable )[J]->GetA() ;
     
    119135      LowEdgeEnergy = ptrVector->GetLowEdgeEnergy(i) ;
    120136      Value = ComputeMicroscopicCrossSection(&aParticleType,
    121                                                  LowEdgeEnergy,
    122                                                  AtomicNumber,AtomicWeight) ;
     137                                             LowEdgeEnergy,
     138                                             AtomicNumber,AtomicWeight) ;
    123139      ptrVector->PutValue(i,Value) ;
    124140    }
     
    130146  const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable() ;
    131147  if (theMeanFreePathTable) {
    132      theMeanFreePathTable->clearAndDestroy();
    133      delete theMeanFreePathTable;
     148    theMeanFreePathTable->clearAndDestroy();
     149    delete theMeanFreePathTable;
    134150  }
    135151  theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
     
    142158  {
    143159    ptrVector = new G4PhysicsLogVector(LowestKineticEnergy,
    144                                          HighestKineticEnergy,
    145                                          TotBin ) ;
     160                                       HighestKineticEnergy,
     161                                       TotBin ) ;
    146162
    147163    const G4Material* material= (*theMaterialTable)[K];
     
    167183void G4MuNuclearInteraction::ComputePartialSumSigma(
    168184                                   const G4ParticleDefinition* ParticleType,
    169                                                G4double KineticEnergy,
    170                                                const G4Material* aMaterial)
     185                                   G4double KineticEnergy,
     186                                   const G4Material* aMaterial)
    171187
    172188// Build the table of cross section per element. The table is built for MATERIALS.
     
    183199
    184200   for ( G4int Ielem=0 ; Ielem < NbOfElements ; Ielem++ )
    185       {             
    186         SIGMA += theAtomNumDensityVector[Ielem] *
    187               ComputeMicroscopicCrossSection( ParticleType, KineticEnergy,
    188                                         (*theElementVector)[Ielem]->GetZ(),
    189                                         (*theElementVector)[Ielem]->GetA()) ;
    190         PartialSumSigma[Imate]->push_back(SIGMA);
    191       }
     201     {             
     202       SIGMA += theAtomNumDensityVector[Ielem] *
     203        ComputeMicroscopicCrossSection( ParticleType, KineticEnergy,
     204                                        (*theElementVector)[Ielem]->GetZ(),
     205                                        (*theElementVector)[Ielem]->GetA()) ;
     206       PartialSumSigma[Imate]->push_back(SIGMA);
     207     }
    192208}
    193209
     
    529545  // select randomly 1 element within the material
    530546
    531   const G4int Index = aMaterial->GetIndex();
    532   const G4int NumberOfElements = aMaterial->GetNumberOfElements();
     547  G4int Index = aMaterial->GetIndex();
     548  G4int NumberOfElements = aMaterial->GetNumberOfElements();
    533549  const G4ElementVector* theElementVector = aMaterial->GetElementVector();
     550  if(1 == NumberOfElements) return ((*theElementVector)[0]);
    534551
    535552  G4double rval = G4UniformRand()*((*PartialSumSigma[Index])[NumberOfElements-1]);
    536   for ( G4int i=0; i < NumberOfElements; i++ )
     553  for ( G4int i=0; i < NumberOfElements; i++ ) {
    537554    if (rval <= (*PartialSumSigma[Index])[i]) return ((*theElementVector)[i]);
    538   G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
    539        << "' has no elements, NULL pointer returned." << G4endl;
    540   return 0;
    541 }
     555  }
     556  G4cout << "G4MuNuclearInteraction WARNING !!! no element selected for '"
     557         << aMaterial->GetName()
     558         << " 1st element returned." << G4endl;
     559  return ((*theElementVector)[0]);
     560}
     561
    542562void G4MuNuclearInteraction::PrintInfoDefinition()
    543563{
  • trunk/source/processes/hadronic/models/photolepton_hadron/muon_nuclear/src/G4MuonNucleusInteractionModel.cc

    r819 r962  
    2626//
    2727// $Id: G4MuonNucleusInteractionModel.cc,v 1.6 2006/06/29 20:57:36 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// --------------------------------------------------------------
  • trunk/source/processes/hadronic/models/photolepton_hadron/muon_nuclear/src/G4ParametrizedHadronicVertex.cc

    r819 r962  
    2626//
    2727// $Id: G4ParametrizedHadronicVertex.cc,v 1.6 2006/06/29 20:57:40 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// --------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.