source: trunk/source/processes/hadronic/models/im_r_matrix/src/G4VCrossSectionSource.cc @ 1315

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

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 6.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// $Id: G4VCrossSectionSource.cc,v 1.6 2010/03/12 15:45:18 gunter Exp $ //
27//
28
29#include "globals.hh"
30#include "G4HadronicException.hh"
31#include "G4ios.hh"
32#include "G4VCrossSectionSource.hh"
33#include "G4ParticleDefinition.hh"
34#include "G4KineticTrack.hh"
35#include "G4CrossSectionVector.hh"
36#include "G4CrossSectionSourcePtr.hh"
37#include "G4Proton.hh"
38#include "G4Neutron.hh"
39
40G4VCrossSectionSource::G4VCrossSectionSource()
41{ }
42
43
44G4VCrossSectionSource::~G4VCrossSectionSource()
45{ }
46
47
48G4ParticleDefinition * G4VCrossSectionSource::
49FindKeyParticle(const G4KineticTrack& trk1,const G4KineticTrack& trk2) const
50{
51  G4ParticleDefinition * result;
52 
53  G4ParticleDefinition * p1 = trk1.GetDefinition();
54  G4ParticleDefinition * p2 = trk2.GetDefinition();
55 
56  if( (p1==G4Proton::Proton() && p2==G4Proton::Proton() ) ||
57      (p1==G4Neutron::Neutron() && p2==G4Neutron::Neutron()) )
58  {
59    result = G4Proton::Proton();
60  }
61  else if( (p1==G4Neutron::Neutron() && p2==G4Proton::Proton()) ||
62           (p2==G4Neutron::Neutron() && p1==G4Proton::Proton()) )
63  {
64    result = G4Neutron::Neutron();
65  }
66  else
67  {
68    throw G4HadronicException(__FILE__, __LINE__, "G4VCrossSectionSource: unklnown particles in FindKeyParticle");
69  }
70  return result;
71}
72
73G4bool G4VCrossSectionSource::operator==(const G4VCrossSectionSource &right) const
74{
75  return (this == (G4VCrossSectionSource *) &right);
76}
77
78
79G4bool G4VCrossSectionSource::operator!=(const G4VCrossSectionSource &right) const
80{
81  return (this != (G4VCrossSectionSource *) &right);
82}
83
84
85void G4VCrossSectionSource::Print() const
86{
87  G4int nComponents = 0;
88  const G4CrossSectionVector* components = GetComponents();
89  if (components)
90    {
91      nComponents = components->size();
92    }
93  G4cout << "---- " << this->Name() << " ---- has " << nComponents << " components" <<G4endl;
94  G4int i;
95  for (i=0; i<nComponents; i++)
96    {
97      G4cout << "-" <<  this->Name() << " - Component " << i << ": " <<G4endl;
98
99      G4CrossSectionSourcePtr componentPtr = (*components)[i];
100      G4VCrossSectionSource* component = componentPtr();
101      component->Print();
102    }
103}
104
105
106void G4VCrossSectionSource::PrintAll(const G4KineticTrack& trk1, const G4KineticTrack& trk2) const
107{
108  G4double sqrtS = (trk1.Get4Momentum() + trk2.Get4Momentum()).mag();
109  G4double sigma = CrossSection(trk1,trk2) / millibarn;
110  G4cout << "---- " << Name() << ": "
111         << "Ecm = " << sqrtS / GeV << " GeV -  " 
112         << " Cross section = " << sigma << " mb "
113         << G4endl;
114
115  G4int nComponents = 0;
116  const G4CrossSectionVector* components = GetComponents();
117  if (components != 0)
118    {
119      nComponents = components->size();
120    }
121  G4int i;
122  for (i=0; i<nComponents; i++)
123    {
124      G4cout << "* Component " << i << ": ";
125      G4CrossSectionSourcePtr componentPtr = (*components)[i];
126      G4VCrossSectionSource* component = componentPtr();
127      component->PrintAll(trk1,trk2);
128    }
129}
130
131
132G4bool G4VCrossSectionSource::InLimits(G4double e, G4double eLow, G4double eHigh) const
133{
134  G4bool answer = false;
135  if (e >= eLow && e <= eHigh) answer = true;
136  return answer;
137}
138
139G4double G4VCrossSectionSource::LowLimit() const
140{
141  return 0.; 
142}
143
144
145G4double G4VCrossSectionSource::HighLimit() const
146{
147  return DBL_MAX; 
148}
149
150G4bool G4VCrossSectionSource::IsValid(G4double e) const
151{
152  G4bool answer = false;
153  if (e >= LowLimit() && e <= HighLimit()) answer = true;
154  return answer;
155}
156
157const G4ParticleDefinition* G4VCrossSectionSource::FindLightParticle(const G4KineticTrack& trk1, 
158                                                                     const G4KineticTrack& trk2) const
159{
160  G4double mass1 = trk1.GetDefinition()->GetPDGMass();
161  G4double mass2 = trk2.GetDefinition()->GetPDGMass();
162  if (mass1 < mass2)
163    {
164      return trk1.GetDefinition();
165    }
166  else
167    {
168      return trk2.GetDefinition();
169    }
170}
171
172
173G4double G4VCrossSectionSource::FcrossX(G4double e, G4double e0, 
174                     G4double sigma, G4double eParam, G4double power) const
175{
176  G4double result = 0.;
177
178  G4double denom = eParam*eParam + (e-e0)*(e-e0);
179  if (denom > 0.) 
180  {
181    G4double value = (2.* eParam * sigma * (e-e0) / denom) * std::pow(((e0 + eParam) / e), power);
182    result = std::max(0., value);
183  }
184  return result;
185}     
186   
187G4double G4VCrossSectionSource::GetTransversePionMass() const
188{
189  // Parameter from UrQMD
190  const G4double transversePionMass = 0.3 * GeV;
191  return transversePionMass;
192}
193
194
195G4double G4VCrossSectionSource::GetMinStringMass() const
196{
197  // Parameter from UrQMD
198  const G4double minStringMass = 0.52 * GeV;
199  return minStringMass;
200}
201
202
203
Note: See TracBrowser for help on using the repository browser.