@@ -128,50 +128,46 @@ int TimeFrame::loadROFrameData(gsl::span<o2::itsmft::ROFRecord> rofs,
128128 geom->fillMatrixCache (o2::math_utils::bit2Mask (o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G));
129129
130130 mNrof = 0 ;
131- for (int clusterId{0 }; clusterId < clusters.size () && mNrof < rofs.size (); ++clusterId) {
132- auto & c = clusters[clusterId];
133-
134- int layer = geom->getLayer (c.getSensorID ());
135-
136- auto pattID = c.getPatternID ();
137- o2::math_utils::Point3D<float > locXYZ;
138- float sigmaY2 = DefClusError2Row, sigmaZ2 = DefClusError2Col, sigmaYZ = 0 ; // Dummy COG errors (about half pixel size)
139- if (pattID != itsmft::CompCluster::InvalidPatternID) {
140- sigmaY2 = dict->getErr2X (pattID);
141- sigmaZ2 = dict->getErr2Z (pattID);
142- if (!dict->isGroup (pattID)) {
143- locXYZ = dict->getClusterCoordinates (c);
131+ for (auto & rof : rofs) {
132+ for (int clusterId{rof.getFirstEntry ()}; clusterId < rof.getFirstEntry () + rof.getNEntries (); ++clusterId) {
133+ auto & c = clusters[clusterId];
134+
135+ int layer = geom->getLayer (c.getSensorID ());
136+
137+ auto pattID = c.getPatternID ();
138+ o2::math_utils::Point3D<float > locXYZ;
139+ float sigmaY2 = DefClusError2Row, sigmaZ2 = DefClusError2Col, sigmaYZ = 0 ; // Dummy COG errors (about half pixel size)
140+ if (pattID != itsmft::CompCluster::InvalidPatternID) {
141+ sigmaY2 = dict->getErr2X (pattID);
142+ sigmaZ2 = dict->getErr2Z (pattID);
143+ if (!dict->isGroup (pattID)) {
144+ locXYZ = dict->getClusterCoordinates (c);
145+ } else {
146+ o2::itsmft::ClusterPattern patt (pattIt);
147+ locXYZ = dict->getClusterCoordinates (c, patt);
148+ }
144149 } else {
145150 o2::itsmft::ClusterPattern patt (pattIt);
146- locXYZ = dict->getClusterCoordinates (c, patt);
151+ locXYZ = dict->getClusterCoordinates (c, patt, false );
147152 }
148- } else {
149- o2::itsmft::ClusterPattern patt (pattIt);
150- locXYZ = dict->getClusterCoordinates (c, patt, false );
153+ auto sensorID = c.getSensorID ();
154+ // Inverse transformation to the local --> tracking
155+ auto trkXYZ = geom->getMatrixT2L (sensorID) ^ locXYZ;
156+ // Transformation to the local --> global
157+ auto gloXYZ = geom->getMatrixL2G (sensorID) * locXYZ;
158+
159+ addTrackingFrameInfoToLayer (layer, gloXYZ.x (), gloXYZ.y (), gloXYZ.z (), trkXYZ.x (), geom->getSensorRefAlpha (sensorID),
160+ std::array<float , 2 >{trkXYZ.y (), trkXYZ.z ()},
161+ std::array<float , 3 >{sigmaY2, sigmaYZ, sigmaZ2});
162+
163+ // / Rotate to the global frame
164+ addClusterToLayer (layer, gloXYZ.x (), gloXYZ.y (), gloXYZ.z (), mUnsortedClusters [layer].size ());
165+ addClusterExternalIndexToLayer (layer, clusterId);
151166 }
152- auto sensorID = c.getSensorID ();
153- // Inverse transformation to the local --> tracking
154- auto trkXYZ = geom->getMatrixT2L (sensorID) ^ locXYZ;
155- // Transformation to the local --> global
156- auto gloXYZ = geom->getMatrixL2G (sensorID) * locXYZ;
157-
158- addTrackingFrameInfoToLayer (layer, gloXYZ.x (), gloXYZ.y (), gloXYZ.z (), trkXYZ.x (), geom->getSensorRefAlpha (sensorID),
159- std::array<float , 2 >{trkXYZ.y (), trkXYZ.z ()},
160- std::array<float , 3 >{sigmaY2, sigmaYZ, sigmaZ2});
161-
162- // / Rotate to the global frame
163- addClusterToLayer (layer, gloXYZ.x (), gloXYZ.y (), gloXYZ.z (), mUnsortedClusters [layer].size ());
164- addClusterExternalIndexToLayer (layer, clusterId);
165-
166- while (mNrof < rofs.size () && clusterId >= rofs[mNrof ].getFirstEntry () + rofs[mNrof ].getNEntries () - 1 ) {
167- for (unsigned int iL{0 }; iL < mUnsortedClusters .size (); ++iL) {
168- mROframesClusters [iL].push_back (mUnsortedClusters [iL].size ());
169- if (iL < 2 ) {
170- mTrackletsIndexROf [iL].push_back (mUnsortedClusters [1 ].size ()); // Tracklets used in vertexer are always computed wrt clusters on the second layer
171- }
172- }
173- mNrof ++;
167+ for (unsigned int iL{0 }; iL < mUnsortedClusters .size (); ++iL) {
168+ mROframesClusters [iL].push_back (mUnsortedClusters [iL].size ());
174169 }
170+ mNrof ++;
175171 }
176172 if (mcLabels) {
177173 mClusterLabels = mcLabels;
0 commit comments