Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6d926ee
ADD: Including Mask Metrology file in Depth Calibration, correction s…
ckierans Aug 5, 2025
1f2163f
CHG: Updated x,y definition with mask rotation, added print statements
ckierans Sep 2, 2025
5577c2e
Updated metrology with correct understanding of rotation angles, now …
ckierans Oct 27, 2025
d05aa6a
Strip Pairing Chi Square Algorithm Updated (#61)
julianmgerber Nov 18, 2025
6ba6e6b
Resolving merge conflict with Sean's recent PR
ckierans Dec 10, 2025
beb5c32
CHG: Updated x,y definition with mask rotation, added print statements
ckierans Sep 2, 2025
c138b17
Updated metrology with correct understanding of rotation angles, now …
ckierans Oct 27, 2025
9410061
Strip Pairing Chi Square Algorithm Updated (#61)
julianmgerber Nov 18, 2025
f858369
Resolving merge conflict with Sean's recent PR
ckierans Dec 10, 2025
108275f
Resolving merge conflict with Sean's recent PR
ckierans Dec 10, 2025
e0861b2
[DEE] Improve strip ID handling for guard ring events
fhagemann Nov 22, 2025
7c3d1d6
Add TODOs
fhagemann Nov 25, 2025
3d3e0e3
ADD: How to handle ToDo's
zoglauer Oct 24, 2025
3eeacff
CHG: Updated README.md
zoglauer Oct 24, 2025
5038c55
CHG: Add historic contributors
zoglauer Oct 24, 2025
2fb1580
Resolving merge conflict with Sean's recent PR
ckierans Dec 10, 2025
230f190
Cleanup: added comments and cleaned up extraneous print statements
snpike Sep 23, 2025
649f74c
BUG: Clear variables on Finalize
snpike Sep 23, 2025
f5c13f0
[DEE] Read detector dimensions from the geometry (#76)
fhagemann Dec 9, 2025
22f3214
Resolving merge conflict with Sean's recent PR
ckierans Dec 10, 2025
a5a5de2
CHG: Updated x,y definition with mask rotation, added print statements
ckierans Sep 2, 2025
1d90cc8
Merge branch 'metrology' into metrology_merge
ckierans Dec 10, 2025
92ed5b7
Removing a vim mistype
ckierans Dec 10, 2025
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
8 changes: 8 additions & 0 deletions include/MGUIOptionsDepthCalibration2024.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ class MGUIOptionsDepthCalibration2024 : public MGUIOptions
//! Select spline file to load, splines will convert CTD->Depth
MGUIEFileSelector* m_SplinesFileSelector;

//! Select mask metrology file to load. This gives the translation and rotation for each strip in the detector frame
MGUIEFileSelector* m_MaskMetrologyFileSelector;

bool m_UseMaskMetCorr;

TGCheckButton* m_MaskMetModeCB;
enum ButtonIDs {c_MetFile};

//! Check button if working with the Card Cage at UCSD
TGCheckButton* m_UCSDOverride;

Expand Down
40 changes: 37 additions & 3 deletions include/MModuleDepthCalibration2024.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ class MModuleDepthCalibration2024 : public MModule
//! Get filename for CTD->Depth splines
MString GetSplinesFileName() const {return m_SplinesFile;}

//! Enable/Disable Preamp Temp Correction
void EnableMaskMetrologyCorrection(bool X) {m_MaskMetrologyEnabled = X;}
//! Get coincidence merging true/false
bool GetMaskMetrologyCorrection() const { return m_MaskMetrologyEnabled; }

//! Set filename for mask metrology
void SetMaskMetrologyFileName( const MString& FileName) {m_MaskMetrologyFile = FileName;}
//! Get filename for CTD->Depth splines
MString GetMaskMetrologyFileName() const {return m_MaskMetrologyFile;}

//! Set whether the data came from the card cage at UCSD
void SetUCSDOverride( bool Override ) {m_UCSDOverride = Override;}
//! Get whether the data came from the card cage at UCSD
Expand All @@ -91,24 +101,42 @@ class MModuleDepthCalibration2024 : public MModule
protected:
//! Returns the strip with most energy from vector Strips, also gives back the energy fraction
MStripHit* GetDominantStrip(std::vector<MStripHit*>& Strips, double& EnergyFraction);

//! Retrieve the appropriate Depth values given the DetID
vector<double> GetDepth(int DetID);
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> 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);

//! Adds a Depth-to-CTD relation
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);

//! Determine the Grade (geometry of charge sharing) of the Hit
int GetHitGrade(MHit* H);

//! Load in the specified coefficients file
bool LoadCoeffsFile(MString FName);

//! Return the coefficients for a pixel
vector<double>* GetPixelCoeffs(int PixelCode);

//! Load the splines file
bool LoadSplinesFile(MString FName);

//! Mask Metrology Correction
bool m_MaskMetrologyEnabled;

//! Load the metrology mask file
bool LoadMaskMetrologyFile(MString FName);

//! Get the x, y position of the intersection of two strips based on the Metrology Mask
vector<double> GetStripIntersection(MReadOutElementDoubleStrip LVStrip, MReadOutElementDoubleStrip HVStrip);

//! Get the timing FWHM noise for the specified pixel and Energy
double GetTimingNoiseFWHM(int PixelCode, double Energy);

Expand Down Expand Up @@ -150,6 +178,12 @@ class MModuleDepthCalibration2024 : public MModule
unordered_map<int, vector<TSpline3*>> m_SplineMap;
bool m_SplinesFileIsLoaded;
bool m_CoeffsFileIsLoaded;
bool m_MaskMetrologyFileIsLoaded;

// The Mask Metrology
MString m_MaskMetrologyFile;
map<MReadOutElementDoubleStrip, vector<double>> m_MaskMetrology;


// boolean for use with the card cage at UCSD since it tags all events as detector 11
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need that?
The UCSD code should be its own branch and not be in the main code?
Maybe make an issue

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I created an issue for this. Leaving this code for now.

bool m_UCSDOverride;
Expand Down
3 changes: 1 addition & 2 deletions include/MReadOutAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,7 @@ class MReadOutAssembly : public MReadOutSequence
bool m_StripHitBelowThreshold;
MString m_StripHitBelowThresholdString;




//! True if event has been filtered out
bool m_FilteredOut;

Expand Down
54 changes: 46 additions & 8 deletions src/MGUIOptionsDepthCalibration2024.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,30 @@ void MGUIOptionsDepthCalibration2024::Create()
m_SplinesFileSelector = new MGUIEFileSelector(m_OptionsFrame, "Select a splines file:",
dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->GetSplinesFileName());
m_SplinesFileSelector->SetFileType("splines", "*.csv");
TGLayoutHints* Label2Layout = new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 10, 10, 10, 10);
m_OptionsFrame->AddFrame(m_SplinesFileSelector, Label2Layout);
// TGLayoutHints* Label2Layout = new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 10, 10, 10, 10);
m_OptionsFrame->AddFrame(m_SplinesFileSelector, LabelLayout);

m_MaskMetModeCB = new TGCheckButton(m_OptionsFrame, "Enable mask metrology correction and read calibration from file:", c_MetFile);
m_MaskMetModeCB->SetState((dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->GetMaskMetrologyCorrection() == 1) ? kButtonDown : kButtonUp);
m_MaskMetModeCB->Associate(this);
m_OptionsFrame->AddFrame(m_MaskMetModeCB, LabelLayout);

m_UseMaskMetCorr = dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->GetMaskMetrologyCorrection();

// TGLayoutHints* FileLabelLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX, m_FontScaler*65 + 21*m_FontScaler, m_FontScaler*65, 0, 2*m_FontScaler);

m_MaskMetrologyFileSelector = new MGUIEFileSelector(m_OptionsFrame, "", dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->GetMaskMetrologyFileName());
m_MaskMetrologyFileSelector->SetFileType("metrology", "*.metrology.csv");
m_OptionsFrame->AddFrame(m_MaskMetrologyFileSelector, LabelLayout);


if (m_UseMaskMetCorr == true) {
m_MaskMetrologyFileSelector->SetEnabled(true);
} else {
m_MaskMetrologyFileSelector->SetEnabled(false);
}



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());
Expand All @@ -97,16 +119,28 @@ bool MGUIOptionsDepthCalibration2024::ProcessMessage(long Message, long Paramete
bool Status = true;

switch (GET_MSG(Message)) {
case kC_COMMAND:
switch (GET_SUBMSG(Message)) {
case kCM_BUTTON:
break;
default:
case kC_COMMAND:
switch (GET_SUBMSG(Message)) {
case kCM_BUTTON:
break;
case kCM_CHECKBUTTON:
switch (Parameter1) {
case c_MetFile:
if (m_MaskMetModeCB->GetState() == kButtonDown) {
m_UseMaskMetCorr = true;
m_MaskMetrologyFileSelector->SetEnabled(true);
} else if (m_MaskMetModeCB->GetState() == kButtonUp) {
m_UseMaskMetCorr = false;
m_MaskMetrologyFileSelector->SetEnabled(false);
}
break;
}
break;
default:
break;
}
break;
default:
break;
}

if (Status == false) {
Expand All @@ -127,6 +161,10 @@ bool MGUIOptionsDepthCalibration2024::OnApply()

dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->SetCoeffsFileName(m_CoeffsFileSelector->GetFileName());
dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->SetSplinesFileName(m_SplinesFileSelector->GetFileName());

if (dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->GetMaskMetrologyCorrection() != m_UseMaskMetCorr) dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->EnableMaskMetrologyCorrection(m_UseMaskMetCorr);

dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->SetMaskMetrologyFileName(m_MaskMetrologyFileSelector->GetFileName());
dynamic_cast<MModuleDepthCalibration2024*>(m_Module)->SetUCSDOverride(m_UCSDOverride->IsOn());

return true;
Expand Down
Loading