source: trunk/source/processes/electromagnetic/highenergy/src/G4eeTo3PiModel.cc @ 1050

Last change on this file since 1050 was 1007, checked in by garnier, 15 years ago

update to geant4.9.2

File size: 5.5 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// $Id: G4eeTo3PiModel.cc,v 1.1 2008/07/10 18:07:27 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-02 $
28//
29// -------------------------------------------------------------------
30//
31// GEANT4 Class header file
32//
33//
34// File name:     G4eeTo3PiModel
35//
36// Author:        Vladimir Ivanchenko
37//
38// Creation date: 25.10.2003
39//
40// Modifications:
41//
42//
43// -------------------------------------------------------------------
44//
45
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
48//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49
50#include "G4eeTo3PiModel.hh"
51#include "Randomize.hh"
52#include "G4PionPlus.hh"
53#include "G4PionMinus.hh"
54#include "G4PionZero.hh"
55#include "G4DynamicParticle.hh"
56#include "G4PhysicsVector.hh"
57#include "G4PhysicsLinearVector.hh"
58#include "G4eeCrossSections.hh"
59#include "G4RandomDirection.hh"
60#include <complex>
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63
64using namespace std;
65
66G4eeTo3PiModel::G4eeTo3PiModel(G4eeCrossSections* cr):
67  cross(cr)
68{
69  massPi  = G4PionPlus::PionPlus()->GetPDGMass();
70  massPi0 = G4PionZero::PionZero()->GetPDGMass();
71  massOm  = 782.62*MeV;
72  massPhi = 1019.46*MeV;
73  gcash   = 0.0;
74  gmax    = 1.0;
75}
76
77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
78
79G4eeTo3PiModel::~G4eeTo3PiModel()
80{
81  G4cout << "### G4eeTo3PiModel::~G4eeTo3PiModel: gmax= "
82         << gmax << " gcash= " << gcash << G4endl;
83}
84
85//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
86
87G4PhysicsVector* G4eeTo3PiModel::PhysicsVector(G4double emin, 
88                                               G4double emax) const
89{
90  G4double tmin = std::max(emin, ThresholdEnergy());
91  G4double tmax = std::max(tmin, emax);
92  G4int nbins = (G4int)((tmax - tmin)/(1.*MeV));
93  G4PhysicsVector* v = new G4PhysicsLinearVector(emin,emax,nbins);
94  v->SetSpline(true);
95  return v;
96}
97
98//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
99
100void G4eeTo3PiModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp,
101            G4double e, const G4ThreeVector& direction) 
102{
103  if(e < ThresholdEnergy()) return;
104
105  G4double x0 = massPi0/e;
106  G4double x1 = massPi/e;
107
108  G4LorentzVector w0, w1, w2;
109  G4ThreeVector dir0, dir1, mom, mom1, mom2;
110  G4double e0, p0, e2, p, g, m01, m02, m12;
111
112  // max pi0 energy
113  G4double edel  = 0.5*e*(1.0 + x0*x0 - 4.0*x1*x1) - massPi0;
114
115  do {
116    // pi0 sample
117    e0 = edel*G4UniformRand() + massPi0;
118    p0 = sqrt(e0 - massPi0*massPi0);
119    dir0 = G4RandomDirection();
120    w0 = G4LorentzVector(p0*dir0.x(),p0*dir0.y(),p0*dir0.z(),e0);
121
122    // pi+pi- pair
123    w1 = G4LorentzVector(-p0*dir0.x(),-p0*dir0.y(),-p0*dir0.z(),e-e0);
124    G4ThreeVector bst = w1.boostVector();
125    e2 = 0.25*w1.m2();
126
127    // pi+
128    p = sqrt(e2 - massPi*massPi);
129    dir1 = G4RandomDirection();
130    w2 = G4LorentzVector(p*dir1.x(),p*dir1.y(),p*dir1.z(),sqrt(e2));
131    w2.boost(bst);
132    mom2 = w2.vect();
133
134    // pi-
135    w1 -= w2;
136    mom1 = w2.vect();
137
138    m01 = w0*w1;
139    m02 = w0*w2;
140    m12 = w1*w2;
141
142    mom = mom1*mom2;
143    g = mom.mag2()*norm( 1.0/cross->DpRho(m01) +  1.0/cross->DpRho(m02)
144                         + 1.0/cross->DpRho(m12) );
145    if(g > gmax) {
146      G4cout << "G4eeTo3PiModel::SampleSecondaries WARNING matrix element g= "
147             << g << " > " << gmax << " (majoranta)" << G4endl;
148    }
149    if(g > gcash) gcash = g;
150   
151  } while( gmax*G4UniformRand() > g );
152
153  w0.rotateUz(direction);
154  w1.rotateUz(direction);
155  w2.rotateUz(direction);
156
157  // create G4DynamicParticle objects
158  G4DynamicParticle* dp0 = 
159     new G4DynamicParticle(G4PionZero::PionZero(), w0);
160  G4DynamicParticle* dp1 = 
161     new G4DynamicParticle(G4PionPlus::PionPlus(), w1);
162  G4DynamicParticle* dp2 = 
163     new G4DynamicParticle(G4PionMinus::PionMinus(), w2);
164  newp->push_back(dp0);
165  newp->push_back(dp1);
166  newp->push_back(dp2);
167}
168
169//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
170
Note: See TracBrowser for help on using the repository browser.