@@ -349,7 +349,7 @@ void AODProducerWorkflowDPL::addToTracksExtraTable(TracksExtraCursorType& tracks
349349 truncateFloatFraction (extraInfoHolder.trdChi2 , mTrackChi2 ),
350350 truncateFloatFraction (extraInfoHolder.tofChi2 , mTrackChi2 ),
351351 truncateFloatFraction (extraInfoHolder.tpcSignal , mTrackSignal ),
352- truncateFloatFraction ( extraInfoHolder.trdSignal , mTrackSignal ),
352+ extraInfoHolder.trdSignal , // byte encoded value do not truncate
353353 truncateFloatFraction (extraInfoHolder.length , mTrackSignal ),
354354 truncateFloatFraction (extraInfoHolder.tofExpMom , mTrack1Pt ),
355355 truncateFloatFraction (extraInfoHolder.trackEtaEMCAL , mTrackPosEMCAL ),
@@ -390,24 +390,24 @@ void AODProducerWorkflowDPL::addToTracksQATable(TracksQACursorType& tracksQACurs
390390}
391391
392392template <typename TRDsExtraCursorType>
393- void AODProducerWorkflowDPL::addToTRDsExtra (const o2::globaltracking::RecoContainer& recoData, TRDsExtraCursorType& trdExtraCursor, const GIndex& trkIdx, int trkTableIdx)
393+ void AODProducerWorkflowDPL::addToTRDsExtra (const o2::globaltracking::RecoContainer& recoData, TRDsExtraCursorType& trdExtraCursor, const GIndex& trkIdx, TrackExtraInfo& extraInfo, int trkTableIdx)
394394{
395- static int q0s[6 ] = {-1 }, q1s[6 ] = {-1 }, q2s[6 ] = {-1 };
396- static float q0sCor[6 ] = {-1 }, q1sCor[6 ] = {-1 }, q2sCor[6 ] = {-1 };
397- static float ttgls[6 ] = {-999 }, tphis[6 ] = {-999 };
395+ const int NLAYERS = o2::trd::TrackTRD::EGPUTRDTrack::kNLayers ;
396+ int q0s[NLAYERS] = {-1 }, q1s[NLAYERS] = {-1 }, q2s[NLAYERS] = {-1 };
397+ float q0sCor[NLAYERS] = {-1 }, q1sCor[NLAYERS] = {-1 }, q2sCor[NLAYERS] = {-1 };
398+ float ttgls[NLAYERS] = {-999 }, tphis[NLAYERS] = {-999 };
398399
399400 auto contributorsGID = recoData.getSingleDetectorRefs (trkIdx);
400401 if (!contributorsGID[GIndex::Source::TRD].isIndexSet ()) { // should be redunant
401402 return ;
402403 }
403404 const auto & trk = recoData.getTrack <o2::trd::TrackTRD>(contributorsGID[GIndex::Source::TRD]);
404- auto trkC = trk;
405405 const auto & trklets = recoData.getTRDTracklets ();
406406 const auto & ctrklets = recoData.getTRDCalibratedTracklets ();
407- for ( int iLay{ 0 }; iLay < 6 ; ++iLay) {
408- q0s[iLay] = q1s[iLay] = q2s[iLay] = - 1 ;
409- q0sCor[iLay] = q1sCor[iLay] = q2sCor[iLay] = - 1 ;
410- tphis[ iLay] = ttgls[ iLay] = - 999 ;
407+ auto trkC = trk; // local copy to propagate
408+
409+ float dEdx{ 0 .} ;
410+ for ( int iLay{ 0 }; iLay < NLAYERS; ++iLay) {
411411 auto trkltId = trk.getTrackletIndex (iLay);
412412 if (trkltId < 0 ) {
413413 continue ;
@@ -421,11 +421,11 @@ void AODProducerWorkflowDPL::addToTRDsExtra(const o2::globaltracking::RecoContai
421421 int trkltSec = trkltDet / 30 ;
422422 if (trkltSec != o2::math_utils::angle2Sector (trkC.getAlpha ())) {
423423 if (!trkC.rotate (o2::math_utils::sector2Angle (trkltSec))) {
424- break ;
424+ continue ;
425425 }
426426 }
427427 if (!o2::base::Propagator::Instance ()->PropagateToXBxByBz (trkC, ctrklets[trkltId].getX (), o2::base::Propagator::MAX_SIN_PHI, o2::base::Propagator::MAX_STEP, mMatCorr )) {
428- break ;
428+ continue ;
429429 }
430430
431431 auto tphi = trkC.getSnp () / std::sqrt ((1 .f - trkC.getSnp ()) * (1 .f + trkC.getSnp ()));
@@ -440,26 +440,18 @@ void AODProducerWorkflowDPL::addToTRDsExtra(const o2::globaltracking::RecoContai
440440 ttgls[iLay] = trkC.getTgl ();
441441 tphis[iLay] = tphi;
442442
443- // z-row merging
444- if (trk.getIsCrossingNeighbor (iLay) && trk.getHasNeighbor ()) {
445- for (const auto & trklt : trklets) {
446- if (tracklet.getTrackletWord () == trklt.getTrackletWord ()) {
447- continue ;
448- }
449- if (std::abs (tracklet.getPadCol () - trklt.getPadCol ()) <= 1 && std::abs (tracklet.getPadRow () - trklt.getPadRow ()) == 1 ) {
450- cor = mTRDLocalGain ->getValue (trklt.getHCID () / 2 , trklt.getPadCol (), trklt.getPadRow ()) * trackletLength;
451- q0s[iLay] += trklt.getQ0 ();
452- q1s[iLay] += trklt.getQ1 ();
453- q2s[iLay] += trklt.getQ2 ();
454- q0sCor[iLay] += (float )trklt.getQ0 () / cor;
455- q1sCor[iLay] += (float )trklt.getQ1 () / cor;
456- q2sCor[iLay] += (float )trklt.getQ2 () / cor;
457- }
458- }
459- }
443+ dEdx += (q0sCor[iLay] + q1sCor[iLay] + q2sCor[iLay]);
460444 }
445+ dEdx /= (float )trkC.getNtracklets ();
446+
447+ aod::track::extensions::TRDSignalEncoding enc;
448+ enc.setDEdx (dEdx);
449+ enc.setEProb (trk.getSignal ());
450+ extraInfo.trdSignal = enc.getSignal ();
461451
462- trdExtraCursor (trkTableIdx, q0s, q1s, q2s, q0sCor, q1sCor, q2sCor, ttgls, tphis);
452+ if (mEnableTRDextra ) {
453+ trdExtraCursor (trkTableIdx, q0s, q1s, q2s, q0sCor, q1sCor, q2sCor, ttgls, tphis);
454+ }
463455}
464456
465457template <typename mftTracksCursorType, typename AmbigMFTTracksCursorType>
@@ -612,12 +604,13 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
612604 if (!isProp) {
613605 addToTracksTable (tracksCursor, tracksCovCursor, trOrig, collisionID, aod::track::TrackIU);
614606 }
615- addToTracksExtraTable (tracksExtraCursor, extraInfoHolder);
616607
617- if (mEnableTRDextra && trackIndex.includesDet (GIndex::Source::TRD)) {
618- addToTRDsExtra (data, trdsExtraCursor, trackIndex, mTableTrID );
608+ if (trackIndex.includesDet (GIndex::Source::TRD)) {
609+ addToTRDsExtra (data, trdsExtraCursor, trackIndex, extraInfoHolder, mTableTrID );
619610 }
620611
612+ addToTracksExtraTable (tracksExtraCursor, extraInfoHolder);
613+
621614 // collecting table indices of barrel tracks for V0s table
622615 if (extraInfoHolder.bcSlice [0 ] >= 0 && collisionID < 0 ) {
623616 ambigTracksCursor (mTableTrID , extraInfoHolder.bcSlice );
@@ -2606,7 +2599,6 @@ AODProducerWorkflowDPL::TrackExtraInfo AODProducerWorkflowDPL::processBarrelTrac
26062599 if (contributorsGID[GIndex::Source::TRD].isIndexSet ()) { // ITS-TPC-TRD-TOF, TPC-TRD-TOF, TPC-TRD, ITS-TPC-TRD
26072600 const auto & trdOrig = data.getTrack <o2::trd::TrackTRD>(contributorsGID[GIndex::Source::TRD]); // refitted TRD trac
26082601 extraInfoHolder.trdChi2 = trdOrig.getChi2 ();
2609- extraInfoHolder.trdSignal = trdOrig.getSignal ();
26102602 extraInfoHolder.trdPattern = getTRDPattern (trdOrig);
26112603 if (extraInfoHolder.trackTimeRes < 0 .) { // time is not set yet, this is possible only for TPC-TRD and ITS-TPC-TRD tracks, since those with TOF are set upstream
26122604 // TRD is triggered: time uncertainty is within a BC
0 commit comments