Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden Photon flux integration #76

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8d7f724
created hidden photon files and started work
tomasoshea Jun 20, 2023
f1e5be3
Coded in HP flux calculation
tomasoshea Jun 22, 2023
b58c1f2
Changed comments to HP versions
tomasoshea Jun 22, 2023
17ac38f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 22, 2023
76b0c6d
Removed all monochromatic and .flux code
tomasoshea Jun 22, 2023
af6550d
Merge branch 'master' of https://github.com/tomasoshea/axionlib
tomasoshea Jun 22, 2023
cd4b0e6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 22, 2023
57d7428
Merge branch 'master' into master
jgalan Jun 22, 2023
4d7b548
Inlcuded mass dependence and set chi=1
tomasoshea Jun 27, 2023
712ca97
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2023
43aee16
Mass set only in loadtables
tomasoshea Jun 27, 2023
8687a30
Merge branch 'master' of https://github.com/tomasoshea/axionlib
tomasoshea Jun 27, 2023
d577a5d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2023
ddfcefb
Merge branch 'master' into master
jgalan Aug 31, 2023
ac0aa28
created hidden photon plot code
tomasoshea Aug 31, 2023
8a7990f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 31, 2023
f81afa5
fixed args error
tomasoshea Sep 5, 2023
a81dcb4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 5, 2023
fdedb14
fixing bugs
tomasoshea Sep 6, 2023
98136de
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2023
c0758b2
fixing bugs again
tomasoshea Sep 6, 2023
0a1f729
fixing bugs again
tomasoshea Sep 6, 2023
1b71f05
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2023
3712ce2
fixing bugs pt.4
tomasoshea Sep 6, 2023
b261cc0
fixing bugs pt.5
tomasoshea Sep 6, 2023
74e04fb
fixing bugs pt.6
tomasoshea Sep 6, 2023
3871b57
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2023
1abf766
fixed bugs, now compiles
tomasoshea Sep 7, 2023
1885077
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 7, 2023
b4984f9
changed how mass is set for hidden photon
tomasoshea Sep 8, 2023
55492be
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 8, 2023
3950fa1
Revert "created hidden photon plot code"
jgalan Sep 11, 2023
ee57b39
Readding data submodule?
jgalan Sep 11, 2023
d2e3d9b
TRestAxionSolarXYZFlux. Fixing compilation issues
jgalan Sep 11, 2023
56f58d2
fixing hidden photon solar plot
tomasoshea Sep 12, 2023
6e94816
fixed unspecified int c = 0
tomasoshea Sep 15, 2023
5f91092
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 15, 2023
f2ea342
commented out redundant 'wG' in calculation
tomasoshea Sep 15, 2023
fae682b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 15, 2023
5cab20e
created some plots
tomasoshea Sep 26, 2023
8085857
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 26, 2023
914fa20
created HP field code
tomasoshea Sep 26, 2023
7934ad9
Merge branch 'tomas_HP' into HP_field
tomasoshea Sep 27, 2023
3e3b935
continued work on HP field
tomasoshea Sep 27, 2023
f735320
Merge branch 'tomas_HP' into HP_field
tomasoshea Sep 27, 2023
d9b1946
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 27, 2023
60274a1
moved images
tomasoshea Sep 27, 2023
0374c9d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 27, 2023
4ee82fc
Update src/TRestAxionSolarHiddenPhotonFlux.cxx
jgalan Oct 3, 2023
1e9d52f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 3, 2023
8f49cee
Solving conflicts
jgalan Jan 21, 2024
3bb3260
TRestAxionQCDField fixing conflicts
jgalan Jan 21, 2024
ca1961a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 21, 2024
7205cec
TRestAxionQCDField. Fixing compilation issues
jgalan Jan 21, 2024
b05d3f3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
*.root
**/.DS_Store
*.json
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "data"]
path = data
url = https://github.com/rest-for-physics/axionlib-data.git
url = https://github.com/rest-for-physics/axionlib-data
[submodule "external/solarAxionFlux"]
path = external/solarAxionFlux
url = https://github.com/sebhoof/SolarAxionFlux.git
Binary file added images/SolarHiddenPhotonFlux/flux0.001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SolarHiddenPhotonFlux/flux0.01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SolarHiddenPhotonFlux/flux0.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SolarHiddenPhotonFlux/flux1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SolarHiddenPhotonFlux/flux10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SolarHiddenPhotonFlux/flux100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SolarHiddenPhotonFlux/flux1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SolarHiddenPhotonFlux/flux20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SolarHiddenPhotonFlux/flux30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SolarHiddenPhotonFlux/flux50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions inc/TRestAxionFieldPropagationProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

#include "TRestAxionEvent.h"
#include "TRestAxionEventProcess.h"
#include "TRestAxionField.h"
#include "TRestAxionMagneticField.h"
#include "TRestAxionQCDField.h"
#include "TRestPhysics.h"
#include "TVector3.h"
#include "TVectorD.h"
Expand All @@ -44,7 +44,7 @@ class TRestAxionFieldPropagationProcess : public TRestAxionEventProcess {
TRestAxionMagneticField* fMagneticField = nullptr; //!

/// A pointer to TRestAxionField that implements probability calculations
TRestAxionField* fAxionField = nullptr; //!
TRestAxionQCDField* fAxionField = nullptr; //!

/// A pointer to TRestBufferGas given to TRestAxionField to perform calculations in a particular gas
TRestAxionBufferGas* fBufferGas = nullptr; //!
Expand Down
65 changes: 65 additions & 0 deletions inc/TRestAxionHiddenPhotonField.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*************************************************************************
* This file is part of the REST software framework. *
* *
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
* For more information see http://gifna.unizar.es/trex *
* *
* REST is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* REST is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have a copy of the GNU General Public License along with *
* REST in $REST_PATH/LICENSE. *
* If not, see http://www.gnu.org/licenses/. *
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/

#ifndef _TRestAxionHiddenPhotonField
#define _TRestAxionHiddenPhotonField

#include "TRestAxionBufferGas.h"

//! A basic class to define analytical axion-photon conversion calculations for axion helioscopes
class TRestAxionHiddenPhotonField : public TObject {
private:
Bool_t fDebug = false; //!

void Initialize();

/// A pointer to the buffer gas definition
TRestAxionBufferGas* fBufferGas = NULL; //!

public:
/// momentum difference q
Double_t momentumTransfer(Double_t Ea, Double_t ma, Double_t mg);

/// vacuum conversion probability
Double_t VacuumConversion(Double_t Lcoh, Double_t Ea, Double_t ma);

/// It enables/disables debug mode
void SetDebug(Bool_t v) { fDebug = v; }

/// It assigns a gas buffer medium to the calculation
void AssignBufferGas(TRestAxionBufferGas* buffGas) { fBufferGas = buffGas; }

/// It assigns a gas buffer medium to the calculation
void SetBufferGas(TRestAxionBufferGas* buffGas) { fBufferGas = buffGas; }

Double_t GammaTransmissionProbability(Double_t Lcoh, Double_t Ea, Double_t ma, Double_t mg = 0,
Double_t absLength = 0);

// Double_t PhotonAbsorptionProbability(Double_t Lcoh, Double_t Ea, Double_t ma,
// Double_t mg = 0, Double_t absLength = 0);

TRestAxionHiddenPhotonField();
~TRestAxionHiddenPhotonField();

ClassDef(TRestAxionHiddenPhotonField, 2);
};
#endif
4 changes: 2 additions & 2 deletions inc/TRestAxionLikelihood.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "TRandom3.h"
#include "TRestAxionBufferGas.h"
#include "TRestAxionField.h"
#include "TRestAxionQCDField.h"
#include "TRestAxionSolarModel.h"
#include "TRestAxionSpectrum.h"

Expand Down Expand Up @@ -62,7 +62,7 @@ class TRestAxionLikelihood : public TRestMetadata {

Double_t fLastStepDensity = 0.; //->

TRestAxionField* fAxionField; //!
TRestAxionQCDField* fAxionField; //!
TRestAxionBufferGas* fBufferGas; //!
TRestAxionSpectrum* fAxionSpectrum; //!

Expand Down
12 changes: 6 additions & 6 deletions inc/TRestAxionField.h → inc/TRestAxionQCDField.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/

#ifndef _TRestAxionField
#define _TRestAxionField
#ifndef _TRestAxionQCDField
#define _TRestAxionQCDField

#include "TRestAxionBufferGas.h"

//! A basic class to define analytical axion-photon conversion calculations for axion helioscopes
class TRestAxionField : public TObject {
class TRestAxionQCDField : public TObject {
private:
Bool_t fDebug = false; //!

Expand Down Expand Up @@ -84,9 +84,9 @@ class TRestAxionField : public TObject {
Double_t maMax = 0.15,
Double_t rampDown = 5.0);

TRestAxionField();
~TRestAxionField();
TRestAxionQCDField();
~TRestAxionQCDField();

ClassDef(TRestAxionField, 2);
ClassDef(TRestAxionQCDField, 2);
};
#endif
29 changes: 21 additions & 8 deletions inc/TRestAxionSolarFlux.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#define _TRestAxionSolarFlux

#include <TCanvas.h>
#include <TH1F.h>
#include <TH2F.h>
#include <TH1D.h>
#include <TH2D.h>
#include <TRandom3.h>
#include <TRestMetadata.h>

Expand All @@ -38,6 +38,9 @@ class TRestAxionSolarFlux : public TRestMetadata {
/// Axion coupling strength
Double_t fCouplingStrength = 0; //<

/// Mass parameter
Double_t fMass = 0; //!

/// Seed used in random generator
Int_t fSeed = 0; //<

Expand All @@ -61,18 +64,26 @@ class TRestAxionSolarFlux : public TRestMetadata {
/// It is required in order to load solar flux tables into memory
void Initialize();

/// It is required in order to load solar flux tables into memory for specific mass
void InitializeMass(Double_t mass) {
SetMass(mass);
Initialize();
}

/// Set mass and reinitialise
void SetMass(Double_t m) { fMass = m; } // Initialize(); }

/// It returns the integrated flux at earth in cm-2 s-1 for the given energy range
virtual Double_t IntegrateFluxInRange(TVector2 eRange = TVector2(-1, -1), Double_t mass = 0) = 0;
virtual Double_t IntegrateFluxInRange(TVector2 eRange = TVector2(-1, -1)) = 0;

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

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

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

virtual TCanvas* DrawSolarFlux();

Expand All @@ -83,7 +94,9 @@ class TRestAxionSolarFlux : public TRestMetadata {

Bool_t AreTablesLoaded() { return fTablesLoaded; }

TH1F* GetFluxHistogram(std::string fname, Double_t binSize = 0.01);
Double_t GetMass() { return fMass; }

TH1D* GetFluxHistogram(std::string fname, Double_t binSize = 0.01);
TCanvas* DrawFluxFile(std::string fname, Double_t binSize = 0.01);

void PrintMetadata();
Expand Down
131 changes: 131 additions & 0 deletions inc/TRestAxionSolarHiddenPhotonFlux.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*************************************************************************
* This file is part of the REST software framework. *
* *
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
* For more information see http://gifna.unizar.es/trex *
* *
* REST is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* REST is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have a copy of the GNU General Public License along with *
* REST in $REST_PATH/LICENSE. *
* If not, see http://www.gnu.org/licenses/. *
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/

#ifndef _TRestAxionSolarHiddenPhotonFlux
#define _TRestAxionSolarHiddenPhotonFlux

#include <TRestAxionSolarFlux.h>
#include <TRestAxionSolarModel.h>

//! A metadata class to load tabulated solar hidden photon fluxes. Kinetic mixing set to 1.
class TRestAxionSolarHiddenPhotonFlux : public TRestAxionSolarFlux {
private:
/// The filename containing the solar flux table with continuum spectrum
std::string fFluxDataFile = ""; //<

/// The filename containing the resonance width (wGamma)
std::string fWidthDataFile = ""; //<

/// The filename containing the plasma frequency (wp) table
std::string fPlasmaFreqDataFile = ""; //<

/// It will be used when loading `.flux` files to define the input file energy binsize in eV.
Double_t fBinSize = 0; //<

/// The tabulated solar flux continuum spectra TH1D(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius
std::vector<TH1D*> fFluxTable; //!

/// The tabulated solar flux continuum spectra TH1D(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius
std::vector<TH1D*> fContinuumTable; //!

/// The tabulated resonance width TH1D(200,0,20)keV in eV2 versus solar radius
std::vector<TH1D*> fWidthTable; //!

/// The solar plasma frequency vector in eV versus solar radius
std::vector<TH1D*> fPlasmaFreqTable; //!

/// The total solar flux TH1D(200,0,20)keV in cm-2 s-1 keV-1 versus solar radius
std::vector<TH1D*> fFullFluxTable; //!

/// Accumulative integrated solar flux for each solar ring for continuum spectrum (renormalized to unity)
std::vector<Double_t> fFluxTableIntegrals; //!

/// Total solar flux for monochromatic contributions
Double_t fTotalContinuumFlux = 0; //!

/// A pointer to the continuum spectrum histogram
TH1D* fContinuumHist = nullptr; //!

/// A pointer to the superposed monochromatic and continuum spectrum histogram
TH1D* fTotalHist = nullptr; //!

void ReadFluxFile();
void LoadContinuumFluxTable();
void LoadMonoChromaticFluxTable();
void IntegrateSolarFluxes();

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

/// It returns true if width table was loaded
Bool_t isWidthTableLoaded() { return fWidthTable.size() > 0; }

/// It returns true if plasma frequency table was loaded
Bool_t isPlasmaFreqLoaded() { return fPlasmaFreqTable.size() > 0; }

/// It returns the integrated flux at earth in cm-2 s-1 for the given energy range
Double_t IntegrateFluxInRange(TVector2 eRange = TVector2(-1, -1)) override;

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

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

void LoadContinuumTable();
void LoadWidthTable();
void LoadPlasmaFreqTable();

// calculate solar HP flux from the 3 tables and mass
void CalculateSolarFlux();
/// It returns the total integrated flux at earth in cm-2 s-1
Double_t GetTotalFlux() override { return fTotalContinuumFlux; }

/// It returns an energy integrated spectrum in cm-2 s-1 keV-1
TH1D* GetEnergySpectrum() override { return GetTotalSpectrum(); }

TH1D* GetContinuumSpectrum();
TH1D* GetTotalSpectrum();

virtual TCanvas* DrawSolarFlux() override;

/// Tables might be loaded using a solar model description by TRestAxionSolarModel
void InitializeSolarTable(TRestAxionSolarModel* model) {
// TOBE implemented
// This method should initialize the tables fFluxTable and fFluxLines
}

void ExportTables(Bool_t ascii = false) override;

void PrintMetadata() override;

void PrintContinuumSolarTable();
void PrintIntegratedRingFlux();

TRestAxionSolarHiddenPhotonFlux();
TRestAxionSolarHiddenPhotonFlux(const char* cfgFileName, std::string name = "");
~TRestAxionSolarHiddenPhotonFlux();

ClassDefOverride(TRestAxionSolarHiddenPhotonFlux, 1);
};
#endif
Loading
Loading