Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/underground_physics/src/DMXMinEkineCuts.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 // 
0029 // --------------------------------------------------------------
0030 //  GEANT 4 class implementation file 
0031 //
0032 //  History: first implementation, based on object model of
0033 //  2nd December 1995, G.Cosmo
0034 // --------------------------------------------------------------
0035 //                   15 April 1998 M.Maire
0036 // --------------------------------------------------------------
0037 
0038 #include "DMXMinEkineCuts.hh"
0039 
0040 #include "G4Step.hh"
0041 #include "G4UserLimits.hh"
0042 #include "G4VParticleChange.hh"
0043 #include "G4LossTableManager.hh"
0044 
0045 DMXMinEkineCuts::DMXMinEkineCuts(const G4String& aName)
0046   : DMXSpecialCuts(aName)
0047 {
0048     if (verboseLevel>1) {
0049     G4cout << GetProcessName() << " is created "<< G4endl;
0050    }
0051   SetProcessType(fUserDefined);
0052 }
0053 
0054 DMXMinEkineCuts::~DMXMinEkineCuts()
0055 {}
0056 
0057 DMXMinEkineCuts::DMXMinEkineCuts(DMXMinEkineCuts&)
0058   : DMXSpecialCuts()
0059 {}
0060 
0061 
0062 G4double DMXMinEkineCuts::PostStepGetPhysicalInteractionLength(
0063                              const G4Track& aTrack,
0064                  G4double ,
0065                  G4ForceCondition* condition)
0066 {
0067   // condition is set to "Not Forced"
0068   *condition = NotForced;
0069   
0070   G4double     proposedStep = DBL_MAX;
0071   // get the pointer to UserLimits
0072   G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits();
0073   const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
0074   G4ParticleDefinition* aParticleDef = aTrack.GetDefinition();
0075   
0076   if (pUserLimits && aParticleDef->GetPDGCharge() != 0.0) {
0077     //min kinetic energy
0078     G4double temp = DBL_MAX;
0079     G4double    eKine     = aParticle->GetKineticEnergy();
0080     const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
0081     G4double eMin = pUserLimits->GetUserMinEkine(aTrack);
0082 
0083     if (eKine < eMin)
0084       return 0.;
0085 
0086     G4double    rangeNow = DBL_MAX;
0087       
0088     G4LossTableManager* lossManager = G4LossTableManager::Instance();
0089     rangeNow = lossManager->GetRange(aParticleDef,eKine,couple);
0090 
0091     // charged particles only      
0092     G4double rangeMin = lossManager->GetRange(aParticleDef,eMin,couple); 
0093     temp = rangeNow - rangeMin;
0094     if (proposedStep > temp) proposedStep = temp;  
0095   }
0096   return proposedStep;
0097 }