Skip to content

Commit

Permalink
Introduce necessary modifications to AlignmentTrackSelector in order …
Browse files Browse the repository at this point in the history
…to store the Phase-2 clusters
  • Loading branch information
mmusich committed Dec 21, 2022
1 parent daec9c6 commit 3c18fe0
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 10 deletions.
1 change: 1 addition & 0 deletions CommonTools/RecoAlgos/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<use name="DataFormats/TrackingRecHit"/>
<use name="DataFormats/SiStripCluster"/>
<use name="DataFormats/SiPixelCluster"/>
<use name="DataFormats/Phase2TrackerCluster"/>
<use name="DataFormats/TrackerRecHit2D"/>
<use name="DataFormats/RecoCandidate"/>
<use name="DataFormats/Candidate"/>
Expand Down
7 changes: 5 additions & 2 deletions CommonTools/RecoAlgos/interface/ClusterStorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -39,7 +40,9 @@ namespace helper {
void processAllClusters(edmNew::DetSetVector<SiPixelCluster> &pixelDsvToFill,
edm::RefProd<edmNew::DetSetVector<SiPixelCluster> > refPixelClusters,
edmNew::DetSetVector<SiStripCluster> &stripDsvToFill,
edm::RefProd<edmNew::DetSetVector<SiStripCluster> > refStripClusters);
edm::RefProd<edmNew::DetSetVector<SiStripCluster> > refStripClusters,
edmNew::DetSetVector<Phase2TrackerCluster1D> &phase2OTDsvToFill,
edm::RefProd<edmNew::DetSetVector<Phase2TrackerCluster1D> > refPhase2OTClusters);

private:
/// A struct for clusters associated to hits
Expand Down Expand Up @@ -77,7 +80,7 @@ namespace helper {
typedef ClusterHitRecord<SiStripRecHit2D::ClusterRef> StripClusterHitRecord;
//FIXME:: this is just temporary solution for phase2,
//probably is good to add a Phase2ClusterStorer?
typedef ClusterHitRecord<Phase2TrackerRecHit1D::CluRef> Phase2OTClusterHitRecord;
typedef ClusterHitRecord<Phase2TrackerRecHit1D::ClusterRef> Phase2OTClusterHitRecord;

//------------------------------------------------------------------
//! Processes all the clusters of a specific type
Expand Down
13 changes: 12 additions & 1 deletion CommonTools/RecoAlgos/interface/MuonSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -74,6 +75,7 @@ namespace helper {
std::unique_ptr<TrackingRecHitCollection> selStandAloneTracksHits_;
std::unique_ptr<edmNew::DetSetVector<SiStripCluster>> selStripClusters_;
std::unique_ptr<edmNew::DetSetVector<SiPixelCluster>> selPixelClusters_;
std::unique_ptr<edmNew::DetSetVector<Phase2TrackerCluster1D>> selPhase2OTClusters_;

reco::MuonRefProd rMuons_;
reco::TrackRefProd rTracks_;
Expand Down Expand Up @@ -128,6 +130,9 @@ namespace helper {
edm::RefProd<edmNew::DetSetVector<SiPixelCluster>> rPixelClusters =
evt.template getRefBeforePut<edmNew::DetSetVector<SiPixelCluster>>();

edm::RefProd<edmNew::DetSetVector<Phase2TrackerCluster1D>> rPhase2OTClusters =
evt.template getRefBeforePut<edmNew::DetSetVector<Phase2TrackerCluster1D>>();

id_ = 0;
igbd_ = 0;
isad_ = 0;
Expand All @@ -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);
}

//----------------------------------------------------------------------
Expand All @@ -161,6 +171,7 @@ namespace helper {
//--- New: save clusters too
produces<edmNew::DetSetVector<SiPixelCluster>>().setBranchAlias(alias + "PixelClusters");
produces<edmNew::DetSetVector<SiStripCluster>>().setBranchAlias(alias + "StripClusters");
produces<edmNew::DetSetVector<Phase2TrackerCluster1D>>().setBranchAlias(alias + "Phase2OTClusters");
produces<reco::TrackCollection>("GlobalMuon").setBranchAlias(alias + "GlobalMuonTracks");
produces<reco::TrackExtraCollection>("GlobalMuon").setBranchAlias(alias + "GlobalMuonExtras");
produces<TrackingRecHitCollection>("GlobalMuon").setBranchAlias(alias + "GlobalMuonHits");
Expand Down
12 changes: 11 additions & 1 deletion CommonTools/RecoAlgos/interface/TrackSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -71,6 +72,7 @@ namespace helper {
std::unique_ptr<TrackingRecHitCollection> selHits_;
std::unique_ptr<edmNew::DetSetVector<SiStripCluster> > selStripClusters_;
std::unique_ptr<edmNew::DetSetVector<SiPixelCluster> > selPixelClusters_;
std::unique_ptr<edmNew::DetSetVector<Phase2TrackerCluster1D> > selPhase2OTClusters_;

//--- References to products (i.e. to collections):
reco::TrackRefProd rTracks_;
Expand Down Expand Up @@ -107,6 +109,8 @@ namespace helper {
evt.template getRefBeforePut<edmNew::DetSetVector<SiPixelCluster> >();
edm::RefProd<edmNew::DetSetVector<SiStripCluster> > rStripClusters =
evt.template getRefBeforePut<edmNew::DetSetVector<SiStripCluster> >();
edm::RefProd<edmNew::DetSetVector<Phase2TrackerCluster1D> > rPhase2OTClusters =
evt.template getRefBeforePut<edmNew::DetSetVector<Phase2TrackerCluster1D> >();

//--- Indices into collections handled with RefProd
idx_ = 0; //!< index to track extra coll
Expand All @@ -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);
}

//----------------------------------------------------------------------
Expand All @@ -135,6 +144,7 @@ namespace helper {
//--- New: save clusters too
produces<edmNew::DetSetVector<SiPixelCluster> >().setBranchAlias(alias + "PixelClusters");
produces<edmNew::DetSetVector<SiStripCluster> >().setBranchAlias(alias + "StripClusters");
produces<edmNew::DetSetVector<Phase2TrackerCluster1D> >().setBranchAlias(alias + "Phase2OTClusters");
}
}; // (end of class TrackSelectorBase)

Expand Down
16 changes: 12 additions & 4 deletions CommonTools/RecoAlgos/src/ClusterStorer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,17 @@ namespace helper {
void ClusterStorer::clear() {
pixelClusterRecords_.clear();
stripClusterRecords_.clear();
phase2OTClusterRecords_.clear();
}

// -------------------------------------------------------------
void ClusterStorer::processAllClusters(edmNew::DetSetVector<SiPixelCluster> &pixelDsvToFill,
edm::RefProd<edmNew::DetSetVector<SiPixelCluster> > refPixelClusters,
edmNew::DetSetVector<SiStripCluster> &stripDsvToFill,
edm::RefProd<edmNew::DetSetVector<SiStripCluster> > refStripClusters) {
void ClusterStorer::processAllClusters(
edmNew::DetSetVector<SiPixelCluster> &pixelDsvToFill,
edm::RefProd<edmNew::DetSetVector<SiPixelCluster> > refPixelClusters,
edmNew::DetSetVector<SiStripCluster> &stripDsvToFill,
edm::RefProd<edmNew::DetSetVector<SiStripCluster> > refStripClusters,
edmNew::DetSetVector<Phase2TrackerCluster1D> &phase2OTDsvToFill,
edm::RefProd<edmNew::DetSetVector<Phase2TrackerCluster1D> > refPhase2OTClusters) {
if (!pixelClusterRecords_.empty()) {
this->processClusters<SiPixelRecHit, SiPixelCluster>(pixelClusterRecords_, pixelDsvToFill, refPixelClusters);
}
Expand All @@ -89,6 +93,10 @@ namespace helper {
// is specialised such that 'RecHitType' is not used...
this->processClusters<SiStripRecHit2D, SiStripCluster>(stripClusterRecords_, stripDsvToFill, refStripClusters);
}
if (!phase2OTClusterRecords_.empty()) {
this->processClusters<Phase2TrackerRecHit1D, Phase2TrackerCluster1D>(
phase2OTClusterRecords_, phase2OTDsvToFill, refPhase2OTClusters);
}
}

//-------------------------------------------------------------
Expand Down
8 changes: 6 additions & 2 deletions CommonTools/RecoAlgos/src/MuonSelector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
#include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h"
#include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"

#include <DataFormats/SiStripDetId/interface/SiStripDetId.h>
#include "DataFormats/SiStripDetId/interface/SiStripDetId.h"

#include "FWCore/MessageLogger/interface/MessageLogger.h"

Expand All @@ -26,6 +25,7 @@ namespace helper {
selStandAloneTracksHits_(new TrackingRecHitCollection),
selStripClusters_(new edmNew::DetSetVector<SiStripCluster>),
selPixelClusters_(new edmNew::DetSetVector<SiPixelCluster>),
selPhase2OTClusters_(new edmNew::DetSetVector<Phase2TrackerCluster1D>),
rMuons_(),
rTracks_(),
rTrackExtras_(),
Expand Down Expand Up @@ -202,6 +202,9 @@ namespace helper {
const ProjectedSiStripRecHit2D &pHit = static_cast<const ProjectedSiStripRecHit2D &>(hit);
if (!pHit.originalHit().cluster().isAvailable())
return false;
} else if (hit_type == typeid(Phase2TrackerRecHit1D)) {
if (!static_cast<const Phase2TrackerRecHit1D &>(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.
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions CommonTools/RecoAlgos/src/TrackSelector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace helper {
selHits_(new TrackingRecHitCollection),
selStripClusters_(new edmNew::DetSetVector<SiStripCluster>),
selPixelClusters_(new edmNew::DetSetVector<SiPixelCluster>),
selPhase2OTClusters_(new edmNew::DetSetVector<Phase2TrackerCluster1D>),
rTracks_(),
rTrackExtras_(),
rHits_(),
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class Phase2TrackerRecHit1D final : public TrackerSingleRecHit {
public:
typedef OmniClusterRef::Phase2Cluster1DRef CluRef;
typedef OmniClusterRef::Phase2Cluster1DRef ClusterRef;

Phase2TrackerRecHit1D() {}

Expand Down

0 comments on commit 3c18fe0

Please sign in to comment.