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
252 changes: 97 additions & 155 deletions include/MReadOutAssembly.h

Large diffs are not rendered by default.

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(true, "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();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add error message

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(true, "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(true, "No calibration coefficients");
++m_Error1;
} else if (CTDVec.size() == 0) {
cout << "Empty CTD vector" << endl;
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError(true, "No calibration coefficients");
} else if (DepthVec.size() == 0) {
cout << "Empty Depth vector" << endl;
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError(true, "No calibration coefficients");
} else if ((LVTiming < 1.0E-6) || (HVTiming < 1.0E-6)) {
++m_Error3;
H->SetNoDepth();
Event->SetDepthCalibrationIncomplete();
Event->SetDepthCalibrationError(true, "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(true, "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->IsStripPairingError()==false) {
Copy link
Collaborator

@zoglauer zoglauer Jan 21, 2026

Choose a reason for hiding this comment

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

White space: ..() == 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