Skip to content

Commit

Permalink
Merge pull request #60 from rest-for-physics/nkx111-single-event-file
Browse files Browse the repository at this point in the history
Fixing pipeline
  • Loading branch information
jgalan authored Apr 28, 2023
2 parents 65a5546 + b8c9b59 commit 794b691
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ jobs:
export REST_RUN=100
cd ${{ env.AXION_LIB_PATH }}/pipeline/ray-tracing/optics/
wget https://rest-for-physics.github.io/axionlib-data/optics/xmm.rml
wget https://rest-for-physics.github.io/axionlib-data/optics/XMM.Wolter
wget https://rest-for-physics.github.io/axionlib-data/optics/XMM.trueWolter
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Reflectivity_Single_Au_250_Ni_0.4.N901f
wget https://rest-for-physics.github.io/axionlib-data/opticsMirror/Transmission_Single_Au_250_Ni_0.4.N901f
restManager --c opticsBench.rml
Expand Down Expand Up @@ -248,6 +248,7 @@ jobs:
source ${{ env.REST_PATH }}/thisREST.sh
cd ${{ env.AXION_LIB_PATH }}/pipeline/ray-tracing/full-chain/
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/fluxes.rml
wget https://rest-for-physics.github.io/axionlib-data/solarFlux/Primakoff_LennertHoof_202203.dat
wget https://rest-for-physics.github.io/axionlib-data/transmission/windows.rml
wget https://rest-for-physics.github.io/axionlib-data/transmission/Al.sol
wget https://rest-for-physics.github.io/axionlib-data/transmission/Cu.sol
Expand Down
26 changes: 14 additions & 12 deletions pipeline/ray-tracing/full-chain/ValidateChain.C
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ Int_t ValidateChain(std::string fname) {

Double_t integral = h->Integral() / run->GetEntries();
std::cout << "Average axion-photon probability : " << integral << std::endl;
if (integral < 9.71489e-24 || integral > 9.91489e-24) {
std::cout << "Axion-photon probability is not within the expected range!" << std::endl;
return 3;

run->GetAnalysisTree()->Draw("optics_efficiency", "optics_efficiency");
TH1D* l = (TH1D*)run->GetAnalysisTree()->GetHistogram();
if (l == nullptr) {
std::cout << "Problems generating optics_efficiency histogram" << std::endl;
return 6;
}

Double_t integral3 = l->Integral() / run->GetEntries();
std::cout << "Average optics efficiency : " << integral3 << std::endl;

run->GetAnalysisTree()->Draw("window_transmission", "window_transmission");
TH1D* g = (TH1D*)run->GetAnalysisTree()->GetHistogram();
if (g == nullptr) {
Expand All @@ -39,25 +45,21 @@ Int_t ValidateChain(std::string fname) {

Double_t integral2 = g->Integral() / run->GetEntries();
std::cout << "Average window transmission : " << integral2 << std::endl;
if (integral2 < 0.135 || integral2 > 0.145) {

if (integral < 9.71489e-24 || integral > 9.91489e-24) {
std::cout << "Axion-photon probability is not within the expected range!" << std::endl;
return 3;
}

run->GetAnalysisTree()->Draw("optics_efficiency", "optics_efficiency");
TH1D* l = (TH1D*)run->GetAnalysisTree()->GetHistogram();
if (l == nullptr) {
std::cout << "Problems generating optics_efficiency histogram" << std::endl;
return 6;
if (integral2 < 0.125 || integral2 > 0.135) {
std::cout << "Average window transmission is not within the expected range!" << std::endl;
return 5;
}

Double_t integral3 = l->Integral() / run->GetEntries();
std::cout << "Average optics efficiency : " << integral3 << std::endl;
if (integral3 < 0.045 || integral3 > 0.055) {
std::cout << "Optics efficiency is not within the expected range!" << std::endl;
return 7;
}

delete run;

return 0;
Expand Down
4 changes: 0 additions & 4 deletions src/TRestAxionGeneratorProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ void TRestAxionGeneratorProcess::InitProcess() {
fRandom = nullptr;
}

if (fRandom != nullptr) {
delete fRandom;
fRandom = nullptr;
}
fRandom = new TRandom3(fSeed);
fSeed = fRandom->TRandom::GetSeed();
}
Expand Down
4 changes: 3 additions & 1 deletion src/TRestAxionOptics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ void TRestAxionOptics::Initialize() {
if (fOpticsFile != "") {
std::string fullPathFileName = SearchFile(fOpticsFile);

TRestTools::ReadASCIITable(fullPathFileName, fOpticsData, 3);
if (!TRestTools::ReadASCIITable(fullPathFileName, fOpticsData, 3)) {
RESTError << "TRestAxionOptics. Error reading optics file : " << fOpticsFile << RESTendl;
}

// std::cout << "Reading table" << std::endl;
// TRestTools::PrintTable(fOpticsData, 6, 9);
Expand Down
4 changes: 3 additions & 1 deletion src/TRestAxionOpticsMirror.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ void TRestAxionOpticsMirror::LoadTables() {
string fname = DownloadHenkeFile();

std::vector<std::vector<Double_t>> data;
TRestTools::ReadASCIITable(fname, data, 2);
if (!TRestTools::ReadASCIITable(fname, data, 2)) {
RESTError << "TRestAxionOpticsMirror. Error reading HenkeFile table" << RESTendl;
}

// we skip the last point if we are not at the latest angles file
Int_t N = data.size() - 1;
Expand Down
12 changes: 10 additions & 2 deletions src/TRestAxionSolarFlux.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ void TRestAxionSolarFlux::LoadContinuumFluxTable() {
std::vector<std::vector<Float_t>> fluxTable;
if (TRestTools::GetFileNameExtension(fFluxDataFile) == "dat") {
std::vector<std::vector<Double_t>> doubleTable;
TRestTools::ReadASCIITable(fullPathName, doubleTable);
if (!TRestTools::ReadASCIITable(fullPathName, doubleTable)) {
RESTError << "TRestAxionSolarFlux::LoadContinuumFluxTable. " << RESTendl;
RESTError << "Could not read solar flux table : " << fFluxDataFile << RESTendl;
return;
}
for (const auto& row : doubleTable) {
std::vector<Float_t> floatVec(row.begin(), row.end());
fluxTable.push_back(floatVec);
Expand Down Expand Up @@ -342,7 +346,11 @@ void TRestAxionSolarFlux::LoadMonoChromaticFluxTable() {
RESTDebug << "File : " << fullPathName << RESTendl;

std::vector<std::vector<Double_t>> doubleTable;
TRestTools::ReadASCIITable(fullPathName, doubleTable);
if (!TRestTools::ReadASCIITable(fullPathName, doubleTable)) {
RESTError << "TRestAxionSolarFlux::LoadMonoChromaticFluxTable." << RESTendl;
RESTError << "Could not read solar flux table : " << fFluxSptFile << RESTendl;
return;
}

std::vector<std::vector<Float_t>> asciiTable;
for (const auto& row : doubleTable) {
Expand Down

0 comments on commit 794b691

Please sign in to comment.