source: trunk/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPEnAngCorrelation.cc

Last change on this file 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: 5.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// neutron_hp -- source file
27// J.P. Wellisch, Nov-1996
28// A prototype of the low energy neutron transport model.
29//
30// 100413 Fix bug in incidence energy by T. Koi 
31//
32#include "G4NeutronHPEnAngCorrelation.hh"
33#include "G4LorentzRotation.hh"
34#include "G4LorentzVector.hh"
35#include "G4RotationMatrix.hh"
36
37G4ReactionProduct * G4NeutronHPEnAngCorrelation::SampleOne(G4double anEnergy)
38{ 
39  G4ReactionProduct * result = new G4ReactionProduct;
40 
41  // do we have an appropriate distribution
42  if(nProducts!=1) throw G4HadronicException(__FILE__, __LINE__, "More than one product in SampleOne");
43 
44  // get the result
45  G4ReactionProductVector * temp=0;
46  G4int i=0;
47  while(temp == 0) temp = theProducts[i++].Sample(anEnergy);
48 
49  // is the multiplicity correct
50  if(temp->size()!=1) throw G4HadronicException(__FILE__, __LINE__, "SampleOne: Yield not correct");
51 
52  // fill result
53  result = temp->operator[](0);
54 
55  // some garbage collection
56  delete temp;
57 
58  // return result
59  return result;
60}
61
62G4ReactionProductVector * G4NeutronHPEnAngCorrelation::Sample(G4double anEnergy)
63{
64  G4ReactionProductVector * result = new G4ReactionProductVector;
65  G4int i;
66  G4ReactionProductVector * it;
67  G4ReactionProduct theCMS;
68  G4LorentzRotation toZ;
69  if(frameFlag==2)
70  {
71    // simplify and double check @
72    G4ThreeVector the3Neutron = theNeutron.GetMomentum(); //theNeutron has value in LAB
73    G4double nEnergy = theNeutron.GetTotalEnergy();
74    G4ThreeVector the3Target = theTarget.GetMomentum();  //theTarget has value in LAB
75    G4double tEnergy = theTarget.GetTotalEnergy();
76    G4double totE = nEnergy+tEnergy;
77    G4ThreeVector the3CMS = the3Target+the3Neutron;
78    theCMS.SetMomentum(the3CMS);
79    G4double cmsMom = std::sqrt(the3CMS*the3CMS);
80    G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
81    theCMS.SetMass(sqrts);
82    theCMS.SetTotalEnergy(totE);
83    G4ReactionProduct aNeutron;
84    aNeutron.Lorentz(theNeutron, theCMS);
85    //TKDB 100413
86    //ENDF-6 Formats Manual ENDF-102
87    //CHAPTER 6. FILE 6: PRODUCT ENERGY-ANGLE DISTRIBUTIONS
88    //LCT Reference system for secondary energy and angle (incident energy is always given in the LAB system)
89    //anEnergy = aNeutron.GetKineticEnergy();
90    anEnergy = theNeutron.GetKineticEnergy(); //should be same argumment of "anEnergy"
91
92    G4LorentzVector Ptmp (aNeutron.GetMomentum(), aNeutron.GetTotalEnergy());
93
94    toZ.rotateZ(-1*Ptmp.phi());
95    toZ.rotateY(-1*Ptmp.theta());
96  }
97  theTotalMeanEnergy=0;
98  G4LorentzRotation toLab(toZ.inverse()); //toLab only change axis NOT to LAB system
99  for(i=0; i<nProducts; i++)
100  {
101    it = theProducts[i].Sample(anEnergy);
102    G4double aMeanEnergy = theProducts[i].MeanEnergyOfThisInteraction();
103    if(aMeanEnergy>0)
104    {
105      theTotalMeanEnergy += aMeanEnergy;
106    }
107    else
108    {
109      theTotalMeanEnergy = anEnergy/nProducts+theProducts[i].GetQValue();
110    }
111    if(it!=0)
112    {
113      for(unsigned int ii=0; ii<it->size(); ii++)
114      {
115        G4LorentzVector pTmp1 (it->operator[](ii)->GetMomentum(),
116                               it->operator[](ii)->GetTotalEnergy());
117        pTmp1 = toLab*pTmp1;
118        it->operator[](ii)->SetMomentum(pTmp1.vect());
119        it->operator[](ii)->SetTotalEnergy(pTmp1.e());
120        if(frameFlag==1) // target rest //TK 100413 should be LAB?
121        {
122          it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theTarget); //TK 100413 Is this really need?
123        }
124        else if(frameFlag==2) // CMS
125        {
126#ifdef G4_NHP_DEBUG
127          cout <<"G4NeutronHPEnAngCorrelation: "<<
128                 it->at(ii)->GetTotalEnergy()<<" "<<
129                 it->at(ii)->GetMomentum()<<G4endl;
130#endif
131          it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
132        }
133        else
134        {
135          throw G4HadronicException(__FILE__, __LINE__, "G4NeutronHPEnAngCorrelation::Sample: The frame of the finalstate is not specified");
136        }
137        result->push_back(it->operator[](ii));
138      }
139    delete it;
140    }
141  }   
142  return result;
143}
144
Note: See TracBrowser for help on using the repository browser.