G4NeutronHPContAngularPar.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 080718 Add ClearHistories method and related class member
00030 //
00031 #ifndef G4NeutronHPContAngularPar_h
00032 #define G4NeutronHPContAngularPar_h 1
00033 
00034 #include "G4ios.hh"
00035 #include <fstream>
00036 #include "globals.hh"
00037 #include "G4NeutronHPList.hh"
00038 #include "G4ReactionProduct.hh"
00039 #include "G4NeutronHPInterpolator.hh"
00040 #include "G4InterpolationManager.hh"
00041 
00042 class G4NeutronHPContAngularPar
00043 {
00044   public:
00045   
00046   G4NeutronHPContAngularPar()
00047   {
00048     theAngular = 0;
00049     currentMeanEnergy = -2;
00050      fresh = true;
00051   }
00052   ~G4NeutronHPContAngularPar()
00053   {
00054     if(theAngular!=0) delete [] theAngular;
00055   }
00056   
00057   void Init(std::ifstream & aDataFile);
00058   
00059   G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass, 
00060                              G4int angularRep, G4int interpol);
00061   
00062   G4double GetEnergy() { return theEnergy; }
00063   
00064   void SetPrimary(G4ReactionProduct * aPrimary)
00065   {
00066     thePrimary = aPrimary;
00067   }
00068   
00069   void SetTarget(G4ReactionProduct * aTarget)
00070   {
00071     theTarget = aTarget;
00072   }
00073   
00074   void SetTargetCode(G4double aTargetCode) { theTargetCode = aTargetCode; }
00075   
00076   void SetInterpolation(G4int theInterpolation)
00077   {
00078     theManager.Init(theInterpolation, nEnergies); // one range only
00079   }
00080 
00081   void Merge(G4double anEnergy, G4InterpolationScheme & aScheme, 
00082              G4NeutronHPContAngularPar & store1, 
00083              G4NeutronHPContAngularPar & store2) // hmmmm, this interpolates legendre coefficients. Dangerous @@@
00084   {
00085     nDiscreteEnergies = store1.nDiscreteEnergies;
00086     nAngularParameters = store1.nAngularParameters;
00087     nEnergies = store1.nEnergies;
00088     theManager = store1.theManager;
00089     theEnergy = anEnergy;
00090     if(theAngular != 0) delete [] theAngular;
00091     theAngular = new G4NeutronHPList[nEnergies];
00092     G4int i, ii;
00093     G4double value;
00094     for(i=0; i<nEnergies; i++)
00095     {
00096       theAngular[i].SetLabel(store1.theAngular[i].GetLabel());
00097       for(ii=0; ii<nAngularParameters; ii++)
00098       {
00099 //        G4cout <<"test "<<i<<" "<<store1.theEnergy<<" "<<store2.theEnergy<<" "
00100 //             << store1.theAngular[i].GetValue(ii)<<" "<<
00101 //             store2.theAngular[i].GetValue(ii)<<G4endl;
00102         value = theInt.Interpolate(aScheme, anEnergy, 
00103                                    store1.theEnergy, store2.theEnergy,
00104                                    store1.theAngular[i].GetValue(ii),
00105                                    store2.theAngular[i].GetValue(ii));
00106         theAngular[i].SetValue(ii, value);
00107       }
00108     }
00109   };
00110   
00111   G4double MeanEnergyOfThisInteraction()
00112   {
00113     G4double result;
00114     if(currentMeanEnergy<-1)
00115     {
00116       return 0;
00117       // throw G4HadronicException(__FILE__, __LINE__, "G4NeutronHPContAngularPar: Logical error in Product class");
00118     }
00119     else
00120     {
00121       result = currentMeanEnergy;
00122     }
00123     currentMeanEnergy = -2;
00124     return result;
00125   }
00126   
00127   private:
00128   
00129   // incoming particle
00130   G4double theEnergy; 
00131   
00132   // number of exit channel energies
00133   G4int nEnergies; 
00134   // number of discrete exit channels
00135   G4int nDiscreteEnergies;
00136   // number of angular paramerers per channel
00137   G4int nAngularParameters;
00138   // knows the interpolation between List labels
00139   G4InterpolationManager theManager; 
00140   // on per exit-channel energy
00141   G4NeutronHPList * theAngular; 
00142   
00143   private:
00144   
00145   G4NeutronHPInterpolator theInt;
00146   
00147   G4double theTargetCode;
00148   G4ReactionProduct * theTarget;
00149   G4ReactionProduct * thePrimary;
00150   
00151   G4double currentMeanEnergy;
00152 
00153 //080718
00154    public:
00155       void ClearHistories(){ fresh = true; };
00156    private:
00157       G4bool fresh; 
00158       G4double remaining_energy; // represent energy rest of cascade chain
00159 };
00160 #endif

Generated on Mon May 27 17:48:59 2013 for Geant4 by  doxygen 1.4.7