diff --git a/Detectors/ITSMFT/ITS/tracking/CMakeLists.txt b/Detectors/ITSMFT/ITS/tracking/CMakeLists.txt index d3871b9e75d70..b9c26a63c2b47 100644 --- a/Detectors/ITSMFT/ITS/tracking/CMakeLists.txt +++ b/Detectors/ITSMFT/ITS/tracking/CMakeLists.txt @@ -15,10 +15,8 @@ o2_add_library(ITStracking SOURCES src/ClusterLines.cxx src/Cluster.cxx src/Configuration.cxx - src/ROframe.cxx src/TimeFrame.cxx src/IOUtils.cxx - src/Label.cxx src/Tracker.cxx src/TrackerTraits.cxx src/TrackingConfigParam.cxx diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/ArrayUtils.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/ArrayUtils.h deleted file mode 100644 index 971ae6a7fe83a..0000000000000 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/ArrayUtils.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -/// -/// \file ArrayUtils.h -/// \brief -/// - -#ifndef TRACKINGITSU_INCLUDE_ARRAYUTILS_H_ -#define TRACKINGITSU_INCLUDE_ARRAYUTILS_H_ - -#include -#include -#include - -namespace o2 -{ -namespace its -{ -namespace CA -{ - -namespace ArrayUtils -{ -template -constexpr std::array fillArray(Initializer, std::index_sequence); -template -constexpr std::array fillArray(Initializer); -} // namespace ArrayUtils - -template -constexpr std::array ArrayUtils::fillArray(Initializer initializer, std::index_sequence) -{ - return std::array{{initializer(Is)...}}; -} - -template -constexpr std::array ArrayUtils::fillArray(Initializer initializer) -{ - return ArrayUtils::fillArray(initializer, std::make_index_sequence{}); -} -} // namespace CA -} // namespace its -} // namespace o2 - -#endif /* TRACKINGITSU_INCLUDE_ARRAYUTILS_H_ */ diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/IOUtils.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/IOUtils.h index 0ada9dfbc6188..8adacdf58d74d 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/IOUtils.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/IOUtils.h @@ -16,62 +16,27 @@ #ifndef TRACKINGITSU_INCLUDE_EVENTLOADER_H_ #define TRACKINGITSU_INCLUDE_EVENTLOADER_H_ -#include -#include -#include #include -#include "DataFormatsITSMFT/ROFRecord.h" -#include "ITStracking/Configuration.h" -#include "ITStracking/ROframe.h" -#include "ITStracking/Label.h" -#include "ITStracking/Road.h" -#include "ITStracking/TrackingConfigParam.h" #include "ITSMFTBase/SegmentationAlpide.h" #include "ReconstructionDataFormats/BaseCluster.h" -#include "ITSMFTReconstruction/ChipMappingITS.h" #include "DataFormatsITSMFT/CompCluster.h" #include "DataFormatsITSMFT/TopologyDictionary.h" +#include "DataFormatsITSMFT/ROFRecord.h" // TODO this is just included since the alignment code include it now -namespace o2 +namespace o2::its::ioutils { -class MCCompLabel; - -namespace dataformats -{ -template -class MCTruthContainer; -} - -namespace its -{ - -namespace ioutils -{ constexpr float DefClusErrorRow = o2::itsmft::SegmentationAlpide::PitchRow * 0.5; constexpr float DefClusErrorCol = o2::itsmft::SegmentationAlpide::PitchCol * 0.5; constexpr float DefClusError2Row = DefClusErrorRow * DefClusErrorRow; constexpr float DefClusError2Col = DefClusErrorCol * DefClusErrorCol; -void loadEventData(ROframe& events, gsl::span clusters, - gsl::span::iterator& pattIt, const itsmft::TopologyDictionary* dict, - const dataformats::MCTruthContainer* clsLabels = nullptr); -int loadROFrameData(const o2::itsmft::ROFRecord& rof, ROframe& events, gsl::span clusters, - gsl::span::iterator& pattIt, const itsmft::TopologyDictionary* dict, - const dataformats::MCTruthContainer* mClsLabels = nullptr); - void convertCompactClusters(gsl::span clusters, gsl::span::iterator& pattIt, std::vector>& output, const itsmft::TopologyDictionary* dict); -inline static const o2::itsmft::ChipMappingITS& getChipMappingITS() -{ - static const o2::itsmft::ChipMappingITS MP; - return MP; -} - template o2::math_utils::Point3D extractClusterData(const itsmft::CompClusterExt& c, iterator& iter, const itsmft::TopologyDictionary* dict, T& sig2y, T& sig2z) { @@ -115,8 +80,6 @@ std::array extractClusterDataA(const itsmft::CompClusterExt& c, iterator& } } -} // namespace ioutils -} // namespace its -} // namespace o2 +} // namespace o2::its::ioutils #endif /* TRACKINGITSU_INCLUDE_EVENTLOADER_H_ */ diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Label.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Label.h deleted file mode 100644 index ec45e6587a974..0000000000000 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Label.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -/// -/// \file Label.h -/// \brief -/// - -#ifndef TRACKINGITSU_INCLUDE_LABEL_H_ -#define TRACKINGITSU_INCLUDE_LABEL_H_ - -#include - -namespace o2 -{ -namespace its -{ - -struct Label final { - Label(const int, const float, const float, const float, const int, const int); - - int monteCarloId; - float transverseMomentum; - float phi; - float pseudorapidity; - int pdgCode; - int numberOfClusters; - - friend std::ostream& operator<<(std::ostream&, const Label&); -}; -} // namespace its -} // namespace o2 - -#endif /* TRACKINGITSU_INCLUDE_LABEL_H_ */ diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/ROframe.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/ROframe.h deleted file mode 100644 index d35e5bc545904..0000000000000 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/ROframe.h +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -/// -/// \file ROframe.h -/// \brief -/// - -#ifndef TRACKINGITSU_INCLUDE_ROFRAME_H_ -#define TRACKINGITSU_INCLUDE_ROFRAME_H_ - -#include -#include -#include -#include -#include - -#include "ITStracking/Cluster.h" -#include "ITStracking/Constants.h" - -#include "ReconstructionDataFormats/Vertex.h" -#include "SimulationDataFormat/MCCompLabel.h" -#include "SimulationDataFormat/MCTruthContainer.h" - -namespace o2 -{ -namespace its -{ - -using Vertex = o2::dataformats::Vertex>; - -class ROframe final -{ - public: - ROframe(int ROframeId, int nLayers); - int getROFrameId() const; - const float3& getPrimaryVertex(const int) const; - int getPrimaryVerticesNum() const; - void addPrimaryVertex(const float, const float, const float); - void addPrimaryVertices(std::vector vertices); - void addPrimaryReconstructedVertex(const float, const float, const float); - void printPrimaryVertices() const; - int getTotalClusters() const; - bool empty() const; - - const auto& getClusters() const { return mClusters; } - const std::vector& getClustersOnLayer(int layerId) const; - const std::vector& getTrackingFrameInfoOnLayer(int layerId) const; - const auto& getTrackingFrameInfo() const { return mTrackingFrameInfo; } - - const TrackingFrameInfo& getClusterTrackingFrameInfo(int layerId, const Cluster& cl) const; - const MCCompLabel& getClusterFirstLabel(int layerId, const Cluster& cl) const; - const MCCompLabel& getClusterFirstLabel(int layerId, const int clId) const; - const gsl::span getClusterLabels(int layerId, const int clId) const; - const gsl::span getClusterLabels(int layerId, const Cluster& cl) const; - int getClusterExternalIndex(int layerId, const int clId) const; - std::vector getTracksId(const int layerId, const std::vector& cl); - - template - void addClusterToLayer(int layer, T&&... args); - template - void addTrackingFrameInfoToLayer(int layer, T&&... args); - void setMClabelsContainer(const dataformats::MCTruthContainer* ptr); - void addClusterExternalIndexToLayer(int layer, const int idx); - bool hasMCinformation() const; - - void clear(); - - private: - const int mROframeId; - const o2::dataformats::MCTruthContainer* mMClabels = nullptr; - std::vector mPrimaryVertices; - std::vector> mClusters; - std::vector> mTrackingFrameInfo; - std::vector> mClusterExternalIndices; -}; - -inline int ROframe::getROFrameId() const { return mROframeId; } - -inline const float3& ROframe::getPrimaryVertex(const int vertexIndex) const { return mPrimaryVertices[vertexIndex]; } - -inline int ROframe::getPrimaryVerticesNum() const { return mPrimaryVertices.size(); } - -inline bool ROframe::empty() const { return getTotalClusters() == 0; } - -inline const std::vector& ROframe::getClustersOnLayer(int layerId) const -{ - return mClusters[layerId]; -} - -inline const std::vector& ROframe::getTrackingFrameInfoOnLayer(int layerId) const -{ - return mTrackingFrameInfo[layerId]; -} - -inline const TrackingFrameInfo& ROframe::getClusterTrackingFrameInfo(int layerId, const Cluster& cl) const -{ - return mTrackingFrameInfo[layerId][cl.clusterId]; -} - -inline const MCCompLabel& ROframe::getClusterFirstLabel(int layerId, const Cluster& cl) const -{ - return getClusterFirstLabel(layerId, cl.clusterId); -} - -inline const MCCompLabel& ROframe::getClusterFirstLabel(int layerId, const int clId) const -{ - return *(mMClabels->getLabels(getClusterExternalIndex(layerId, clId)).begin()); -} - -inline const gsl::span ROframe::getClusterLabels(int layerId, const int clId) const -{ - return mMClabels->getLabels(getClusterExternalIndex(layerId, clId)); -} - -inline const gsl::span ROframe::getClusterLabels(int layerId, const Cluster& cl) const -{ - return getClusterLabels(layerId, cl.clusterId); -} - -inline int ROframe::getClusterExternalIndex(int layerId, const int clId) const -{ - return mClusterExternalIndices[layerId][clId]; -} - -inline std::vector ROframe::getTracksId(const int layerId, const std::vector& cl) -{ - std::vector tracksId; - for (auto& cluster : cl) { - tracksId.push_back(getClusterFirstLabel(layerId, cluster).isNoise() ? -1 : getClusterFirstLabel(layerId, cluster).getTrackID()); - } - return tracksId; -} - -template -void ROframe::addClusterToLayer(int layer, T&&... values) -{ - mClusters[layer].emplace_back(std::forward(values)...); -} - -template -void ROframe::addTrackingFrameInfoToLayer(int layer, T&&... values) -{ - mTrackingFrameInfo[layer].emplace_back(std::forward(values)...); -} - -inline void ROframe::setMClabelsContainer(const dataformats::MCTruthContainer* ptr) -{ - mMClabels = ptr; -} - -inline void ROframe::addClusterExternalIndexToLayer(int layer, const int idx) -{ - mClusterExternalIndices[layer].push_back(idx); -} - -inline void ROframe::clear() -{ - for (unsigned int iL = 0; iL < mClusters.size(); ++iL) { - mClusters[iL].clear(); - mTrackingFrameInfo[iL].clear(); - // mClusterLabels[iL].clear(); - mClusterExternalIndices[iL].clear(); - } - mPrimaryVertices.clear(); - mMClabels = nullptr; -} - -inline bool ROframe::hasMCinformation() const -{ - // for (const auto& vect : mClusterLabels) { - // if (!vect.empty()) { - // return true; - // } - // } - // return false; - return mMClabels; -} - -} // namespace its -} // namespace o2 - -#endif /* TRACKINGITSU_INCLUDE_ROFRAME_H_ */ diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Smoother.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Smoother.h index 2dcd521797837..101f4b8d72601 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Smoother.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Smoother.h @@ -17,7 +17,6 @@ #include "ReconstructionDataFormats/Track.h" #include "DataFormatsITS/TrackITS.h" #include "DetectorsBase/Propagator.h" -#include "ITStracking/ROframe.h" namespace o2 { @@ -28,14 +27,14 @@ template class Smoother { public: - Smoother(TrackITSExt& track, size_t layer, const ROframe& event, float bZ, o2::base::PropagatorF::MatCorrType corr); + // Smoother(TrackITSExt& track, size_t layer, const ROframe& event, float bZ, o2::base::PropagatorF::MatCorrType corr); ~Smoother(); bool isValidInit() const { return mInitStatus; } - bool testCluster(const int clusterId, const ROframe& event); + // bool testCluster(const int clusterId, const ROframe& event); bool getSmoothedTrack(); float getChi2() const { return mBestChi2; } float getLastChi2() const { return mLastChi2; } diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Tracker.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Tracker.h index 78c290374a67d..3f80d239946b1 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Tracker.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Tracker.h @@ -32,7 +32,6 @@ #include "ITStracking/Configuration.h" #include "CommonConstants/MathConstants.h" #include "ITStracking/Definitions.h" -#include "ITStracking/ROframe.h" #include "ITStracking/MathUtils.h" #include "ITStracking/TimeFrame.h" #include "ITStracking/TrackerTraits.h" diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Vertexer.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Vertexer.h index 285e4d7e9547d..dedfdbf7f00fa 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Vertexer.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/Vertexer.h @@ -25,7 +25,6 @@ #include -#include "ITStracking/ROframe.h" #include "ITStracking/Constants.h" #include "ITStracking/Configuration.h" #include "ITStracking/TimeFrame.h" @@ -33,12 +32,6 @@ #include "ITStracking/BoundedAllocator.h" #include "ReconstructionDataFormats/Vertex.h" -#include "ITStracking/ClusterLines.h" -#include "ITStracking/Tracklet.h" -#include "ITStracking/Cluster.h" - -#include "GPUCommonLogger.h" - namespace o2::its { diff --git a/Detectors/ITSMFT/ITS/tracking/src/IOUtils.cxx b/Detectors/ITSMFT/ITS/tracking/src/IOUtils.cxx index 2638b437d61f8..e2ce374ed1600 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/IOUtils.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/IOUtils.cxx @@ -17,20 +17,11 @@ #include #include -#include -#include -#include #include -#include -#include -#include -#include #include "ITSBase/GeometryTGeo.h" -#include "ITStracking/Constants.h" -#include "MathUtils/Utils.h" -#include "SimulationDataFormat/MCCompLabel.h" -#include "SimulationDataFormat/MCTruthContainer.h" +#include "ITStracking/TrackingConfigParam.h" +#include "ITSMFTReconstruction/ChipMappingITS.h" namespace { @@ -46,10 +37,10 @@ void ioutils::convertCompactClusters(gsl::span clu std::vector>& output, const itsmft::TopologyDictionary* dict) { + static const o2::itsmft::ChipMappingITS chmap; GeometryTGeo* geom = GeometryTGeo::Instance(); bool applyMisalignment = false; const auto& conf = TrackerParamConfig::Instance(); - const auto& chmap = getChipMappingITS(); for (int il = 0; il < chmap.NLayers; il++) { if (conf.sysErrY2[il] > 0.f || conf.sysErrZ2[il] > 0.f) { applyMisalignment = true; @@ -69,77 +60,3 @@ void ioutils::convertCompactClusters(gsl::span clu cl3d.setErrors(sigmaY2, sigmaZ2, sigmaYZ); } } - -void ioutils::loadEventData(ROframe& event, gsl::span clusters, - gsl::span::iterator& pattIt, const itsmft::TopologyDictionary* dict, - const dataformats::MCTruthContainer* clsLabels) -{ - if (clusters.empty()) { - std::cerr << "Missing clusters." << std::endl; - return; - } - event.clear(); - GeometryTGeo* geom = GeometryTGeo::Instance(); - geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G)); - int clusterId{0}; - - for (const auto& c : clusters) { - const int layer = geom->getLayer(c.getSensorID()); - float sigmaY2{0}, sigmaZ2{0}, sigmaYZ{0}; - auto locXYZ = extractClusterData(c, pattIt, dict, sigmaY2, sigmaZ2); - auto sensorID = c.getSensorID(); - // Inverse transformation to the local --> tracking - auto trkXYZ = geom->getMatrixT2L(sensorID) ^ locXYZ; - // Transformation to the local --> global - auto gloXYZ = geom->getMatrixL2G(sensorID) * locXYZ; - - event.addTrackingFrameInfoToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), trkXYZ.x(), geom->getSensorRefAlpha(sensorID), - std::array{trkXYZ.y(), trkXYZ.z()}, - std::array{sigmaY2, sigmaYZ, sigmaZ2}); - - /// Rotate to the global frame - event.addClusterToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), event.getClustersOnLayer(layer).size()); - if (clsLabels) { - // event.addClusterLabelToLayer(layer, *(clsLabels->getLabels(clusterId).begin())); - event.setMClabelsContainer(clsLabels); - } - event.addClusterExternalIndexToLayer(layer, clusterId); - clusterId++; - } -} - -int ioutils::loadROFrameData(const o2::itsmft::ROFRecord& rof, ROframe& event, gsl::span clusters, gsl::span::iterator& pattIt, const itsmft::TopologyDictionary* dict, - const dataformats::MCTruthContainer* mcLabels) -{ - event.clear(); - GeometryTGeo* geom = GeometryTGeo::Instance(); - geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G)); - int clusterId{0}; - - auto first = rof.getFirstEntry(); - auto clusters_in_frame = rof.getROFData(clusters); - for (const auto& c : clusters_in_frame) { - const int layer = geom->getLayer(c.getSensorID()); - float sigmaY2{0}, sigmaZ2{0}, sigmaYZ{0}; - auto locXYZ = extractClusterData(c, pattIt, dict, sigmaY2, sigmaZ2); - auto sensorID = c.getSensorID(); - // Inverse transformation to the local --> tracking - auto trkXYZ = geom->getMatrixT2L(sensorID) ^ locXYZ; - // Transformation to the local --> global - auto gloXYZ = geom->getMatrixL2G(sensorID) * locXYZ; - - event.addTrackingFrameInfoToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), trkXYZ.x(), geom->getSensorRefAlpha(sensorID), - std::array{trkXYZ.y(), trkXYZ.z()}, - std::array{sigmaY2, sigmaYZ, sigmaZ2}); - - /// Rotate to the global frame - event.addClusterToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), event.getClustersOnLayer(layer).size()); - if (mcLabels) { - // event.addClusterLabelToLayer(layer, *(mcLabels->getLabels(first + clusterId).begin())); - event.setMClabelsContainer(mcLabels); - } - event.addClusterExternalIndexToLayer(layer, first + clusterId); - clusterId++; - } - return (int)clusters_in_frame.size(); -} diff --git a/Detectors/ITSMFT/ITS/tracking/src/Label.cxx b/Detectors/ITSMFT/ITS/tracking/src/Label.cxx deleted file mode 100644 index e195318828f51..0000000000000 --- a/Detectors/ITSMFT/ITS/tracking/src/Label.cxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -/// -/// \file Label.cxx -/// \brief -/// - -#include "ITStracking/Label.h" - -namespace o2 -{ -namespace its -{ - -Label::Label(const int mcId, const float pT, const float phi, const float eta, const int pdg, const int ncl) - : monteCarloId{mcId}, - transverseMomentum{pT}, - phi{phi}, - pseudorapidity{eta}, - pdgCode{pdg}, - numberOfClusters{ncl} -{ - // Nothing to do -} - -std::ostream& operator<<(std::ostream& outputStream, const Label& label) -{ - outputStream << label.monteCarloId << "\t" << label.transverseMomentum << "\t" << label.phi << "\t" - << label.pseudorapidity << "\t" << label.pdgCode << "\t" << label.numberOfClusters; - - return outputStream; -} -} // namespace its -} // namespace o2 diff --git a/Detectors/ITSMFT/ITS/tracking/src/ROframe.cxx b/Detectors/ITSMFT/ITS/tracking/src/ROframe.cxx deleted file mode 100644 index ee885db3c49ea..0000000000000 --- a/Detectors/ITSMFT/ITS/tracking/src/ROframe.cxx +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -/// -/// \file ROframe.cxx -/// \brief -/// - -#include "ITStracking/ROframe.h" - -#include - -namespace o2 -{ -namespace its -{ - -ROframe::ROframe(int ROframeId, int nLayers) : mROframeId{ROframeId} -{ - mClusters.resize(nLayers); - mTrackingFrameInfo.resize(nLayers); - // mClusterLabels.resize(nLayers); - mClusterExternalIndices.resize(nLayers); -} - -void ROframe::addPrimaryVertex(const float xCoordinate, const float yCoordinate, const float zCoordinate) -{ - mPrimaryVertices.emplace_back(float3{xCoordinate, yCoordinate, zCoordinate}); -} - -void ROframe::addPrimaryVertices(std::vector vertices) -{ - for (Vertex& vertex : vertices) { - mPrimaryVertices.emplace_back(float3{vertex.getX(), vertex.getY(), vertex.getZ()}); - } -} - -void ROframe::printPrimaryVertices() const -{ - const int verticesNum{static_cast(mPrimaryVertices.size())}; - - for (int iVertex{0}; iVertex < verticesNum; ++iVertex) { - - const float3& currentVertex = mPrimaryVertices[iVertex]; - std::cout << "-1\t" << currentVertex.x << "\t" << currentVertex.y << "\t" << currentVertex.z << std::endl; - } -} - -int ROframe::getTotalClusters() const -{ - size_t totalClusters{0}; - for (auto& clusters : mClusters) { - totalClusters += clusters.size(); - } - return int(totalClusters); -} -} // namespace its -} // namespace o2 diff --git a/Detectors/ITSMFT/ITS/tracking/src/Smoother.cxx b/Detectors/ITSMFT/ITS/tracking/src/Smoother.cxx index 9bc65161c3cbb..f2f7dbc81398f 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/Smoother.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/Smoother.cxx @@ -25,92 +25,92 @@ constexpr std::array getInverseSymm2D(const std::array& ma } // Smoother -template -Smoother::Smoother(TrackITSExt& track, size_t smoothingLayer, const ROframe& event, float bZ, o2::base::PropagatorF::MatCorrType corr) : mLayerToSmooth{smoothingLayer}, - mBz(bZ), - mCorr(corr) -{ - - auto propInstance = o2::base::Propagator::Instance(); - const TrackingFrameInfo& originalTf = event.getTrackingFrameInfoOnLayer(mLayerToSmooth).at(track.getClusterIndex(mLayerToSmooth)); - - mOutwardsTrack = track; // This track will be propagated outwards inside the smoother! (as last step of fitting did inward propagation) - mInwardsTrack = {track.getParamOut(), // This track will be propagated inwards inside the smoother! - static_cast(mOutwardsTrack.getNumberOfClusters()), -999, static_cast(event.getROFrameId()), - mOutwardsTrack.getParamOut(), mOutwardsTrack.getClusterIndexes()}; - - mOutwardsTrack.resetCovariance(); - mOutwardsTrack.setChi2(0); - mInwardsTrack.resetCovariance(); - mInwardsTrack.setChi2(0); - - bool statusOutw{false}; - bool statusInw{false}; - - ////////////////////// - // Outward propagation - for (size_t iLayer{0}; iLayer < mLayerToSmooth; ++iLayer) { - if (mOutwardsTrack.getClusterIndex(iLayer) == constants::UnusedIndex) { // Shorter tracks - continue; - } - const TrackingFrameInfo& tF = event.getTrackingFrameInfoOnLayer(iLayer).at(mOutwardsTrack.getClusterIndex(iLayer)); - statusOutw = mOutwardsTrack.rotate(tF.alphaTrackingFrame); - statusOutw &= propInstance->propagateToX(mOutwardsTrack, - tF.xTrackingFrame, - mBz, - o2::base::PropagatorImpl::MAX_SIN_PHI, - o2::base::PropagatorImpl::MAX_STEP, - mCorr); - mOutwardsTrack.setChi2(mOutwardsTrack.getChi2() + mOutwardsTrack.getPredictedChi2(tF.positionTrackingFrame, tF.covarianceTrackingFrame)); - statusOutw &= mOutwardsTrack.o2::track::TrackParCov::update(tF.positionTrackingFrame, tF.covarianceTrackingFrame); - // LOG(info) << "Outwards loop on inwards track, layer: " << iLayer << " x: " << mOutwardsTrack.getX(); - } - - // Prediction on the previously outwards-propagated track is done on a copy, as the process seems to be not reversible - auto outwardsClone = mOutwardsTrack; - statusOutw = outwardsClone.rotate(originalTf.alphaTrackingFrame); - statusOutw &= propInstance->propagateToX(outwardsClone, - originalTf.xTrackingFrame, - mBz, - o2::base::PropagatorImpl::MAX_SIN_PHI, - o2::base::PropagatorImpl::MAX_STEP, - mCorr); - ///////////////////// - // Inward propagation - for (size_t iLayer{D - 1}; iLayer > mLayerToSmooth; --iLayer) { - if (mInwardsTrack.getClusterIndex(iLayer) == constants::UnusedIndex) { // Shorter tracks - continue; - } - const TrackingFrameInfo& tF = event.getTrackingFrameInfoOnLayer(iLayer).at(mInwardsTrack.getClusterIndex(iLayer)); - statusInw = mInwardsTrack.rotate(tF.alphaTrackingFrame); - statusInw &= propInstance->propagateToX(mInwardsTrack, - tF.xTrackingFrame, - mBz, - o2::base::PropagatorImpl::MAX_SIN_PHI, - o2::base::PropagatorImpl::MAX_STEP, - mCorr); - mInwardsTrack.setChi2(mInwardsTrack.getChi2() + mInwardsTrack.getPredictedChi2(tF.positionTrackingFrame, tF.covarianceTrackingFrame)); - statusInw &= mInwardsTrack.o2::track::TrackParCov::update(tF.positionTrackingFrame, tF.covarianceTrackingFrame); - // LOG(info) << "Inwards loop on outwards track, layer: " << iLayer << " x: " << mInwardsTrack.getX(); - } - - // Prediction on the previously inwards-propagated track is done on a copy, as the process seems to be not revesible - auto inwardsClone = mInwardsTrack; - statusInw = inwardsClone.rotate(originalTf.alphaTrackingFrame); - statusInw &= propInstance->propagateToX(inwardsClone, - originalTf.xTrackingFrame, - mBz, - o2::base::PropagatorImpl::MAX_SIN_PHI, - o2::base::PropagatorImpl::MAX_STEP, - mCorr); - // Compute weighted local chi2 - mInitStatus = statusInw && statusOutw; - if (mInitStatus) { - mBestChi2 = computeSmoothedPredictedChi2(inwardsClone, outwardsClone, originalTf.positionTrackingFrame, originalTf.covarianceTrackingFrame); - mLastChi2 = mBestChi2; - LOG(info) << "Smoothed chi2 on original cluster: " << mBestChi2; - } -} +// template +// Smoother::Smoother(TrackITSExt& track, size_t smoothingLayer, const ROframe& event, float bZ, o2::base::PropagatorF::MatCorrType corr) : mLayerToSmooth{smoothingLayer}, +// mBz(bZ), +// mCorr(corr) +// { +// +// auto propInstance = o2::base::Propagator::Instance(); +// const TrackingFrameInfo& originalTf = event.getTrackingFrameInfoOnLayer(mLayerToSmooth).at(track.getClusterIndex(mLayerToSmooth)); +// +// mOutwardsTrack = track; // This track will be propagated outwards inside the smoother! (as last step of fitting did inward propagation) +// mInwardsTrack = {track.getParamOut(), // This track will be propagated inwards inside the smoother! +// static_cast(mOutwardsTrack.getNumberOfClusters()), -999, static_cast(event.getROFrameId()), +// mOutwardsTrack.getParamOut(), mOutwardsTrack.getClusterIndexes()}; +// +// mOutwardsTrack.resetCovariance(); +// mOutwardsTrack.setChi2(0); +// mInwardsTrack.resetCovariance(); +// mInwardsTrack.setChi2(0); +// +// bool statusOutw{false}; +// bool statusInw{false}; +// +// ////////////////////// +// // Outward propagation +// for (size_t iLayer{0}; iLayer < mLayerToSmooth; ++iLayer) { +// if (mOutwardsTrack.getClusterIndex(iLayer) == constants::UnusedIndex) { // Shorter tracks +// continue; +// } +// const TrackingFrameInfo& tF = event.getTrackingFrameInfoOnLayer(iLayer).at(mOutwardsTrack.getClusterIndex(iLayer)); +// statusOutw = mOutwardsTrack.rotate(tF.alphaTrackingFrame); +// statusOutw &= propInstance->propagateToX(mOutwardsTrack, +// tF.xTrackingFrame, +// mBz, +// o2::base::PropagatorImpl::MAX_SIN_PHI, +// o2::base::PropagatorImpl::MAX_STEP, +// mCorr); +// mOutwardsTrack.setChi2(mOutwardsTrack.getChi2() + mOutwardsTrack.getPredictedChi2(tF.positionTrackingFrame, tF.covarianceTrackingFrame)); +// statusOutw &= mOutwardsTrack.o2::track::TrackParCov::update(tF.positionTrackingFrame, tF.covarianceTrackingFrame); +// // LOG(info) << "Outwards loop on inwards track, layer: " << iLayer << " x: " << mOutwardsTrack.getX(); +// } +// +// // Prediction on the previously outwards-propagated track is done on a copy, as the process seems to be not reversible +// auto outwardsClone = mOutwardsTrack; +// statusOutw = outwardsClone.rotate(originalTf.alphaTrackingFrame); +// statusOutw &= propInstance->propagateToX(outwardsClone, +// originalTf.xTrackingFrame, +// mBz, +// o2::base::PropagatorImpl::MAX_SIN_PHI, +// o2::base::PropagatorImpl::MAX_STEP, +// mCorr); +// ///////////////////// +// // Inward propagation +// for (size_t iLayer{D - 1}; iLayer > mLayerToSmooth; --iLayer) { +// if (mInwardsTrack.getClusterIndex(iLayer) == constants::UnusedIndex) { // Shorter tracks +// continue; +// } +// const TrackingFrameInfo& tF = event.getTrackingFrameInfoOnLayer(iLayer).at(mInwardsTrack.getClusterIndex(iLayer)); +// statusInw = mInwardsTrack.rotate(tF.alphaTrackingFrame); +// statusInw &= propInstance->propagateToX(mInwardsTrack, +// tF.xTrackingFrame, +// mBz, +// o2::base::PropagatorImpl::MAX_SIN_PHI, +// o2::base::PropagatorImpl::MAX_STEP, +// mCorr); +// mInwardsTrack.setChi2(mInwardsTrack.getChi2() + mInwardsTrack.getPredictedChi2(tF.positionTrackingFrame, tF.covarianceTrackingFrame)); +// statusInw &= mInwardsTrack.o2::track::TrackParCov::update(tF.positionTrackingFrame, tF.covarianceTrackingFrame); +// // LOG(info) << "Inwards loop on outwards track, layer: " << iLayer << " x: " << mInwardsTrack.getX(); +// } +// +// // Prediction on the previously inwards-propagated track is done on a copy, as the process seems to be not revesible +// auto inwardsClone = mInwardsTrack; +// statusInw = inwardsClone.rotate(originalTf.alphaTrackingFrame); +// statusInw &= propInstance->propagateToX(inwardsClone, +// originalTf.xTrackingFrame, +// mBz, +// o2::base::PropagatorImpl::MAX_SIN_PHI, +// o2::base::PropagatorImpl::MAX_STEP, +// mCorr); +// // Compute weighted local chi2 +// mInitStatus = statusInw && statusOutw; +// if (mInitStatus) { +// mBestChi2 = computeSmoothedPredictedChi2(inwardsClone, outwardsClone, originalTf.positionTrackingFrame, originalTf.covarianceTrackingFrame); +// mLastChi2 = mBestChi2; +// LOG(info) << "Smoothed chi2 on original cluster: " << mBestChi2; +// } +// } template Smoother::~Smoother() = default; @@ -173,48 +173,48 @@ float Smoother::computeSmoothedPredictedChi2(const o2::track::TrackParCov& fi return chi2; } -template -bool Smoother::testCluster(const int clusterId, const ROframe& event) -{ - if (!mInitStatus) { - return false; - } - auto propInstance = o2::base::Propagator::Instance(); - const TrackingFrameInfo& testTf = event.getTrackingFrameInfoOnLayer(mLayerToSmooth).at(clusterId); - - bool statusOutw{false}; - bool statusInw{false}; - - // Prediction on the previously outwards-propagated track is done on a copy, as the process seems to be not reversible - auto outwardsClone = mOutwardsTrack; - statusOutw = outwardsClone.rotate(testTf.alphaTrackingFrame); - statusOutw &= propInstance->propagateToX(outwardsClone, - testTf.xTrackingFrame, - mBz, - o2::base::PropagatorImpl::MAX_SIN_PHI, - o2::base::PropagatorImpl::MAX_STEP, - mCorr); - - // Prediction on the previously inwards-propagated track is done on a copy, as the process seems to be not reversible - auto inwardsClone = mInwardsTrack; - statusInw = inwardsClone.rotate(testTf.alphaTrackingFrame); - statusInw &= propInstance->propagateToX(inwardsClone, - testTf.xTrackingFrame, - mBz, - o2::base::PropagatorImpl::MAX_SIN_PHI, - o2::base::PropagatorImpl::MAX_STEP, - mCorr); - if (!(statusOutw && statusInw)) { - LOG(warning) << "Failed propagation in smoother!"; - return false; - } - - // Compute weighted local chi2 - mLastChi2 = computeSmoothedPredictedChi2(inwardsClone, outwardsClone, testTf.positionTrackingFrame, testTf.covarianceTrackingFrame); - LOG(info) << "Smoothed chi2 on tested cluster: " << mLastChi2; - - return true; -} +// template +// bool Smoother::testCluster(const int clusterId, const ROframe& event) +// { +// if (!mInitStatus) { +// return false; +// } +// auto propInstance = o2::base::Propagator::Instance(); +// const TrackingFrameInfo& testTf = event.getTrackingFrameInfoOnLayer(mLayerToSmooth).at(clusterId); +// +// bool statusOutw{false}; +// bool statusInw{false}; +// +// // Prediction on the previously outwards-propagated track is done on a copy, as the process seems to be not reversible +// auto outwardsClone = mOutwardsTrack; +// statusOutw = outwardsClone.rotate(testTf.alphaTrackingFrame); +// statusOutw &= propInstance->propagateToX(outwardsClone, +// testTf.xTrackingFrame, +// mBz, +// o2::base::PropagatorImpl::MAX_SIN_PHI, +// o2::base::PropagatorImpl::MAX_STEP, +// mCorr); +// +// // Prediction on the previously inwards-propagated track is done on a copy, as the process seems to be not reversible +// auto inwardsClone = mInwardsTrack; +// statusInw = inwardsClone.rotate(testTf.alphaTrackingFrame); +// statusInw &= propInstance->propagateToX(inwardsClone, +// testTf.xTrackingFrame, +// mBz, +// o2::base::PropagatorImpl::MAX_SIN_PHI, +// o2::base::PropagatorImpl::MAX_STEP, +// mCorr); +// if (!(statusOutw && statusInw)) { +// LOG(warning) << "Failed propagation in smoother!"; +// return false; +// } +// +// // Compute weighted local chi2 +// mLastChi2 = computeSmoothedPredictedChi2(inwardsClone, outwardsClone, testTf.positionTrackingFrame, testTf.covarianceTrackingFrame); +// LOG(info) << "Smoothed chi2 on tested cluster: " << mLastChi2; +// +// return true; +// } template class Smoother<7>; diff --git a/Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx b/Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx index e0bd94ed223c0..105a28a2d8a92 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/Tracker.cxx @@ -19,7 +19,6 @@ #include "ITStracking/Cell.h" #include "ITStracking/Constants.h" #include "ITStracking/IndexTableUtils.h" -#include "ITStracking/Smoother.h" #include "ITStracking/Tracklet.h" #include "ITStracking/TrackerTraits.h" #include "ITStracking/TrackingConfigParam.h" diff --git a/Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx b/Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx index 604c6ad88080f..81e140ac8178e 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx @@ -9,15 +9,18 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include + +#include + #include "ITSMFTBase/DPLAlpideParam.h" #include "ITSBase/GeometryTGeo.h" #include "ITSReconstruction/FastMultEstConfig.h" #include "ITSReconstruction/FastMultEst.h" +#include "ITStracking/TrackingConfigParam.h" #include "ITStracking/TrackingInterface.h" -#include -#include #include "DataFormatsITSMFT/ROFRecord.h" #include "DataFormatsITSMFT/PhysTrigger.h" @@ -25,7 +28,6 @@ #include "CommonDataFormat/IRFrame.h" #include "DetectorsBase/GRPGeomHelper.h" #include "ITStracking/BoundedAllocator.h" -#include "ITStracking/TrackingConfigParam.h" #include "Framework/DeviceSpec.h" using namespace o2::framework; diff --git a/Detectors/ITSMFT/ITS/tracking/src/Vertexer.cxx b/Detectors/ITSMFT/ITS/tracking/src/Vertexer.cxx index bd9d1402a1ebf..1daef9bb18fb0 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/Vertexer.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/Vertexer.cxx @@ -16,8 +16,9 @@ #include "ITStracking/Vertexer.h" #include "ITStracking/BoundedAllocator.h" #include "ITStracking/Cluster.h" -#include "ITStracking/ROframe.h" + #include "ITStracking/ClusterLines.h" +#include "ITStracking/Tracklet.h" #include "ITStracking/IndexTableUtils.h" #include "ITStracking/VertexerTraits.h" #include "ITStracking/TrackingConfigParam.h" diff --git a/Detectors/ITSMFT/ITS/workflow/include/ITSWorkflow/CookedTrackerSpec.h b/Detectors/ITSMFT/ITS/workflow/include/ITSWorkflow/CookedTrackerSpec.h index 88e4b06a5c8ce..eb55081889c12 100644 --- a/Detectors/ITSMFT/ITS/workflow/include/ITSWorkflow/CookedTrackerSpec.h +++ b/Detectors/ITSMFT/ITS/workflow/include/ITSWorkflow/CookedTrackerSpec.h @@ -19,12 +19,15 @@ #include "ITStracking/TimeFrame.h" #include "ITStracking/Vertexer.h" #include "ITStracking/VertexerTraits.h" +#include "ITStracking/BoundedAllocator.h" #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsITSMFT/TopologyDictionary.h" #include "Framework/Task.h" #include "TStopwatch.h" #include "DetectorsBase/GRPGeomHelper.h" +#include + using namespace o2::framework; namespace o2 @@ -57,6 +60,8 @@ class CookedTrackerDPL : public Task o2::its::CookedTracker mTracker; std::unique_ptr mVertexerTraitsPtr = nullptr; std::unique_ptr mVertexerPtr = nullptr; + std::shared_ptr mMemoryPool; + std::shared_ptr mTaskArena; TStopwatch mTimer; }; diff --git a/Detectors/ITSMFT/ITS/workflow/src/CookedTrackerSpec.cxx b/Detectors/ITSMFT/ITS/workflow/src/CookedTrackerSpec.cxx index 640265f881749..98662e46269d1 100644 --- a/Detectors/ITSMFT/ITS/workflow/src/CookedTrackerSpec.cxx +++ b/Detectors/ITSMFT/ITS/workflow/src/CookedTrackerSpec.cxx @@ -34,7 +34,6 @@ #include "DetectorsBase/Propagator.h" #include "ITSBase/GeometryTGeo.h" #include "CommonDataFormat/IRFrame.h" -#include "ITStracking/ROframe.h" #include "ITStracking/IOUtils.h" #include "DetectorsCommonDataFormats/DetectorNameConf.h" #include "CommonUtils/StringUtils.h" @@ -65,6 +64,11 @@ void CookedTrackerDPL::init(InitContext& ic) o2::base::GRPGeomHelper::instance().setRequest(mGGCCDBRequest); auto nthreads = ic.options().get("nthreads"); mTracker.setNumberOfThreads(nthreads); + mTaskArena = std::make_shared(nthreads); + mMemoryPool = std::make_unique(); + mVertexerPtr->setMemoryPool(mMemoryPool); + mVertexerPtr->setNThreads(nthreads, mTaskArena); + mVertexerTraitsPtr->setMemoryPool(mMemoryPool); } void CookedTrackerDPL::run(ProcessingContext& pc) @@ -105,6 +109,7 @@ void CookedTrackerDPL::run(ProcessingContext& pc) mc2rofs = pc.inputs().get>("MC2ROframes"); } TimeFrame mTimeFrame; + mTimeFrame.setMemoryPool(mMemoryPool); LOG(info) << "ITSCookedTracker pulled " << compClusters.size() << " clusters, in " << rofs.size() << " RO frames"; @@ -113,7 +118,6 @@ void CookedTrackerDPL::run(ProcessingContext& pc) mTracker.setMCTruthContainers(labels.get(), &trackLabels); } - o2::its::ROframe event(0, 7); mVertexerPtr->adoptTimeFrame(mTimeFrame); auto& vertROFvec = pc.outputs().make>(Output{"ITS", "VERTICESROF", 0}); diff --git a/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx b/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx index b5a1530e83d8c..598ce3c35c98c 100644 --- a/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx +++ b/Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx @@ -18,6 +18,7 @@ #include "DetectorsBase/GlobalParams.h" #include "DetectorsBase/Propagator.h" #include "ReconstructionDataFormats/TrackTPCITS.h" +#include "ReconstructionDataFormats/Vertex.h" #include "DataFormatsTRD/Tracklet64.h" #include "DataFormatsTRD/CalibratedTracklet.h" #include "DataFormatsTRD/TriggerRecord.h" diff --git a/Detectors/Upgrades/ITS3/reconstruction/src/TrackingInterface.cxx b/Detectors/Upgrades/ITS3/reconstruction/src/TrackingInterface.cxx index 99ac05e61baf8..3d18ab267bd46 100644 --- a/Detectors/Upgrades/ITS3/reconstruction/src/TrackingInterface.cxx +++ b/Detectors/Upgrades/ITS3/reconstruction/src/TrackingInterface.cxx @@ -12,6 +12,7 @@ #include "ITS3Reconstruction/TrackingInterface.h" #include "ITS3Reconstruction/IOUtils.h" #include "ITSBase/GeometryTGeo.h" +#include "ITStracking/TrackingConfigParam.h" #include "ITSMFTBase/DPLAlpideParam.h" #include "DetectorsBase/GRPGeomHelper.h" #include "Framework/DeviceSpec.h"