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

Adding x_sep for integration of NuSTAR like optics #74

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9815117
Adding x_sep in TRestAxionTrueWolterOptics.h
jovoy Aug 22, 2023
dbcc47c
Adding x_sep to TRestAxionWolterOptics.h
jovoy Aug 22, 2023
92fda9d
Adding x_sep to TRestAxionTrueWolterOptics.cxx
jovoy Aug 22, 2023
350dd66
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 22, 2023
2aefce7
Adding x_sep to TRestAxionWolterOptics.cxx
jovoy Aug 22, 2023
941945d
Correct variable spelling
jovoy Aug 22, 2023
7deb7d9
Correcting variable spelling
jovoy Aug 22, 2023
e6ed715
Adding x_sep for hyperbolic and parabolic mirror interaction
jovoy Aug 22, 2023
5077ff5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 22, 2023
dc5541f
Adding x_sep to entrance and exit position in TRestAxionTrueWolterOpt…
jovoy Aug 22, 2023
ad5b10d
Fixed x_sep into a vector in TRestAxionTrueWolterOptics.cxx
jovoy Aug 22, 2023
a4dc161
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 22, 2023
c69bc30
Adding x_sep to entrance and exit position in TRestAxionWolterOptics.h
jovoy Aug 22, 2023
b967ccb
Correcting x_sep into a vector in TRestAxionWolterOptics.cxx
jovoy Aug 22, 2023
f44569d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 22, 2023
4540f6c
Added x_sep in first and second mirror interaction in TRestAxionWolte…
jovoy Aug 22, 2023
40ca3be
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 22, 2023
c9b4362
Removed variables from TRestPhysics
jovoy Aug 28, 2023
923a11f
Corrected a sign switch
jovoy Aug 28, 2023
04f2cee
Correction of vectors in definition of x_sep
jovoy Aug 28, 2023
6adc342
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 28, 2023
30aff7f
X-sep vector correction
jovoy Aug 28, 2023
8b00dea
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 28, 2023
ed07d2e
Merge branch 'master' into jovoy-x_sep
jovoy Dec 15, 2023
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
7 changes: 5 additions & 2 deletions inc/TRestAxionTrueWolterOptics.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class TRestAxionTrueWolterOptics : public TRestAxionOptics {
/// Mirror thickness in mm. See schematic figure.
std::vector<Double_t> fThickness; //!

/// Distance between mirror stacks in mm. See schematic figure.
std::vector<Double_t> fXSep; //!

/// The spider structure to be used as an optical opaque mask (common to all planes)
TRestSpiderMask* fSpiderMask = nullptr; //<

Expand Down Expand Up @@ -110,13 +113,13 @@ class TRestAxionTrueWolterOptics : public TRestAxionOptics {

/// It returns the entrance Z-position defined by the optical axis.
Double_t GetEntrancePositionZ() override {
if (fCosAlpha.size() > 0) return -fMirrorLength * fCosAlpha[0];
if (fCosAlpha.size() > 0) return -fMirrorLength * fCosAlpha[0] - 0.5 * fXSep[0];
return 0;
}

/// It returns the exit Z-position defined by the optical axis
Double_t GetExitPositionZ() override {
if (fCosAlpha_3.size() > 0) return fMirrorLength * fCosAlpha_3[0];
if (fCosAlpha_3.size() > 0) return fMirrorLength * fCosAlpha_3[0] + 0.5 * fXSep[0];
return 0;
}

Expand Down
7 changes: 5 additions & 2 deletions inc/TRestAxionWolterOptics.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class TRestAxionWolterOptics : public TRestAxionOptics {
/// Mirror thickness in mm. See schematic figure.
std::vector<Double_t> fThickness; //!

/// Distance between mirror stacks in mm. See schematic figure.
std::vector<Double_t> fXSep; //!

/// The spider structure to be used as an optical opaque mask (common to all planes)
TRestSpiderMask* fSpiderMask = nullptr; //<

Expand Down Expand Up @@ -110,13 +113,13 @@ class TRestAxionWolterOptics : public TRestAxionOptics {

/// It returns the entrance Z-position defined by the optical axis.
Double_t GetEntrancePositionZ() override {
if (fCosAlpha.size() > 0) return -fMirrorLength * fCosAlpha[0];
if (fCosAlpha.size() > 0) return -fMirrorLength * fCosAlpha[0] - 0.5 * fXSep[0];
return 0;
}

/// It returns the exit Z-position defined by the optical axis
Double_t GetExitPositionZ() override {
if (fCosAlpha_3.size() > 0) return fMirrorLength * fCosAlpha_3[0];
if (fCosAlpha_3.size() > 0) return fMirrorLength * fCosAlpha_3[0] + 0.5 * fXSep[0];
return 0;
}

Expand Down
19 changes: 12 additions & 7 deletions src/TRestAxionTrueWolterOptics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ void TRestAxionTrueWolterOptics::Initialize() {
fAlpha = GetAlpha();
fThickness = GetThickness();

fXSep.clear();
for (const auto& a : fAlpha)
fXSep.push_back(2 * (fR1 - fR3 - fMirrorLength * TMath::Sin(a)) / TMath::Tan(a));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fR3 is a std::vector that's why the compilation is failing, and validation is not going through.

Your need to access the elements of fR1 and fR3.

for( size_t n = 0; n < fAlpha.size(); n++ )
     fXSep.push_back(2 * (fR1[n] - fR3[n] - fMirrorLength * TMath::Sin(fAlpha[n])) / TMath::Tan(fAlpha[n]));

where I am assuming fAlpha, fR1 and fR3 have the same number of elements.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, that's true!


if (fAlpha.size() == 0) return;

fCosAlpha.clear();
Expand Down Expand Up @@ -276,9 +280,10 @@ Int_t TRestAxionTrueWolterOptics::FirstMirrorReflection(const TVector3& pos, con

//// Reflection on first mirror
fFirstInteractionPosition = REST_Physics::GetParabolicVectorIntersection(
pos, dir, fAlpha[mirror], fR3[mirror], fMirrorLength); // should add this: TVector3(0, 0, -1), vertex
pos, dir, fAlpha[mirror], fR3[mirror]); // should add this: TVector3(0, 0, -1), vertex

if (fFirstInteractionPosition.Z() < GetEntrancePositionZ() || fFirstInteractionPosition.Z() > 0) {
if (fFirstInteractionPosition.Z() < GetEntrancePositionZ() ||
fFirstInteractionPosition.Z() > -(0.5 * fXSep[mirror])) {
RESTDebug << "TRestAxionTrueWolterOptics::FirstMirrorReflection. No interaction!" << RESTendl;
fFirstInteractionPosition = REST_Physics::MoveByDistance(pos, dir, fMirrorLength / 2.);
fMiddleDirection = fEntranceDirection;
Expand Down Expand Up @@ -321,12 +326,12 @@ Int_t TRestAxionTrueWolterOptics::SecondMirrorReflection(const TVector3& pos, co
TVector3 vertex(0, 0, fBackVertex[mirror]);
Double_t focal = fR3[mirror] / TMath::Tan(4 * fAlpha[mirror]);

//// Reflection on first mirror
fSecondInteractionPosition =
REST_Physics::GetHyperbolicVectorIntersection(pos, dir, fAlpha[mirror], fR3[mirror], fMirrorLength,
focal); // should add this: TVector3(0, 0, -1), vertex,
//// Reflection on second mirror
fSecondInteractionPosition = REST_Physics::GetHyperbolicVectorIntersection(
pos, dir, fAlpha[mirror], fR3[mirror], focal); // should add this: TVector3(0, 0, -1), vertex,

if (fSecondInteractionPosition.Z() > GetExitPositionZ() || fSecondInteractionPosition.Z() < 0) {
if (fSecondInteractionPosition.Z() > GetExitPositionZ() ||
fSecondInteractionPosition.Z() < (0.5 * fXSep[mirror])) {
RESTDebug << "TRestAxionTrueWolterOptics::SecondMirrorReflection. No interaction!" << RESTendl;
fSecondInteractionPosition = REST_Physics::MoveByDistance(pos, dir, fMirrorLength / 2.);
fExitDirection = fMiddleDirection;
Expand Down
10 changes: 8 additions & 2 deletions src/TRestAxionWolterOptics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ void TRestAxionWolterOptics::Initialize() {
fAlpha = GetAlpha();
fThickness = GetThickness();

fXSep.clear();
for (const auto& a : fAlpha)
fXSep.push_back(2 * (fR1 - fR3 - fMirrorLength * TMath::Sin(a)) / TMath::Tan(a));

if (fAlpha.size() == 0) return;

fCosAlpha.clear();
Expand Down Expand Up @@ -278,7 +282,8 @@ Int_t TRestAxionWolterOptics::FirstMirrorReflection(const TVector3& pos, const T
fFirstInteractionPosition =
pos + dir * REST_Physics::GetConeVectorIntersection(pos, dir, TVector3(0, 0, -1), vertex, cosA);

if (fFirstInteractionPosition.Z() < GetEntrancePositionZ() || fFirstInteractionPosition.Z() > 0) {
if (fFirstInteractionPosition.Z() < GetEntrancePositionZ() ||
fFirstInteractionPosition.Z() > -(0.5 * fXSep[mirror])) {
RESTDebug << "TRestAxionWolterOptics::FirstMirrorReflection. No interaction!" << RESTendl;
fFirstInteractionPosition = REST_Physics::MoveByDistance(pos, dir, fMirrorLength / 2.);
fMiddleDirection = fEntranceDirection;
Expand Down Expand Up @@ -323,7 +328,8 @@ Int_t TRestAxionWolterOptics::SecondMirrorReflection(const TVector3& pos, const
fSecondInteractionPosition =
pos + dir * REST_Physics::GetConeVectorIntersection(pos, dir, TVector3(0, 0, -1), vertex, cosA);

if (fSecondInteractionPosition.Z() > GetExitPositionZ() || fSecondInteractionPosition.Z() < 0) {
if (fSecondInteractionPosition.Z() > GetExitPositionZ() ||
fSecondInteractionPosition.Z() < (0.5 * fXSep[mirror])) {
RESTDebug << "TRestAxionWolterOptics::SecondMirrorReflection. No interaction!" << RESTendl;
fSecondInteractionPosition = REST_Physics::MoveByDistance(pos, dir, fMirrorLength / 2.);
fExitDirection = fMiddleDirection;
Expand Down
Loading