Skip to content

Commit cdabf3d

Browse files
committed
Support per-layer ITS clusters in its3-tracking-study-workflow
1 parent 7c76602 commit cdabf3d

3 files changed

Lines changed: 62 additions & 52 deletions

File tree

‎Detectors/Upgrades/ITS3/study/include/ITS3TrackingStudy/TrackingStudy.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
namespace o2::its3::study
1919
{
2020

21-
o2::framework::DataProcessorSpec getTrackingStudySpec(o2::dataformats::GlobalTrackID::mask_t srcTracks, o2::dataformats::GlobalTrackID::mask_t srcClus, bool useMC, bool withPV);
21+
o2::framework::DataProcessorSpec getTrackingStudySpec(o2::dataformats::GlobalTrackID::mask_t srcTracks, o2::dataformats::GlobalTrackID::mask_t srcClus, bool useMC, bool withPV, bool itsStag);
2222

2323
} // namespace o2::its3::study
2424

‎Detectors/Upgrades/ITS3/study/src/TrackingStudy.cxx‎

Lines changed: 59 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "CommonUtils/TreeStreamRedirector.h"
2020
#include "DataFormatsGlobalTracking/RecoContainer.h"
21+
#include "DataFormatsITSMFT/ClustersPerLayer.h"
2122
#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h"
2223
#include "DataFormatsITSMFT/Digit.h"
2324
#include "ITSMFTSimulation/Hit.h"
@@ -139,7 +140,7 @@ class TrackingStudySpec final : public Task
139140
TrackCounter mTrackCounter;
140141

141142
using TrackingCluster = align::TrackingCluster<float>;
142-
std::vector<TrackingCluster> mITScl;
143+
o2::itsmft::ClustersPerLayer<TrackingCluster> mITScl; // addressed by the composed (layer,index) ID
143144
std::span<const int> mITSclRef;
144145

145146
const ITS3TrackingStudyParam* mParams{nullptr};
@@ -237,39 +238,43 @@ void TrackingStudySpec::process()
237238

238239
void TrackingStudySpec::prepareITSClusters()
239240
{
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();
245241
auto geom = its::GeometryTGeo::Instance();
246242
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
267275
}
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();
273278
}
274279

275280
bool TrackingStudySpec::selectTrack(GTrackID trkID, bool checkMCTruth) const
@@ -787,26 +792,29 @@ void TrackingStudySpec::doMCStudy()
787792
}
788793
}
789794
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+
}
807815
}
808816
}
809-
}
817+
} // loop over the layer slots
810818
LOGP(info, "** Analysing tracks ... ");
811819
auto accountLbl = [&](const globaltracking::RecoContainer::GlobalIDSet& contributorsGID, DetID::ID det) {
812820
if (contributorsGID[det].isIndexSet()) {
@@ -1242,10 +1250,11 @@ void TrackingStudySpec::getImpactParams(const o2::track::TrackParCov& trk, const
12421250
ip[1] = trk.getZ() + (trk.getTgl() / rp4 * std::asin((f2 * r1) - (f1 * r2))) - z;
12431251
}
12441252

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)
12461254
{
12471255
std::vector<OutputSpec> outputs;
12481256
auto dataRequest = std::make_shared<DataRequest>();
1257+
dataRequest->setITSPerLayer(itsStag);
12491258

12501259
dataRequest->requestTracks(srcTracks, useMC);
12511260
dataRequest->requestIT3Clusters(useMC);

‎Detectors/Upgrades/ITS3/study/src/its3-tracking-study-workflow.cxx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
6262
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
6363
auto useMC = !configcontext.options().get<bool>("disable-mc");
6464
auto usePV = !configcontext.options().get<bool>("without-pv");
65+
auto doStag = o2::itsmft::DPLAlpideParamInitializer::isITSStaggeringEnabled(configcontext);
6566

6667
GID::mask_t srcTrc = allowedSourcesTrc & GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
6768
GID::mask_t srcCls = allowedSourcesClus & GID::getSourcesMask(configcontext.options().get<std::string>("cluster-sources"));
@@ -71,7 +72,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
7172
o2::globaltracking::InputHelper::addInputSpecsPVertex(configcontext, specs, useMC);
7273
}
7374

74-
specs.emplace_back(o2::its3::study::getTrackingStudySpec(srcTrc, srcCls, useMC, usePV));
75+
specs.emplace_back(o2::its3::study::getTrackingStudySpec(srcTrc, srcCls, useMC, usePV, doStag));
7576

7677
o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
7778

0 commit comments

Comments
 (0)