From 3c18fe00873f1260753d964175ed30466970f3ba Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 13 Dec 2022 16:41:35 +0100 Subject: [PATCH] Introduce necessary modifications to AlignmentTrackSelector in order to store the Phase-2 clusters --- CommonTools/RecoAlgos/BuildFile.xml | 1 + CommonTools/RecoAlgos/interface/ClusterStorer.h | 7 +++++-- CommonTools/RecoAlgos/interface/MuonSelector.h | 13 ++++++++++++- CommonTools/RecoAlgos/interface/TrackSelector.h | 12 +++++++++++- CommonTools/RecoAlgos/src/ClusterStorer.cc | 16 ++++++++++++---- CommonTools/RecoAlgos/src/MuonSelector.cc | 8 ++++++-- CommonTools/RecoAlgos/src/TrackSelector.cc | 2 ++ .../interface/Phase2TrackerRecHit1D.h | 1 + 8 files changed, 50 insertions(+), 10 deletions(-) diff --git a/CommonTools/RecoAlgos/BuildFile.xml b/CommonTools/RecoAlgos/BuildFile.xml index 736edd2d2c27e..a6c0862d7e5a3 100644 --- a/CommonTools/RecoAlgos/BuildFile.xml +++ b/CommonTools/RecoAlgos/BuildFile.xml @@ -6,6 +6,7 @@ + diff --git a/CommonTools/RecoAlgos/interface/ClusterStorer.h b/CommonTools/RecoAlgos/interface/ClusterStorer.h index 6b31dde114262..af9ff64161193 100644 --- a/CommonTools/RecoAlgos/interface/ClusterStorer.h +++ b/CommonTools/RecoAlgos/interface/ClusterStorer.h @@ -20,6 +20,7 @@ #include "DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" +#include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h" #include "DataFormats/Common/interface/DetSetVectorNew.h" namespace helper { @@ -39,7 +40,9 @@ namespace helper { void processAllClusters(edmNew::DetSetVector &pixelDsvToFill, edm::RefProd > refPixelClusters, edmNew::DetSetVector &stripDsvToFill, - edm::RefProd > refStripClusters); + edm::RefProd > refStripClusters, + edmNew::DetSetVector &phase2OTDsvToFill, + edm::RefProd > refPhase2OTClusters); private: /// A struct for clusters associated to hits @@ -77,7 +80,7 @@ namespace helper { typedef ClusterHitRecord StripClusterHitRecord; //FIXME:: this is just temporary solution for phase2, //probably is good to add a Phase2ClusterStorer? - typedef ClusterHitRecord Phase2OTClusterHitRecord; + typedef ClusterHitRecord Phase2OTClusterHitRecord; //------------------------------------------------------------------ //! Processes all the clusters of a specific type diff --git a/CommonTools/RecoAlgos/interface/MuonSelector.h b/CommonTools/RecoAlgos/interface/MuonSelector.h index e508db3448024..bf5c7ff1ffa8d 100644 --- a/CommonTools/RecoAlgos/interface/MuonSelector.h +++ b/CommonTools/RecoAlgos/interface/MuonSelector.h @@ -22,6 +22,7 @@ #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" +#include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h" #include "DataFormats/Common/interface/DetSetVectorNew.h" #include "CommonTools/RecoAlgos/interface/ClusterStorer.h" #include "CommonTools/UtilAlgos/interface/ObjectSelector.h" @@ -74,6 +75,7 @@ namespace helper { std::unique_ptr selStandAloneTracksHits_; std::unique_ptr> selStripClusters_; std::unique_ptr> selPixelClusters_; + std::unique_ptr> selPhase2OTClusters_; reco::MuonRefProd rMuons_; reco::TrackRefProd rTracks_; @@ -128,6 +130,9 @@ namespace helper { edm::RefProd> rPixelClusters = evt.template getRefBeforePut>(); + edm::RefProd> rPhase2OTClusters = + evt.template getRefBeforePut>(); + id_ = 0; igbd_ = 0; isad_ = 0; @@ -145,7 +150,12 @@ namespace helper { processMuon(mu); } //--- Clone the clusters and fixup refs - clusterStorer_.processAllClusters(*selPixelClusters_, rPixelClusters, *selStripClusters_, rStripClusters); + clusterStorer_.processAllClusters(*selPixelClusters_, + rPixelClusters, + *selStripClusters_, + rStripClusters, + *selPhase2OTClusters_, + rPhase2OTClusters); } //---------------------------------------------------------------------- @@ -161,6 +171,7 @@ namespace helper { //--- New: save clusters too produces>().setBranchAlias(alias + "PixelClusters"); produces>().setBranchAlias(alias + "StripClusters"); + produces>().setBranchAlias(alias + "Phase2OTClusters"); produces("GlobalMuon").setBranchAlias(alias + "GlobalMuonTracks"); produces("GlobalMuon").setBranchAlias(alias + "GlobalMuonExtras"); produces("GlobalMuon").setBranchAlias(alias + "GlobalMuonHits"); diff --git a/CommonTools/RecoAlgos/interface/TrackSelector.h b/CommonTools/RecoAlgos/interface/TrackSelector.h index 322100a67c6de..d70b9870e5d3c 100644 --- a/CommonTools/RecoAlgos/interface/TrackSelector.h +++ b/CommonTools/RecoAlgos/interface/TrackSelector.h @@ -22,6 +22,7 @@ #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" #include "DataFormats/SiStripCluster/interface/SiStripCluster.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" +#include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h" #include "DataFormats/Common/interface/DetSetVectorNew.h" #include "CommonTools/RecoAlgos/interface/ClusterStorer.h" #include "CommonTools/UtilAlgos/interface/ObjectSelector.h" @@ -71,6 +72,7 @@ namespace helper { std::unique_ptr selHits_; std::unique_ptr > selStripClusters_; std::unique_ptr > selPixelClusters_; + std::unique_ptr > selPhase2OTClusters_; //--- References to products (i.e. to collections): reco::TrackRefProd rTracks_; @@ -107,6 +109,8 @@ namespace helper { evt.template getRefBeforePut >(); edm::RefProd > rStripClusters = evt.template getRefBeforePut >(); + edm::RefProd > rPhase2OTClusters = + evt.template getRefBeforePut >(); //--- Indices into collections handled with RefProd idx_ = 0; //!< index to track extra coll @@ -121,7 +125,12 @@ namespace helper { processTrack(trk); } //--- Clone the clusters and fixup refs - clusterStorer_.processAllClusters(*selPixelClusters_, rPixelClusters, *selStripClusters_, rStripClusters); + clusterStorer_.processAllClusters(*selPixelClusters_, + rPixelClusters, + *selStripClusters_, + rStripClusters, + *selPhase2OTClusters_, + rPhase2OTClusters); } //---------------------------------------------------------------------- @@ -135,6 +144,7 @@ namespace helper { //--- New: save clusters too produces >().setBranchAlias(alias + "PixelClusters"); produces >().setBranchAlias(alias + "StripClusters"); + produces >().setBranchAlias(alias + "Phase2OTClusters"); } }; // (end of class TrackSelectorBase) diff --git a/CommonTools/RecoAlgos/src/ClusterStorer.cc b/CommonTools/RecoAlgos/src/ClusterStorer.cc index 760be3efc6c0b..5452301be4f90 100644 --- a/CommonTools/RecoAlgos/src/ClusterStorer.cc +++ b/CommonTools/RecoAlgos/src/ClusterStorer.cc @@ -71,13 +71,17 @@ namespace helper { void ClusterStorer::clear() { pixelClusterRecords_.clear(); stripClusterRecords_.clear(); + phase2OTClusterRecords_.clear(); } // ------------------------------------------------------------- - void ClusterStorer::processAllClusters(edmNew::DetSetVector &pixelDsvToFill, - edm::RefProd > refPixelClusters, - edmNew::DetSetVector &stripDsvToFill, - edm::RefProd > refStripClusters) { + void ClusterStorer::processAllClusters( + edmNew::DetSetVector &pixelDsvToFill, + edm::RefProd > refPixelClusters, + edmNew::DetSetVector &stripDsvToFill, + edm::RefProd > refStripClusters, + edmNew::DetSetVector &phase2OTDsvToFill, + edm::RefProd > refPhase2OTClusters) { if (!pixelClusterRecords_.empty()) { this->processClusters(pixelClusterRecords_, pixelDsvToFill, refPixelClusters); } @@ -89,6 +93,10 @@ namespace helper { // is specialised such that 'RecHitType' is not used... this->processClusters(stripClusterRecords_, stripDsvToFill, refStripClusters); } + if (!phase2OTClusterRecords_.empty()) { + this->processClusters( + phase2OTClusterRecords_, phase2OTDsvToFill, refPhase2OTClusters); + } } //------------------------------------------------------------- diff --git a/CommonTools/RecoAlgos/src/MuonSelector.cc b/CommonTools/RecoAlgos/src/MuonSelector.cc index 0b7d84646d158..d2af24a89aaa3 100644 --- a/CommonTools/RecoAlgos/src/MuonSelector.cc +++ b/CommonTools/RecoAlgos/src/MuonSelector.cc @@ -5,8 +5,7 @@ #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" #include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" - -#include +#include "DataFormats/SiStripDetId/interface/SiStripDetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -26,6 +25,7 @@ namespace helper { selStandAloneTracksHits_(new TrackingRecHitCollection), selStripClusters_(new edmNew::DetSetVector), selPixelClusters_(new edmNew::DetSetVector), + selPhase2OTClusters_(new edmNew::DetSetVector), rMuons_(), rTracks_(), rTrackExtras_(), @@ -202,6 +202,9 @@ namespace helper { const ProjectedSiStripRecHit2D &pHit = static_cast(hit); if (!pHit.originalHit().cluster().isAvailable()) return false; + } else if (hit_type == typeid(Phase2TrackerRecHit1D)) { + if (!static_cast(hit).cluster().isAvailable()) + return false; } else { // std::cout << "| It is a " << hit_type.name() << " hit !?" << std::endl; // Do nothing. We might end up here for FastSim hits. @@ -230,6 +233,7 @@ namespace helper { if (cloneClusters()) { evt.put(std::move(selStripClusters_)); evt.put(std::move(selPixelClusters_)); + evt.put(std::move(selPhase2OTClusters_)); } return h; } diff --git a/CommonTools/RecoAlgos/src/TrackSelector.cc b/CommonTools/RecoAlgos/src/TrackSelector.cc index 3e6492d40c0c8..5e61f61263b5b 100644 --- a/CommonTools/RecoAlgos/src/TrackSelector.cc +++ b/CommonTools/RecoAlgos/src/TrackSelector.cc @@ -10,6 +10,7 @@ namespace helper { selHits_(new TrackingRecHitCollection), selStripClusters_(new edmNew::DetSetVector), selPixelClusters_(new edmNew::DetSetVector), + selPhase2OTClusters_(new edmNew::DetSetVector), rTracks_(), rTrackExtras_(), rHits_(), @@ -62,6 +63,7 @@ namespace helper { evt.put(std::move(selHits_)); evt.put(std::move(selStripClusters_)); evt.put(std::move(selPixelClusters_)); + evt.put(std::move(selPhase2OTClusters_)); return h; } diff --git a/DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h b/DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h index 5a9bb8d0f4122..e598abf6e5c28 100644 --- a/DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h +++ b/DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h @@ -10,6 +10,7 @@ class Phase2TrackerRecHit1D final : public TrackerSingleRecHit { public: typedef OmniClusterRef::Phase2Cluster1DRef CluRef; + typedef OmniClusterRef::Phase2Cluster1DRef ClusterRef; Phase2TrackerRecHit1D() {}