Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 13, 2024
1 parent f6fa98e commit 8729e09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
34 changes: 15 additions & 19 deletions src/TRestAxionField.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

#include <TComplex.h>
#include <TVectorD.h>

#include <gsl/gsl_errno.h>
#include <gsl/gsl_integration.h>

Expand Down Expand Up @@ -324,7 +323,7 @@ std::pair<Double_t, Double_t> TRestAxionField::GammaTransmissionFieldMapProbabil
Double_t accuracy,
Int_t num_intervals,
Int_t qawo_levels) {
gsl_set_error_handler_off();
gsl_set_error_handler_off();

if (!fMagneticField) {
RESTError << "TRestAxionField::GammaTransmissionFieldMapProbability requires a magnetic field map!"
Expand All @@ -333,8 +332,7 @@ std::pair<Double_t, Double_t> TRestAxionField::GammaTransmissionFieldMapProbabil
return {0.0, 0.0};
}

if( fMagneticField->GetTrackLength() <= 0 )
return {0.0, 0.0};
if (fMagneticField->GetTrackLength() <= 0) return {0.0, 0.0};

double photonMass = 0; // Vacuum
if (fBufferGas) photonMass = fBufferGas->GetPhotonMass(Ea);
Expand Down Expand Up @@ -402,11 +400,10 @@ std::pair<Double_t, Double_t> TRestAxionField::ComputeResonanceIntegral(Double_t

auto start = std::chrono::system_clock::now();

int status = gsl_integration_qag(&F, 0, fMagneticField->GetTrackLength(), accuracy, accuracy, num_intervals,
GSL_INTEG_GAUSS61, workspace, &reprob, &rerr);
int status = gsl_integration_qag(&F, 0, fMagneticField->GetTrackLength(), accuracy, accuracy,
num_intervals, GSL_INTEG_GAUSS61, workspace, &reprob, &rerr);

if( status > 0 )
return {0,status};
if (status > 0) return {0, status};

auto end = std::chrono::system_clock::now();
auto seconds = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
Expand Down Expand Up @@ -468,20 +465,19 @@ std::pair<Double_t, Double_t> TRestAxionField::ComputeOffResonanceIntegral(Doubl

gsl_integration_qawo_table* wf =
gsl_integration_qawo_table_alloc(q, fMagneticField->GetTrackLength(), GSL_INTEG_COSINE, qawo_levels);
int status = gsl_integration_qawo(&F, 0, accuracy, accuracy, num_intervals, workspace, wf, &reprob, &rerr);
if( status > 0 )
{
gsl_integration_qawo_table_free(wf);
return {0,status};
}
int status =
gsl_integration_qawo(&F, 0, accuracy, accuracy, num_intervals, workspace, wf, &reprob, &rerr);
if (status > 0) {
gsl_integration_qawo_table_free(wf);
return {0, status};
}

gsl_integration_qawo_table_set(wf, q, fMagneticField->GetTrackLength(), GSL_INTEG_SINE);
status = gsl_integration_qawo(&F, 0, accuracy, accuracy, num_intervals, workspace, wf, &improb, &imerr);
if( status > 0 )
{
gsl_integration_qawo_table_free(wf);
return {0,status};
}
if (status > 0) {
gsl_integration_qawo_table_free(wf);
return {0, status};
}

auto end = std::chrono::system_clock::now();
auto seconds = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
Expand Down
2 changes: 1 addition & 1 deletion src/TRestAxionMagneticField.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ void TRestAxionMagneticField::SetTrack(const TVector3& position, const TVector3&
fTrackStart = TVector3(0, 0, 0);
fTrackDirection = TVector3(0, 0, 0);
fTrackLength = 0;
return;
return;
}

fTrackStart = trackBounds[0];
Expand Down

0 comments on commit 8729e09

Please sign in to comment.