@@ -402,23 +402,23 @@ int MatchTPCITS::getNMatchRecordsITS(const TrackLocITS& tTPC) const
402402}
403403
404404// ______________________________________________
405- void MatchTPCITS::addTPCSeed (const o2::track::TrackParCov& _tr, float t0, float terr, GTrackID srcGID, int tpcID)
405+ int MatchTPCITS::addTPCSeed (const o2::track::TrackParCov& _tr, float t0, float terr, GTrackID srcGID, int tpcID)
406406{
407407 // account single TPC seed, can be from standalone TPC track or constrained track from match to TRD and/or TOF
408408 const float SQRT12DInv = 2 . / sqrt (12 .);
409409 if (_tr.getX () > o2::constants::geom::XTPCInnerRef + 0.1 || std::abs (_tr.getQ2Pt ()) > mMinTPCTrackPtInv ) {
410- return ;
410+ return - 99 ;
411411 }
412412 const auto & tpcOrig = mTPCTracksArray [tpcID];
413413 // discard tracks w/o certain number of total or innermost pads (last cluster is innermost one)
414414 if (tpcOrig.getNClusterReferences () < mParams ->minTPCClusters ) {
415- return ;
415+ return - 89 ;
416416 }
417417 uint8_t clSect = 0 , clRow = 0 ;
418418 uint32_t clIdx = 0 ;
419419 tpcOrig.getClusterReference (mTPCTrackClusIdx , tpcOrig.getNClusterReferences () - 1 , clSect, clRow, clIdx);
420420 if (clRow > mParams ->askMinTPCRow [clSect]) {
421- return ;
421+ return - 9 ;
422422 }
423423 // create working copy of track param
424424 bool extConstrained = srcGID.getSource () != GTrackID::TPC;
@@ -449,13 +449,14 @@ void MatchTPCITS::addTPCSeed(const o2::track::TrackParCov& _tr, float t0, float
449449 }
450450 if (!propagateToRefX (trc)) {
451451 mTPCWork .pop_back (); // discard track whose propagation to XMatchingRef failed
452- return ;
452+ return - 1 ;
453453 }
454454 if (mMCTruthON ) {
455455 mTPCLblWork .emplace_back (mTPCTrkLabels [tpcID]);
456456 }
457457 // cache work track index
458458 mTPCSectIndexCache [o2::math_utils::angle2Sector (trc.getAlpha ())].push_back (mTPCWork .size () - 1 );
459+ return 0 ;
459460}
460461
461462// ______________________________________________
@@ -485,6 +486,32 @@ bool MatchTPCITS::prepareTPCData()
485486 mTPCSectIndexCache [sec].reserve (100 + 1.2 * ntrW / o2::constants::math::NSectors);
486487 }
487488
489+ mTPCRefitter = std::make_unique<o2::gpu::GPUO2InterfaceRefit>(mTPCClusterIdxStruct , mTPCCorrMapsHelper , mBz , mTPCTrackClusIdx .data (), 0 , mTPCRefitterShMap .data (), mTPCRefitterOccMap .data (), mTPCRefitterOccMap .size (), nullptr , o2::base::Propagator::Instance ());
490+ mTPCRefitter ->setTrackReferenceX (900 ); // disable propagation after refit by setting reference to value > 500
491+ mNTPCOccBinLength = mTPCRefitter ->getParam ()->rec .tpc .occupancyMapTimeBins ;
492+ mTBinClOcc .clear ();
493+ if (mNTPCOccBinLength > 1 && mTPCRefitterOccMap .size ()) {
494+ mNTPCOccBinLengthInv = 1 . / mNTPCOccBinLength ;
495+ int nTPCBins = mNHBPerTF * o2::constants::lhc::LHCMaxBunches / 8 , ninteg = 0 ;
496+ int nTPCOccBins = nTPCBins * mNTPCOccBinLengthInv , sumBins = std::max (1 , int (o2::constants::lhc::LHCMaxBunches / 8 * mNTPCOccBinLengthInv ));
497+ mTBinClOcc .resize (nTPCOccBins);
498+ std::vector<float > mltHistTB (nTPCOccBins);
499+ float sm = 0 ., tb = 0.5 * mNTPCOccBinLength ;
500+ for (int i = 0 ; i < nTPCOccBins; i++) {
501+ mltHistTB[i] = mTPCRefitter ->getParam ()->GetUnscaledMult (tb);
502+ tb += mNTPCOccBinLength ;
503+ }
504+ for (int i = nTPCOccBins; i--;) {
505+ sm += mltHistTB[i];
506+ if (i + sumBins < nTPCOccBins) {
507+ sm -= mltHistTB[i + sumBins];
508+ }
509+ mTBinClOcc [i] = sm;
510+ }
511+ } else {
512+ mTBinClOcc .resize (1 );
513+ }
514+
488515 auto creator = [this ](auto & trk, GTrackID gid, float time0, float terr) {
489516 if constexpr (isITSTrack<decltype (trk)>()) {
490517 // do nothing, ITS tracks will be processed in a direct loop over ROFs
@@ -494,20 +521,27 @@ bool MatchTPCITS::prepareTPCData()
494521 } else if (std::abs (trk.getQ2Pt ()) > mMinTPCTrackPtInv ) {
495522 return true ;
496523 }
524+ int resAdd = -100 ;
525+ int tpcIndex = -1 ;
497526 if constexpr (isTPCTrack<decltype (trk)>()) {
498527 // unconstrained TPC track, with t0 = TrackTPC.getTime0+0.5*(DeltaFwd-DeltaBwd) and terr = 0.5*(DeltaFwd+DeltaBwd) in TimeBins
499528 if (!this ->mSkipTPCOnly && trk.getNClusters () > 0 ) {
500- this ->addTPCSeed (trk, this ->tpcTimeBin2MUS (time0), this ->tpcTimeBin2MUS (terr), gid, gid.getIndex ());
529+ resAdd = this ->addTPCSeed (trk, this ->tpcTimeBin2MUS (time0), this ->tpcTimeBin2MUS (terr), gid, (tpcIndex = gid.getIndex () ));
501530 }
502531 }
503532 if constexpr (isTPCTOFTrack<decltype (trk)>()) {
504533 // TPC track constrained by TOF time, time and its error in \mus
505- this ->addTPCSeed (trk, time0, terr, gid, this ->mRecoCont ->getTPCContributorGID (gid));
534+ resAdd = this ->addTPCSeed (trk, time0, terr, gid, (tpcIndex = this ->mRecoCont ->getTPCContributorGID (gid) ));
506535 }
507536 if constexpr (isTRDTrack<decltype (trk)>()) {
508537 // TPC track constrained by TRD trigger time, time and its error in \mus
509- this ->addTPCSeed (trk, time0, terr, gid, this ->mRecoCont ->getTPCContributorGID (gid));
538+ resAdd = this ->addTPCSeed (trk, time0, terr, gid, (tpcIndex = this ->mRecoCont ->getTPCContributorGID (gid) ));
510539 }
540+ #ifdef _ALLOW_DEBUG_TREES_
541+ if (resAdd > -10 && mDBGOut && isDebugFlag (TPCOrigTree)) {
542+ dumpTPCOrig (resAdd == 0 , tpcIndex);
543+ }
544+ #endif
511545 // note: TPCTRDTPF tracks are actually TRD track with extra TOF cluster
512546 return true ;
513547 };
@@ -576,31 +610,6 @@ bool MatchTPCITS::prepareTPCData()
576610 mITSROFofTPCBin[ib] = itsROF;
577611 }
578612*/
579- mTPCRefitter = std::make_unique<o2::gpu::GPUO2InterfaceRefit>(mTPCClusterIdxStruct , mTPCCorrMapsHelper , mBz , mTPCTrackClusIdx .data (), 0 , mTPCRefitterShMap .data (), mTPCRefitterOccMap .data (), mTPCRefitterOccMap .size (), nullptr , o2::base::Propagator::Instance ());
580- mTPCRefitter ->setTrackReferenceX (900 ); // disable propagation after refit by setting reference to value > 500
581- mNTPCOccBinLength = mTPCRefitter ->getParam ()->rec .tpc .occupancyMapTimeBins ;
582- mTBinClOcc .clear ();
583- if (mNTPCOccBinLength > 1 && mTPCRefitterOccMap .size ()) {
584- mNTPCOccBinLengthInv = 1 . / mNTPCOccBinLength ;
585- int nTPCBins = mNHBPerTF * o2::constants::lhc::LHCMaxBunches / 8 , ninteg = 0 ;
586- int nTPCOccBins = nTPCBins * mNTPCOccBinLengthInv , sumBins = std::max (1 , int (o2::constants::lhc::LHCMaxBunches / 8 * mNTPCOccBinLengthInv ));
587- mTBinClOcc .resize (nTPCOccBins);
588- std::vector<float > mltHistTB (nTPCOccBins);
589- float sm = 0 ., tb = 0.5 * mNTPCOccBinLength ;
590- for (int i = 0 ; i < nTPCOccBins; i++) {
591- mltHistTB[i] = mTPCRefitter ->getParam ()->GetUnscaledMult (tb);
592- tb += mNTPCOccBinLength ;
593- }
594- for (int i = nTPCOccBins; i--;) {
595- sm += mltHistTB[i];
596- if (i + sumBins < nTPCOccBins) {
597- sm -= mltHistTB[i + sumBins];
598- }
599- mTBinClOcc [i] = sm;
600- }
601- } else {
602- mTBinClOcc .resize (1 );
603- }
604613 mInteractionMUSLUT .clear ();
605614 mInteractionMUSLUT .resize (maxTime + 3 * o2::constants::lhc::LHCOrbitMUS, -1 );
606615 mTimer [SWPrepTPC].Stop ();
@@ -2816,6 +2825,36 @@ void MatchTPCITS::setDebugFlag(UInt_t flag, bool on)
28162825 }
28172826}
28182827
2828+ // _________________________________________________________
2829+ void MatchTPCITS::dumpTPCOrig (bool acc, int tpcIndex)
2830+ {
2831+ // /< fill debug tree for TPC original tracks (passing pT cut)
2832+ mTimer [SWDBG].Start (false );
2833+ const auto & tpcOrig = mTPCTracksArray [tpcIndex];
2834+ uint8_t clSect = 0 , clRow = 0 ;
2835+ uint32_t clIdx = 0 ;
2836+ tpcOrig.getClusterReference (mTPCTrackClusIdx , tpcOrig.getNClusterReferences () - 1 , clSect, clRow, clIdx);
2837+ int tb = tpcOrig.getTime0 () * mNTPCOccBinLengthInv ;
2838+ float mltTPC = tb < 0 ? mTBinClOcc [0 ] : (tb >= mTBinClOcc .size () ? mTBinClOcc .back () : mTBinClOcc [tb]);
2839+ (*mDBGOut ) << " tpcOrig"
2840+ << " tf=" << mTFCount
2841+ << " index=" << tpcIndex
2842+ << " acc=" << acc
2843+ << " chi2TPC=" << tpcOrig.getChi2 ()
2844+ << " nClus=" << tpcOrig.getNClusters ()
2845+ << " time0=" << tpcOrig.getTime0 ()
2846+ << " trc=" << ((o2::track::TrackParCov&)tpcOrig)
2847+ << " minRow=" << clRow
2848+ << " multTPC=" << mltTPC;
2849+ if (mMCTruthON ) {
2850+ (*mDBGOut ) << " tpcOrig"
2851+ << " tpcLbl=" << mTPCTrkLabels [tpcIndex];
2852+ }
2853+ (*mDBGOut ) << " tpcOrig"
2854+ << " \n " ;
2855+ mTimer [SWDBG].Stop ();
2856+ }
2857+
28192858// _________________________________________________________
28202859void MatchTPCITS::fillTPCITSmatchTree (int itsID, int tpcID, int rejFlag, float chi2, float tCorr)
28212860{
0 commit comments