REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestAxionSpectrum.h
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 _TRestAxionSpectrum
24 #define _TRestAxionSpectrum
25 
26 #include <TRestMetadata.h>
27 
28 #ifdef USE_SolaxFlux
29 #include "solaxflux/spectral_flux.hpp"
30 #endif
31 
34  private:
35  // Generic initialization routines.
36  void Initialize();
37  // The mode of this class. There are 3 different modes available: table, analytic, and solar_model.
38  // Energy in keV, flux in axions / cm^2 s keV
39  // table : provide a text file with up to 4 columns (and reference values of the associated couplings
40  // g1 and g2).
41  // - 2 columns: energy | flux for coupling g1
42  // - 3 columns: energy | flux for coupling g1 | flux for coupling g2
43  // - 4 columns: energy | radius on solar disc | flux for coupling g1 | flux for coupling g2
44  // analytical : provide parameters a, b, norm, g1ref for the following ansatz OR a named set of parameters
45  // available in the data/ folder
46  // flux = norm * (g1/g1ref)^2 * energy^a * exp(-b * energy)
47  // solar_model: provide a text file with a solar model
48  std::string sMode = "none";
49  // InitFromConfigFile() generates an (interpolated) axion spectrum from a config file.
50  void InitFromConfigFile();
51 
52 #ifdef USE_SolaxFlux
53  // An instance of the axion spectrum class from the AxionSolarFlux lib.
54  AxionSpectrum spectrum;
55  // Solar model if this needs to be defined locally.
56  SolarModel sol;
57 #endif
58 
59  double fDefaultG1 = NAN;
60  double fDefaultG2 = 0;
61  std::string sTableFileName;
62 
63  // TString fProcessName;
64  // TString fMetaDataFromFileHeader;
65  // std::vector<std::vector<double>> fSpectrumTable;
66 
67  public:
68  // Constructors
70  TRestAxionSpectrum(const char* cfgFileName, std::string name = "");
72 
73  double GetSolarAxionFlux(double erg_lo, double erg_hi, double er_step_size);
74  double GetDifferentialSolarAxionFlux(double erg);
75 
76  void PrintMetadata();
77  // bool isSpectrumTableLoaded() { return fSpectrumTable.size() > 0; }
78  // TString GetProcessName() { return fProcessName; }
79 
80  ClassDef(TRestAxionSpectrum, 1);
81 };
82 
83 #endif
A metadata class to define a solar axion spectrum and functions to evaluate it.
void InitFromConfigFile()
To make settings from rml file. This method must be implemented in the derived class.
void PrintMetadata()
Implemented it in the derived metadata class to print out specific metadata information.
void Initialize()
Making default settings.
A base class for any REST metadata class.
Definition: TRestMetadata.h:74