Skip to content
Snippets Groups Projects
Commit f42cba7c authored by Stephen A. Wood's avatar Stephen A. Wood Committed by Stephen A. Wood
Browse files

Make raster derived position/angles, with offsets available to Beamline

parent d1fe1812
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,8 @@
\author Buddhini Waidyawansa
*/
#include "TMath.h"
#include "THcRaster.h"
#include "THaEvData.h"
#include "THaDetMap.h"
......@@ -17,7 +19,6 @@
#include "THcGlobals.h"
#include "THaGlobals.h"
//#include "THcHitList.h"
#include <cstring>
......@@ -84,11 +85,24 @@ Int_t THcRaster::ReadDatabase( const TDatime& date )
{"frx_adcpercm",&fFrXADCperCM, kDouble},
{"fry_adcpercm",&fFrYADCperCM, kDouble},
{"pbeam",&fgpbeam, kDouble},
{"frx_dist", &fgfrx_dist, kDouble},
{"fry_dist", &fgfry_dist, kDouble},
{"beam_x", &fgbeam_xoff, kDouble,0,1},
{"beam_xp", &fgbeam_xpoff, kDouble,0,1},
{"beam_y", &fgbeam_yoff, kDouble,0,1},
{"beam_yp", &fgbeam_ypoff, kDouble,0,1},
{"usefr", &fgusefr, kInt,0,1},
{0}
};
// Default offsets to zero
fgbeam_xoff = 0.0;
fgbeam_xpoff = 0.0;
fgbeam_yoff = 0.0;
fgbeam_ypoff = 0.0;
fgusefr = 0;
// get the calibration factors from gbeam.param file
gHcParms->LoadParmValues((DBRequest*)&list,prefix);
gHcParms->LoadParmValues((DBRequest*)&list,prefix);
return kOK;
......@@ -298,8 +312,21 @@ Int_t THcRaster::Process( ){
// std::cout<<" X = "<<fXpos<<" Y = "<<fYpos<<std::endl;
fDirection.SetXYZ(0.0,0.0,1.0); // Set arbitrarily to avoid run time warnings
Double_t tt;
Double_t tp;
if(fgusefr != 0) {
fPosition[1].SetXYZ(fXpos+fgbeam_xoff, fYpos+fgbeam_yoff, 0.0);
tt = fXpos/fgfrx_dist+fgbeam_xpoff;
tp = fYpos/fgfry_dist+fgbeam_ypoff;
} else { // Just use fixed beam position and angle
fPosition[0].SetXYZ(fgbeam_xoff, fgbeam_yoff, 0.0);
tt = fgbeam_xpoff;
tp = fgbeam_ypoff;
}
fDirection.SetXYZ(tt, tp ,1.0); // Set arbitrarily to avoid run time warnings
fDirection *= 1.0/TMath::Sqrt(1.0+tt*tt+tp*tp);
return 0;
}
......
......@@ -28,8 +28,8 @@ class THcRaster : public THaBeamDet, public THcHitList {
Int_t Process();
// TVector3 GetPosition() const { return fPosition[2]; }
TVector3 GetPosition() const { return fPosition[0]; }
TVector3 GetDirection() const { return fDirection; } // Hall C we don't use raster direction yet.
TVector3 GetPosition() const { return fPosition[1]; }
TVector3 GetDirection() const { return fDirection; }
Double_t GetCurrentX() { return fRawPos[0]; }
Double_t GetCurrentY() { return fRawPos[1]; }
......@@ -41,6 +41,13 @@ class THcRaster : public THaBeamDet, public THcHitList {
Int_t DefineVariables( EMode mode );
Double_t fgpbeam; //beam momentum
Double_t fgfrx_dist; //Distance of raster to target
Double_t fgfry_dist;
Double_t fgbeam_xoff; // Beam offsets
Double_t fgbeam_xpoff; // Beam offsets
Double_t fgbeam_yoff; // Beam offsets
Double_t fgbeam_ypoff; // Beam offsets
Int_t fgusefr; /* Use Raster for beam position */
Double_t fRawXADC; // X raw ADC
Double_t fRawYADC; // Y raw ADC
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment