Skip to content

Commit 56f58d2

Browse files
committed
fixing hidden photon solar plot
1 parent d2e3d9b commit 56f58d2

11 files changed

+1646
-193
lines changed

Diff for: inc/TRestAxionSolarFlux.h

+13-8
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#define _TRestAxionSolarFlux
2525

2626
#include <TCanvas.h>
27-
#include <TH1F.h>
28-
#include <TH2F.h>
27+
#include <TH1D.h>
28+
#include <TH2D.h>
2929
#include <TRandom3.h>
3030
#include <TRestMetadata.h>
3131

@@ -58,23 +58,29 @@ class TRestAxionSolarFlux : public TRestMetadata {
5858
TRestAxionSolarFlux(const char* cfgFileName, std::string name = "");
5959

6060
/// It defines how to read the solar tables at the inhereted class
61-
virtual Bool_t LoadTables(Double_t mass = 0) = 0;
61+
virtual Bool_t LoadTables() = 0;
6262

6363
public:
6464
/// It is required in order to load solar flux tables into memory
6565
void Initialize();
6666

67+
/// It is required in order to load solar flux tables into memory for specific mass
68+
void InitializeMass( Double_t mass ) { SetMass(mass); Initialize(); }
69+
70+
/// Set mass and reinitialise
71+
void SetMass( Double_t m ) { fMass = m; } //Initialize(); }
72+
6773
/// It returns the integrated flux at earth in cm-2 s-1 for the given energy range
68-
virtual Double_t IntegrateFluxInRange(TVector2 eRange = TVector2(-1, -1), Double_t mass = 0) = 0;
74+
virtual Double_t IntegrateFluxInRange(TVector2 eRange = TVector2(-1, -1)) = 0;
6975

7076
/// It returns the total integrated flux at earth in cm-2 s-1
71-
virtual Double_t GetTotalFlux(Double_t mass = 0) = 0;
77+
virtual Double_t GetTotalFlux() = 0;
7278

7379
/// It defines how to generate Monte Carlo energy and radius values to reproduce the flux
7480
virtual std::pair<Double_t, Double_t> GetRandomEnergyAndRadius(TVector2 eRange = TVector2(-1, -1)) = 0;
7581

7682
/// It returns an energy integrated spectrum in cm-2 s-1 keV-1
77-
virtual TH1F* GetEnergySpectrum(Double_t m = 0) = 0;
83+
virtual TH1D* GetEnergySpectrum() = 0;
7884

7985
virtual TCanvas* DrawSolarFlux();
8086

@@ -86,9 +92,8 @@ class TRestAxionSolarFlux : public TRestMetadata {
8692
Bool_t AreTablesLoaded() { return fTablesLoaded; }
8793

8894
Double_t GetMass() { return fMass; }
89-
void SetMass(const Double_t& m) { fMass = m; }
9095

91-
TH1F* GetFluxHistogram(std::string fname, Double_t binSize = 0.01);
96+
TH1D* GetFluxHistogram(std::string fname, Double_t binSize = 0.01);
9297
TCanvas* DrawFluxFile(std::string fname, Double_t binSize = 0.01);
9398

9499
void PrintMetadata();

Diff for: inc/TRestAxionSolarHiddenPhotonFlux.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ class TRestAxionSolarHiddenPhotonFlux : public TRestAxionSolarFlux {
4141
/// It will be used when loading `.flux` files to define the input file energy binsize in eV.
4242
Double_t fBinSize = 0; //<
4343

44-
/// The tabulated solar flux continuum spectra TH1F(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius
45-
std::vector<TH1F*> fFluxTable; //!
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; //!
4646

47-
/// The tabulated solar flux continuum spectra TH1F(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius
48-
std::vector<TH1F*> fContinuumTable; //!
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; //!
4949

50-
/// The tabulated resonance width TH1F(200,0,20)keV in eV2 versus solar radius
51-
std::vector<TH1F*> fWidthTable; //!
50+
/// The tabulated resonance width TH1D(200,0,20)keV in eV2 versus solar radius
51+
std::vector<std::vector<Double_t>> fWidthTable; //!
5252

5353
/// The solar plasma frequency vector in eV versus solar radius
54-
std::vector<TH1F*> fPlasmaFreqTable; //!
54+
std::vector<std::vector<Double_t>> fPlasmaFreqTable; //!
5555

56-
/// The total solar flux TH1F(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius
57-
std::vector<TH1F*> fFullFluxTable; //!
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; //!
5858

5959
/// Accumulative integrated solar flux for each solar ring for continuum spectrum (renormalized to unity)
6060
std::vector<Double_t> fFluxTableIntegrals; //!
@@ -63,17 +63,17 @@ class TRestAxionSolarHiddenPhotonFlux : public TRestAxionSolarFlux {
6363
Double_t fTotalContinuumFlux = 0; //!
6464

6565
/// A pointer to the continuum spectrum histogram
66-
TH1F* fContinuumHist = nullptr; //!
66+
TH1D* fContinuumHist = nullptr; //!
6767

6868
/// A pointer to the superposed monochromatic and continuum spectrum histogram
69-
TH1F* fTotalHist = nullptr; //!
69+
TH1D* fTotalHist = nullptr; //!
7070

7171
void ReadFluxFile();
7272
void LoadContinuumFluxTable();
7373
void LoadMonoChromaticFluxTable();
7474
void IntegrateSolarFluxes();
7575

76-
public:
76+
public:
7777
/// It returns true if continuum flux spectra was loaded
7878
Bool_t isSolarTableLoaded() { return fFluxTable.size() > 0; }
7979

@@ -84,13 +84,13 @@ class TRestAxionSolarHiddenPhotonFlux : public TRestAxionSolarFlux {
8484
Bool_t isPlasmaFreqLoaded() { return fPlasmaFreqTable.size() > 0; }
8585

8686
/// 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), Double_t mass = 0) override;
87+
Double_t IntegrateFluxInRange(TVector2 eRange = TVector2(-1, -1)) override;
8888

8989
/// It defines how to generate Monte Carlo energy and radius values to reproduce the flux
9090
std::pair<Double_t, Double_t> GetRandomEnergyAndRadius(TVector2 eRange = TVector2(-1, -1)) override;
9191

9292
/// It defines how to read the solar tables at the inhereted class for a given mass in eV
93-
Bool_t LoadTables(Double_t mass) override;
93+
Bool_t LoadTables() override;
9494

9595
void LoadContinuumTable();
9696
void LoadWidthTable();
@@ -99,13 +99,13 @@ class TRestAxionSolarHiddenPhotonFlux : public TRestAxionSolarFlux {
9999
// calculate solar HP flux from the 3 tables and mass
100100
void CalculateSolarFlux();
101101
/// It returns the total integrated flux at earth in cm-2 s-1
102-
Double_t GetTotalFlux(Double_t mass = 0) override { return fTotalContinuumFlux; }
102+
Double_t GetTotalFlux() override { return fTotalContinuumFlux; }
103103

104104
/// It returns an energy integrated spectrum in cm-2 s-1 keV-1
105-
TH1F* GetEnergySpectrum(Double_t m = 0) override { return GetTotalSpectrum(); }
105+
TH1D* GetEnergySpectrum() override { return GetTotalSpectrum(); }
106106

107-
TH1F* GetContinuumSpectrum();
108-
TH1F* GetTotalSpectrum();
107+
TH1D* GetContinuumSpectrum();
108+
TH1D* GetTotalSpectrum();
109109

110110
virtual TCanvas* DrawSolarFlux() override;
111111

Diff for: inc/TRestAxionSolarHiddenPhotonFlux.h.new

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
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

Comments
 (0)