Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:52

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
0028 //
0029 #ifndef G4ParticleHPLabAngularEnergy_h
0030 #define G4ParticleHPLabAngularEnergy_h 1
0031 
0032 #include "G4InterpolationManager.hh"
0033 #include "G4Neutron.hh"
0034 #include "G4ParticleHPInterpolator.hh"
0035 #include "G4ParticleHPVector.hh"
0036 #include "G4ReactionProduct.hh"
0037 #include "G4VParticleHPEnergyAngular.hh"
0038 #include "G4ios.hh"
0039 #include "globals.hh"
0040 
0041 #include <fstream>
0042 
0043 class G4ParticleHPLabAngularEnergy : public G4VParticleHPEnergyAngular
0044 {
0045   public:
0046     G4ParticleHPLabAngularEnergy()
0047     {
0048       theEnergies = nullptr;
0049       theData = nullptr;
0050       nCosTh = nullptr;
0051       theSecondManager = nullptr;
0052       nEnergies = -1;
0053       currentMeanEnergy = -1.0;
0054     }
0055     ~G4ParticleHPLabAngularEnergy() override
0056     {
0057       delete[] theEnergies;
0058       delete[] nCosTh;
0059       if (theData != nullptr) {
0060         for (G4int i = 0; i < nEnergies; i++)
0061           delete[] theData[i];
0062         delete[] theData;
0063       }
0064       delete[] theSecondManager;
0065     }
0066 
0067   public:
0068     void Init(std::istream& aDataFile) override;
0069     G4ReactionProduct* Sample(G4double anEnergy, G4double massCode, G4double mass) override;
0070     G4double MeanEnergyOfThisInteraction() override { return currentMeanEnergy; }
0071 
0072   private:
0073     // number of incoming neutron energies
0074     G4int nEnergies;
0075     // Interpol between neutron energies
0076     G4InterpolationManager theManager;
0077     // Incoming neutron energies
0078     G4double* theEnergies;
0079     // number of directioncosines; parallel to theEnergies
0080     G4int* nCosTh;
0081     // knows the interpolation between these stores
0082     G4InterpolationManager* theSecondManager;
0083     // vectors of secondary energy, haufigkeit; parallel to theEnergies
0084     G4ParticleHPVector** theData;
0085 
0086     // utility interpolator
0087     G4ParticleHPInterpolator theInt;
0088 
0089     // cashed value of mean secondary energy in this event.
0090     G4double currentMeanEnergy;
0091 };
0092 #endif