@@ -35,6 +35,9 @@ void Reconstructor::process(o2::fdd::Digit const& digitBC, gsl::span<const o2::f
3535 int nStored = 0 ;
3636 int nch = inChData.size ();
3737
38+ bool atLeastOneVertexChannel = false ;
39+ bool atLeastOneChannelInSwAmplitudeRange = false ;
40+
3841 for (int ich = 0 ; ich < nch; ich++) {
3942 if (mDeadChannelMap && !mDeadChannelMap ->isChannelAlive (inChData[ich].mPMNumber )) {
4043 LOG (debug) << " Channel " << ich << " is dead - discarding data" ;
@@ -48,43 +51,47 @@ void Reconstructor::process(o2::fdd::Digit const& digitBC, gsl::span<const o2::f
4851 nStored++;
4952 }
5053
51- Float_t adc = inChData[ich].mChargeADC ;
52- Float_t time = (inChData[ich].mTime ) * timePerTDC;
53- if (time == o2::InteractionRecord::DummyTime) {
54- continue ;
55- }
56- Float_t timeErr = 1 ;
54+ float adc = inChData[ich].mChargeADC ;
55+ float time = (inChData[ich].mTime ) * timePerTDC;
56+
57+ float timeWeight = 1 ;
5758 if (adc > FDDRecoConfig::Instance ().AmplitudeCutOnCollisionTimeWeights ) {
58- timeErr = 1 . / adc;
59+ timeWeight = adc * adc;
5960 }
6061 if ((int )inChData[ich].mPMNumber < 8 ) {
6162 nInTimeC += inTime;
62- timeFDC += time / (timeErr * timeErr) ;
63- weightFDC += 1 . / (timeErr * timeErr) ;
63+ timeFDC += time * timeWeight ;
64+ weightFDC += timeWeight ;
6465 } else {
6566 nInTimeA += inTime;
66- timeFDA += time / (timeErr * timeErr) ;
67- weightFDA += 1 . / (timeErr * timeErr) ;
67+ timeFDA += time * timeWeight ;
68+ weightFDA += timeWeight ;
6869 }
70+
71+ atLeastOneVertexChannel = FDDRecoConfig::areChannelDataFlagsGood (inChData[ich].mFEEBits );
72+ atLeastOneChannelInSwAmplitudeRange = (adc >= FDDRecoConfig::SwTriggerAmplitudeLowThreshold && adc <= FDDRecoConfig::SwTriggerAmplitudeHighThreshold);
6973 }
7074 const int nsToPs = 1e3 ;
7175 std::array<int , 2 > mCollisionTime = {o2::fdd::RecPoint::sDummyCollissionTime , o2::fdd::RecPoint::sDummyCollissionTime };
72- // / Avg time for each side, only if one channel satisfy the TVDC condition (if not, also avg time is propagated for background study using AO2D)
73- if (nInTimeA > 0 ) {
74- mCollisionTime [o2::fdd::RecPoint::TimeA] = (weightFDA > 1 ) ? round (timeFDA / weightFDA * nsToPs)
75- : o2::fdd::RecPoint::sDummyCollissionTime ;
76- } else {
77- if (weightFDA > 0 ) {
78- mCollisionTime [o2::fdd::RecPoint::TimeA] = round (timeFDA / weightFDA * nsToPs);
79- }
76+
77+ float meanTimeSideA = round (timeFDA / weightFDA * nsToPs);
78+ float meanTimeSideC = round (timeFDC / weightFDC * nsToPs);
79+ float sideTimeDifference = fabs (meanTimeSideC - meanTimeSideA);
80+ bool swTriggerBit = false ;
81+ swTriggerBit = (
82+ FDDRecoConfig::SwTriggerEnabled &&
83+ (sideTimeDifference => FDDRecoConfig::SwTriggerTimeLowThreshold
84+ && sideTimeDifference <= FDDRecoConfig::SwTriggerTimeHighThreshold
85+ && atLeastOneVertexChannel
86+ && atLeastOneChannelInSwAmplitudeRange
87+ )
88+ );
89+
90+ if (nInTimeA > 0 && weightFDA > FDDRecoConfig::Instance ().AmplitudeCollisionTimeCutSideA ) {
91+ mCollisionTime [o2::fdd::RecPoint::TimeA] = round (timeFDA / weightFDA * nsToPs);
8092 }
81- if (nInTimeC > 0 ) {
82- mCollisionTime [o2::fdd::RecPoint::TimeC] = (weightFDC > 1 ) ? round (timeFDC / weightFDC * nsToPs)
83- : o2::fdd::RecPoint::sDummyCollissionTime ;
84- } else {
85- if (weightFDC > 0 ) {
86- mCollisionTime [o2::fdd::RecPoint::TimeC] = round (timeFDC / weightFDC * nsToPs);
87- }
93+ if (nInTimeC > 0 && weightFDC > FDDRecoConfig::Instance ().AmplitudeCollisionTimeCutSideC ) {
94+ mCollisionTime [o2::fdd::RecPoint::TimeC] = round (timeFDC / weightFDC * nsToPs);
8895 }
8996 RecPoints.emplace_back (mCollisionTime , firstEntry, nStored, digitBC.getIntRecord (), digitBC.mTriggers );
9097}
0 commit comments