|
| 1 | +/************************************************************************* |
| 2 | + * This file is part of the REST software framework. * |
| 3 | + * * |
| 4 | + * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) * |
| 5 | + * For more information see http://gifna.unizar.es/trex * |
| 6 | + * * |
| 7 | + * REST is free software: you can redistribute it and/or modify * |
| 8 | + * it under the terms of the GNU General Public License as published by * |
| 9 | + * the Free Software Foundation, either version 3 of the License, or * |
| 10 | + * (at your option) any later version. * |
| 11 | + * * |
| 12 | + * REST is distributed in the hope that it will be useful, * |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 15 | + * GNU General Public License for more details. * |
| 16 | + * * |
| 17 | + * You should have a copy of the GNU General Public License along with * |
| 18 | + * REST in $REST_PATH/LICENSE. * |
| 19 | + * If not, see http://www.gnu.org/licenses/. * |
| 20 | + * For the list of contributors see $REST_PATH/CREDITS. * |
| 21 | + *************************************************************************/ |
| 22 | + |
| 23 | +#ifndef _TRestAxionSolarHiddenPhotonFlux |
| 24 | +#define _TRestAxionSolarHiddenPhotonFlux |
| 25 | + |
| 26 | +#include <TRestAxionSolarFlux.h> |
| 27 | +#include <TRestAxionSolarModel.h> |
| 28 | + |
| 29 | +//! A metadata class to load tabulated solar hidden photon fluxes. Kinetic mixing set to 1. |
| 30 | +class TRestAxionSolarHiddenPhotonFlux : public TRestAxionSolarFlux { |
| 31 | + private: |
| 32 | + /// The filename containing the solar flux table with continuum spectrum |
| 33 | + std::string fFluxDataFile = ""; //< |
| 34 | + |
| 35 | + /// The filename containing the resonance width (wGamma) |
| 36 | + std::string fWidthDataFile = ""; //< |
| 37 | + |
| 38 | + /// The filename containing the plasma frequency (wp) table |
| 39 | + std::string fPlasmaFreqDataFile = ""; //< |
| 40 | + |
| 41 | + /// It will be used when loading `.flux` files to define the input file energy binsize in eV. |
| 42 | + Double_t fBinSize = 0; //< |
| 43 | + |
| 44 | + /// The tabulated solar flux continuum spectra TH1D(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius |
| 45 | + std::vector<TH1D*> fFluxTable; //! |
| 46 | + |
| 47 | + /// The tabulated solar flux continuum spectra TH1D(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius |
| 48 | + std::vector<std::vector<Double_t>> fContinuumTable; //! |
| 49 | + |
| 50 | + /// The tabulated resonance width TH1D(200,0,20)keV in eV2 versus solar radius |
| 51 | + std::vector<std::vector<Double_t>> fWidthTable; //! |
| 52 | + |
| 53 | + /// The solar plasma frequency vector in eV versus solar radius |
| 54 | + std::vector<std::vector<Double_t>> fPlasmaFreqTable; //! |
| 55 | + |
| 56 | + /// The total solar flux TH1D(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius |
| 57 | + std::vector<TH1D*> fFullFluxTable; //! |
| 58 | + |
| 59 | + /// Accumulative integrated solar flux for each solar ring for continuum spectrum (renormalized to unity) |
| 60 | + std::vector<Double_t> fFluxTableIntegrals; //! |
| 61 | + |
| 62 | + /// Total solar flux for monochromatic contributions |
| 63 | + Double_t fTotalContinuumFlux = 0; //! |
| 64 | + |
| 65 | + /// A pointer to the continuum spectrum histogram |
| 66 | + TH1D* fContinuumHist = nullptr; //! |
| 67 | + |
| 68 | + /// A pointer to the superposed monochromatic and continuum spectrum histogram |
| 69 | + TH1D* fTotalHist = nullptr; //! |
| 70 | + |
| 71 | + void ReadFluxFile(); |
| 72 | + void LoadContinuumFluxTable(); |
| 73 | + void LoadMonoChromaticFluxTable(); |
| 74 | + void IntegrateSolarFluxes(); |
| 75 | + |
| 76 | + public: |
| 77 | + /// It returns true if continuum flux spectra was loaded |
| 78 | + Bool_t isSolarTableLoaded() { return fFluxTable.size() > 0; } |
| 79 | + |
| 80 | + /// It returns true if width table was loaded |
| 81 | + Bool_t isWidthTableLoaded() { return fWidthTable.size() > 0; } |
| 82 | + |
| 83 | + /// It returns true if plasma frequency table was loaded |
| 84 | + Bool_t isPlasmaFreqLoaded() { return fPlasmaFreqTable.size() > 0; } |
| 85 | + |
| 86 | + /// It returns the integrated flux at earth in cm-2 s-1 for the given energy range |
| 87 | + Double_t IntegrateFluxInRange(TVector2 eRange = TVector2(-1, -1)) override; |
| 88 | + |
| 89 | + /// It defines how to generate Monte Carlo energy and radius values to reproduce the flux |
| 90 | + std::pair<Double_t, Double_t> GetRandomEnergyAndRadius(TVector2 eRange = TVector2(-1, -1)) override; |
| 91 | + |
| 92 | + /// It defines how to read the solar tables at the inhereted class for a given mass in eV |
| 93 | + Bool_t LoadTables() override; |
| 94 | + |
| 95 | + void LoadContinuumTable(); |
| 96 | + void LoadWidthTable(); |
| 97 | + void LoadPlasmaFreqTable(); |
| 98 | + |
| 99 | + // calculate solar HP flux from the 3 tables and mass |
| 100 | + void CalculateSolarFlux(); |
| 101 | + /// It returns the total integrated flux at earth in cm-2 s-1 |
| 102 | + Double_t GetTotalFlux() override { return fTotalContinuumFlux; } |
| 103 | + |
| 104 | + /// It returns an energy integrated spectrum in cm-2 s-1 keV-1 |
| 105 | + TH1D* GetEnergySpectrum() override { return GetTotalSpectrum(); } |
| 106 | + |
| 107 | + TH1D* GetContinuumSpectrum(); |
| 108 | + TH1D* GetTotalSpectrum(); |
| 109 | + |
| 110 | + virtual TCanvas* DrawSolarFlux() override; |
| 111 | + |
| 112 | + /// Tables might be loaded using a solar model description by TRestAxionSolarModel |
| 113 | + void InitializeSolarTable(TRestAxionSolarModel* model) { |
| 114 | + // TOBE implemented |
| 115 | + // This method should initialize the tables fFluxTable and fFluxLines |
| 116 | + } |
| 117 | + |
| 118 | + void ExportTables(Bool_t ascii = false) override; |
| 119 | + |
| 120 | + void PrintMetadata() override; |
| 121 | + |
| 122 | + void PrintContinuumSolarTable(); |
| 123 | + void PrintIntegratedRingFlux(); |
| 124 | + |
| 125 | + TRestAxionSolarHiddenPhotonFlux(); |
| 126 | + TRestAxionSolarHiddenPhotonFlux(const char* cfgFileName, std::string name = ""); |
| 127 | + ~TRestAxionSolarHiddenPhotonFlux(); |
| 128 | + |
| 129 | + ClassDefOverride(TRestAxionSolarHiddenPhotonFlux, 1); |
| 130 | +}; |
| 131 | +#endif |
0 commit comments