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/MDEEStripHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ struct MDEEStripHit
unsigned int m_ADC;
//! If the strip exceeds thresholds
bool m_HasTriggered;
//! If the strip was a nearest neighbor
bool m_IsNearestNeighbor;
//! If the strip has fast timing
bool m_HasFastTiming;
//! The measured TAC value in ADC units
Expand Down
11 changes: 11 additions & 0 deletions include/MModuleDEESMEX.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ class MModuleDEESMEX : public MModule
return m_ShieldEnergyCorrection.GetShieldEnergyCorrectionFileName();
}

//! Set hardware threshold file name
void SetHardwareThresholdFileName(const MString& FileName)
{
m_StripReadout.SetHardwareThresholdFileName(FileName);
}
//! Get hardware threshold file name
MString GetHardwareThresholdFileName() const
{
return m_StripReadout.GetHardwareThresholdFileName();
}

//! Set dead time file name
void SetDeadtimeFileName(const MString& FileName)
{
Expand Down
8 changes: 6 additions & 2 deletions include/MModuleEnergyCalibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ class MModuleEnergyCalibration : public MModule
void SetNearestNeighborThreshold(double Threshold) { m_NearestNeighborThreshold = Threshold; }
//! Get the threshold value for Nearest Neighbors
double GetNearestNeighborThreshold() const { return m_NearestNeighborThreshold; }


//! Get the threshold map
map<MReadOutElementDoubleStrip, double> GetHardwareThresholdMap() const { return m_HardwareThresholdMap; }

//! Create the expos
virtual void CreateExpos();
Expand Down Expand Up @@ -194,8 +196,10 @@ class MModuleEnergyCalibration : public MModule
map<MReadOutElementDoubleStrip, TF1*> m_Calibration; // TF1* is a function to be applied
//! Resolution Calibration map between read-out element and fitted function
map<MReadOutElementDoubleStrip, TF1*> m_ResolutionCalibration;
//! Temperature Calibration map between read-out element and fitted function
//! Map between read-out element and slow threshold for analysis purposes
map<MReadOutElementDoubleStrip, double> m_ThresholdMap;
//! Map between read-out element and hardware thresholds on the slow shaper
map<MReadOutElementDoubleStrip, double> m_HardwareThresholdMap;

//! Max value of the ADC units
static constexpr double m_MaxADCRange = 16383;
Expand Down
11 changes: 11 additions & 0 deletions include/MSubModuleStripReadout.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class MSubModuleStripReadout : public MSubModule
//! Get energy calibration file name
MString GetEnergyCalibrationFileName() const { return m_EnergyCalibrationFileName; }

//! Set hardware threshold file name
void SetHardwareThresholdFileName(const MString& FileName) { m_HardwareThresholdFileName = FileName; }
//! Get hardware threshold file name
MString GetHardwareThresholdFileName() const { return m_HardwareThresholdFileName; }

//! Initialize the module
virtual bool Initialize();

Expand Down Expand Up @@ -95,6 +100,9 @@ class MSubModuleStripReadout : public MSubModule
private:
//! Energy calibration file name
MString m_EnergyCalibrationFileName;

//! Hardware threshold file name
MString m_HardwareThresholdFileName;

//! Name of the strip map
std::map<MReadOutElementDoubleStrip, TF1*> m_Calibration;
Expand All @@ -104,6 +112,9 @@ class MSubModuleStripReadout : public MSubModule

//! Map storing the FWHM fits for each strip
std::map<MReadOutElementDoubleStrip, TF1*> m_ResolutionCalibration;

//! Map storing the hardware thresholds of the slow shaper for each strip
std::map<MReadOutElementDoubleStrip, double> m_HardwareThresholdMap;

//! Max value of the ADC units
static constexpr double m_MaxADCRange = 16383;
Expand Down
8 changes: 0 additions & 8 deletions include/MSubModuleStripTrigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ class MSubModuleStripTrigger : public MSubModule
//! Process strip hits for deadtime and trigger determination
bool ProcessStripHits(MReadOutAssembly* Event);

//! Helper function for getting count rate (including nearest neighbor)
bool CountRate(vector<int> ASICChannels, vector<double> CountTime);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the motivation for removing this function?


//! Check if at least one strip exists on each side of each detector
bool CheckTriggerConditions(MReadOutAssembly* Event);

Expand Down Expand Up @@ -209,11 +206,6 @@ class MSubModuleStripTrigger : public MSubModule
//! Stores trigger counts for each detector
vector<int> m_NumStripTriggers;

//! Event strip times for counting (should be removed later)
vector<double> m_EventStripTimes;
//! Event strip IDs for counting (should be removed later)
vector<double> m_EventStripIDs;

#ifdef ___CLING___
public:
ClassDef(MSubModuleStripTrigger, 0) // no description
Expand Down
1,188 changes: 1,188 additions & 0 deletions resource/dee/dummy.ecal

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions resource/dee/dummy_hardware_thresholds.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
STRIP_ID,Detector,side,strip,threshold_adc,threshold_keV
96,0,l,0,2028,7.0
97,0,l,1,2028,7.0
98,0,l,2,2028,7.0
99,0,l,3,2028,7.0
100,0,l,4,2028,7.0
101,0,l,5,2028,7.0
102,0,l,6,2028,7.0
103,0,l,7,2028,7.0
104,0,l,8,2028,7.0
105,0,l,9,2028,7.0
106,0,l,10,2028,7.0
107,0,l,11,2028,7.0
108,0,l,12,2028,7.0
109,0,l,13,2028,7.0
110,0,l,14,2028,7.0
111,0,l,15,2028,7.0
112,0,l,16,2028,7.0
113,0,l,17,2028,7.0
114,0,l,18,2028,7.0
115,0,l,19,2028,7.0
116,0,l,20,2028,7.0
117,0,l,21,2028,7.0
118,0,l,22,2028,7.0
119,0,l,23,2028,7.0
120,0,l,24,2028,7.0
121,0,l,25,2028,7.0
122,0,l,26,2028,7.0
123,0,l,27,2028,7.0
124,0,l,28,2028,7.0
125,0,l,29,2028,7.0
126,0,l,30,2028,7.0
127,0,l,31,2028,7.0
64,0,l,32,2028,7.0
65,0,l,33,2028,7.0
66,0,l,34,2028,7.0
67,0,l,35,2028,7.0
68,0,l,36,2028,7.0
69,0,l,37,2028,7.0
70,0,l,38,2028,7.0
71,0,l,39,2028,7.0
72,0,l,40,2028,7.0
73,0,l,41,2028,7.0
74,0,l,42,2028,7.0
75,0,l,43,2028,7.0
76,0,l,44,2028,7.0
77,0,l,45,2028,7.0
78,0,l,46,2028,7.0
79,0,l,47,2028,7.0
80,0,l,48,2028,7.0
81,0,l,49,2028,7.0
82,0,l,50,2028,7.0
83,0,l,51,2028,7.0
84,0,l,52,2028,7.0
85,0,l,53,2028,7.0
86,0,l,54,2028,7.0
87,0,l,55,2028,7.0
88,0,l,56,2028,7.0
89,0,l,57,2028,7.0
90,0,l,58,2028,7.0
91,0,l,59,2028,7.0
92,0,l,60,2028,7.0
93,0,l,61,2028,7.0
94,0,l,62,2028,7.0
95,0,l,63,2028,7.0
2049,0,l,64,2028,7.0
32,0,h,0,2028,7.0
33,0,h,1,2028,7.0
34,0,h,2,2028,7.0
35,0,h,3,2028,7.0
36,0,h,4,2028,7.0
37,0,h,5,2028,7.0
38,0,h,6,2028,7.0
39,0,h,7,2028,7.0
40,0,h,8,2028,7.0
41,0,h,9,2028,7.0
42,0,h,10,2028,7.0
43,0,h,11,2028,7.0
44,0,h,12,2028,7.0
45,0,h,13,2028,7.0
46,0,h,14,2028,7.0
47,0,h,15,2028,7.0
48,0,h,16,2028,7.0
49,0,h,17,2028,7.0
50,0,h,18,2028,7.0
51,0,h,19,2028,7.0
52,0,h,20,2028,7.0
53,0,h,21,2028,7.0
54,0,h,22,2028,7.0
55,0,h,23,2028,7.0
56,0,h,24,2028,7.0
57,0,h,25,2028,7.0
58,0,h,26,2028,7.0
59,0,h,27,2028,7.0
60,0,h,28,2028,7.0
61,0,h,29,2028,7.0
62,0,h,30,2028,7.0
63,0,h,31,2028,7.0
0,0,h,32,2028,7.0
1,0,h,33,2028,7.0
2,0,h,34,2028,7.0
3,0,h,35,2028,7.0
4,0,h,36,2028,7.0
5,0,h,37,2028,7.0
6,0,h,38,2028,7.0
7,0,h,39,2028,7.0
8,0,h,40,2028,7.0
9,0,h,41,2028,7.0
10,0,h,42,2028,7.0
11,0,h,43,2028,7.0
12,0,h,44,2028,7.0
13,0,h,45,2028,7.0
14,0,h,46,2028,7.0
15,0,h,47,2028,7.0
16,0,h,48,2028,7.0
17,0,h,49,2028,7.0
18,0,h,50,2028,7.0
19,0,h,51,2028,7.0
20,0,h,52,2028,7.0
21,0,h,53,2028,7.0
22,0,h,54,2028,7.0
23,0,h,55,2028,7.0
24,0,h,56,2028,7.0
25,0,h,57,2028,7.0
26,0,h,58,2028,7.0
27,0,h,59,2028,7.0
28,0,h,60,2028,7.0
29,0,h,61,2028,7.0
30,0,h,62,2028,7.0
31,0,h,63,2028,7.0
2048,0,h,64,2028,7.0
1 change: 1 addition & 0 deletions src/MDEEStripHit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ MStripHit* MDEEStripHit::Convert()
SH->SetADCUnits(m_ADC);
SH->SetTAC(m_TAC);
SH->HasFastTiming(m_HasFastTiming);
SH->IsNearestNeighbor(m_IsNearestNeighbor);
//SH->AddOrigins();
SH->IsGuardRing(m_IsGuardRing);

Expand Down
13 changes: 7 additions & 6 deletions src/MGUIOptionsDEESMEX.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ void MGUIOptionsDEESMEX::Create()
dynamic_cast<MModuleLoaderSimulationsSingleDet*>(m_Module)->GetDeadStripFileName());
m_DeadStripFileSelector->SetFileType("Dead strips file", "*.txt");
m_OptionsFrame->AddFrame(m_DeadStripFileSelector, LabelLayout);

m_ThresholdFileSelector = new MGUIEFileSelector(m_OptionsFrame, "Please select a thresholds file:",
dynamic_cast<MModuleLoaderSimulationsSingleDet*>(m_Module)->GetThresholdFileName());
m_ThresholdFileSelector->SetFileType("Thresholds file", "*.dat");
*/
m_ThresholdFileSelector = new MGUIEFileSelector(m_OptionsFrame, "Please select a hardware thresholds file:",
dynamic_cast<MModuleDEESMEX*>(m_Module)->GetHardwareThresholdFileName());
m_ThresholdFileSelector->SetFileType("Hardware thresholds file", "*.csv");
m_OptionsFrame->AddFrame(m_ThresholdFileSelector, LabelLayout);

/*
m_GuardRingThresholdFileSelector = new MGUIEFileSelector(m_OptionsFrame, "Please select a guard ring thresholds file:",
dynamic_cast<MModuleLoaderSimulationsSingleDet*>(m_Module)->GetGuardRingThresholdFileName());
m_GuardRingThresholdFileSelector->SetFileType("Thresholds file", "*.dat");
Expand Down Expand Up @@ -224,7 +224,8 @@ bool MGUIOptionsDEESMEX::OnApply()
dynamic_cast<MModuleDEESMEX*>(m_Module)->SetEnableShieldVeto(m_EnableShieldVetoButton->IsOn());
dynamic_cast<MModuleDEESMEX*>(m_Module)->SetEnableGuardRingVeto(m_EnableGuardRingVetoButton->IsOn());
dynamic_cast<MModuleDEESMEX*>(m_Module)->SetApplyTimingResolutionCalibration(m_TimingResolutionCalibrationButton->IsOn());
//dynamic_cast<MModuleLoaderSimulationsSingleDet*>(m_Module)->SetThresholdFileName(m_ThresholdFileSelector->GetFileName());
dynamic_cast<MModuleDEESMEX*>(m_Module)->SetHardwareThresholdFileName(m_ThresholdFileSelector->GetFileName());

//dynamic_cast<MModuleLoaderSimulationsSingleDet*>(m_Module)->SetGuardRingThresholdFileName(m_GuardRingThresholdFileSelector->GetFileName());
//dynamic_cast<MModuleLoaderSimulationsSingleDet*>(m_Module)->SetChargeSharingFileName(m_ChargeSharingFileSelector->GetFileName());
//dynamic_cast<MModuleLoaderSimulationsSingleDet*>(m_Module)->SetCrosstalkFileName(m_CrosstalkFileSelector->GetFileName());
Expand Down
8 changes: 6 additions & 2 deletions src/MModuleEnergyCalibration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ void MModuleEnergyCalibration::Finalize()
delete F.second;
}

m_ThresholdMap.clear();
m_HardwareThresholdMap.clear();

return;
}

Expand Down Expand Up @@ -534,15 +537,16 @@ bool MModuleEnergyCalibration::ReadSlowThresholdCutFile(MString FileName) {
int DetID = Tokens[1 + IndexOffset].ToInt(); // Detector ID
MString Side = Tokens[2 + IndexOffset].ToString(); // side is a string, either 'l' or 'h'
int StripID = Tokens[3 + IndexOffset].ToInt(); // stripID
//int ThresholdADC = Tokens[4 + IndexOffset].ToInt(); // energy threshold in ADC
int ThresholdADC = Tokens[4 + IndexOffset].ToInt(); // energy threshold in ADC
double ThresholdKeVFile = Tokens[5 + IndexOffset].ToDouble(); //energy threshold in keV

MReadOutElementDoubleStrip R;
R.SetDetectorID(DetID);
R.SetStripID(StripID);
R.IsLowVoltageStrip(Side == "l");

// map detectorID, strip number, and voltage side to the threshold (keV)
// map detectorID, strip number, and voltage side to the threshold (both ADC and keV)
m_HardwareThresholdMap[R] = ThresholdADC;
m_ThresholdMap[R] = ThresholdKeVFile;
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/MSubModuleDEEOutput.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,23 @@ bool MSubModuleDEEOutput::AnalyzeEvent(MReadOutAssembly* Event)
{
// Main data analysis routine, which updates the event to a new level

// Convert the DEE strip hits to standard strip hits
// Sort and convert the DEE strip hits to standard strip hits
list<MDEEStripHit>& LVHits = Event->GetDEEStripHitLVListReference();
LVHits.sort([](const MDEEStripHit& a, const MDEEStripHit& b) {
return a.m_ROE < b.m_ROE;
});
for (MDEEStripHit& SH: LVHits) {
Event->AddStripHit(SH.Convert());
}

list<MDEEStripHit>& HVHits = Event->GetDEEStripHitHVListReference();
HVHits.sort([](const MDEEStripHit& a, const MDEEStripHit& b) {
return a.m_ROE < b.m_ROE;
});
for (MDEEStripHit& SH: HVHits) {
Event->AddStripHit(SH.Convert());
}

list<MDEECrystalHit>& CHits = Event->GetDEECrystalHitListReference();
for (MDEECrystalHit& CH: CHits) {
Event->AddCrystalHit(CH.Convert());
Expand Down
8 changes: 4 additions & 4 deletions src/MSubModuleDepthReadout.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ bool MSubModuleDepthReadout::AnalyzeEvent(MReadOutAssembly* Event)
if (SH.m_FastPeakTime > -200.0 && SH.m_FastPeakTime < 10000.0) {
SH.m_Timing = 4200.0 - SH.m_FastPeakTime;

// TODO: apply fast threshold
SH.m_HasFastTiming = true;
// TODO: apply more realistic fast threshold
SH.m_HasFastTiming = (SH.m_Energy > 10.0);

if (m_ApplyTimingResolutionCalibration == true){
int PixelCode = 10000*DetID + 100*StripID + SH.m_OppositeStripID;
if (m_Coeffs.count(PixelCode) == 1){
vector<double> Coeffs = m_Coeffs[PixelCode];
double CTD_FWHM = Coeffs[2] * m_Coeffs_Energy / SH.m_Energy;
double CTD_Sigma = CTD_FWHM / 2.355;
double CTD_Sigma = min(abs(CTD_FWHM / 2.355), 50.0);
// Smear the timing value based on the given CTD resolution
// --> divide by √2 to obtain TAC resolution from CTD resolution
SH.m_Timing = gRandom->Gaus(SH.m_Timing, CTD_Sigma / TMath::Sqrt(2.0));
Expand Down Expand Up @@ -213,7 +213,7 @@ bool MSubModuleDepthReadout::AnalyzeEvent(MReadOutAssembly* Event)
if (m_Coeffs.count(PixelCode) == 1){
vector<double> Coeffs = m_Coeffs[PixelCode];
double CTD_FWHM = Coeffs[2] * m_Coeffs_Energy / SH.m_Energy;
double CTD_Sigma = CTD_FWHM / 2.355;
double CTD_Sigma = min(abs(CTD_FWHM / 2.355), 50.0);
// Smear the timing value based on the given CTD resolution
// --> divide by √2 to obtain TAC resolution from CTD resolution
SH.m_Timing = gRandom->Gaus(SH.m_Timing, CTD_Sigma / TMath::Sqrt(2.0));
Expand Down
Loading
Loading