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

Last change on this file since 898 was 819, checked in by garnier, 16 years ago

import all except CVS

File size: 4.4 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.6 2006/06/29 20:57:40 gunter Exp $
28// GEANT4 tag $Name:  $
29//
30// --------------------------------------------------------------
31#include "G4ParametrizedHadronicVertex.hh"
32#include "G4HadFinalState.hh"
33#include "G4ParticleChange.hh"
34
35G4VParticleChange * G4ParametrizedHadronicVertex::
36ApplyYourself(G4Nucleus & theTarget, const G4Track &thePhoton)
37{   
38    static G4ParticleChange theTotalResult; 
39
40    theTotalResult.Clear();
41    theTotalResult.ProposeLocalEnergyDeposit(0.);
42    theTotalResult.Initialize(thePhoton);
43    theTotalResult.ProposeTrackStatus(fAlive);
44    G4double theKineticEnergy = thePhoton.GetKineticEnergy();
45    G4HadFinalState * aR = 0;
46    G4HadProjectile thePro(thePhoton);
47    if(CLHEP::RandBit::shootBit())
48    {
49      if(theKineticEnergy<20*GeV) aR = theLowEPionMinus->ApplyYourself(thePro, theTarget);
50      else aR = theHighEPionMinus->ApplyYourself(thePro, theTarget);
51    }
52    else
53    {
54      if(theKineticEnergy<20*GeV) aR = theLowEPionPlus->ApplyYourself(thePro, theTarget);
55      else aR = theHighEPionPlus->ApplyYourself(thePro, theTarget);
56    }
57    aR->SetTrafoToLab(thePro.GetTrafoToLab());
58    if(aR->GetStatusChange()==stopAndKill)
59    {
60      theTotalResult.ProposeTrackStatus(fStopAndKill);
61      theTotalResult.ProposeEnergy( 0.0 );
62    }
63    if(aR->GetStatusChange()==suspend)
64    {
65      theTotalResult.ProposeTrackStatus(fSuspend);
66    }
67    if(aR->GetStatusChange()!=stopAndKill )
68    {
69      G4double newWeight = aR->GetWeightChange()*thePhoton.GetWeight();
70      theTotalResult.ProposeParentWeight(newWeight); 
71      if(aR->GetEnergyChange()>-.5) theTotalResult.ProposeEnergy(aR->GetEnergyChange());
72      G4LorentzVector newDirection(aR->GetMomentumChange().unit(), 1.);
73      newDirection*=aR->GetTrafoToLab();
74      theTotalResult.ProposeMomentumDirection(newDirection.vect());
75    }
76
77    theTotalResult.ProposeLocalEnergyDeposit(aR->GetLocalEnergyDeposit());
78    theTotalResult.SetNumberOfSecondaries(aR->GetNumberOfSecondaries());
79
80    G4ThreeVector it(0., 0., 1.);
81    G4double what = 2.*pi*G4UniformRand();
82    for(G4int i=0; i<aR->GetNumberOfSecondaries(); i++)
83    {
84      G4LorentzVector theM = aR->GetSecondary(i)->GetParticle()->Get4Momentum();
85      theM.rotate(what, it);
86      theM*=aR->GetTrafoToLab();
87      aR->GetSecondary(i)->GetParticle()->Set4Momentum(theM);
88      G4double time = aR->GetSecondary(i)->GetTime();
89      if(time<0) time = thePhoton.GetGlobalTime();
90      G4Track* track = new G4Track(aR->GetSecondary(i)->GetParticle(),
91                                   thePhoton.GetGlobalTime(),
92                                   thePhoton.GetPosition());
93      G4double newWeight = thePhoton.GetWeight()*aR->GetSecondary(i)->GetWeight();
94      track->SetWeight(newWeight);
95      theTotalResult.AddSecondary(track);
96    }
97  return &theTotalResult;
98}
Note: See TracBrowser for help on using the repository browser.