Ignore:
Timestamp:
Dec 22, 2010, 3:52:27 PM (13 years ago)
Author:
garnier
Message:

geant4 tag 9.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LivermorePolarizedPhotoElectricModel.cc

    r1197 r1347  
    5050  // 4 = entering in methods
    5151
     52  SetDeexcitationFlag(true);
     53  ActivateAuger(false);
     54
    5255  G4cout << "Livermore Polarized PhotoElectric is constructed " << G4endl
    5356         << "Energy range: "
     
    6265G4LivermorePolarizedPhotoElectricModel::~G4LivermorePolarizedPhotoElectricModel()
    6366
    64   if (meanFreePathTable)   delete meanFreePathTable;
     67  //  if (meanFreePathTable)   delete meanFreePathTable;
    6568  if (crossSectionHandler) delete crossSectionHandler;
    6669  if (shellCrossSectionHandler) delete shellCrossSectionHandler;
     
    9093
    9194
     95  /*
    9296  // Energy limits
    9397 
    9498  if (LowEnergyLimit() < lowEnergyLimit)
    95     {
    96       G4cout << "G4LivermorePolarizedPhotoElectricModel: low energy limit increased from " <<
    97         LowEnergyLimit()/eV << " eV to " << lowEnergyLimit << " eV" << G4endl;
    98       SetLowEnergyLimit(lowEnergyLimit);
    99     }
    100 
     99  {
     100  G4cout << "G4LivermorePolarizedPhotoElectricModel: low energy limit increased from " <<
     101  LowEnergyLimit()/eV << " eV to " << lowEnergyLimit << " eV" << G4endl;
     102  SetLowEnergyLimit(lowEnergyLimit);
     103  }
     104 
    101105  if (HighEnergyLimit() > highEnergyLimit)
    102     {
    103       G4cout << "G4LivermorePolarizedPhotoElectricModel: high energy limit decreased from " <<
    104         HighEnergyLimit()/GeV << " GeV to " << highEnergyLimit << " GeV" << G4endl;
    105       SetHighEnergyLimit(highEnergyLimit);
    106     }
    107 
     106  {
     107  G4cout << "G4LivermorePolarizedPhotoElectricModel: high energy limit decreased from " <<
     108  HighEnergyLimit()/GeV << " GeV to " << highEnergyLimit << " GeV" << G4endl;
     109  SetHighEnergyLimit(highEnergyLimit);
     110  }
     111  */
     112 
    108113  // Reading of data files - all materials are read
    109114 
     
    114119
    115120  meanFreePathTable = 0;
    116   meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials();
     121  //  meanFreePathTable = crossSectionHandler->BuildMeanFreePathForMaterials();
    117122
    118123  shellCrossSectionHandler = new G4CrossSectionHandler();
     
    125130  if (verboseLevel > 2)
    126131    G4cout << "Loaded cross section files for Livermore Polarized PhotoElectric model" << G4endl;
    127 
     132 
    128133  InitialiseElementSelectors(particle,cuts);
    129134
     
    138143  if(isInitialised) return;
    139144
    140   if(pParticleChange)
     145  /*  if(pParticleChange)
    141146    fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
    142147  else
    143148    fParticleChange = new G4ParticleChangeForGamma();
    144    
     149  */
     150   
     151  fParticleChange = GetParticleChangeForGamma();
     152 
    145153  isInitialised = true;
    146154}
     
    179187
    180188  G4double photonEnergy = aDynamicGamma->GetKineticEnergy();
    181   // Within energy limit?
    182 
    183   if(photonEnergy <= lowEnergyLimit)
    184     {
    185       fParticleChange->ProposeTrackStatus(fStopAndKill);
    186       fParticleChange->SetProposedKineticEnergy(0.);
     189  G4ThreeVector gammaPolarization0 = aDynamicGamma->GetPolarization(); 
     190  G4ThreeVector photonDirection = aDynamicGamma->GetMomentumDirection();
     191 
     192  // kill incident photon
     193 
     194  fParticleChange->SetProposedKineticEnergy(0.);
     195  fParticleChange->ProposeTrackStatus(fStopAndKill);
     196 
     197  // low-energy gamma is absorpted by this process
     198
     199  if (photonEnergy <= lowEnergyLimit)
     200    {
    187201      fParticleChange->ProposeLocalEnergyDeposit(photonEnergy);
    188202      return;
    189203    }
    190 
    191 
    192   G4ThreeVector gammaPolarization0 = aDynamicGamma->GetPolarization();
    193 
     204 
    194205  // Protection: a polarisation parallel to the
    195206  // direction causes problems;
    196207  // in that case find a random polarization
    197208
    198   G4ThreeVector photonDirection = aDynamicGamma->GetMomentumDirection();
    199 
    200209  // Make sure that the polarization vector is perpendicular to the
    201210  // gamma direction. If not
    202 
     211 
    203212  if(!(gammaPolarization0.isOrthogonal(photonDirection, 1e-6))||(gammaPolarization0.mag()==0))
    204213    { // only for testing now
     
    212221        }
    213222    }
    214 
     223 
    215224  // End of Protection
    216 
     225 
    217226  //  G4double E0_m = photonEnergy / electron_mass_c2 ;
    218227
    219228  // Select randomly one element in the current material
    220229
    221   G4int Z = crossSectionHandler->SelectRandomAtom(couple,photonEnergy);
     230  //  G4int Z = crossSectionHandler->SelectRandomAtom(couple,photonEnergy);
     231
     232  const G4ParticleDefinition* particle =  aDynamicGamma->GetDefinition();
     233  const G4Element* elm = SelectRandomAtom(couple->GetMaterial(),particle,photonEnergy);
     234  G4int Z = (G4int)elm->GetZ();
    222235
    223236  // Select the ionised shell in the current atom according to shell cross sections
     
    229242  G4double bindingEnergy = shell->BindingEnergy();
    230243  G4int shellId = shell->ShellId();
    231 
    232   // Create lists of pointers to DynamicParticles (photons and electrons)
    233   // (Is the electron vector necessary? To be checked)
    234   std::vector<G4DynamicParticle*>* photonVector = 0;
    235   std::vector<G4DynamicParticle*> electronVector;
    236 
    237   G4double energyDeposit = 0.0;
    238 
     244 
    239245  // Primary outgoing  electron
    240 
     246 
    241247  G4double eKineticEnergy = photonEnergy - bindingEnergy;
    242248
     
    256262                                                           electronDirection,
    257263                                                           eKineticEnergy);
    258       electronVector.push_back(electron);
     264      fvect->push_back(electron);
    259265    }
    260266  else
     
    264270 
    265271
    266   G4int nElectrons = electronVector.size();
    267   size_t nTotPhotons = 0;
    268   G4int nPhotons=0;
    269 
    270   const G4ProductionCutsTable* theCoupleTable=
    271     G4ProductionCutsTable::GetProductionCutsTable();
    272   size_t index = couple->GetIndex();
    273   G4double cutg = (*(theCoupleTable->GetEnergyCutsVector(0)))[index];
    274   cutg = std::min(cutForLowEnergySecondaryPhotons,cutg);
    275 
    276   G4double cute = (*(theCoupleTable->GetEnergyCutsVector(1)))[index];
    277   cute = std::min(cutForLowEnergySecondaryPhotons,cute);
    278 
    279   G4DynamicParticle* aPhoton;
    280 
    281   // Generation of fluorescence
    282   // Data in EADL are available only for Z > 5
    283   // Protection to avoid generating photons in the unphysical case of
    284   // shell binding energy > photon energy
    285   if (Z > 5  && (bindingEnergy > cutg || bindingEnergy > cute))
    286     {
    287       photonVector = deexcitationManager.GenerateParticles(Z,shellId);
    288       nTotPhotons = photonVector->size();
    289       for (size_t k=0; k<nTotPhotons; k++)
    290         {
    291           aPhoton = (*photonVector)[k];
    292           if (aPhoton)
    293             {
    294               G4double itsCut = cutg;
    295               if(aPhoton->GetDefinition() == G4Electron::Electron()) itsCut = cute;
    296 
    297               G4double itsEnergy = aPhoton->GetKineticEnergy();
    298 
    299               if (itsEnergy > itsCut && itsEnergy <= bindingEnergy)
     272  // deexcitation
     273  if(DeexcitationFlag() && Z > 5) {
     274    const G4ProductionCutsTable* theCoupleTable=
     275      G4ProductionCutsTable::GetProductionCutsTable();
     276    size_t index = couple->GetIndex();
     277    G4double cutg = (*(theCoupleTable->GetEnergyCutsVector(0)))[index];
     278    //cutg = std::min(cutForLowEnergySecondaryPhotons,cutg);
     279    G4double cute = (*(theCoupleTable->GetEnergyCutsVector(1)))[index];
     280    //cute = std::min(cutForLowEnergySecondaryPhotons,cute);
     281   
     282    //   G4DynamicParticle* aPhoton;
     283   
     284    // Generation of fluorescence
     285    // Data in EADL are available only for Z > 5
     286    // Protection to avoid generating photons in the unphysical case of
     287    // shell binding energy > photon energy
     288    if (bindingEnergy > cutg || bindingEnergy > cute)
     289      {
     290        G4DynamicParticle* aPhoton;
     291        deexcitationManager.SetCutForSecondaryPhotons(cutg);
     292        deexcitationManager.SetCutForAugerElectrons(cute);
     293        std::vector<G4DynamicParticle*>* photonVector =
     294          deexcitationManager.GenerateParticles(Z,shellId);
     295        size_t nTotPhotons = photonVector->size();
     296        for (size_t k=0; k<nTotPhotons; k++)
     297          {
     298            aPhoton = (*photonVector)[k];
     299            if (aPhoton)
     300              {
     301                G4double itsEnergy = aPhoton->GetKineticEnergy();
     302                if (itsEnergy <= bindingEnergy)
    300303                {
    301                   nPhotons++;
    302304                  // Local energy deposit is given as the sum of the
    303305                  // energies of incident photons minus the energies
    304306                  // of the outcoming fluorescence photons
    305307                  bindingEnergy -= itsEnergy;
    306 
     308                  fvect->push_back(aPhoton);
    307309                }
    308               else
    309                 {
    310                   delete aPhoton;
    311                   (*photonVector)[k] = 0;
    312                 }
    313             }
    314         }
    315     }     
     310                else
     311                  {
     312                    delete aPhoton;
     313                    (*photonVector)[k] = 0;
     314                  }
     315              }
     316          }
     317        delete photonVector;
     318      }
     319  }
     320  // excitation energy left
     321  fParticleChange->ProposeLocalEnergyDeposit(bindingEnergy);
     322}
     323
     324/*
    316325  energyDeposit += bindingEnergy;
    317326  // Final state
    318 
     327 
    319328  for (G4int l = 0; l<nElectrons; l++ )
    320     {
    321       aPhoton = electronVector[l];
    322       if(aPhoton) {
    323         fvect->push_back(aPhoton);
    324       }
    325     }
     329  {
     330  aPhoton = electronVector[l];
     331  if(aPhoton) {
     332  fvect->push_back(aPhoton);
     333  }
     334  }
    326335  for ( size_t ll = 0; ll < nTotPhotons; ll++)
    327     {
    328       aPhoton = (*photonVector)[ll];
    329       if(aPhoton) {
    330         fvect->push_back(aPhoton);
    331       }
    332     }
    333 
    334   delete photonVector;
    335 
    336   if (energyDeposit < 0)
    337     {
    338       G4cout << "WARNING - "
    339              << "G4LowEnergyPhotoElectric::PostStepDoIt - Negative energy deposit"
    340              << G4endl;
    341       energyDeposit = 0;
    342     }
    343 
    344   // kill incident photon
     336  {
     337  aPhoton = (*photonVector)[ll];
     338  if(aPhoton) {
     339  fvect->push_back(aPhoton);
     340  }
     341    }
     342   
     343    delete photonVector;
     344   
     345    if (energyDeposit < 0)
     346    {
     347    G4cout << "WARNING - "
     348    << "G4LowEnergyPhotoElectric::PostStepDoIt - Negative energy deposit"
     349    << G4endl;
     350    energyDeposit = 0;
     351    }
     352   
     353    // kill incident photon
    345354  fParticleChange->ProposeMomentumDirection( 0., 0., 0. );
    346355  fParticleChange->SetProposedKineticEnergy(0.);
     
    349358
    350359}
    351 
    352 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    353 
    354 void G4LivermorePolarizedPhotoElectricModel::SetCutForLowEnSecPhotons(G4double cut)
    355 {
    356   cutForLowEnergySecondaryPhotons = cut;
    357   deexcitationManager.SetCutForSecondaryPhotons(cut);
    358 }
    359 
    360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    361 
    362 void G4LivermorePolarizedPhotoElectricModel::SetCutForLowEnSecElectrons(G4double cut)
    363 {
    364   cutForLowEnergySecondaryElectrons = cut;
    365   deexcitationManager.SetCutForAugerElectrons(cut);
    366 }
    367 
    368 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    369 
    370 void G4LivermorePolarizedPhotoElectricModel::ActivateAuger(G4bool val)
    371 {
    372   deexcitationManager.ActivateAugerElectronProduction(val);
     360*/
     361
     362
     363//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     364
     365void G4LivermorePolarizedPhotoElectricModel::ActivateAuger(G4bool augerbool)
     366{
     367  if (!DeexcitationFlag() && augerbool)
     368    {
     369      G4cout << "WARNING - G4LivermorePolarizedPhotoElectricModel" << G4endl;
     370      G4cout << "The use of the Atomic Deexcitation Manager is set to false " << G4endl;
     371      G4cout << "Therefore, Auger electrons will be not generated anyway" << G4endl;
     372    }
     373  deexcitationManager.ActivateAugerElectronProduction(augerbool);
     374  if (verboseLevel > 1)
     375    G4cout << "Auger production set to " << augerbool << G4endl;
     376
    373377}
    374378
     
    526530//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    527531
    528 G4double G4LivermorePolarizedPhotoElectricModel::GetMeanFreePath(const G4Track& track,
    529                                                       G4double,
    530                                                       G4ForceCondition*)
    531 {
    532 
    533   const G4DynamicParticle* photon = track.GetDynamicParticle();
    534   G4double energy = photon->GetKineticEnergy();
    535   G4Material* material = track.GetMaterial();
    536   //  size_t materialIndex = material->GetIndex();
    537 
    538   G4double meanFreePath = DBL_MAX;
    539 
    540   //  if (energy > highEnergyLimit)
    541   //    meanFreePath = meanFreePathTable->FindValue(highEnergyLimit,materialIndex);
    542   //  else if (energy < lowEnergyLimit) meanFreePath = DBL_MAX;
    543   //  else meanFreePath = meanFreePathTable->FindValue(energy,materialIndex);
    544 
    545   G4double cross = shellCrossSectionHandler->ValueForMaterial(material,energy);
    546   if(cross > 0.0) meanFreePath = 1.0/cross;
    547 
    548   return meanFreePath;
    549 
    550 
    551 }
    552 
    553 
     532/*
     533   G4double G4LivermorePolarizedPhotoElectricModel::GetMeanFreePath(const G4Track& track,
     534   G4double,
     535   G4ForceCondition*)
     536   {
     537   
     538   const G4DynamicParticle* photon = track.GetDynamicParticle();
     539   G4double energy = photon->GetKineticEnergy();
     540   G4Material* material = track.GetMaterial();
     541   //  size_t materialIndex = material->GetIndex();
     542   
     543   G4double meanFreePath = DBL_MAX;
     544   
     545   //  if (energy > highEnergyLimit)
     546   //    meanFreePath = meanFreePathTable->FindValue(highEnergyLimit,materialIndex);
     547   //  else if (energy < lowEnergyLimit) meanFreePath = DBL_MAX;
     548   //  else meanFreePath = meanFreePathTable->FindValue(energy,materialIndex);
     549   
     550   G4double cross = shellCrossSectionHandler->ValueForMaterial(material,energy);
     551   if(cross > 0.0) meanFreePath = 1.0/cross;
     552   
     553   return meanFreePath;
     554   
     555   
     556   }
     557*/
     558
     559
Note: See TracChangeset for help on using the changeset viewer.