8 outputClusters_(
pset.getParameter<
bool>(
"outputClusters")),
13 std::vector<edm::InputTag>
trackExtraTags =
pset.getParameter<std::vector<edm::InputTag>>(
"trackExtraTags");
18 std::vector<edm::InputTag> trackExtraAssocTags =
pset.getParameter<std::vector<edm::InputTag>>(
"trackExtraAssocs");
25 consumes<edmNew::DetSetVector<SiPixelCluster>>(
pset.getParameter<
edm::InputTag>(
"pixelClusterTag"));
27 consumes<edmNew::DetSetVector<SiStripCluster>>(
pset.getParameter<
edm::InputTag>(
"stripClusterTag"));
37 "Produces reduced set of TrackExtras and corresponding TrackingRecHits and (optionally) Pixe/Strip clusters "
38 "associated to a muon track.");
40 desc.add<std::vector<edm::InputTag>>(
"trackExtraTags",
46 desc.add<std::vector<edm::InputTag>>(
"trackExtraAssocs", {});
50 desc.add<
bool>(
"outputClusters",
true);
51 descriptions.
add(
"muonReducedTrackExtras",
desc);
57 std::vector<edm::Handle<reco::TrackExtraCollection>> trackExtrasV(
trackExtraTokens_.size());
67 std::map<edm::ProductID, std::vector<bool>> idxstokeep;
68 for (
auto const& trackExtras : trackExtrasV) {
69 idxstokeep[trackExtras.id()].resize(trackExtras->size(),
false);
80 if (!
assoc->contains(trackExtra.
id())) {
85 trackExtra = trackExtraOut;
88 auto idxs = idxstokeep.find(trackExtra.
id());
89 if (idxs != idxstokeep.end()) {
90 idxs->second[trackExtra.
key()] =
true;
111 std::vector<bool> pixelClustersToKeep;
112 std::vector<bool> stripClustersToKeep;
118 pixelClustersToKeep.resize(
pixelClusters->dataSize(),
false);
119 stripClustersToKeep.resize(
stripClusters->dataSize(),
false);
127 for (
auto const& trackExtras : trackExtrasV) {
128 const std::vector<bool>& idxs = idxstokeep.at(trackExtras.id());
130 std::vector<int> associdxs(trackExtras->size(), -1);
131 for (
unsigned int i = 0;
i < trackExtras->size(); ++
i) {
138 associdxs[
i] = trackExtrasOut.size();
157 for (
auto const&
hit : trackExtra.
recHits()) {
161 if (singleHit !=
nullptr) {
164 pixelClustersToKeep[pixelRef.
key()] =
true;
166 SiStripClusterRef
const& stripRef = singleHit->
cluster_strip();
167 if (stripRef.isNonnull() && stripRef.id() ==
stripClusters.id()) {
168 stripClustersToKeep[stripRef.key()] =
true;
171 if (matched2DHit !=
nullptr) {
174 if (monoRef.isNonnull() && monoRef.id() ==
stripClusters.id()) {
175 stripClustersToKeep[monoRef.key()] =
true;
177 if (stereoRef.isNonnull() && stereoRef.id() ==
stripClusters.id()) {
178 stripClustersToKeep[stereoRef.key()] =
true;
187 assocfiller.
insert(trackExtras, associdxs.begin(), associdxs.end());
197 std::unordered_map<unsigned int, unsigned int> pixelClusterIdxMap;
198 std::unordered_map<unsigned int, unsigned int> stripClusterIdxMap;
202 unsigned int iIndex = 0;
207 for (
auto iter = setIter->begin(), iterEnd = setIter->end(); iter != iterEnd; ++iter, ++iIndex) {
208 if (pixelClustersToKeep[iIndex]) {
210 const unsigned int oIndex = pixelClusterIdxMap.size();
211 pixelClusterIdxMap[iIndex] = oIndex;
220 for (
auto iter = setIter->begin(), iterEnd = setIter->end(); iter != iterEnd; ++iter, ++iIndex) {
221 if (stripClustersToKeep[iIndex]) {
223 const unsigned int oIndex = stripClusterIdxMap.size();
224 stripClusterIdxMap[iIndex] = oIndex;
235 for (
auto&
hit : trackingRecHitsOut) {
237 if (singleHit !=
nullptr) {
243 SiStripClusterRef
const& stripRef = singleHit->
cluster_strip();
244 if (stripRef.isNonnull() && stripRef.id() ==
stripClusters.id()) {
245 SiStripClusterRef
const stripRefOut(stripClustersOutH, stripClusterIdxMap.at(stripRef.key()));
249 if (matched2DHit !=
nullptr) {
252 if (monoRef.isNonnull() && monoRef.id() ==
stripClusters.id()) {
253 SiStripClusterRef
const monoRefOut(stripClustersOutH, stripClusterIdxMap.at(monoRef.key()));
256 if (stereoRef.isNonnull() && stereoRef.id() ==
stripClusters.id()) {
257 SiStripClusterRef
const stereoRefOut(stripClustersOutH, stripClusterIdxMap.at(stereoRef.key()));