Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions include/MGUIOptionsDepthCalibration2024.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class MGUIOptionsDepthCalibration2024 : public MGUIOptions
//! Check button if working with the Card Cage at UCSD
TGCheckButton* m_UCSDOverride;

//! Check button if weighting X and Y by energy
TGCheckButton* m_WeightedXY;

#ifdef ___CLING___
public:
Expand Down
12 changes: 11 additions & 1 deletion include/MModuleDepthCalibration2024.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ class MModuleDepthCalibration2024 : public MModule
//! Get whether the data came from the card cage at UCSD
bool GetUCSDOverride() const {return m_UCSDOverride;}

//! Set whether X and Y positions should be calculated by weighting strips by energy
void SetWeightedXY( bool WeightedXY ) {m_WeightedXY = WeightedXY;}
//! Get whether X and Y positions should be calculated by weighting strips by energy
bool GetWeightedXY() const {return m_WeightedXY;}

//! Read the XML configuration
bool ReadXmlConfiguration(MXmlNode* Node);
Expand All @@ -95,10 +99,14 @@ class MModuleDepthCalibration2024 : public MModule
vector<double> GetDepth(int DetID);
//! Retrieve the appropriate CTD values given the DetID and Grade
vector<double> GetCTD(int DetID, int Grade);
//! Retrieve the appropriate depth-to-CTD spline given the DetID and Grade
TSpline3* GetSpline(int DetID, int Grade);
//! Normal distribution
vector<double> norm_pdf(vector<double> x, double mu, double sigma);
//! Adds a Depth-to-CTD relation
bool AddDepthCTD(vector<double> depthvec, vector<vector<double>> ctdarr, int DetID, unordered_map<int, vector<double>>& DepthGrid, unordered_map<int,vector<vector<double>>>& CTDMap);
bool AddDepthCTD(vector<double> Depth, vector<vector<double>> CTDArr, int DetID, unordered_map<int, vector<double>>& DepthGrid, unordered_map<int,vector<vector<double>>>& CTDMap, unordered_map<int,vector<TSpline3*>>& SplineMap, unsigned int NPoints);
// Calculate the Energy-weighted X and Y strip position
bool CalculateEnergyWeightedPosition(vector<MStripHit*> LVStrips, vector<MStripHit*> HVStrips, double& WeightedLVStripID, double& WeightedHVStripID);
//! Determine the Grade (geometry of charge sharing) of the Hit
int GetHitGrade(MHit* H);
//! Load in the specified coefficients file
Expand Down Expand Up @@ -145,11 +153,13 @@ class MModuleDepthCalibration2024 : public MModule
// The CTD Map maps each detector (int) to a 2D array of CTD values.
unordered_map<int, vector<vector<double>>> m_CTDMap;
unordered_map<int, vector<double>> m_DepthGrid;
unordered_map<int, vector<TSpline3*>> m_SplineMap;
bool m_SplinesFileIsLoaded;
bool m_CoeffsFileIsLoaded;

// boolean for use with the card cage at UCSD since it tags all events as detector 11
bool m_UCSDOverride;
bool m_WeightedXY;



Expand Down
8 changes: 7 additions & 1 deletion src/MGUIOptionsDepthCalibration2024.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ void MGUIOptionsDepthCalibration2024::Create()

m_UCSDOverride = new TGCheckButton(m_OptionsFrame, "Check this box if you're using the card cage at UCSD", 1);
m_UCSDOverride->SetOn(dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->GetUCSDOverride());
TGLayoutHints* Label3Layout = new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 10, 10, 10, 10);
m_OptionsFrame->AddFrame(m_UCSDOverride, Label3Layout);

m_WeightedXY = new TGCheckButton(m_OptionsFrame, "Check this box to weight the X and Y positions by energy deposited.", 1);
m_WeightedXY->SetOn(dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->GetWeightedXY());
TGLayoutHints* Label4Layout = new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 10, 10, 10, 10);
m_OptionsFrame->AddFrame(m_UCSDOverride, Label4Layout);
m_OptionsFrame->AddFrame(m_WeightedXY, Label4Layout);

PostCreate();
}
Expand Down Expand Up @@ -128,6 +133,7 @@ bool MGUIOptionsDepthCalibration2024::OnApply()
dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->SetCoeffsFileName(m_CoeffsFileSelector->GetFileName());
dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->SetSplinesFileName(m_SplinesFileSelector->GetFileName());
dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->SetUCSDOverride(m_UCSDOverride->IsOn());
dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->SetWeightedXY(m_WeightedXY->IsOn());

return true;
}
Expand Down
Loading