|
18 | 18 |
|
19 | 19 | #include "CommonUtils/TreeStreamRedirector.h" |
20 | 20 | #include "DataFormatsGlobalTracking/RecoContainer.h" |
| 21 | +#include "DataFormatsITSMFT/ClustersPerLayer.h" |
21 | 22 | #include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h" |
22 | 23 | #include "DataFormatsITSMFT/Digit.h" |
23 | 24 | #include "ITSMFTSimulation/Hit.h" |
@@ -139,7 +140,7 @@ class TrackingStudySpec final : public Task |
139 | 140 | TrackCounter mTrackCounter; |
140 | 141 |
|
141 | 142 | using TrackingCluster = align::TrackingCluster<float>; |
142 | | - std::vector<TrackingCluster> mITScl; |
| 143 | + o2::itsmft::ClustersPerLayer<TrackingCluster> mITScl; // addressed by the composed (layer,index) ID |
143 | 144 | std::span<const int> mITSclRef; |
144 | 145 |
|
145 | 146 | const ITS3TrackingStudyParam* mParams{nullptr}; |
@@ -237,39 +238,43 @@ void TrackingStudySpec::process() |
237 | 238 |
|
238 | 239 | void TrackingStudySpec::prepareITSClusters() |
239 | 240 | { |
240 | | - const auto& clusITS = mRecoData.getITSClusters(); |
241 | | - LOGP(info, "Preparing {} measurments", clusITS.size()); |
242 | | - const auto& patterns = mRecoData.getITSClustersPatterns(); |
243 | | - mITScl.reserve(clusITS.size()); |
244 | | - auto pattIt = patterns.begin(); |
245 | 241 | auto geom = its::GeometryTGeo::Instance(); |
246 | 242 | mITSclRef = mRecoData.getITSTracksClusterRefs(); |
247 | | - mITScl.clear(); |
248 | | - mITScl.reserve(clusITS.size()); |
249 | | - for (const auto& cls : clusITS) { |
250 | | - const auto sens = cls.getSensorID(); |
251 | | - float sigmaY2{0}, sigmaZ2{0}; |
252 | | - math_utils::Point3D<float> locXYZ = o2::its3::ioutils::extractClusterData(cls, pattIt, mITSDict, sigmaY2, sigmaZ2); |
253 | | - // Transformation to the local --> global |
254 | | - const auto gloXYZ = geom->getMatrixL2G(sens) * locXYZ; |
255 | | - // Inverse transformation to the local --> tracking |
256 | | - o2::math_utils::Point3D<float> trkXYZ = geom->getMatrixT2L(sens) ^ locXYZ; |
257 | | - // Tracking alpha angle |
258 | | - // We want that each cluster rotates its tracking frame to the clusters phi |
259 | | - // that way the track linearization around the measurement is less biases to the arc |
260 | | - // this means automatically that the measurement on the arc is at 0 for the curved layers |
261 | | - float alpha = geom->getSensorRefAlpha(sens); |
262 | | - if (constants::detID::isDetITS3(sens)) { |
263 | | - trkXYZ.SetY(0.f); |
264 | | - // alpha&x always have to be defined wrt to the global Z axis! |
265 | | - trkXYZ.SetX(std::hypot(gloXYZ.x(), gloXYZ.y())); |
266 | | - alpha = std::atan2(gloXYZ.y(), gloXYZ.x()); |
| 243 | + int nLr = mRecoData.getITSPerLayer() ? o2::globaltracking::MaxITSLayers : 1; |
| 244 | + mITScl.init(nLr); |
| 245 | + for (int lr = 0; lr < nLr; lr++) { // with a single (monolithic) input all clusters are in the layer slot 0 |
| 246 | + mITScl.beginLayer(lr); |
| 247 | + const auto& clusITS = mRecoData.getITSClusters(lr); |
| 248 | + const auto& patterns = mRecoData.getITSClustersPatterns(lr); |
| 249 | + LOGP(info, "Preparing {} measurments of the layer slot {}", clusITS.size(), lr); |
| 250 | + mITScl.getClusters().reserve(mITScl.size() + clusITS.size()); |
| 251 | + auto pattIt = patterns.begin(); |
| 252 | + for (const auto& cls : clusITS) { |
| 253 | + const auto sens = cls.getSensorID(); |
| 254 | + float sigmaY2{0}, sigmaZ2{0}; |
| 255 | + math_utils::Point3D<float> locXYZ = o2::its3::ioutils::extractClusterData(cls, pattIt, mITSDict, sigmaY2, sigmaZ2); |
| 256 | + // Transformation to the local --> global |
| 257 | + const auto gloXYZ = geom->getMatrixL2G(sens) * locXYZ; |
| 258 | + // Inverse transformation to the local --> tracking |
| 259 | + o2::math_utils::Point3D<float> trkXYZ = geom->getMatrixT2L(sens) ^ locXYZ; |
| 260 | + // Tracking alpha angle |
| 261 | + // We want that each cluster rotates its tracking frame to the clusters phi |
| 262 | + // that way the track linearization around the measurement is less biases to the arc |
| 263 | + // this means automatically that the measurement on the arc is at 0 for the curved layers |
| 264 | + float alpha = geom->getSensorRefAlpha(sens); |
| 265 | + if (constants::detID::isDetITS3(sens)) { |
| 266 | + trkXYZ.SetY(0.f); |
| 267 | + // alpha&x always have to be defined wrt to the global Z axis! |
| 268 | + trkXYZ.SetX(std::hypot(gloXYZ.x(), gloXYZ.y())); |
| 269 | + alpha = std::atan2(gloXYZ.y(), gloXYZ.x()); |
| 270 | + } |
| 271 | + auto& cl3d = mITScl.getClusters().emplace_back(sens, trkXYZ); |
| 272 | + cl3d.setErrors(sigmaY2, sigmaZ2, 0.f); |
| 273 | + cl3d.alpha = alpha; |
| 274 | + math_utils::detail::bringToPMPi(cl3d.alpha); // alpha is defined on -Pi,Pi |
267 | 275 | } |
268 | | - auto& cl3d = mITScl.emplace_back(sens, trkXYZ); |
269 | | - cl3d.setErrors(sigmaY2, sigmaZ2, 0.f); |
270 | | - cl3d.alpha = alpha; |
271 | | - math_utils::detail::bringToPMPi(cl3d.alpha); // alpha is defined on -Pi,Pi |
272 | | - } |
| 276 | + } // loop over the layer slots |
| 277 | + mITScl.finalize(); |
273 | 278 | } |
274 | 279 |
|
275 | 280 | bool TrackingStudySpec::selectTrack(GTrackID trkID, bool checkMCTruth) const |
@@ -787,26 +792,29 @@ void TrackingStudySpec::doMCStudy() |
787 | 792 | } |
788 | 793 | } |
789 | 794 | LOGP(info, "** Creating particle/clusters correspondence ... "); |
790 | | - const auto& clusters = mRecoData.getITSClusters(); |
791 | | - const auto& clustersMCLCont = mRecoData.getITSClustersMCLabels(); |
792 | | - for (auto iCluster{0}; iCluster < clusters.size(); ++iCluster) { |
793 | | - auto labs = clustersMCLCont->getLabels(iCluster); |
794 | | - for (auto& lab : labs) { |
795 | | - if (!lab.isValid() || lab.getSourceID() != 0 || !lab.isCorrect()) { |
796 | | - continue; |
797 | | - } |
798 | | - int trackID = 0, evID = 0, srcID = 0; |
799 | | - bool fake = false; |
800 | | - lab.get(trackID, evID, srcID, fake); |
801 | | - auto& cluster = clusters[iCluster]; |
802 | | - auto layer = o2::its::GeometryTGeo::Instance()->getLayer(cluster.getSensorID()); |
803 | | - auto& part = info[{trackID, evID, srcID}]; |
804 | | - part.clusters |= (1 << layer); |
805 | | - if (fake) { |
806 | | - part.fakeClusters |= (1 << layer); |
| 795 | + int nLrCl = mRecoData.getITSPerLayer() ? o2::globaltracking::MaxITSLayers : 1; |
| 796 | + for (int lr = 0; lr < nLrCl; lr++) { // with a single (monolithic) input all clusters are in the layer slot 0 |
| 797 | + const auto& clusters = mRecoData.getITSClusters(lr); |
| 798 | + const auto& clustersMCLCont = mRecoData.getITSClustersMCLabels(lr); |
| 799 | + for (auto iCluster{0}; iCluster < clusters.size(); ++iCluster) { |
| 800 | + auto labs = clustersMCLCont->getLabels(iCluster); |
| 801 | + for (auto& lab : labs) { |
| 802 | + if (!lab.isValid() || lab.getSourceID() != 0 || !lab.isCorrect()) { |
| 803 | + continue; |
| 804 | + } |
| 805 | + int trackID = 0, evID = 0, srcID = 0; |
| 806 | + bool fake = false; |
| 807 | + lab.get(trackID, evID, srcID, fake); |
| 808 | + auto& cluster = clusters[iCluster]; |
| 809 | + auto layer = o2::its::GeometryTGeo::Instance()->getLayer(cluster.getSensorID()); |
| 810 | + auto& part = info[{trackID, evID, srcID}]; |
| 811 | + part.clusters |= (1 << layer); |
| 812 | + if (fake) { |
| 813 | + part.fakeClusters |= (1 << layer); |
| 814 | + } |
807 | 815 | } |
808 | 816 | } |
809 | | - } |
| 817 | + } // loop over the layer slots |
810 | 818 | LOGP(info, "** Analysing tracks ... "); |
811 | 819 | auto accountLbl = [&](const globaltracking::RecoContainer::GlobalIDSet& contributorsGID, DetID::ID det) { |
812 | 820 | if (contributorsGID[det].isIndexSet()) { |
@@ -1242,10 +1250,11 @@ void TrackingStudySpec::getImpactParams(const o2::track::TrackParCov& trk, const |
1242 | 1250 | ip[1] = trk.getZ() + (trk.getTgl() / rp4 * std::asin((f2 * r1) - (f1 * r2))) - z; |
1243 | 1251 | } |
1244 | 1252 |
|
1245 | | -DataProcessorSpec getTrackingStudySpec(GTrackID::mask_t srcTracks, GTrackID::mask_t srcClusters, bool useMC, bool withPV) |
| 1253 | +DataProcessorSpec getTrackingStudySpec(GTrackID::mask_t srcTracks, GTrackID::mask_t srcClusters, bool useMC, bool withPV, bool itsStag) |
1246 | 1254 | { |
1247 | 1255 | std::vector<OutputSpec> outputs; |
1248 | 1256 | auto dataRequest = std::make_shared<DataRequest>(); |
| 1257 | + dataRequest->setITSPerLayer(itsStag); |
1249 | 1258 |
|
1250 | 1259 | dataRequest->requestTracks(srcTracks, useMC); |
1251 | 1260 | dataRequest->requestIT3Clusters(useMC); |
|
0 commit comments