@@ -312,72 +312,72 @@ void CheckClusters(const std::string& clusfile = "o2clus_trk.root",
312312 continue ;
313313 }
314314
315- // ── MC label ───────────────────────────────────────────────────────
316- const auto& labels = clusLabArr -> getLabels (clEntry );
317- if (labels .empty () || !labels [0 ].isValid ()) {
318- nInvalidLabel ++ ;
319- continue ;
320- }
321- const auto& lab = labels [0 ];
322- const int trID = lab .getTrackID ();
323- const int evID = lab .getEventID ();
324-
325- // ── Find matching MC hit ────────────────────────────────────────────
326- const auto& mc2hit = mc2hitVec [evID ];
327- uint64_t key = (uint64_t (trID ) << 32 ) + cluster .chipID ;
328- auto hitEntry = mc2hit .find (key );
329- if (hitEntry == mc2hit .end ()) {
330- nNoMCHit ++ ;
331- continue ;
332- }
333- const auto& hit = (* hitVecPool [evID ])[hitEntry -> second ];
334- const float pt = TMath ::Hypot (hit .GetPx (), hit .GetPy ());
335-
336- // ── Hit global midpoint ────────────────────────────────────────────
337- const auto& gloHend = hit .GetPos ();
338- const auto& gloHsta = hit .GetPosStart ();
339- o2 ::math_utils ::Point3D < float > gloHmid (
340- 0.5f * (gloHend .X () + gloHsta .X ()),
341- 0.5f * (gloHend .Y () + gloHsta .Y ()),
342- 0.5f * (gloHend .Z () + gloHsta .Z ()));
343-
344- // ── Hit global → local ─────────────────────────────
345- o2 ::math_utils ::Point3D < float > locHsta = gman -> getMatrixL2G (cluster .chipID ) ^ (gloHsta ); // inverse L2G
346- o2 ::math_utils ::Point3D < float > locHend = gman -> getMatrixL2G (cluster .chipID ) ^ (gloHend ); // inverse L2G
347-
348- // ── Propagate hit segment to the sensor response surface ───────────────
349- // Rather than the geometric midpoint, find where the track segment crosses
350- // the response plane (y = responseYShift in the flat local frame).
351- // For VD (curved): convert both endpoints to flat frame first.
352- // For ML/OT (flat): use local coordinates directly.
353- float hitLocX {0.f }, hitLocZ {0.f };
354- if (cluster .subDetID == 0 ) { // VD – curved sensor
355- auto flatSta = o2 ::trk ::SegmentationChip ::curvedToFlat (cluster .layer , locHsta .X (), locHsta .Y ());
356- auto flatEnd = o2 ::trk ::SegmentationChip ::curvedToFlat (cluster .layer , locHend .X (), locHend .Y ());
357- float x0 = flatSta .X (), y0 = flatSta .Y (), z0 = locHsta .Z ();
358- float dltx = flatEnd .X () - x0 , dlty = flatEnd .Y () - y0 , dltz = locHend .Z () - z0 ;
359- float r = (std ::abs (dlty ) > 1e-9f ) ? (yPlaneVD - y0 ) / dlty : 0.5f ;
360- hitLocX = x0 + r * dltx ;
361- hitLocZ = z0 + r * dltz ;
362- } else { // ML/OT – flat sensor
363- float x0 = locHsta .X (), y0 = locHsta .Y (), z0 = locHsta .Z ();
364- float dltx = locHend .X () - x0 , dlty = locHend .Y () - y0 , dltz = locHend .Z () - z0 ;
365- float r = (std ::abs (dlty ) > 1e-9f ) ? (yPlaneMLOT - y0 ) / dlty : 0.5f ;
366- hitLocX = x0 + r * dltx ;
367- hitLocZ = z0 + r * dltz ;
368- }
315+ // ── MC label ───────────────────────────────────────────────────────
316+ const auto& labels = clusLabArr -> getLabels (clEntry );
317+ if (labels .empty () || !labels [0 ].isValid ()) {
318+ nInvalidLabel ++ ;
319+ continue ;
320+ }
321+ const auto& lab = labels [0 ];
322+ const int trID = lab .getTrackID ();
323+ const int evID = lab .getEventID ();
324+
325+ // ── Find matching MC hit ────────────────────────────────────────────
326+ const auto& mc2hit = mc2hitVec [evID ];
327+ uint64_t key = (uint64_t (trID ) << 32 ) + cluster .chipID ;
328+ auto hitEntry = mc2hit .find (key );
329+ if (hitEntry == mc2hit .end ()) {
330+ nNoMCHit ++ ;
331+ continue ;
332+ }
333+ const auto& hit = (* hitVecPool [evID ])[hitEntry -> second ];
334+ const float pt = TMath ::Hypot (hit .GetPx (), hit .GetPy ());
335+
336+ // ── Hit global midpoint ────────────────────────────────────────────
337+ const auto& gloHend = hit .GetPos ();
338+ const auto& gloHsta = hit .GetPosStart ();
339+ o2 ::math_utils ::Point3D < float > gloHmid (
340+ 0.5f * (gloHend .X () + gloHsta .X ()),
341+ 0.5f * (gloHend .Y () + gloHsta .Y ()),
342+ 0.5f * (gloHend .Z () + gloHsta .Z ()));
343+
344+ // ── Hit global → local ─────────────────────────────
345+ o2 ::math_utils ::Point3D < float > locHsta = gman -> getMatrixL2G (cluster .chipID ) ^ (gloHsta ); // inverse L2G
346+ o2 ::math_utils ::Point3D < float > locHend = gman -> getMatrixL2G (cluster .chipID ) ^ (gloHend ); // inverse L2G
347+
348+ // ── Propagate hit segment to the sensor response surface ───────────────
349+ // Rather than the geometric midpoint, find where the track segment crosses
350+ // the response plane (y = responseYShift in the flat local frame).
351+ // For VD (curved): convert both endpoints to flat frame first.
352+ // For ML/OT (flat): use local coordinates directly.
353+ float hitLocX {0.f }, hitLocZ {0.f };
354+ if (cluster .subDetID == 0 ) { // VD – curved sensor
355+ auto flatSta = o2 ::trk ::SegmentationChip ::curvedToFlat (cluster .layer , locHsta .X (), locHsta .Y ());
356+ auto flatEnd = o2 ::trk ::SegmentationChip ::curvedToFlat (cluster .layer , locHend .X (), locHend .Y ());
357+ float x0 = flatSta .X (), y0 = flatSta .Y (), z0 = locHsta .Z ();
358+ float dltx = flatEnd .X () - x0 , dlty = flatEnd .Y () - y0 , dltz = locHend .Z () - z0 ;
359+ float r = (std ::abs (dlty ) > 1e-9f ) ? (yPlaneVD - y0 ) / dlty : 0.5f ;
360+ hitLocX = x0 + r * dltx ;
361+ hitLocZ = z0 + r * dltz ;
362+ } else { // ML/OT – flat sensor
363+ float x0 = locHsta .X (), y0 = locHsta .Y (), z0 = locHsta .Z ();
364+ float dltx = locHend .X () - x0 , dlty = locHend .Y () - y0 , dltz = locHend .Z () - z0 ;
365+ float r = (std ::abs (dlty ) > 1e-9f ) ? (yPlaneMLOT - y0 ) / dlty : 0.5f ;
366+ hitLocX = x0 + r * dltx ;
367+ hitLocZ = z0 + r * dltz ;
368+ }
369369
370- nValid ++ ;
371- std ::array < float , 21 > data = {
372- (float )evID , (float )trID ,
373- hitLocX , hitLocZ ,
374- (float )gloHmid .X (), (float )gloHmid .Y (), (float )gloHmid .Z (),
375- (float )gloC .X (), (float )gloC .Y (), (float )gloC .Z (),
376- clLocX , clLocZ ,
377- (float )rofRec .getROFrame (), (float )cluster .size , (float )cluster .chipID ,
378- (float )cluster .layer , (float )cluster .disk , (float )cluster .subDetID ,
379- (float )cluster .row , (float )cluster .col , pt };
380- nt .Fill (data .data ());
370+ nValid ++ ;
371+ std ::array < float , 21 > data = {
372+ (float )evID , (float )trID ,
373+ hitLocX , hitLocZ ,
374+ (float )gloHmid .X (), (float )gloHmid .Y (), (float )gloHmid .Z (),
375+ (float )gloC .X (), (float )gloC .Y (), (float )gloC .Z (),
376+ clLocX , clLocZ ,
377+ (float )rofRec .getROFrame (), (float )cluster .size , (float )cluster .chipID ,
378+ (float )cluster .layer , (float )cluster .disk , (float )cluster .subDetID ,
379+ (float )cluster .row , (float )cluster .col , pt };
380+ nt .Fill (data .data ());
381381 }
382382 }
383383 }
0 commit comments