-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDarkMatter.h
85 lines (63 loc) · 3.47 KB
/
DarkMatter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef DARKMATTER_H
#define DARKMATTER_H
/// This header contains the classes for different Dark Matter models
/// They also inherit from
#include <string>
#include <memory>
#include <cmath>
#include <vector>
#include "Constants.h"
#include "Source.h"
#include "HaloModel.h"
#include "AngularPowerSpectrum.h"
/* Classes that hold information about Dark Matter objects
* Energy spectrum is taken from simulations
* Parameter here is Mass
* APS is just a 3D matrix pointing to double values
*/
class DarkMatter : public DGRBSource
{
protected:
std::shared_ptr<gsl2DInterpolationWrapper> dNdLogx; // Used for the energy spectrum
public:
std::shared_ptr<HaloModel> HM;
const double Mass;
std::shared_ptr<AngularPowerSpectrum<double> > APS;
std::function<double(const double E, const double z)> EnergySpectrum = 0; // dN/dE
DarkMatter(std::shared_ptr<CosmologyModel> _CM, std::shared_ptr<HaloModel> HM, std::shared_ptr<EBLAbsorbtionCoefficient> tau, std::shared_ptr<gsl2DInterpolationWrapper> dNdLogx, const double m, std::string name)
: DGRBSource(_CM, tau, name), dNdLogx(dNdLogx), HM(HM), Mass(m) {}
};
/// Annihilating Dark matter is characterized by the Thermalized Annihilation Cross Section
class AnnihilatingDM : public DarkMatter
{
public:
const double ThermalizedAnnihilationCrossSection;
AnnihilatingDM(std::shared_ptr<CosmologyModel> _CM, std::shared_ptr<HaloModel> HM, std::shared_ptr<EBLAbsorbtionCoefficient> tau, std::shared_ptr<gsl2DInterpolationWrapper> dNdLogx, const double m, const double ThermalizedAnnihilationCrossSection)
: DarkMatter(_CM, HM, tau, dNdLogx, m, "Annihilating Dark Matter"), ThermalizedAnnihilationCrossSection(ThermalizedAnnihilationCrossSection)
{
// Set necessary functions
EnergySpectrum = [dNdLogx, m] ( const double E, const double z)
{ return std::max(0., dNdLogx->Eval(m, log10(2.*E/m))) /E; };
WindowFunction = [this] ( const double E, const double z) // check E*(1+z) terms
{ return this->ThermalizedAnnihilationCrossSection / (8.*M_PI) * pow(CM->O_dm * CM->CriticalDensity / Mass, 2.) * pow(1.+z, 3.) * this->HM->ClumpingFactor(z) * this->EnergySpectrum(E*(1.+z), z) * exp(-(*(this->tau))(E*(1.+z),z)); };
SourceDensityFT = [this] (const double k, const double M, const double z) // Load the source density from the Halo Model // This should probably be moved out of the HaloModel class, and computed internally in the DM class
{ std::cout << "SDSBFT: " << this->HM->SourceDensitySubhaloBoostFT(k, M, z) << " CF: " << this->HM->ClumpingFactor(z) << std::endl;
return this->HM->SourceDensitySubhaloBoostFT(k, M, z) / this->HM->ClumpingFactor(z); };
}
};
/// Decaying DM is characterized by its Half Life
class DecayingDM : public DarkMatter
{
public:
const double HalfLife;
DecayingDM(std::shared_ptr<CosmologyModel> _CM, std::shared_ptr<HaloModel> HM, std::shared_ptr<EBLAbsorbtionCoefficient> tau, std::shared_ptr<gsl2DInterpolationWrapper> dNdLogx, const double m, const double HalfLife)
: DarkMatter(_CM, HM, tau, dNdLogx, m, "Decaying Dark Matter"), HalfLife(HalfLife)
{
EnergySpectrum = [dNdLogx, m] ( const double E, const double z)
{ return std::max(0., dNdLogx->Eval(m, log10(E/m))) /E; };
WindowFunction = [this] ( const double E, const double z)
{ return 1. / (4.*M_PI) * CM->O_dm * CM->CriticalDensity / (Mass*this->HalfLife)* this->EnergySpectrum(E*(1.+z), z) * exp(-(*(this->tau))(E*(1.+z),z)); };
SourceDensityFT = HM->NFWHaloDensityProfileFT;
}
};
#endif