@@ -1113,6 +1113,11 @@ void MatchTOF::doMatchingForTPC(int sec)
11131113{
11141114 auto & gasParam = o2::tpc::ParameterGas::Instance ();
11151115 float vdrift = gasParam.DriftV ;
1116+ float vdriftInBC = Geo::BC_TIME_INPS * 1E-6 * vdrift;
1117+
1118+ int bc_grouping = 40 ;
1119+ int bc_grouping_half = (bc_grouping + 1 ) / 2 ;
1120+ double BCgranularity = Geo::BC_TIME_INPS * bc_grouping;
11161121
11171122 // /< do the real matching per sector
11181123 mMatchedTracksPairs .clear (); // new sector
@@ -1146,7 +1151,6 @@ void MatchTOF::doMatchingForTPC(int sec)
11461151 auto & trefTrk = trackWork.first ;
11471152 auto & intLT = mLTinfos [cacheTrk[itrk]];
11481153
1149- int nBCcand = 1 ;
11501154 BCcand.clear ();
11511155 nStripsCrossedInPropagation.clear ();
11521156
@@ -1155,8 +1159,17 @@ void MatchTOF::doMatchingForTPC(int sec)
11551159 // look at BC candidates for the track
11561160 itof0 = 0 ;
11571161 double minTrkTime = (trackWork.second .getTimeStamp () - trackWork.second .getTimeStampError ()) * 1 .E6 ; // minimum time in ps
1162+ minTrkTime = int (minTrkTime / BCgranularity) * BCgranularity; // align min to a BC
11581163 double maxTrkTime = (trackWork.second .getTimeStamp () + mExtraTPCFwdTime [cacheTrk[itrk]]) * 1 .E6 ; // maximum time in ps
11591164
1165+ /*
1166+ for (double tBC = minTrkTime; tBC < maxTrkTime; tBC += BCgranularity) {
1167+ unsigned long ibc = (unsigned long)(tBC * Geo::BC_TIME_INPS_INV);
1168+ BCcand.emplace_back(ibc);
1169+ nStripsCrossedInPropagation.emplace_back(0);
1170+ }
1171+ */
1172+
11601173 for (auto itof = itof0; itof < nTOFCls; itof++) {
11611174 auto & trefTOF = mTOFClusWork [cacheTOF[itof]];
11621175
@@ -1175,6 +1188,8 @@ void MatchTOF::doMatchingForTPC(int sec)
11751188
11761189 unsigned long bc = (unsigned long )(trefTOF.getTime () * Geo::BC_TIME_INPS_INV);
11771190
1191+ bc = (bc / bc_grouping_half) * bc_grouping_half;
1192+
11781193 bool isalreadyin = false ;
11791194
11801195 for (int k = 0 ; k < BCcand.size (); k++) {
@@ -1188,6 +1203,9 @@ void MatchTOF::doMatchingForTPC(int sec)
11881203 nStripsCrossedInPropagation.emplace_back (0 );
11891204 }
11901205 }
1206+
1207+ // printf("BC = %ld\n",BCcand.size());
1208+
11911209 detId.clear ();
11921210 detId.reserve (BCcand.size ());
11931211 trkLTInt.clear ();
@@ -1302,8 +1320,8 @@ void MatchTOF::doMatchingForTPC(int sec)
13021320 }
13031321 }
13041322 for (int ibc = 0 ; ibc < BCcand.size (); ibc++) {
1305- float minTime = (BCcand[ibc] - 1 ) * Geo::BC_TIME_INPS;
1306- float maxTime = (BCcand[ibc] + 1 ) * Geo::BC_TIME_INPS;
1323+ float minTime = (BCcand[ibc] - bc_grouping ) * Geo::BC_TIME_INPS;
1324+ float maxTime = (BCcand[ibc] + bc_grouping ) * Geo::BC_TIME_INPS;
13071325 for (Int_t imatch = 0 ; imatch < nStripsCrossedInPropagation[ibc]; imatch++) {
13081326 // we take as residual the average of the residuals along the propagation in the same strip
13091327 deltaPos[ibc][imatch][0 ] /= nStepsInsideSameStrip[ibc][imatch];
@@ -1333,6 +1351,8 @@ void MatchTOF::doMatchingForTPC(int sec)
13331351 break ;
13341352 }
13351353
1354+ unsigned long bcClus = trefTOF.getTime () * Geo::BC_TIME_INPS_INV;
1355+
13361356 int mainChannel = trefTOF.getMainContributingChannel ();
13371357 int indices[5 ];
13381358 Geo::getVolumeIndices (mainChannel, indices);
@@ -1382,6 +1402,7 @@ void MatchTOF::doMatchingForTPC(int sec)
13821402 LOG (DEBUG) << " Propagated Track [" << itrk << " , " << cacheTrk[itrk] << " ]: detId[" << iPropagation << " ] = " << detId[ibc][iPropagation][0 ] << " , " << detId[ibc][iPropagation][1 ] << " , " << detId[ibc][iPropagation][2 ] << " , " << detId[ibc][iPropagation][3 ] << " , " << detId[ibc][iPropagation][4 ];
13831403 float resX = deltaPos[ibc][iPropagation][0 ] - (indices[4 ] - detId[ibc][iPropagation][4 ]) * Geo::XPAD + posCorr[0 ]; // readjusting the residuals due to the fact that the propagation fell in a pad that was not exactly the one of the cluster
13841404 float resZ = deltaPos[ibc][iPropagation][2 ] - (indices[3 ] - detId[ibc][iPropagation][3 ]) * Geo::ZPAD + posCorr[2 ]; // readjusting the residuals due to the fact that the propagation fell in a pad that was not exactly the one of the cluster
1405+ resZ += (BCcand[ibc] - bcClus) * vdriftInBC * side; // add bc correction
13851406 float res = TMath::Sqrt (resX * resX + resZ * resZ);
13861407 if (indices[0 ] != detId[ibc][iPropagation][0 ]) {
13871408 continue ;
0 commit comments