Skip to content

Commit

Permalink
Merge pull request #23 from rest-for-physics/jgalan_solar_flux
Browse files Browse the repository at this point in the history
TRestAxionSolarFlux upgrades to support additional tables format and original .flux files
  • Loading branch information
jgalan authored May 24, 2022
2 parents 1c3cc18 + b1ed7a3 commit 4249c2d
Show file tree
Hide file tree
Showing 23 changed files with 808 additions and 408 deletions.
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

0 comments on commit 4249c2d

Please sign in to comment.