Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:17:10

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 //
0028 // Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
0029 //
0030 // History:
0031 // -----------
0032 // 28 Nov 2001 Elena Guardincerri     Created
0033 //
0034 // -------------------------------------------------------------------
0035 
0036 #include "XrayFluoNormalization.hh"
0037 #include "XrayFluoDataSet.hh"
0038 #include "G4SystemOfUnits.hh"
0039 #include "G4VDataSetAlgorithm.hh"
0040 #include "G4LogLogInterpolation.hh"
0041 
0042 XrayFluoNormalization::XrayFluoNormalization()
0043 
0044 { }
0045 
0046 XrayFluoNormalization::~XrayFluoNormalization()
0047 
0048 { }
0049 
0050 const XrayFluoDataSet* XrayFluoNormalization::Normalize(G4double minIntExtreme, G4double maxIntExtreme, G4int nBins, G4String fileName)
0051 {
0052  
0053  G4VDataSetAlgorithm* interpolation = new G4LogLogInterpolation();
0054 
0055  XrayFluoDataSet* dataSet = 
0056    new XrayFluoDataSet(1,fileName,interpolation,keV,1);
0057   
0058  G4double integral = Integrate(minIntExtreme, maxIntExtreme, nBins, dataSet);
0059  
0060  G4VDataSetAlgorithm* interpolation2 = new G4LogLogInterpolation();
0061  
0062  XrayFluoDataSet* finalDataSet = new XrayFluoDataSet(1,fileName,interpolation2,keV,1/(integral/keV));
0063  return finalDataSet;
0064 }
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0067 
0068 G4double XrayFluoNormalization::Integrate(G4double minIntExtreme, G4double maxIntExtreme, G4int nBins, XrayFluoDataSet* dataSet)
0069 {
0070  G4double partialHeight = 0;
0071  G4int id = 0;
0072  G4double lenghtOfBins = (maxIntExtreme - minIntExtreme)/nBins;
0073  
0074  for (G4int i = 0; i<nBins; i++)
0075    {
0076      G4double midPoint = minIntExtreme + i*lenghtOfBins+lenghtOfBins/2;
0077     
0078      G4double heightOfRectangle = dataSet->FindValue(midPoint,id);
0079     
0080      partialHeight += heightOfRectangle;
0081    
0082    }
0083 
0084  G4double integral = lenghtOfBins * partialHeight;
0085  
0086  delete dataSet;
0087  dataSet = 0;
0088  return integral;
0089 }
0090 
0091 
0092 
0093