Skip to content

Commit

Permalink
Merge pull request #87 from rest-for-physics/jovoy-target-position
Browse files Browse the repository at this point in the history
Change Axion generator Target Position
  • Loading branch information
jovoy authored Feb 26, 2024
2 parents 068fb45 + 0595ab5 commit 2f77db4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions inc/TRestAxionAnalysisProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class TRestAxionAnalysisProcess : public TRestEventProcess {
/// A pointer to the specific TRestAxionEvent
TRestAxionEvent* fAxionEvent; //!

/// The analysis position in mm with regards to the sun at (0,0,-AU).
TVector3 fAnalysisPosition = TVector3(0, 0, 0); //<

void Initialize() override;

void LoadDefaultConfig();
Expand Down
3 changes: 3 additions & 0 deletions inc/TRestAxionGeneratorProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class TRestAxionGeneratorProcess : public TRestEventProcess {
/// The target size in mm (or generator source extension) for the generator.
Double_t fTargetRadius = 800; //<

/// The target position in mm with regards to the sun at (0,0,-AU).
TVector3 fTargetPosition = TVector3(0, 0, 0); //<

/// The generator type (solarFlux/flat)
TString fGeneratorType = "solarFlux"; //<

Expand Down
5 changes: 3 additions & 2 deletions src/TRestAxionAnalysisProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,13 @@ TRestEvent* TRestAxionAnalysisProcess::ProcessEvent(TRestEvent* evInput) {
SetObservableValue("energy", fAxionEvent->GetEnergy());
SetObservableValue("mass", fAxionEvent->GetMass() * units("eV"));

Double_t x = fAxionEvent->GetPosition().X();
Double_t y = fAxionEvent->GetPosition().Y();
Double_t x = fAxionEvent->GetPosition().X() - fAnalysisPosition.X();
Double_t y = fAxionEvent->GetPosition().Y() - fAnalysisPosition.Y();
SetObservableValue("posX", x);
SetObservableValue("posY", y);
SetObservableValue("posZ", fAxionEvent->GetPosition().Z());

/// The following only works if the center of the signal is where the analysis position is.
Double_t r = TMath::Sqrt(x * x + y * y);
SetObservableValue("R", r);

Expand Down
9 changes: 6 additions & 3 deletions src/TRestAxionGeneratorProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,12 @@ TRestEvent* TRestAxionGeneratorProcess::ProcessEvent(TRestEvent* evInput) {

/// The axion position must be displaced by the target size.
/// We always do this. It is independent of generator
/// The target is virtually placed at the (0,0,0).
/// The target is virtually placed at the (0,0,0) + TargetPosition since the
/// experiment is not focussed by the bore but by the whole experiment.
/// In my opinion the target should be either the optics, or the magnet end bore.
/// Then one should place the optics or the magnet end bore at the (0,0,0).
/// Then one should place the optics or the magnet end bore at the (0,0,0) + TargetPosition.
/// TODO: The target position and the magnetic field have to be in the same spot in x- and y-direction
/// apparently.
///
do {
x = 2 * (fRandom->Rndm() - 0.5);
Expand All @@ -178,7 +181,7 @@ TRestEvent* TRestAxionGeneratorProcess::ProcessEvent(TRestEvent* evInput) {

r = TMath::Sqrt(r);

axionPosition = axionPosition + TVector3(fTargetRadius * x, fTargetRadius * y, 0);
axionPosition = axionPosition + TVector3(fTargetRadius * x, fTargetRadius * y, 0) + fTargetPosition;

Double_t mass = fRandom->Uniform(fAxionMassRange.X(), fAxionMassRange.Y());

Expand Down

0 comments on commit 2f77db4

Please sign in to comment.