diff --git a/src/evb/CompassRun.cpp b/src/evb/CompassRun.cpp index 35cd7e0..4bf00a5 100644 --- a/src/evb/CompassRun.cpp +++ b/src/evb/CompassRun.cpp @@ -369,7 +369,7 @@ namespace EventBuilder { startIndex = 0; CoincEvent this_event; SlowSort coincidizer(m_params.slowCoincidenceWindow, m_params.channelMapFile); - SFPAnalyzer analyzer(m_params.ZT, m_params.AT, m_params.ZP, m_params.AP, m_params.ZE, m_params.AE, m_params.beamEnergy, m_params.spsAngle, m_params.BField); + SFPAnalyzer analyzer(m_params); std::vector> parvec; parvec.reserve(9); @@ -459,7 +459,7 @@ namespace EventBuilder { std::vector fast_events; SlowSort coincidizer(m_params.slowCoincidenceWindow, m_params.channelMapFile); FastSort speedyCoincidizer(m_params.fastCoincidenceWindowSABRE, m_params.fastCoincidenceWindowIonCh); - SFPAnalyzer analyzer(m_params.ZT, m_params.AT, m_params.ZP, m_params.AP, m_params.ZE, m_params.AE, m_params.beamEnergy, m_params.spsAngle, m_params.BField); + SFPAnalyzer analyzer(m_params); std::vector> parvec; parvec.reserve(9); diff --git a/src/evb/EVBApp.cpp b/src/evb/EVBApp.cpp index 1347e25..4933952 100644 --- a/src/evb/EVBApp.cpp +++ b/src/evb/EVBApp.cpp @@ -72,6 +72,7 @@ namespace EventBuilder { m_params.BField = data["BField(kG)"].as(); m_params.beamEnergy = data["BeamEnergy(MeV)"].as(); m_params.spsAngle = data["SPSAngle(deg)"].as(); + m_params.nudge = data["Nudge(cm)"].as(); m_params.runMin = data["MinRun"].as(); m_params.runMax = data["MaxRun"].as(); @@ -116,6 +117,7 @@ namespace EventBuilder { yamlStream << YAML::Key << "BField(kG)" << YAML::Value << m_params.BField; yamlStream << YAML::Key << "BeamEnergy(MeV)" << YAML::Value << m_params.beamEnergy; yamlStream << YAML::Key << "SPSAngle(deg)" << YAML::Value << m_params.spsAngle; + yamlStream << YAML::Key << "Nudge(cm)" << YAML::Value << m_params.nudge; yamlStream << YAML::Key << "MinRun" << YAML::Value << m_params.runMin; yamlStream << YAML::Key << "MaxRun" << YAML::Value << m_params.runMax; yamlStream << YAML::EndMap; diff --git a/src/evb/FP_kinematics.cpp b/src/evb/FP_kinematics.cpp index 546cad6..c2cb410 100644 --- a/src/evb/FP_kinematics.cpp +++ b/src/evb/FP_kinematics.cpp @@ -40,7 +40,7 @@ namespace EventBuilder { //requires (Z,A) for T, P, and E, as well as energy of P, // spectrograph angle of interest, and field value double DeltaZ(int ZT, int AT, int ZP, int AP, int ZE, int AE, - double EP, double angle, double B) + double EP, double angle, double B, double nudge) { /* CONSTANTS */ @@ -94,7 +94,7 @@ namespace EventBuilder { double K = (std::sqrt(mp*me*EP / ejectileEnergy) * std::sin(angle)) / (me + mr - std::sqrt(mp*me*EP / ejectileEnergy) * std::cos(angle)); - return -1.0*rho*s_dispersion*s_magnification*K * std::cos(s_centralTrajAngle); //delta-Z in cm + return -1.0*rho*s_dispersion*s_magnification*K * std::cos(s_centralTrajAngle) + nudge; //delta-Z in cm } diff --git a/src/evb/FP_kinematics.h b/src/evb/FP_kinematics.h index 8813745..1c5f078 100644 --- a/src/evb/FP_kinematics.h +++ b/src/evb/FP_kinematics.h @@ -39,7 +39,7 @@ namespace EventBuilder { //requires (Z,A) for T, P, and E, as well as energy of P, // spectrograph angle of interest, and field value double DeltaZ(int ZT, int AT, int ZP, int AP, int ZE, int AE, - double EP, double angle, double B); + double EP, double angle, double B, double nudge = 0); static constexpr double WireDist() { return 4.28625; } //cm diff --git a/src/evb/SFPAnalyzer.cpp b/src/evb/SFPAnalyzer.cpp index 8cda322..4f6441c 100644 --- a/src/evb/SFPAnalyzer.cpp +++ b/src/evb/SFPAnalyzer.cpp @@ -14,10 +14,11 @@ namespace EventBuilder { /*Constructor takes in kinematic parameters for generating focal plane weights*/ - SFPAnalyzer::SFPAnalyzer(int zt, int at, int zp, int ap, int ze, int ae, double ep, - double angle, double b) + SFPAnalyzer::SFPAnalyzer(const EVBParameters& params) { - zfp = DeltaZ(zt, at, zp, ap, ze, ae, ep, angle, b); + zfp = DeltaZ(params.ZT, params.AT, params.ZP, params.AP, params.ZE, params.AE, params.beamEnergy, + params.spsAngle, params.BField, params.nudge); + EVB_INFO("Focal Plane Z-Offset (nudge + kinematics): {}", zfp); event_address = new CoincEvent(); rootObj = new THashTable(); GetWeights(); diff --git a/src/evb/SFPAnalyzer.h b/src/evb/SFPAnalyzer.h index d70d3d4..fea279b 100644 --- a/src/evb/SFPAnalyzer.h +++ b/src/evb/SFPAnalyzer.h @@ -12,14 +12,14 @@ #include "DataStructs.h" #include "FP_kinematics.h" +#include "EVBParameters.h" namespace EventBuilder { class SFPAnalyzer { public: - SFPAnalyzer(int zt, int at, int zp, int ap, int ze, int ae, double ep, double angle, - double b); + SFPAnalyzer(const EVBParameters& params); ~SFPAnalyzer(); ProcessedEvent GetProcessedEvent(CoincEvent& event); inline void ClearHashTable() { rootObj->Clear(); } diff --git a/src/guidict/EVBMainFrame.cpp b/src/guidict/EVBMainFrame.cpp index 14ddf11..75fc41b 100644 --- a/src/guidict/EVBMainFrame.cpp +++ b/src/guidict/EVBMainFrame.cpp @@ -145,9 +145,15 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) : fThetaField = new TGNumberEntryField(thetaFrame, Theta, 0, TGNumberEntry::kNESRealFour, TGNumberEntry::kNEANonNegative); thetaFrame->AddFrame(thetalabel, lhints); thetaFrame->AddFrame(fThetaField, fhints); + TGHorizontalFrame* nudgeFrame = new TGHorizontalFrame(extraFrame, w*0.175, h*0.15); + TGLabel* nudgeLabel = new TGLabel(nudgeFrame, "Nudge (cm):"); + fNudgeField = new TGNumberEntryField(nudgeFrame, Nudge, 0, TGNumberEntry::kNESRealFour); + nudgeFrame->AddFrame(nudgeLabel, lhints); + nudgeFrame->AddFrame(fNudgeField, fhints); extraFrame->AddFrame(beamFrame, fhints); extraFrame->AddFrame(bfFrame, fhints); extraFrame->AddFrame(thetaFrame, fhints); + extraFrame->AddFrame(nudgeFrame, fhints); reactionFrame->AddFrame(targFrame, fhints); reactionFrame->AddFrame(projFrame, fhints); @@ -399,7 +405,8 @@ bool EVBMainFrame::SetParameters() m_parameters.BField = fBField->GetNumber(); m_parameters.beamEnergy = fBKEField->GetNumber(); m_parameters.spsAngle = fThetaField->GetNumber(); - + m_parameters.nudge = fNudgeField->GetNumber(); + m_builder.SetParameters(m_parameters); return true; } diff --git a/src/guidict/EVBMainFrame.h b/src/guidict/EVBMainFrame.h index afc510c..f2f9657 100644 --- a/src/guidict/EVBMainFrame.h +++ b/src/guidict/EVBMainFrame.h @@ -67,6 +67,7 @@ public: TypeBox, RMin, RMax, + Nudge, M_Load_Config, M_Save_Config, M_Exit @@ -85,6 +86,7 @@ private: TGNumberEntryField *fBField, *fBKEField, *fThetaField; TGNumberEntryField *fSlowWindowField, *fFastICField, *fFastSABREField; TGNumberEntryField *fRMinField, *fRMaxField; + TGNumberEntryField *fNudgeField; TGHProgressBar* fProgressBar;