Skip to content
Snippets Groups Projects
Commit 8e059719 authored by Mark Jones's avatar Mark Jones
Browse files

Modify THCTrigDet::Decode

Previously if none of the TDC hits was not within the time cut
window the TDC value was set to 0. Now if there are
TDC hits it selections the first one in the cut window.
If no hit is found in the cut window then it selects the
hit that is closest in time to the lower window limit.
parent a8ce1f8a
No related branches found
No related tags found
1 merge request!1Update april2020
......@@ -275,12 +275,19 @@ Int_t THcTrigDet::Decode(const THaEvData& evData) {
THcRawTdcHit rawTdcHit = hit->GetRawTdcHit();
if (rawTdcHit.GetNHits() >0 && rawTdcHit.HasRefTime() && fTdcRefTime == kBig) fTdcRefTime=rawTdcHit.GetRefTime() ;
UInt_t good_hit=999;
UInt_t closest_hit=999;
Int_t TimeDiff=1000000;
for (UInt_t thit=0; thit<rawTdcHit.GetNHits(); ++thit) {
Int_t TestTime= rawTdcHit.GetTimeRaw(thit);
if (abs(TestTime-fTdcTimeWindowMin[cnt]) < TimeDiff) {
closest_hit=thit;
TimeDiff=abs(TestTime-fTdcTimeWindowMin[cnt]);
}
if (TestTime>=fTdcTimeWindowMin[cnt]&&TestTime<=fTdcTimeWindowMax[cnt]&&good_hit==999) {
good_hit=thit;
}
}
if (good_hit == 999 and closest_hit != 999) good_hit=closest_hit;
if (good_hit<rawTdcHit.GetNHits()) {
fTdcTimeRaw[cnt] = rawTdcHit.GetTimeRaw(good_hit);
fTdcTime[cnt] = rawTdcHit.GetTime(good_hit)*fTdcChanperNS+fTdcOffset;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment