Skip to content
4 changes: 2 additions & 2 deletions include/MGUIOptionsEventFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class MGUIOptionsEventFilter : public MGUIOptions
//! The number of hits
MGUIEMinMaxEntry* m_Hits;

//! Reduced Chi Square Selection
MGUIEMinMaxEntry* m_ReducedChiSquareWindow;
//! Strip Pairing Reduced Chi Square Selection
MGUIEMinMaxEntry* m_StripPairingReducedChiSquareWindow;

// private members:
private:
Expand Down
12 changes: 6 additions & 6 deletions include/MModuleEventFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ class MModuleEventFilter : public MModule
double GetMaximumHits() const { return m_MaximumHits; }

//! Set the maximum Reduced Chi Square
void SetMaximumReducedChiSquare(double MaximumReducedChiSquare) { m_MaximumReducedChiSquare = MaximumReducedChiSquare; }
void SetMaximumStripPairingReducedChiSquare(double MaximumStripPairingReducedChiSquare) { m_MaximumStripPairingReducedChiSquare = MaximumStripPairingReducedChiSquare; }
//! Get the maximum Reduced Chi Square
double GetMaximumReducedChiSquare() const { return m_MaximumReducedChiSquare; }
double GetMaximumStripPairingReducedChiSquare() const { return m_MaximumStripPairingReducedChiSquare; }

//! Set the minimum Reduced Chi Square
void SetMinimumReducedChiSquare(double MinimumReducedChiSquare) { m_MinimumReducedChiSquare = MinimumReducedChiSquare; }
void SetMinimumStripPairingReducedChiSquare(double MinimumStripPairingReducedChiSquare) { m_MinimumStripPairingReducedChiSquare = MinimumStripPairingReducedChiSquare; }
//! Get the minimum Reduced Chi Square
double GetMinimumReducedChiSquare() const { return m_MinimumReducedChiSquare; }
double GetMinimumStripPairingReducedChiSquare() const { return m_MinimumStripPairingReducedChiSquare; }


// protected methods:
Expand Down Expand Up @@ -156,10 +156,10 @@ class MModuleEventFilter : public MModule
unsigned int m_MaximumHits;

//! Minimum reduced chi square (as calculated in strip pairing code)
double m_MinimumReducedChiSquare;
double m_MinimumStripPairingReducedChiSquare;

//! Maximum reduced chi square (as calculated in strip pairing code)
double m_MaximumReducedChiSquare;
double m_MaximumStripPairingReducedChiSquare;


#ifdef ___CLING___
Expand Down
256 changes: 101 additions & 155 deletions include/MReadOutAssembly.h

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/MGUIOptionsEventFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,18 @@ void MGUIOptionsEventFilter::Create()
true, 0.0);
m_OptionsFrame->AddFrame(m_Hits, SecondariesLayout);

TGLabel* ReducedChiSquareLabel = new TGLabel(m_OptionsFrame,
TGLabel* StripPairingReducedChiSquareLabel = new TGLabel(m_OptionsFrame,
"Reduced Chi Squared Window (as calculated in strip pairing)\n"
"This requires that Strip Pairing has been done.");
m_OptionsFrame->AddFrame(ReducedChiSquareLabel, FirstLayout);
m_OptionsFrame->AddFrame(StripPairingReducedChiSquareLabel, FirstLayout);

m_ReducedChiSquareWindow = new MGUIEMinMaxEntry(m_OptionsFrame,
m_StripPairingReducedChiSquareWindow = new MGUIEMinMaxEntry(m_OptionsFrame,
"Choose the minimum and maximum Reduced Chi Square (inclusive):",
false,
dynamic_cast<MModuleEventFilter*>(m_Module)->GetMinimumReducedChiSquare(),
dynamic_cast<MModuleEventFilter*>(m_Module)->GetMaximumReducedChiSquare(),
dynamic_cast<MModuleEventFilter*>(m_Module)->GetMinimumStripPairingReducedChiSquare(),
dynamic_cast<MModuleEventFilter*>(m_Module)->GetMaximumStripPairingReducedChiSquare(),
true, 0.0);
m_OptionsFrame->AddFrame(m_ReducedChiSquareWindow, SecondariesLayout);
m_OptionsFrame->AddFrame(m_StripPairingReducedChiSquareWindow, SecondariesLayout);


PostCreate();
Expand Down Expand Up @@ -194,8 +194,8 @@ bool MGUIOptionsEventFilter::OnApply()
dynamic_cast<MModuleEventFilter*>(m_Module)->SetMinimumHits(m_Hits->GetMinValue());
dynamic_cast<MModuleEventFilter*>(m_Module)->SetMaximumHits(m_Hits->GetMaxValue());

dynamic_cast<MModuleEventFilter*>(m_Module)->SetMinimumReducedChiSquare(m_ReducedChiSquareWindow->GetMinValue());
dynamic_cast<MModuleEventFilter*>(m_Module)->SetMaximumReducedChiSquare(m_ReducedChiSquareWindow->GetMaxValue());
dynamic_cast<MModuleEventFilter*>(m_Module)->SetMinimumStripPairingReducedChiSquare(m_StripPairingReducedChiSquareWindow->GetMinValue());
dynamic_cast<MModuleEventFilter*>(m_Module)->SetMaximumStripPairingReducedChiSquare(m_StripPairingReducedChiSquareWindow->GetMaxValue());

return true;
}
Expand Down
16 changes: 8 additions & 8 deletions src/MModuleDepthCalibration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ bool MModuleDepthCalibration::AnalyzeEvent(MReadOutAssembly* Event)

}
*/
//Event->SetDepthCalibrationIncomplete(); //AWL1x1
//Event->SetDepthCalibrationError(); //AWL1x1

} else if( (XStrips.size() == 2) && (YStrips.size() == 2) ){
//in this case use depth from dominant strips but use weighted X and Y positions
Expand All @@ -328,7 +328,7 @@ bool MModuleDepthCalibration::AnalyzeEvent(MReadOutAssembly* Event)
GlobalPosition = m_DetectorVolumes[DetID]->GetPositionInWorldVolume(LocalPosition);
H->SetPosition(GlobalPosition); H->SetPositionResolution(PositionResolution);

//Event->SetDepthCalibrationIncomplete(); //AWL1x1
//Event->SetDepthCalibrationError(); //AWL1x1

} else {
//set too many SH bad flag
Expand All @@ -339,24 +339,24 @@ bool MModuleDepthCalibration::AnalyzeEvent(MReadOutAssembly* Event)
//good
++m_NoError;
} else if( Error == 1 ){
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError();
++m_Error1;
} else if( Error == 2 ){
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError();
++m_Error2;
} else if( Error == 3){
//Hits that were missing timing information
//EHist->Fill(H->GetEnergy());
//don't set the globally bad flag
//Event->SetDepthCalibrationIncomplete();
//Event->SetDepthCalibrationIncomplete(); //AWL1x1
//Event->SetDepthCalibrationError();
//Event->SetDepthCalibrationError(); //AWL1x1
++m_Error3;
} else if( Error == 4){
//hit was bad because of StripHitMultipleTimes flag from strip pairing
++m_Error4;
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError();
} else if( Error == -1){
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError();
++m_ErrorSH;
}

Expand Down
47 changes: 28 additions & 19 deletions src/MModuleDepthCalibration2024.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,26 @@ bool MModuleDepthCalibration2024::Initialize()
m_YPitches[DetID] = strip->GetPitchY();
m_NXStrips[DetID] = strip->GetNStripsX();
m_NYStrips[DetID] = strip->GetNStripsY();
cout << "Found detector " << det_name << " corresponding to DetID=" << DetID << "." << endl;
cout << "Detector thickness: " << m_Thicknesses[DetID] << endl;
cout << "Number of X strips: " << m_NXStrips[DetID] << endl;
cout << "Number of Y strips: " << m_NYStrips[DetID] << endl;
cout << "X strip pitch: " << m_XPitches[DetID] << endl;
cout << "Y strip pitch: " << m_YPitches[DetID] << endl;

if (g_Verbosity >= c_Info) {
cout << "Found detector " << det_name << " corresponding to DetID=" << DetID << "." << endl;
cout << "Detector thickness: " << m_Thicknesses[DetID] << endl;
cout << "Number of X strips: " << m_NXStrips[DetID] << endl;
cout << "Number of Y strips: " << m_NYStrips[DetID] << endl;
cout << "X strip pitch: " << m_XPitches[DetID] << endl;
cout << "Y strip pitch: " << m_YPitches[DetID] << endl;
}
m_DetectorIDs.push_back(DetID);
m_Detectors[DetID] = det;
} else {
cout<<"ERROR in MModuleDepthCalibration2024::Initialize: Found a duplicate detector: "<<det_name<<endl;
if (g_Verbosity >= c_Error) {
cout<<"ERROR in MModuleDepthCalibration2024::Initialize: Found a duplicate detector: "<<det_name<<endl;
}
}
} else {
cout<<"ERROR in MModuleDepthCalibration2024::Initialize: Found a Strip3D detector with "<<det->GetNSensitiveVolumes()<<" Sensitive Volumes."<<endl;
if (g_Verbosity >= c_Error) {
cout<<"ERROR in MModuleDepthCalibration2024::Initialize: Found a Strip3D detector with "<<det->GetNSensitiveVolumes()<<" Sensitive Volumes."<<endl;
}
}
}
}
Expand Down Expand Up @@ -207,7 +214,7 @@ bool MModuleDepthCalibration2024::AnalyzeEvent(MReadOutAssembly* Event)

if (Event->GetGuardRingVeto()==true) {

Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError("GR Veto");
return false;

} else {
Expand All @@ -224,7 +231,7 @@ bool MModuleDepthCalibration2024::AnalyzeEvent(MReadOutAssembly* Event)
// GRADE=-1 is an error. Break from the loop and continue.
if ( Grade < 0 ){
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError("Error in depth calibration");
if (Grade == -1) {
++m_ErrorSH;
} else if (Grade == -2) {
Expand All @@ -234,7 +241,7 @@ bool MModuleDepthCalibration2024::AnalyzeEvent(MReadOutAssembly* Event)
}
} else if (Grade > 4) { // GRADE=5 is some complicated geometry with multiple hits on a single strip. GRADE=6 means not all strips are adjacent.
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError("Multiple hits on single strip");
if (Grade==5) {
++m_Error5;
} else if (Grade==6) {
Expand Down Expand Up @@ -285,24 +292,24 @@ bool MModuleDepthCalibration2024::AnalyzeEvent(MReadOutAssembly* Event)
double LVTiming = LVSH->GetTiming();
double HVTiming = HVSH->GetTiming();

// If there aren't coefficients loaded, then calibration is incomplete.
// If there aren't coefficients loaded, then report a depth calibration error.
if( Coeffs == nullptr ){
//set the bad flag for depth
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError("No calibration coefficients");
++m_Error1;
} else if (CTDVec.size() == 0) {
cout << "Empty CTD vector" << endl;
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError("No calibration coefficients");
} else if (DepthVec.size() == 0) {
cout << "Empty Depth vector" << endl;
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError("No calibration coefficients");
} else if ((LVTiming < 1.0E-6) || (HVTiming < 1.0E-6)) {
++m_Error3;
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError("No timing");
} else {

// If there are coefficients and timing information is loaded, try calculating the CTD and depth
Expand All @@ -320,7 +327,7 @@ bool MModuleDepthCalibration2024::AnalyzeEvent(MReadOutAssembly* Event)
//if the CTD is out of range, check if we should reject the event.
if( (CTD_s < (Xmin - 2.0*noise)) || (CTD_s > (Xmax + 2.0*noise)) ){
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError("Out of Range");
++m_Error2;
}

Expand Down Expand Up @@ -355,7 +362,7 @@ bool MModuleDepthCalibration2024::AnalyzeEvent(MReadOutAssembly* Event)
Zpos = mean_depth;

// Add the depth to the GUI histogram.
if (Event->IsStripPairingIncomplete()==false) {
if (Event->HasStripPairingError()==false) {
if (HasExpos() == true) {
m_ExpoDepthCalibration->AddDepth(DetID, Zpos);
}
Expand Down Expand Up @@ -475,7 +482,9 @@ std::vector<double>* MModuleDepthCalibration2024::GetPixelCoeffs(int PixelCode)
if( m_Coeffs.count(PixelCode) > 0 ){
return &m_Coeffs[PixelCode];
} else {
cout << "MModuleDepthCalibration2024::GetPixelCoeffs: cannot get stretch and offset; pixel code " << PixelCode << " not found." << endl;
if (g_Verbosity >= c_Warning) {
cout << "MModuleDepthCalibration2024::GetPixelCoeffs: cannot get stretch and offset; pixel code " << PixelCode << " not found." << endl;
}
return nullptr;
}
} else {
Expand Down
16 changes: 8 additions & 8 deletions src/MModuleDepthCalibrationB.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ bool MModuleDepthCalibrationB::AnalyzeEvent(MReadOutAssembly* Event)
NewHits.push_back(NH);
}

// Event->SetDepthCalibrationIncomplete(); //for testing purposes!!! filtering out events that are not 1x1 strip AWL1x1
// Event->SetDepthCalibrationError(); //for testing purposes!!! filtering out events that are not 1x1 strip AWL1x1

} else if( (XStrips.size() == 2) && (YStrips.size() == 2) ){
//in this case use depth from dominant strips but use weighted X and Y positions
Expand All @@ -278,7 +278,7 @@ bool MModuleDepthCalibrationB::AnalyzeEvent(MReadOutAssembly* Event)
//GlobalPosition = m_Geometry->GetGlobalPosition( LocalPosition, m_DetectorNames[DetID]);
GlobalPosition = m_DetectorVolumes[DetID]->GetPositionInWorldVolume(LocalPosition);
H->SetPosition(GlobalPosition); H->SetPositionResolution(PositionResolution);
// Event->SetDepthCalibrationIncomplete(); //for testing purposes!!! filtering out events that are not 1x1 strip AWL1X1
// Event->SetDepthCalibrationError(); //for testing purposes!!! filtering out events that are not 1x1 strip AWL1X1

} else {
//set too many SH bad flag
Expand All @@ -289,24 +289,24 @@ bool MModuleDepthCalibrationB::AnalyzeEvent(MReadOutAssembly* Event)
//good
++m_NoError;
} else if( Error == 1 ){
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError();
++m_Error1;
} else if( Error == 2 ){
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError();
++m_Error2;
} else if( Error == 3){
//Hits that were missing timing information
//EHist->Fill(H->GetEnergy());
//don't set the globally bad flag
//Event->SetDepthCalibrationIncomplete();
// Event->SetDepthCalibrationIncomplete(); //for testing purposes!!! filtering out events that are not 1x1 strip AWL1X1
//Event->SetDepthCalibrationError();
// Event->SetDepthCalibrationError(); //for testing purposes!!! filtering out events that are not 1x1 strip AWL1X1
++m_Error3;
} else if( Error == 4){
//hit was bad because of StripHitMultipleTimes flag from strip pairing
++m_Error4;
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError();
} else if( Error == -1){
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError();
++m_ErrorSH;
}

Expand Down
Loading