7 : muonToken_(consumes<
edm::
View<
reco::
Muon>>(pset.getParameter<
edm::InputTag>(
"muonTag"))),
8 outputClusters_(pset.getParameter<
bool>(
"outputClusters")),
9 selector_(pset.getParameter<
std::
string>(
"cut")),
18 std::vector<edm::InputTag> trackExtraAssocTags = pset.
getParameter<std::vector<edm::InputTag>>(
"trackExtraAssocs");
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;
105 association.
setRef(trackExtraRefProd);
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) {
163 if (pixelRef.
isNonnull() && pixelRef.
id() == pixelClusters.
id()) {
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;
204 for (
auto setIter = pixelClusters->begin(), setIterEnd = pixelClusters->end(); setIter != setIterEnd; ++setIter) {
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;
217 for (
auto setIter = stripClusters->begin(), setIterEnd = stripClusters->end(); setIter != setIterEnd; ++setIter) {
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) {
239 if (pixelRef.
isNonnull() && pixelRef.
id() == pixelClusters.
id()) {
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()));
ClusterStripRef cluster_strip() const
T getParameter(std::string const &) const
void setClusterStripRef(ClusterStripRef const &ref)
bool isNonnull() const
Checks for non-null.
OmniClusterRef const & stereoClusterRef() const
void setRef(const refprod_type &ref)
void insert(const H &h, I begin, I end)
key_type key() const
Accessor for product key.
ProductID id() const
Accessor for product ID.
void setComment(std::string const &value)
ClusterStripRef cluster_strip() const
OmniClusterRef const & monoClusterRef() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Pixel cluster – collection of neighboring pixels above threshold.
ClusterPixelRef cluster_pixel() const
void setClusterPixelRef(ClusterPixelRef const &ref)