source: trunk/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPContAngularPar.hh @ 846

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

import all except CVS

File size: 5.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: G4NeutronHPContAngularPar.hh,v 1.12 2007/06/06 12:45:13 ahoward Exp $
28// GEANT4 tag $Name:  $
29//
30#ifndef G4NeutronHPContAngularPar_h
31#define G4NeutronHPContAngularPar_h 1
32
33#include "G4ios.hh"
34#include <fstream>
35#include "globals.hh"
36#include "G4NeutronHPList.hh"
37#include "G4ReactionProduct.hh"
38#include "G4NeutronHPInterpolator.hh"
39#include "G4InterpolationManager.hh"
40
41class G4NeutronHPContAngularPar
42{
43  public:
44 
45  G4NeutronHPContAngularPar()
46  {
47    theAngular = 0;
48    currentMeanEnergy = -2;
49  }
50  ~G4NeutronHPContAngularPar()
51  {
52    if(theAngular!=0) delete [] theAngular;
53  }
54 
55  void Init(std::ifstream & aDataFile);
56 
57  G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass, 
58                             G4int angularRep, G4int interpol);
59 
60  G4double GetEnergy() { return theEnergy; }
61 
62  void SetPrimary(G4ReactionProduct * aPrimary)
63  {
64    thePrimary = aPrimary;
65  }
66 
67  void SetTarget(G4ReactionProduct * aTarget)
68  {
69    theTarget = aTarget;
70  }
71 
72  void SetTargetCode(G4double aTargetCode) { theTargetCode = aTargetCode; }
73 
74  void SetInterpolation(G4int theInterpolation)
75  {
76    theManager.Init(theInterpolation, nEnergies); // one range only
77  }
78
79  void Merge(G4double anEnergy, G4InterpolationScheme & aScheme, 
80             G4NeutronHPContAngularPar & store1, 
81             G4NeutronHPContAngularPar & store2) // hmmmm, this interpolates legendre coefficients. Dangerous @@@
82  {
83    nDiscreteEnergies = store1.nDiscreteEnergies;
84    nAngularParameters = store1.nAngularParameters;
85    nEnergies = store1.nEnergies;
86    theManager = store1.theManager;
87    theEnergy = anEnergy;
88    if(theAngular != 0) delete [] theAngular;
89    theAngular = new G4NeutronHPList[nEnergies];
90    G4int i, ii;
91    G4double value;
92    for(i=0; i<nEnergies; i++)
93    {
94      theAngular[i].SetLabel(store1.theAngular[i].GetLabel());
95      for(ii=0; ii<nAngularParameters; ii++)
96      {
97//        G4cout <<"test "<<i<<" "<<store1.theEnergy<<" "<<store2.theEnergy<<" "
98//             << store1.theAngular[i].GetValue(ii)<<" "<<
99//             store2.theAngular[i].GetValue(ii)<<G4endl;
100        value = theInt.Interpolate(aScheme, anEnergy, 
101                                   store1.theEnergy, store2.theEnergy,
102                                   store1.theAngular[i].GetValue(ii),
103                                   store2.theAngular[i].GetValue(ii));
104        theAngular[i].SetValue(ii, value);
105      }
106    }
107  };
108 
109  G4double MeanEnergyOfThisInteraction()
110  {
111    G4double result;
112    if(currentMeanEnergy<-1)
113    {
114      return 0;
115      // throw G4HadronicException(__FILE__, __LINE__, "G4NeutronHPContAngularPar: Logical error in Product class");
116    }
117    else
118    {
119      result = currentMeanEnergy;
120    }
121    currentMeanEnergy = -2;
122    return result;
123  }
124 
125  private:
126 
127  // incoming particle
128  G4double theEnergy; 
129 
130  // number of exit channel energies
131  G4int nEnergies; 
132  // number of discrete exit channels
133  G4int nDiscreteEnergies;
134  // number of angular paramerers per channel
135  G4int nAngularParameters;
136  // knows the interpolation between List labels
137  G4InterpolationManager theManager; 
138  // on per exit-channel energy
139  G4NeutronHPList * theAngular; 
140 
141  private:
142 
143  G4NeutronHPInterpolator theInt;
144 
145  G4double theTargetCode;
146  G4ReactionProduct * theTarget;
147  G4ReactionProduct * thePrimary;
148 
149  G4double currentMeanEnergy;
150};
151#endif
Note: See TracBrowser for help on using the repository browser.