Line data Source code
1 : #ifndef CRPROPA_PHOTONBACKGROUND_H 2 : #define CRPROPA_PHOTONBACKGROUND_H 3 : 4 : #include "crpropa/Common.h" 5 : #include "crpropa/Referenced.h" 6 : 7 : #include <vector> 8 : #include <string> 9 : 10 : namespace crpropa { 11 : /** 12 : * \addtogroup PhotonFields 13 : * @{ 14 : */ 15 : 16 : /** 17 : @class PhotonField 18 : @brief Abstract base class for photon fields. 19 : */ 20 1 : class PhotonField: public Referenced { 21 : public: 22 135 : PhotonField() { 23 : this->fieldName = "AbstractPhotonField"; 24 135 : this->isRedshiftDependent = false; 25 135 : } 26 : 27 : /** 28 : returns comoving photon density [1/m^3]. 29 : multiply with (1+z^3) for physical number density. 30 : @param ePhoton photon energy [J] 31 : @param z redshift (if redshift dependent, default = 0.) 32 : */ 33 : virtual double getPhotonDensity(double ePhoton, double z = 0.) const = 0; 34 : virtual double getMinimumPhotonEnergy(double z) const = 0; 35 : virtual double getMaximumPhotonEnergy(double z) const = 0; 36 212 : virtual std::string getFieldName() const { 37 212 : return this->fieldName; 38 : } 39 : 40 : /** 41 : returns overall comoving scaling factor 42 : (cf. CRPropa3-data/calc_scaling.py) 43 : @param z redshift 44 : */ 45 66195 : virtual double getRedshiftScaling(double z) const { 46 66195 : return 1.; 47 : }; 48 : 49 : bool hasRedshiftDependence() const { 50 0 : return this->isRedshiftDependent; 51 : } 52 : 53 : void setFieldName(std::string fieldName) { 54 0 : this->fieldName = fieldName; 55 0 : } 56 : 57 : protected: 58 : std::string fieldName; 59 : bool isRedshiftDependent; 60 : }; 61 : 62 : /** 63 : @class TabularPhotonField 64 : @brief Photon field decorator for tabulated photon fields. 65 : 66 : This class reads photon field data from files; 67 : The first file must be a list of photon energies [J], named fieldName_photonEnergy.txt 68 : The second file must be a list of comoving photon field densities [1/m^3], named fieldName_photonDensity.txt 69 : Optionally, a third file contains redshifts, named fieldName_redshift.txt 70 : */ 71 : class TabularPhotonField: public PhotonField { 72 : public: 73 : TabularPhotonField(const std::string fieldName, const bool isRedshiftDependent = true); 74 : 75 : double getPhotonDensity(double ePhoton, double z = 0.) const; 76 : double getRedshiftScaling(double z) const; 77 : double getMinimumPhotonEnergy(double z) const; 78 : double getMaximumPhotonEnergy(double z) const; 79 : 80 : protected: 81 : void readPhotonEnergy(std::string filePath); 82 : void readPhotonDensity(std::string filePath); 83 : void readRedshift(std::string filePath); 84 : void initRedshiftScaling(); 85 : void checkInputData() const; 86 : 87 : std::vector<double> photonEnergies; 88 : std::vector<double> photonDensity; 89 : std::vector<double> redshifts; 90 : std::vector<double> redshiftScalings; 91 : }; 92 : 93 : /** 94 : @class IRB_Kneiske04 95 : @brief Extragalactic background light model from Kneiske et al. 2004 96 : 97 : Source info: 98 : DOI:10.1051/0004-6361:20031542, 99 : https://www.aanda.org/articles/aa/pdf/2004/03/aa3848.pdf, figure 1 ("Best-fit" model) 100 : */ 101 : class IRB_Kneiske04: public TabularPhotonField { 102 : public: 103 26 : IRB_Kneiske04() : TabularPhotonField("IRB_Kneiske04", true) {} 104 : }; 105 : 106 : /** 107 : @class IRB_Stecker05 108 : @brief Extragalactic background light model by Stecker at al. 2005 109 : 110 : Source info: 111 : DOI:10.1086/506188, astro-ph/0510449 112 : https://iopscience.iop.org/article/10.1086/506188/pdf 113 : */ 114 : class IRB_Stecker05: public TabularPhotonField { 115 : public: 116 14 : IRB_Stecker05() : TabularPhotonField("IRB_Stecker05", true) {} 117 : }; 118 : 119 : /** 120 : @class IRB_Franceschini08 121 : @brief Extragalactic background light model from Franceschini et al. 2008 122 : 123 : Source info: 124 : DOI:10.1051/0004-6361:200809691 125 : https://arxiv.org/pdf/0805.1841.pdf, tables 1 and 2 126 : */ 127 : class IRB_Franceschini08: public TabularPhotonField { 128 : public: 129 14 : IRB_Franceschini08() : TabularPhotonField("IRB_Franceschini08", true) {} 130 : }; 131 : 132 : /** 133 : @class IRB_Finke10 134 : @brief Extragalactic background light model from Finke et al. 2010 135 : 136 : Source info: 137 : DOI:10.1088/0004-637X/712/1/238 138 : https://iopscience.iop.org/article/10.1088/0004-637X/712/1/238/pdf 139 : */ 140 : class IRB_Finke10: public TabularPhotonField { 141 : public: 142 14 : IRB_Finke10() : TabularPhotonField("IRB_Finke10", true) {} 143 : }; 144 : 145 : /** 146 : @class IRB_Dominguez11 147 : @brief Extragalactic background light model from Dominguez et al. 2011 148 : 149 : Source info: 150 : DOI:10.1111/j.1365-2966.2010.17631.x 151 : https://academic.oup.com/mnras/article/410/4/2556/1008012 152 : */ 153 : class IRB_Dominguez11: public TabularPhotonField { 154 : public: 155 14 : IRB_Dominguez11() : TabularPhotonField("IRB_Dominguez11", true) {} 156 : }; 157 : 158 : /** 159 : @class IRB_Gilmore12 160 : @brief Extragalactic background light model from Gilmore et al. 2012 161 : 162 : Source info: 163 : DOI:10.1111/j.1365-2966.2012.20841.x 164 : https://academic.oup.com/mnras/article/422/4/3189/1050758 165 : */ 166 : class IRB_Gilmore12: public TabularPhotonField { 167 : public: 168 14 : IRB_Gilmore12() : TabularPhotonField("IRB_Gilmore12", true) {} 169 : }; 170 : 171 : /** 172 : @class IRB_Stecker16_upper 173 : @brief Extragalactic background light model from Stecker et al. 2016 (upper-bound model) 174 : 175 : Source info: 176 : DOI:10.3847/0004-637X/827/1/6 177 : https://iopscience.iop.org/article/10.3847/0004-637X/827/1/6 178 : */ 179 : class IRB_Stecker16_upper: public TabularPhotonField { 180 : public: 181 14 : IRB_Stecker16_upper() : TabularPhotonField("IRB_Stecker16_upper", true) {} 182 : }; 183 : 184 : /** 185 : @class IRB_Stecker16_lower 186 : @brief Extragalactic background light model from Stecker et al. 2016 (lower-bound model) 187 : 188 : Source info: 189 : DOI:10.3847/0004-637X/827/1/6 190 : https://iopscience.iop.org/article/10.3847/0004-637X/827/1/6 191 : */ 192 : class IRB_Stecker16_lower: public TabularPhotonField { 193 : public: 194 14 : IRB_Stecker16_lower() : TabularPhotonField("IRB_Stecker16_lower", true) {} 195 : }; 196 : 197 : /** 198 : @class IRB_Saldana21 199 : @brief Extragalactic background light model from Saldana-Lopez et al. 2021 200 : 201 : Source info: 202 : DOI:10.1093/mnras/stab2393 203 : https://ui.adsabs.harvard.edu/abs/2021MNRAS.507.5144S/abstract 204 : */ 205 : class IRB_Saldana21: public TabularPhotonField { 206 : public: 207 8 : IRB_Saldana21() : TabularPhotonField("IRB_Saldana21", true) {} 208 : }; 209 : 210 : /** 211 : @class IRB_Saldana21_upper 212 : @brief Extragalactic background light model from Saldana-Lopez et al. 2021 (upper-bound model) 213 : 214 : Source info: 215 : DOI:10.1093/mnras/stab2393 216 : https://ui.adsabs.harvard.edu/abs/2021MNRAS.507.5144S/abstract 217 : */ 218 : class IRB_Saldana21_upper: public TabularPhotonField { 219 : public: 220 0 : IRB_Saldana21_upper() : TabularPhotonField("IRB_Saldana21_upper", true) {} 221 : }; 222 : 223 : /** 224 : @class IRB_Saldana21_lower 225 : @brief Extragalactic background light model from Saldana-Lopez et al. 2021 (lower-bound model) 226 : 227 : Source info: 228 : DOI:10.1093/mnras/stab2393 229 : https://ui.adsabs.harvard.edu/abs/2021MNRAS.507.5144S/abstract 230 : */ 231 : class IRB_Saldana21_lower: public TabularPhotonField { 232 : public: 233 0 : IRB_Saldana21_lower() : TabularPhotonField("IRB_Saldana21_lower", true) {} 234 : }; 235 : 236 : /** 237 : @class IRB_Finke22 238 : @brief Extragalactic background light model from Finke et al. 2022 239 : 240 : Source info: 241 : DOI:10.3847/1538-4357/ac9843 242 : https://iopscience.iop.org/article/10.3847/1538-4357/ac9843/pdf 243 : */ 244 : class IRB_Finke22: public TabularPhotonField { 245 : public: 246 14 : IRB_Finke22() : TabularPhotonField("IRB_Finke22", true) {} 247 : }; 248 : 249 : /** 250 : @class URB 251 : @brief Extragalactic background light model from Protheroe & Biermann 1996 252 : 253 : Source info: 254 : DOI:10.1016/S0927-6505(96)00041-2 255 : https://www.sciencedirect.com/science/article/abs/pii/S0927650596000412 256 : */ 257 : class URB_Protheroe96: public TabularPhotonField { 258 : public: 259 12 : URB_Protheroe96() : TabularPhotonField("URB_Protheroe96", false) {} 260 : }; 261 : 262 : /** 263 : @class URB 264 : @brief Extragalactic background light model based on ARCADE2 observations, by Fixsen et al. 265 : Note that this model does not cover the same energy range as other URB models. Here, only ~10 MHz - 10 GHz is considered. 266 : Therefore, it only makes sense to use this model in very specific studies. 267 : 268 : Source info: 269 : DOI:10.1088/0004-637X/734/1/5 270 : https://iopscience.iop.org/article/10.1088/0004-637X/734/1/5 271 : */ 272 : class URB_Fixsen11: public TabularPhotonField { 273 : public: 274 8 : URB_Fixsen11() : TabularPhotonField("URB_Fixsen11", false) {} 275 : }; 276 : 277 : /** 278 : @class URB 279 : @brief Extragalactic background light model by Nitu et al. 280 : 281 : Source info: 282 : DOI:10.1016/j.astropartphys.2020.102532 283 : https://www.sciencedirect.com/science/article/pii/S0927650520301043? 284 : */ 285 : class URB_Nitu21: public TabularPhotonField { 286 : public: 287 22 : URB_Nitu21() : TabularPhotonField("URB_Nitu21", false) {} 288 : }; 289 : 290 : /** 291 : @class BlackbodyPhotonField 292 : @brief Photon field decorator for black body photon fields. 293 : */ 294 : class BlackbodyPhotonField: public PhotonField { 295 : public: 296 : BlackbodyPhotonField(const std::string fieldName, const double blackbodyTemperature); 297 : double getPhotonDensity(double ePhoton, double z = 0.) const; 298 : double getMinimumPhotonEnergy(double z) const; 299 : double getMaximumPhotonEnergy(double z) const; 300 : void setQuantile(double q); 301 : 302 : protected: 303 : double blackbodyTemperature; 304 : double quantile; 305 : }; 306 : 307 : /** 308 : @class CMB 309 : @brief Cosmic mircowave background photon field 310 : 311 : Source info: 312 : This field is an isotropic blackbody photon field with temperature T = 2.73 K 313 : */ 314 : class CMB: public BlackbodyPhotonField { 315 : public: 316 80 : CMB() : BlackbodyPhotonField("CMB", 2.73) {} 317 : }; 318 : 319 : 320 : } // namespace crpropa 321 : 322 : #endif // CRPROPA_PHOTONBACKGROUND_H