source: trunk/source/processes/hadronic/models/photolepton_hadron/muon_nuclear/src/G4ParametrizedHadronicVertex.cc

Last change on this file was 1340, checked in by garnier, 14 years ago

update ti head

File size: 4.0 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: G4ParametrizedHadronicVertex.cc,v 1.7 2009/03/04 19:09:20 vnivanch Exp $
28// GEANT4 tag $Name: geant4-09-03-ref-09 $
29//
30// --------------------------------------------------------------
31
32#include "G4ParametrizedHadronicVertex.hh"
33#include "G4HadFinalState.hh"
34#include "G4HadProjectile.hh"
35#include "G4LEPionPlusInelastic.hh"
36#include "G4LEPionMinusInelastic.hh"
37#include "G4HEPionPlusInelastic.hh"
38#include "G4HEPionMinusInelastic.hh"
39
40G4ParametrizedHadronicVertex::G4ParametrizedHadronicVertex()
41{
42  theLowEPionPlus = new G4LEPionPlusInelastic;
43  theLowEPionMinus = new G4LEPionMinusInelastic;
44  theHighEPionPlus = new G4HEPionPlusInelastic;
45  theHighEPionMinus = new G4HEPionMinusInelastic;
46}
47
48G4ParametrizedHadronicVertex::~G4ParametrizedHadronicVertex()
49{}
50
51G4VParticleChange* 
52G4ParametrizedHadronicVertex::ApplyYourself(G4Nucleus & theTarget, 
53                                            const G4Track &thePhoton)
54{   
55  theTotalResult.Clear();
56  theTotalResult.Initialize(thePhoton);
57
58  G4double theKineticEnergy = thePhoton.GetKineticEnergy();
59  G4HadFinalState * aR = 0;
60  G4HadProjectile thePro(thePhoton);
61  if(G4UniformRand() > 0.5)
62    {
63      if(theKineticEnergy<20*GeV) aR = theLowEPionMinus->ApplyYourself(thePro, theTarget);
64      else aR = theHighEPionMinus->ApplyYourself(thePro, theTarget);
65    }
66  else
67    {
68      if(theKineticEnergy<20*GeV) aR = theLowEPionPlus->ApplyYourself(thePro, theTarget);
69      else aR = theHighEPionPlus->ApplyYourself(thePro, theTarget);
70    }
71  if(!aR) return &theTotalResult;
72
73  aR->SetTrafoToLab(thePro.GetTrafoToLab());
74
75  G4int nsec = aR->GetNumberOfSecondaries();
76  theTotalResult.SetNumberOfSecondaries(nsec);
77
78  G4ThreeVector it(0., 0., 1.);
79  G4double what = twopi*G4UniformRand();
80  for(G4int i=0; i<nsec; i++)
81    {
82      G4LorentzVector theM = aR->GetSecondary(i)->GetParticle()->Get4Momentum();
83      theM.rotate(what, it);
84      theM*=aR->GetTrafoToLab();
85      aR->GetSecondary(i)->GetParticle()->Set4Momentum(theM);
86      G4double time = aR->GetSecondary(i)->GetTime();
87      if(time<0) time = thePhoton.GetGlobalTime();
88      G4Track* track = new G4Track(aR->GetSecondary(i)->GetParticle(),
89                                   thePhoton.GetGlobalTime(),
90                                   thePhoton.GetPosition());
91      G4double newWeight = thePhoton.GetWeight()*aR->GetSecondary(i)->GetWeight();
92      track->SetWeight(newWeight);
93      theTotalResult.AddSecondary(track);
94    }
95  return &theTotalResult;
96}
Note: See TracBrowser for help on using the repository browser.