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

Implementing TRestAxionXrayWindow using TRestPatternMask #26

Merged
merged 13 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
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
10 changes: 5 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ optics:
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
- wget https://sultan.unizar.es/axionlib-data/opticsMirror/mirrors.rml
- wget https://sultan.unizar.es/axionlib-data/opticsMirror/Reflectivity_Single_C_30_SiO2_0.N901f
- wget https://sultan.unizar.es/axionlib-data/opticsMirror/Transmission_Single_C_30_SiO2_0.N901f
- wget https://sultan.unizar.es/axionlib-data/opticsMirror/Reflectivity_Single_Au_250_Ni_0.4.N901f
- wget https://sultan.unizar.es/axionlib-data/opticsMirror/Transmission_Single_Au_250_Ni_0.4.N901f
- python mirrors.py
- python optics.py
- python basic.py
Expand Down
Binary file modified images/windowsTransmission.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 10 additions & 15 deletions inc/TRestAxionXrayWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,22 @@
#define _TRestAxionXrayWindow

#include <TRestMetadata.h>
#include <TRestPatternMask.h>

//! A metadata class to create x-ray transmission window definitions
class TRestAxionXrayWindow : public TRestMetadata {
private:
/// Position of the center of the window in mm
TVector3 fCenter = TVector3(0, 0, 0); //<

/// Type of window (foil, stripped, grid)
std::string fWindowType = "foil"; //<

/// Thicknesss of window material in mm
Double_t fThickness = 0.0; //<

/// Window material name
std::string fMaterial = "Si"; //<

/// Window radius in mm. For the moment the window is always a circle
Double_t fRadius = 8; //<

/// The periodity of the pattern structure in mm
Double_t fPatternGap = 1; //<

/// The width of the pattern structure mm
Double_t fPatternWidth = 0.5; //<

/// The offset in mm for the first pattern structure. If 0, the first masking structure will be at origin.
Double_t fPatternOffset = 2; //<
/// A mask defining a pattern where the transmission will be effective
TRestPatternMask* fMask = nullptr; //<

/// A vector with the energies loaded from the material file. Not stored in disk.
std::vector<Double_t> fEnergy; //!
Expand All @@ -67,12 +56,18 @@ class TRestAxionXrayWindow : public TRestMetadata {
Int_t GetEnergyIndex(Double_t energy);

public:
Double_t GetWindowRadius() { return fRadius; }
Double_t GetWindowRadius() {
if (!fMask) return 0;
return fMask->GetMaskRadius();
}

TRestPatternMask* GetMask() const { return fMask; }

Double_t GetTransmission(Double_t energy, Double_t x, Double_t y);

void PrintTransmissionData();

void InitFromConfigFile();
void PrintMetadata();

TRestAxionXrayWindow();
Expand Down
31 changes: 21 additions & 10 deletions pipeline/metadata/transmission/windowPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import ROOT, math

outfname = "windowsTransmission.png"
patternType = "strongBack"

from ROOT import (
TChain, TFile, TTree, TCanvas, TPad, TRandom3,
Expand All @@ -27,10 +28,10 @@
totalSamples = 100000

cathode = ROOT.TRestAxionXrayWindow("windows.rml", "cathode")
strongBack = ROOT.TRestAxionXrayWindow("windows.rml", "strongBack")
strongBack = ROOT.TRestAxionXrayWindow("windows.rml", patternType)
siFoil = ROOT.TRestAxionXrayWindow("windows.rml", "siliconFoil")

radius = cathode.GetWindowRadius()
radius = strongBack.GetWindowRadius()
print ( "\nGetting window radius" )
if radius != 8:
print ("\nThe window radius is not as expected! Exit code : 102")
Expand Down Expand Up @@ -62,13 +63,13 @@
for n in range(totalSamples):
x = (radius+2) * (rnd.Rndm() - 0.5) * 2
y = (radius+2) * (rnd.Rndm() - 0.5) * 2
en = 15. * rnd.Rndm()
en = 0.01 + 14.9 * rnd.Rndm()

cth = cathode.GetTransmission( en, x, y)
stb = strongBack.GetTransmission( en, x, y)
sil = siFoil.GetTransmission( en, x, y)

if( cth == 0 ):
if( stb == 0 ):
continue
#print ("x: " + str(x) + " y: " + str(y) + " en: " + str(en) )
#print ("cathode: " + str(cth) + " sBack: " + str(stb) + " siFoil: " + str(sil) )
Expand Down Expand Up @@ -132,15 +133,25 @@
pad1.cd(3)
histH.SetStats(0)
histH.Draw("colz")
#graphsOP[0].GetXaxis().SetLimits(-maxRingRadius-20,maxRingRadius+20);
#graphsOP[0].GetHistogram().SetMaximum(maxRingRadius+20);
#graphsOP[0].GetHistogram().SetMinimum(-maxRingRadius-20);
#graphsOP[0].Draw("AP")
#for n in range(1,rings):
# graphsOP[n].Draw("P")

c1.Print(outfname)

if( histL.Integral() < 10000 ):
print( "Effective counts at low energy below 10000!!")
print ( "Low: " + str( histL.Integral() ) )
exit(103)

if( histM.Integral() < 12000 ):
print( "Effective counts at low energy below 12000!!")
print ( "Mid: " + str( histM.Integral() ) )
exit(104)

if( histH.Integral() < 14000 ):
print( "Effective counts at low energy below 14000!!")
print ( "High: " + str( histH.Integral() ) )
exit(105)


print ("All tests passed! [\033[92m OK \x1b[0m]")

print ("")
Expand Down
3 changes: 2 additions & 1 deletion src/TRestAxionSolarFlux.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void TRestAxionSolarFlux::LoadContinuumFluxTable() {
RESTDebug << "File : " << fullPathName << RESTendl;

std::vector<std::vector<Float_t>> fluxTable;
if (TRestTools::GetFileNameExtension(fFluxDataFile) == "dat") {
if (TRestTools::GetFileNameExtension(fFluxDataFile) == ".dat") {
std::vector<std::vector<Double_t>> doubleTable;
TRestTools::ReadASCIITable(fullPathName, doubleTable);
for (const auto& row : doubleTable) {
Expand All @@ -303,6 +303,7 @@ void TRestAxionSolarFlux::LoadContinuumFluxTable() {
fluxTable.clear();
RESTError << "Filename extension was not recognized!" << RESTendl;
RESTError << "Solar flux table will not be populated" << RESTendl;
RESTError << "Filename extension: " << TRestTools::GetFileNameExtension(fFluxDataFile) << RESTendl;
}

if (fluxTable.size() != 100 && fluxTable[0].size() != 200) {
Expand Down
Loading