2727#include < TH1F.h>
2828#include < TH2F.h>
2929#include < TRandom3.h>
30- #include < TRestAxionSolarModel.h>
3130#include < TRestMetadata.h>
3231
3332// ! A metadata class to load tabulated solar axion fluxes
3433class TRestAxionSolarFlux : public TRestMetadata {
3534 private:
36- // / The filename containning the solar flux table with continuum spectrum
37- std::string fFluxDataFile = " " ; // <
38-
39- // / The filename containning the solar flux spectra for monochromatic spectrum
40- std::string fFluxSptFile = " " ; // <
41-
4235 // / Axion coupling. Defines coupling type and strength.
4336 std::string fCouplingType = " " ; // <
4437
@@ -48,101 +41,55 @@ class TRestAxionSolarFlux : public TRestMetadata {
4841 // / Seed used in random generator
4942 Int_t fSeed = 0 ; // <
5043
51- // / It will be used when loading `.flux` files to define the input file energy binsize in eV.
52- Double_t fBinSize = 0 ; // <
53-
54- // / It will be used when loading `.flux` files to define the threshold for peak identification
55- Double_t fPeakSigma = 0 ; // <
56-
57- // / The tabulated solar flux continuum spectra TH1F(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius
58- std::vector<TH1F*> fFluxTable ; // !
59-
60- // / The tabulated solar flux in cm-2 s-1 for a number of monochromatic energies versus solar radius
61- std::map<Double_t, TH1F*> fFluxLines ; // !
62-
63- // / Accumulative integrated solar flux for each solar ring for continuum spectrum (renormalized to unity)
64- std::vector<Double_t> fFluxTableIntegrals ; // !
65-
66- // / Accumulative integrated solar flux for each monochromatic energy (renormalized to unity)
67- std::vector<Double_t> fFluxLineIntegrals ; // !
68-
69- // / Total solar flux for monochromatic contributions
70- Double_t fTotalMonochromaticFlux = 0 ; // !
71-
72- // / Total solar flux for monochromatic contributions
73- Double_t fTotalContinuumFlux = 0 ; // !
74-
75- // / The ratio between monochromatic and total flux
76- Double_t fFluxRatio = 0 ; // !
77-
78- // / Random number generator
79- TRandom3* fRandom = nullptr ; // !
44+ // / A metadata member to control if this class has been initialized
45+ Bool_t fTablesLoaded = false ; // !
8046
47+ protected:
8148 // / A canvas pointer for drawing
8249 TCanvas* fCanvas = nullptr ; // !
8350
84- // / A pointer to the continuum spectrum histogram
85- TH1F* fContinuumHist = nullptr ; // !
86-
87- // / A pointer to the monochromatic spectrum histogram
88- TH1F* fMonoHist = nullptr ; // !
89-
90- // / A pointer to the superposed monochromatic and continuum spectrum histogram
91- TH1F* fTotalHist = nullptr ; // !
92-
93- // / A metadata member to control if the tables have been loaded
94- Bool_t fTablesLoaded = false ; // !
51+ // / Random number generator
52+ TRandom3* fRandom = nullptr ; // !
9553
96- void Initialize ();
54+ TRestAxionSolarFlux ();
55+ TRestAxionSolarFlux (const char * cfgFileName, std::string name = " " );
9756
98- void ReadFluxFile ();
99- void LoadContinuumFluxTable ();
100- void LoadMonoChromaticFluxTable ();
101- void IntegrateSolarFluxes ();
57+ // / It defines how to read the solar tables at the inhereted class
58+ virtual Bool_t LoadTables () = 0;
10259
10360 public:
104- // / It returns true if continuum flux spectra was loaded
105- Bool_t isSolarTableLoaded () { return fFluxTable .size () > 0 ; }
106-
107- // / It returns true if monochromatic flux spectra was loaded
108- Bool_t isSolarSpectrumLoaded () { return fFluxLines .size () > 0 ; }
61+ // / It is required in order to load solar flux tables into memory
62+ void Initialize ();
10963
11064 // / It returns the integrated flux at earth in cm-2 s-1 for the given energy range
111- Double_t IntegrateFluxInRange (TVector2 eRange = TVector2(-1 , -1 )) ;
65+ virtual Double_t IntegrateFluxInRange (TVector2 eRange = TVector2(-1 , -1 ), Double_t mass = 0) = 0 ;
11266
11367 // / It returns the total integrated flux at earth in cm-2 s-1
114- Double_t GetTotalFlux () { return fTotalContinuumFlux + fTotalMonochromaticFlux ; }
68+ virtual Double_t GetTotalFlux (Double_t mass = 0 ) = 0;
11569
116- std::pair<Double_t, Double_t> GetRandomEnergyAndRadius (TVector2 eRange = TVector2(-1 , -1 ));
70+ // / It defines how to generate Monte Carlo energy and radius values to reproduce the flux
71+ virtual std::pair<Double_t, Double_t> GetRandomEnergyAndRadius (TVector2 eRange = TVector2(-1 , -1 ),
72+ Double_t mass = 0) = 0;
11773
118- void LoadTables ();
74+ // / It returns an energy integrated spectrum in cm-2 s-1 keV-1
75+ virtual TH1F* GetEnergySpectrum (Double_t m = 0 ) = 0;
11976
120- TH1F* GetContinuumSpectrum ();
121- TH1F* GetMonochromaticSpectrum ();
122- TH1F* GetTotalSpectrum ();
77+ virtual TCanvas* DrawSolarFlux ();
12378
124- TH1F* GetFluxHistogram (std::string fname, Double_t binSize = 0.01 );
125- TCanvas* DrawFluxFile (std::string fname, Double_t binSize = 0.01 );
126- TCanvas* DrawSolarFlux ();
127-
128- // / Tables might be loaded using a solar model description by TRestAxionSolarModel
129- void InitializeSolarTable (TRestAxionSolarModel* model) {
130- // TOBE implemented
131- // This method should initialize the tables fFluxTable and fFluxLines
79+ virtual void ExportTables (Bool_t ascii = false ) {
80+ RESTWarning << " TRestAxionSolarFlux::ExportTables must be re-implemented in the inherited class"
81+ << RESTendl;
13282 }
13383
134- void ExportTables (Bool_t ascii = false );
84+ Bool_t AreTablesLoaded () { return fTablesLoaded ; }
13585
136- void PrintMetadata ();
86+ TH1F* GetFluxHistogram (std::string fname, Double_t binSize = 0.01 );
87+ TCanvas* DrawFluxFile (std::string fname, Double_t binSize = 0.01 );
13788
138- void PrintContinuumSolarTable ();
139- void PrintIntegratedRingFlux ();
140- void PrintMonoChromaticFlux ();
89+ void PrintMetadata ();
14190
142- TRestAxionSolarFlux ();
143- TRestAxionSolarFlux (const char * cfgFileName, std::string name = " " );
14491 ~TRestAxionSolarFlux ();
14592
146- ClassDef (TRestAxionSolarFlux, 1 );
93+ ClassDef (TRestAxionSolarFlux, 2 );
14794};
14895#endif
0 commit comments