Skip to content

Commit

Permalink
TRestAxionMagneticField. Major oversight on data not passed by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
jgalan committed May 3, 2024
1 parent 74793f3 commit e6b815b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion inc/TRestAxionMagneticField.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class TRestAxionMagneticField : public TRestMetadata {

void LoadMagneticFieldData(MagneticFieldVolume& mVol, std::vector<std::vector<Float_t>> data);

TVector3 GetMagneticVolumeNode(MagneticFieldVolume mVol, TVector3 pos);
TVector3 GetMagneticVolumeNode(size_t id, TVector3 pos);

/// \brief This private method returns true if the magnetic field volumes loaded are the same as
/// the volumes defined.
Expand Down
10 changes: 5 additions & 5 deletions src/TRestAxionMagneticField.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ TVector3 TRestAxionMagneticField::GetMagneticField(TVector3 pos, Bool_t showWarn
return TVector3(0, 0, 0);
} else {
if (IsFieldConstant(id)) return fConstantField[id];
TVector3 node = GetMagneticVolumeNode(fMagneticFieldVolumes[id], pos);
TVector3 node = GetMagneticVolumeNode((size_t)id, pos);
Int_t nX = node.X();
Int_t nY = node.Y();
Int_t nZ = node.Z();
Expand Down Expand Up @@ -1430,10 +1430,10 @@ TVector3 TRestAxionMagneticField::GetFieldAverageTransverseVector(TVector3 from,
///
/// This method will be made private, no reason to use it outside this class.
///
TVector3 TRestAxionMagneticField::GetMagneticVolumeNode(MagneticFieldVolume mVol, TVector3 pos) {
Int_t nx = mVol.mesh.GetNodeX(pos.X());
Int_t ny = mVol.mesh.GetNodeY(pos.Y());
Int_t nz = mVol.mesh.GetNodeZ(pos.Z());
TVector3 TRestAxionMagneticField::GetMagneticVolumeNode(size_t id, TVector3 pos) {
Int_t nx = fMagneticFieldVolumes[id].mesh.GetNodeX(pos.X());
Int_t ny = fMagneticFieldVolumes[id].mesh.GetNodeY(pos.Y());
Int_t nz = fMagneticFieldVolumes[id].mesh.GetNodeZ(pos.Z());
return TVector3(nx, ny, nz);
}

Expand Down

0 comments on commit e6b815b

Please sign in to comment.