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

TRestAxionSolarFlux upgrades to support additional tables format and original .flux files #23

Merged
merged 43 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1f29c20
TRestAxionSolarFlux. Tables are now Float_t. Binary tables are suppor…
jgalan Apr 11, 2022
38c8639
TRestAxionSolarFlux. Fixed pipelne and .flux tables integration (WIP)
jgalan Apr 11, 2022
8d445ae
Updating PR badges and template description
jgalan Apr 12, 2022
e71942c
solarFlux.py adding LoadTables call
jgalan Apr 12, 2022
da1c4f4
Adding new solar flux definitions
jgalan Apr 12, 2022
74d86af
solarFlux.py fixing a typo
jgalan Apr 12, 2022
4ae207b
compare.py fix name in RML
jgalan Apr 12, 2022
35740dd
Adding additional output at solarFlux.py
jgalan Apr 12, 2022
b37e669
TRestAxionSolarFlux added fLoadedTable to control if tables have been…
jgalan Apr 12, 2022
e294fe7
Deleted pipeline/metadata/fluxes.rml that will be placed now at ./dat…
jgalan Apr 15, 2022
583103d
TRestAxionSolarFlux::ReadFluxFile implemented
jgalan Apr 15, 2022
a394af7
TRestAxionSolarFlux::InitFromConfigFile removed
jgalan Apr 15, 2022
dde4471
TRestAxionSolarFlux::DrawFluxFile method added
jgalan Apr 15, 2022
3b438c5
TRestAxionSolarFlux::GetContinuumHistogram and GetFluxFileHistogram a…
jgalan Apr 18, 2022
1c4250f
TRestAxionSolarFlux::GetMonochromaticSpectrum method added
jgalan Apr 18, 2022
c498b0b
Updating solarFlux scripts and validation
jgalan Apr 20, 2022
758b5a4
TRestAxionSolarFlux::DrawSolarFlux method added and general documenta…
jgalan Apr 20, 2022
8e10ba6
solarPlot.py adding colors to histograms
jgalan Apr 20, 2022
5de4499
Uploading new images
jgalan Apr 20, 2022
470db6e
TRestAxionSolarFlux::ExportTables implementation
jgalan Apr 21, 2022
d084b89
Removing fluxToTables.py. Now this is directly imlemented inside TRes…
jgalan Apr 21, 2022
a0a8635
TRestAxionSolarFlux. Fixing TH1 potential name leak
jgalan Apr 21, 2022
c82525c
.gitlab-ci.yml adding data files through wget
jgalan Apr 21, 2022
58dfffc
solarPlot.py updating the maximum bin that has been affected from inc…
jgalan Apr 22, 2022
84a1d90
Removed RML definitions that will be placed now at axionlib-data
jgalan Apr 22, 2022
a0dc57f
Merge branch 'master' into jgalan_solar_flux
jgalan Apr 22, 2022
6b003ab
Re-arranging pipeline setup
jgalan Apr 22, 2022
c175ff5
Updating data submodule
jgalan Apr 22, 2022
e562088
Ignoring png images
jgalan Apr 22, 2022
a2bb2ed
TRestAxionOpticsMirror. Fixing typo
jgalan Apr 22, 2022
0296fcf
.gitlab-ci.yml downoading also transmission file
jgalan Apr 22, 2022
d155afd
Fixing magneticField pipeline
jgalan Apr 24, 2022
e2cb73b
Fixing optics pipeline
jgalan Apr 24, 2022
ff88169
Fixing windows transmission pipeline
jgalan Apr 24, 2022
7750fd8
Fixing optics pipeline
jgalan Apr 24, 2022
e2b67bd
Fixing pipeline style
jgalan Apr 24, 2022
1b2133a
TRestAxionSolarFlux. Fixing warning
jgalan Apr 24, 2022
284e626
Fixing optics pipeline
jgalan Apr 24, 2022
62eff3c
TRestAxionSolarFlux. Adding metadata member fFluxBinSize
jgalan May 4, 2022
5b87a3f
Updating data submodule
jgalan May 4, 2022
5ab857c
Updating data submodule
jgalan May 4, 2022
f0ea921
TRestAxionSolarFlux. Fixed an issue with .flux binning size identific…
jgalan May 6, 2022
b1ed7a3
Updating data submodule
jgalan May 6, 2022
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
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Please, REMOVE this text! This is just a template to serve as a reminder.

Please, give as much detail as possible at your PR and create the simplest possible PR to facilitate reviewing.

If your PR fixes a given issue, please specify the number followed by #
Expand Down
38 changes: 25 additions & 13 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,17 @@ validateLibrary:
- $CRONJOB == "YES"

build:
type: build
stage: build
script:
- echo "**${CI_PROJECT_DIR}**"
- rm -rf ${CI_PROJECT_DIR}/install
- git clone https://github.com/rest-for-physics/framework.git framework
- cd framework
- ./scripts/checkoutRemoteBranch.sh ${CI_COMMIT_BRANCH}
- git submodule init source/libraries/axion
# This will download the data from axionlib.
# erhaps we should make the data accessible throught https and then open the remote files from the pipeline?
- git submodule update source/libraries/axion
- cd source/libraries/axion/
- git checkout ${CI_COMMIT_BRANCH}
- git submodule init data
- git submodule update data
- cd ../../../
- mkdir build
- cd build
Expand All @@ -63,7 +59,7 @@ build:
expire_in: 1 day

loadRESTLibs:
type: loadRESTLibs
stage: loadRESTLibs
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
# - . ${CI_PROJECT_DIR}/framework/source/libraries/axion/external/solarAxionFlux/bin/thisSolarAxionFluxLib.sh
Expand All @@ -73,14 +69,16 @@ loadRESTLibs:
- $CRONJOB

magneticField:
type: metadata
stage: metadata
script:
# - . ${CI_PROJECT_DIR}/framework/source/libraries/axion/external/solarAxionFlux/bin/thisSolarAxionFluxLib.sh
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/magneticField/
- ls $REST_PATH/data/axion/magneticField/
- wget https://sultan.unizar.es/axionlib-data/magneticField/fields.rml
- wget https://sultan.unizar.es/axionlib-data/magneticField/Bykovskiy_201906.dat
- python magneticField.py
- cd trilinear
- wget https://sultan.unizar.es/axionlib-data/magneticField/fields.rml
- restRoot -b -q GetMagneticField_test.C
- cd ${CI_PROJECT_DIR}/pipeline/metadata/magneticField/boundary/
- restRoot -b -q Boundaries_test.C
Expand All @@ -89,32 +87,46 @@ magneticField:
- $CRONJOB

optics:
type: metadata
stage: metadata
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/optics/
- wget https://sultan.unizar.es/axionlib-data/optics/mirrors.rml
- wget https://sultan.unizar.es/axionlib-data/optics/optics.rml
- wget https://sultan.unizar.es/axionlib-data/optics/Reflectivity_Single_C_30_SiO2_0.N901f
- wget https://sultan.unizar.es/axionlib-data/optics/Transmission_Single_C_30_SiO2_0.N901f
- wget https://sultan.unizar.es/axionlib-data/optics/Reflectivity_Single_Au_250_Ni_0.4.N901f
- wget https://sultan.unizar.es/axionlib-data/optics/Transmission_Single_Au_250_Ni_0.4.N901f
- python mirrors.py
- python optics.py
- python basic.py
except:
variables:
- $CRONJOB


xRayTransmission:
type: metadata
stage: metadata
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/transmission/
- wget https://sultan.unizar.es/axionlib-data/transmission/windows.rml
- wget https://sultan.unizar.es/axionlib-data/transmission/Al.sol
- wget https://sultan.unizar.es/axionlib-data/transmission/Si.sol
- wget https://sultan.unizar.es/axionlib-data/transmission/Si3N4.sol
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${CI_PROJECT_DIR}/mpfr-4.0.2/install/lib
- python windowPlot.py

solarFlux:
type: metadata
stage: metadata
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/pipeline/metadata/solarFlux/
- python solarFlux.py
- wget https://sultan.unizar.es/axionlib-data/solarFlux/fluxes.rml
- wget https://sultan.unizar.es/axionlib-data/solarFlux/Dummy_Galan_202202.spt
- wget https://sultan.unizar.es/axionlib-data/solarFlux/Primakoff_Gianotti_201904.dat
- wget https://sultan.unizar.es/axionlib-data/solarFlux/Primakoff_LennertHoof_202203.dat
- python solarTests.py
- python solarPlot.py
- python compare.py
except:
variables:
Expand Down
Binary file added images/ABC_FluxTable.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/ABC_flux_MC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 39 additions & 13 deletions inc/TRestAxionSolarFlux.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#ifndef _TRestAxionSolarFlux
#define _TRestAxionSolarFlux

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

#include <TRestMetadata.h>
Expand All @@ -35,8 +37,6 @@ class TRestAxionSolarFlux : public TRestMetadata {
private:
void Initialize();

void InitFromConfigFile();

/// The filename containning the solar flux table with continuum spectrum
std::string fFluxDataFile = ""; //<

Expand All @@ -52,11 +52,17 @@ class TRestAxionSolarFlux : public TRestMetadata {
/// Seed used in random generator
Int_t fSeed = 0; //<

/// The tabulated solar flux continuum spectra TH1D(100,0,20)keV in cm-2 s-1 keV-1 versus solar radius
std::vector<TH1D*> fFluxTable; //!
/// 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(100,0,20)keV in cm-2 s-1 keV-1 versus solar radius
std::vector<TH1F*> fFluxTable; //!

/// The tabulated solar flux in cm-2 s-1 for a number of monochromatic energies versus solar radius
std::map<Double_t, TH1D*> fFluxLines; //!
std::map<Double_t, TH1F*> fFluxLines; //!

/// Accumulative integrated solar flux for each solar ring for continuum spectrum (renormalized to unity)
std::vector<Double_t> fFluxTableIntegrals; //!
Expand All @@ -76,6 +82,22 @@ class TRestAxionSolarFlux : public TRestMetadata {
/// Random number generator
TRandom3* fRandom = nullptr; //!

/// A canvas pointer for drawing
TCanvas* fCanvas = nullptr; //!

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

/// A pointer to the monochromatic spectrum histogram
TH1F* fMonoHist = nullptr; //!

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

/// A metadata member to control if the tables have been loaded
Bool_t fTablesLoaded = false; //!

void ReadFluxFile();
void LoadContinuumFluxTable();
void LoadMonoChromaticFluxTable();
void IntegrateSolarFluxes();
Expand All @@ -92,19 +114,23 @@ class TRestAxionSolarFlux : public TRestMetadata {

std::pair<Double_t, Double_t> GetRandomEnergyAndRadius();

void LoadTables();

TH1F* GetContinuumSpectrum();
TH1F* GetMonochromaticSpectrum();
TH1F* GetTotalSpectrum();

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

/// 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(std::string fname) {
// TOBE implemented. Creates fname.dat and fname.spt
// If we have external methods to initialize solar flux tables this method
// might be used to generate the tables that can be used later on directly
//
// Check data/solarFlux/README.md for data format and file naming conventions
}
void ExportTables(Bool_t ascii = false);

void PrintMetadata();

Expand Down
1 change: 1 addition & 0 deletions pipeline/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png
40 changes: 0 additions & 40 deletions pipeline/metadata/magneticField/fields.rml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Int_t CheckPoint(TVector3 point);

Int_t GetMagneticField_test() {
TVector3 coordinates;
myField = new TRestAxionMagneticField("../fields.rml", "bField");
myField = new TRestAxionMagneticField("fields.rml", "bField");

// changing x, while y and z are constant
coordinates = TVector3(-349.8, -325.0, -4975.0);
Expand Down
4 changes: 2 additions & 2 deletions pipeline/metadata/optics/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
totalSamples = 10000
genSize = 80

basicOptics = ROOT.TRestAxionOptics("basic.rml", "basic")
spiderOptics = ROOT.TRestAxionOptics("basic.rml", "basic_spider")
basicOptics = ROOT.TRestAxionOptics("optics.rml", "basic")
spiderOptics = ROOT.TRestAxionOptics("optics.rml", "basic_spider")

rings = basicOptics.GetNumberOfRings()
print( "Number of rings (no-spider): " + str(rings) )
Expand Down
36 changes: 0 additions & 36 deletions pipeline/metadata/optics/basic.rml

This file was deleted.

35 changes: 0 additions & 35 deletions pipeline/metadata/optics/mirrors.rml

This file was deleted.

2 changes: 1 addition & 1 deletion pipeline/metadata/optics/optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ROOT.gSystem.Load("libRestFramework.so")
ROOT.gSystem.Load("libRestAxion.so")

mcplOptics_1 = ROOT.TRestAxionMCPLOptics("setups.rml", "mcpl")
mcplOptics_1 = ROOT.TRestAxionMCPLOptics("optics.rml", "mcpl")
mcplOptics_1.PrintMetadata()

rings = mcplOptics_1.GetNumberOfRings()
Expand Down
19 changes: 0 additions & 19 deletions pipeline/metadata/optics/setups.rml

This file was deleted.

2 changes: 1 addition & 1 deletion pipeline/metadata/solarFlux/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
pad1.Divide(2,1)
pad1.Draw()

primakoffLH = ROOT.TRestAxionSolarFlux("fluxes.rml", "LennertHoof")
primakoffLH = ROOT.TRestAxionSolarFlux("fluxes.rml", "LennertHoofPrimakoff")
primakoffG = ROOT.TRestAxionSolarFlux("fluxes.rml", "Gianotti")

if primakoffLH.GetError():
Expand Down
Loading