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

Creation of hidden photon flux code #72

Merged
merged 31 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
31 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
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
133 changes: 133 additions & 0 deletions inc/TRestAxionSolarHiddenPhotonFlux.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*************************************************************************
* 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. Mass and coupling set to 1.
class TRestAxionSolarHiddenPhotonFlux : public TRestAxionSolarFlux {
private:
/// The hidden photon mass used for calculation
double HiddenPhotonMass;
Copy link
Member

@jgalan jgalan Jun 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do not need the mass here? It is the method GetRandomEnergyAndRadius where we define the mass. There should be something inside that method that gets the probability depending on the mass.

Then, inside the processing chain, TRestAxionGeneratorProcess will chose a given mass, and it will use that method to get a random particle from the sun, with given energy and position in the sun (for a given mass).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been looking at it and instead of having the mass as an argument to all the functions that need it, could we not have it as a member of the class? So for example when GetRandomEnergyAndRadius is called with double_t mass as an argument we can then set HiddenPhotonMass = mass? So that since the flux depends on the mass we wouldn't have to supply mass as an argument to every function that deals with the flux.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is possible.

We just need to make sure then that we have this mass inside TRestAxionSolarFlux and not within TRestAxionQCDSolarFlux or TRestAxionHiddenPhotonFlux.

So, we define a TRestAxionSolarFlux::fMass.

Then, inside the TRestAxionGeneratorProcess we can call TRestAxionSolarFlux::SetMass(m) before calling GetRandomEnergyAndRadius.

TRestAxionGeneratorProcess will only have access to those methods available to TRestAxionSolarFlux.

Copy link
Member

@jgalan jgalan Jun 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then, inside TRestAxionSolarFlux we should add:

Double_t fMass = 0; //!

Double_t GetMass() { return fMass; }
void SetMass(const Double_t &m ){ fMass = m; }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then would we remove the double_t mass from the other functions and just have them use fMass? For example in GetTotalFlux(Double_t mass = 0)


/// The value of the kinetic mixing parameter used for calculation
double HiddenPhotonKineticMixing;
tomasoshea marked this conversation as resolved.
Show resolved Hide resolved

/// 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 freqency (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; //<

/// It will be used when loading `.flux` files to define the threshold for peak identification
Double_t fPeakSigma = 0; //<

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

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

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

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

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

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

/// A pointer to the superposed monochromatic and continuum spectrum histogram
TH1F* 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 fWGammaTable.size() > 0; }

/// It returns true if plasma frequency table was loaded
Bool_t isPlasmaFreqLoaded() { return fWpTable.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), Double_t mass = 0) 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),
Double_t mass = 0) override;

/// It defines how to read the solar tables at the inhereted class
Bool_t LoadTables() override;

/// It returns the total integrated flux at earth in cm-2 s-1
Double_t GetTotalFlux(Double_t mass = 0) override {
return fTotalContinuumFlux + fTotalMonochromaticFlux;
}

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

TH1F* GetContinuumSpectrum();
TH1F* GetMonochromaticSpectrum();
TH1F* 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();
void PrintMonoChromaticFlux();

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

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