@@ -122,6 +122,7 @@ class TrackMCStudy : public Task
122122 std::vector<float > mTPCOcc ; // /< TPC occupancy for this interaction time
123123 std::vector<int > mITSOcc ; // < N ITS clusters in the ROF containing collision
124124 bool mCheckSV = false ; // < check SV binding (apart from prongs availability)
125+ bool mRecProcStage = false ; // < flag that the MC particle was added only at the stage of reco tracks processing
125126 int mNTPCOccBinLength = 0 ; // /< TPC occ. histo bin length in TBs
126127 float mNTPCOccBinLengthInv ;
127128 int mVerbose = 0 ;
@@ -185,6 +186,7 @@ void TrackMCStudy::run(ProcessingContext& pc)
185186
186187 recoData.collectData (pc, *mDataRequest .get ()); // select tracks of needed type, with minimal cuts, the real selected will be done in the vertexer
187188 updateTimeDependentParams (pc); // Make sure this is called after recoData.collectData, which may load some conditions
189+ mRecProcStage = false ;
188190 process (recoData);
189191}
190192
@@ -278,15 +280,21 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
278280 return patt;
279281 };
280282
281- auto getLowestPadrow = [&recoData](const o2::tpc::TrackTPC& trc) {
283+ auto getLowestPadrow = [&recoData](const o2::tpc::TrackTPC& trc, RecTrack& tref ) {
282284 if (recoData.inputsTPCclusters ) {
283285 uint8_t clSect = 0 , clRow = 0 ;
284286 uint32_t clIdx = 0 ;
285287 const auto clRefs = recoData.getTPCTracksClusterRefs ();
288+ const auto tpcClusAcc = recoData.getTPCClusters ();
286289 trc.getClusterReference (clRefs, trc.getNClusterReferences () - 1 , clSect, clRow, clIdx);
287- return int (clRow);
290+ const auto & clus = tpcClusAcc.clusters [clSect][clRow][clIdx];
291+ int padFromEdge = int (clus.getPad ()), npads = o2::gpu::GPUTPCGeometry::NPads (clRow);
292+ if (padFromEdge > npads / 2 ) {
293+ padFromEdge = npads - 1 - padFromEdge;
294+ }
295+ tref.padFromEdge = uint8_t (padFromEdge);
296+ tref.lowestPadRow = clRow;
288297 }
289- return -1 ;
290298 };
291299
292300 auto flagTPCClusters = [&recoData](const o2::tpc::TrackTPC& trc, o2::MCCompLabel lbTrc) {
@@ -352,7 +360,7 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
352360 int nev = mcReader.getNEvents (curSrcMC);
353361 bool okAccVtx = true ;
354362 if (nev != (int )mMCVtVec .size ()) {
355- LOGP (error , " source {} has {} events while {} MC vertices were booked" , curSrcMC, nev, mMCVtVec .size ());
363+ LOGP (debug , " source {} has {} events while {} MC vertices were booked" , curSrcMC, nev, mMCVtVec .size ());
356364 okAccVtx = false ;
357365 }
358366 for (curEvMC = 0 ; curEvMC < nev; curEvMC++) {
@@ -382,6 +390,7 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
382390 }
383391
384392 // add reconstruction info to MC particles. If MC particle was not selected before but was reconstrected, account MC info
393+ mRecProcStage = true ; // MC particles accepted only at this stage will be flagged
385394 for (int iv = 0 ; iv < nv; iv++) {
386395 if (mVerbose > 1 ) {
387396 LOGP (info, " processing PV {} of {}" , iv, nv);
@@ -532,7 +541,7 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
532541 if (msk[DetID::TPC]) {
533542 const auto & trtpc = recoData.getTPCTrack (gidSet[GTrackID::TPC]);
534543 tref.nClTPC = trtpc.getNClusters ();
535- tref. lowestPadRow = getLowestPadrow (trtpc);
544+ getLowestPadrow (trtpc, tref );
536545 flagTPCClusters (trtpc, entry.first );
537546 if (trackFam.entTPC < 0 ) {
538547 trackFam.entTPC = tcnt;
@@ -1088,6 +1097,7 @@ bool TrackMCStudy::addMCParticle(const MCTrack& mcPart, const o2::MCCompLabel& l
10881097 mcEntry.mcTrackInfo .bcInTF = mIntBC [lb.getEventID ()];
10891098 mcEntry.mcTrackInfo .occTPC = mTPCOcc [lb.getEventID ()];
10901099 mcEntry.mcTrackInfo .occITS = mITSOcc [lb.getEventID ()];
1100+ mcEntry.mcTrackInfo .addedAtRecStage = mRecProcStage ;
10911101 int moth = -1 ;
10921102 o2::MCCompLabel mclbPar;
10931103 if ((moth = mcPart.getMotherTrackId ()) >= 0 ) {
0 commit comments