G4ee2KChargedModel.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: G4ee2KChargedModel.cc 66996 2013-01-29 14:50:52Z gcosmo $
00027 //
00028 // -------------------------------------------------------------------
00029 //
00030 // GEANT4 Class header file
00031 //
00032 //
00033 // File name:     G4ee2KChargedModel
00034 //
00035 // Author:        Vladimir Ivanchenko
00036 //
00037 // Creation date: 09.07.2008
00038 //
00039 // Modifications:
00040 //
00041 //
00042 // -------------------------------------------------------------------
00043 //
00044 
00045 
00046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00048 
00049 #include "G4ee2KChargedModel.hh"
00050 #include "Randomize.hh"
00051 #include "G4PhysicalConstants.hh"
00052 #include "G4SystemOfUnits.hh"
00053 #include "G4KaonPlus.hh"
00054 #include "G4KaonMinus.hh"
00055 #include "G4DynamicParticle.hh"
00056 #include "G4PhysicsVector.hh"
00057 #include "G4PhysicsLinearVector.hh"
00058 #include "G4eeCrossSections.hh"
00059 
00060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00061 
00062 using namespace std;
00063 
00064 G4ee2KChargedModel::G4ee2KChargedModel(G4eeCrossSections* cr):
00065   cross(cr)
00066 {
00067   massK = G4KaonPlus::KaonPlus()->GetPDGMass();
00068   massPhi = 1019.46*MeV;
00069 }
00070 
00071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00072 
00073 G4ee2KChargedModel::~G4ee2KChargedModel()
00074 {}
00075 
00076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00077 
00078 G4double G4ee2KChargedModel::ThresholdEnergy() const
00079 {
00080   return 2.0*massK;
00081 }
00082 
00083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00084 
00085 G4double G4ee2KChargedModel::PeakEnergy() const
00086 {
00087   return massPhi;
00088 }
00089 
00090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00091 
00092 G4double G4ee2KChargedModel::ComputeCrossSection(G4double e) const
00093 {
00094   G4double ee = std::min(HighEnergy(),e);
00095   return cross->CrossSection2Kcharged(ee);
00096 }
00097 
00098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00099 
00100 G4PhysicsVector* G4ee2KChargedModel::PhysicsVector(G4double emin, 
00101                                                    G4double emax) const
00102 {
00103   G4double tmin = std::max(emin, 2.0*massK);
00104   G4double tmax = std::max(tmin, emax);
00105   G4int nbins = (G4int)((tmax - tmin)/(1.*MeV));
00106   G4PhysicsVector* v = new G4PhysicsLinearVector(emin,emax,nbins);
00107   v->SetSpline(true);
00108   return v;
00109 }
00110 
00111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00112 
00113 void G4ee2KChargedModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
00114             G4double e, const G4ThreeVector& direction)
00115 {
00116 
00117   G4double tkin = 0.5*e - massK;
00118   if(tkin < 0.0) tkin = 0.0;
00119 
00120   G4double cost;
00121   do {
00122     cost = 2.0*G4UniformRand() - 1.0;
00123   } while( G4UniformRand() > 1.0 - cost*cost );
00124 
00125   G4double sint = sqrt(1.0 - cost*cost);
00126   G4double phi  = twopi * G4UniformRand();
00127 
00128   G4ThreeVector dir(sint*cos(phi),sint*sin(phi), cost);
00129   dir.rotateUz(direction);
00130 
00131   // create G4DynamicParticle objects
00132   G4DynamicParticle* p1 = 
00133      new G4DynamicParticle(G4KaonPlus::KaonPlus(),dir,tkin);
00134   G4DynamicParticle* p2 = 
00135      new G4DynamicParticle(G4KaonMinus::KaonMinus(),-dir,tkin);
00136   newp->push_back(p1);
00137   newp->push_back(p2);
00138 }
00139 
00140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00141 

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