CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MuonTrackProducer.cc
Go to the documentation of this file.
1 //
2 // modified & integrated by Giovanni Abbiendi
3 // from code by Arun Luthra:
4 // UserCode/luthra/MuonTrackSelector/src/MuonTrackSelector.cc
5 //
22 
23 #include <algorithm>
24 #include <sstream>
25 #include <memory>
26 
28 public:
29  explicit MuonTrackProducer(const edm::ParameterSet &);
30 
31 private:
32  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
33 
38 
39  std::vector<std::string> selectionTags;
42 };
43 
45  : muonsToken(consumes<reco::MuonCollection>(parset.getParameter<edm::InputTag>("muonsTag"))),
46  inputDTRecSegment4DToken_(
47  consumes<DTRecSegment4DCollection>(parset.getParameter<edm::InputTag>("inputDTRecSegment4DCollection"))),
48  inputCSCSegmentToken_(
49  consumes<CSCSegmentCollection>(parset.getParameter<edm::InputTag>("inputCSCSegmentCollection"))),
51  selectionTags(parset.getParameter<std::vector<std::string>>("selectionTags")),
52  trackType(parset.getParameter<std::string>("trackType")),
53  ignoreMissingMuonCollection(parset.getUntrackedParameter<bool>("ignoreMissingMuonCollection", false)) {
54  edm::LogVerbatim("MuonTrackProducer") << "constructing MuonTrackProducer" << parset.dump();
55  produces<reco::TrackCollection>();
56  produces<reco::TrackExtraCollection>();
57  produces<TrackingRecHitCollection>();
58 }
59 
61  edm::Handle<reco::MuonCollection> muonCollectionH = iEvent.getHandle(muonsToken);
62  if (ignoreMissingMuonCollection && !muonCollectionH.isValid())
63  edm::LogVerbatim("MuonTrackProducer") << "\n ignoring missing muon collection.";
64 
65  else {
66  const DTRecSegment4DCollection &dtSegmentCollection = iEvent.get(inputDTRecSegment4DToken_);
67  const CSCSegmentCollection &cscSegmentCollection = iEvent.get(inputCSCSegmentToken_);
68 
69  const TrackerTopology &ttopo = iSetup.getData(ttopoToken_);
70 
71  std::unique_ptr<reco::TrackCollection> selectedTracks(new reco::TrackCollection);
72  std::unique_ptr<reco::TrackExtraCollection> selectedTrackExtras(new reco::TrackExtraCollection());
73  std::unique_ptr<TrackingRecHitCollection> selectedTrackHits(new TrackingRecHitCollection());
74 
78 
81 
82  edm::LogVerbatim("MuonTrackProducer") << "\nThere are " << dtSegmentCollection.size() << " DT segments.";
83  unsigned int index_dt_segment = 0;
84  for (DTRecSegment4DCollection::const_iterator segment = dtSegmentCollection.begin();
85  segment != dtSegmentCollection.end();
86  ++segment, index_dt_segment++) {
87  LocalPoint segmentLocalPosition = segment->localPosition();
88  LocalVector segmentLocalDirection = segment->localDirection();
89  LocalError segmentLocalPositionError = segment->localPositionError();
90  LocalError segmentLocalDirectionError = segment->localDirectionError();
91  DetId geoid = segment->geographicalId();
92  DTChamberId dtdetid = DTChamberId(geoid);
93  int wheel = dtdetid.wheel();
94  int station = dtdetid.station();
95  int sector = dtdetid.sector();
96 
97  float segmentX = segmentLocalPosition.x();
98  float segmentY = segmentLocalPosition.y();
99  float segmentdXdZ = segmentLocalDirection.x() / segmentLocalDirection.z();
100  float segmentdYdZ = segmentLocalDirection.y() / segmentLocalDirection.z();
101  float segmentXerr = sqrt(segmentLocalPositionError.xx());
102  float segmentYerr = sqrt(segmentLocalPositionError.yy());
103  float segmentdXdZerr = sqrt(segmentLocalDirectionError.xx());
104  float segmentdYdZerr = sqrt(segmentLocalDirectionError.yy());
105 
106  edm::LogVerbatim("MuonTrackProducer")
107  << "\nDT segment index :" << index_dt_segment << "\nchamber Wh:" << wheel << ",St:" << station
108  << ",Se:" << sector << "\nLocal Position (X,Y)=(" << segmentX << "," << segmentY << ") +/- (" << segmentXerr
109  << "," << segmentYerr << "), "
110  << "Local Direction (dXdZ,dYdZ)=(" << segmentdXdZ << "," << segmentdYdZ << ") +/- (" << segmentdXdZerr << ","
111  << segmentdYdZerr << ")";
112  }
113 
114  edm::LogVerbatim("MuonTrackProducer") << "\nThere are " << cscSegmentCollection.size() << " CSC segments.";
115  unsigned int index_csc_segment = 0;
116  for (CSCSegmentCollection::const_iterator segment = cscSegmentCollection.begin();
117  segment != cscSegmentCollection.end();
118  ++segment, index_csc_segment++) {
119  LocalPoint segmentLocalPosition = segment->localPosition();
120  LocalVector segmentLocalDirection = segment->localDirection();
121  LocalError segmentLocalPositionError = segment->localPositionError();
122  LocalError segmentLocalDirectionError = segment->localDirectionError();
123 
124  DetId geoid = segment->geographicalId();
125  CSCDetId cscdetid = CSCDetId(geoid);
126  int endcap = cscdetid.endcap();
127  int station = cscdetid.station();
128  int ring = cscdetid.ring();
129  int chamber = cscdetid.chamber();
130 
131  float segmentX = segmentLocalPosition.x();
132  float segmentY = segmentLocalPosition.y();
133  float segmentdXdZ = segmentLocalDirection.x() / segmentLocalDirection.z();
134  float segmentdYdZ = segmentLocalDirection.y() / segmentLocalDirection.z();
135  float segmentXerr = sqrt(segmentLocalPositionError.xx());
136  float segmentYerr = sqrt(segmentLocalPositionError.yy());
137  float segmentdXdZerr = sqrt(segmentLocalDirectionError.xx());
138  float segmentdYdZerr = sqrt(segmentLocalDirectionError.yy());
139 
140  edm::LogVerbatim("MuonTrackProducer")
141  << "\nCSC segment index :" << index_csc_segment << "\nchamber Endcap:" << endcap << ",St:" << station
142  << ",Ri:" << ring << ",Ch:" << chamber << "\nLocal Position (X,Y)=(" << segmentX << "," << segmentY
143  << ") +/- (" << segmentXerr << "," << segmentYerr << "), "
144  << "Local Direction (dXdZ,dYdZ)=(" << segmentdXdZ << "," << segmentdYdZ << ") +/- (" << segmentdXdZerr << ","
145  << segmentdYdZerr << ")";
146  }
147 
148  edm::LogVerbatim("MuonTrackProducer") << "\nThere are " << muonCollectionH->size() << " reco::Muons.";
149  unsigned int muon_index = 0;
150  for (reco::MuonCollection::const_iterator muon = muonCollectionH->begin(); muon != muonCollectionH->end();
151  ++muon, muon_index++) {
152  edm::LogVerbatim("MuonTrackProducer") << "\n******* muon index : " << muon_index;
153 
154  const bool isGoodResult =
155  std::all_of(selectionTags.begin(), selectionTags.end(), [&muon](const std::string &name) {
157  return muon::isGoodMuon(*muon, muonType);
158  });
159 
160  if (isGoodResult) {
161  // new copy of Track
162  reco::TrackRef trackref;
163  bool addMatchedMuonSegments = false;
164 
165  if (trackType == "innerTrack") {
166  if (muon->innerTrack().isNonnull())
167  trackref = muon->innerTrack();
168  else
169  continue;
170  } else if (trackType == "outerTrack") {
171  if (muon->outerTrack().isNonnull())
172  trackref = muon->outerTrack();
173  else
174  continue;
175  } else if (trackType == "globalTrack") {
176  if (muon->globalTrack().isNonnull())
177  trackref = muon->globalTrack();
178  else
179  continue;
180  } else if (trackType == "innerTrackPlusSegments") {
181  if (muon->innerTrack().isNonnull()) {
182  trackref = muon->innerTrack();
183  addMatchedMuonSegments = true;
184  } else
185  continue;
186  } else if (trackType == "rpcMuonTrack") {
187  if (muon->innerTrack().isNonnull() && muon->isRPCMuon()) {
188  trackref = muon->innerTrack();
189  } else
190  continue;
191  } else if (trackType == "gemMuonTrack") {
192  if (muon->innerTrack().isNonnull() && muon->isGEMMuon()) {
193  trackref = muon->innerTrack();
194  } else
195  continue;
196  } else if (trackType == "me0MuonTrack") {
197  if (muon->innerTrack().isNonnull() && muon->isME0Muon()) {
198  trackref = muon->innerTrack();
199  } else
200  continue;
201  } else if (trackType == "tunepTrack") {
202  if (muon->isGlobalMuon() && muon->tunePMuonBestTrack().isNonnull())
203  trackref = muon->tunePMuonBestTrack();
204  else
205  continue;
206  } else if (trackType == "pfTrack") {
207  if (muon->isPFMuon() && muon->muonBestTrack().isNonnull())
208  trackref = muon->muonBestTrack();
209  else
210  continue;
211  } else if (trackType == "recomuonTrack") {
212  if (muon->muonBestTrackType() != muon->tunePMuonBestTrackType())
213  edm::LogVerbatim("MuonTrackProducer") << "\n *** PF != TuneP *** \n" << std::endl;
214 
215  edm::LogVerbatim("MuonTrackProducer") << "isGlobal ? " << muon->isGlobalMuon() << std::endl;
216  edm::LogVerbatim("MuonTrackProducer")
217  << "isTracker ? " << muon->isTrackerMuon() << ", isRPC ? " << muon->isRPCMuon() << ", isGEM ? "
218  << muon->isGEMMuon() << ", isME0 ? " << muon->isME0Muon() << std::endl;
219  edm::LogVerbatim("MuonTrackProducer") << "isStandAlone ? " << muon->isStandAloneMuon() << std::endl;
220  edm::LogVerbatim("MuonTrackProducer") << "isCalo ? " << muon->isCaloMuon() << std::endl;
221  edm::LogVerbatim("MuonTrackProducer") << "isPF ? " << muon->isPFMuon() << std::endl << std::endl;
222 
223  edm::LogVerbatim("MuonTrackProducer")
224  << " enum MuonTrackType {None, InnerTrack, OuterTrack, CombinedTrack, TPFMS, Picky, DYT }" << std::endl;
225 
226  edm::LogVerbatim("MuonTrackProducer")
227  << "(muon) pt = " << muon->pt() << ", eta = " << muon->eta() << ", phi = " << muon->phi() << std::endl;
228 
229  if (muon->muonBestTrack().isNonnull())
230  edm::LogVerbatim("MuonTrackProducer")
231  << "(best) pt = " << muon->muonBestTrack()->pt() << ", eta = " << muon->muonBestTrack()->eta()
232  << ", phi = " << muon->muonBestTrack()->phi()
233  << ", N mu hits = " << muon->muonBestTrack()->hitPattern().numberOfValidMuonHits()
234  << ", N trk hits = " << muon->muonBestTrack()->hitPattern().numberOfValidTrackerHits()
235  << ", MuonTrackType = " << muon->muonBestTrackType() << std::endl;
236  if (muon->tunePMuonBestTrack().isNonnull())
237  edm::LogVerbatim("MuonTrackProducer")
238  << "(tuneP) pt = " << muon->tunePMuonBestTrack()->pt()
239  << ", eta = " << muon->tunePMuonBestTrack()->eta() << ", phi = " << muon->tunePMuonBestTrack()->phi()
240  << ", N mu hits = " << muon->tunePMuonBestTrack()->hitPattern().numberOfValidMuonHits()
241  << ", N trk hits = " << muon->tunePMuonBestTrack()->hitPattern().numberOfValidTrackerHits()
242  << ", MuonTrackType = " << muon->tunePMuonBestTrackType() << std::endl;
243  if (muon->innerTrack().isNonnull())
244  edm::LogVerbatim("MuonTrackProducer")
245  << "(inner) pt = " << muon->innerTrack()->pt() << ", eta = " << muon->innerTrack()->eta()
246  << ", phi = " << muon->innerTrack()->phi()
247  << ", N trk hits = " << muon->innerTrack()->hitPattern().numberOfValidTrackerHits() << std::endl;
248  if (muon->globalTrack().isNonnull())
249  edm::LogVerbatim("MuonTrackProducer")
250  << "(global) pt = " << muon->globalTrack()->pt() << ", eta = " << muon->globalTrack()->eta()
251  << ", phi = " << muon->globalTrack()->phi()
252  << ", N mu hits = " << muon->globalTrack()->hitPattern().numberOfValidMuonHits()
253  << ", N trk hits = " << muon->globalTrack()->hitPattern().numberOfValidTrackerHits() << std::endl;
254  if (muon->outerTrack().isNonnull())
255  edm::LogVerbatim("MuonTrackProducer")
256  << "(outer) pt = " << muon->outerTrack()->pt() << ", eta = " << muon->outerTrack()->eta()
257  << ", phi = " << muon->outerTrack()->phi()
258  << ", N mu hits = " << muon->outerTrack()->hitPattern().numberOfValidMuonHits() << std::endl;
259  if (muon->tpfmsTrack().isNonnull())
260  edm::LogVerbatim("MuonTrackProducer")
261  << "(tpfms) pt = " << muon->tpfmsTrack()->pt() << ", eta = " << muon->tpfmsTrack()->eta()
262  << ", phi = " << muon->tpfmsTrack()->phi()
263  << ", N mu hits = " << muon->tpfmsTrack()->hitPattern().numberOfValidMuonHits()
264  << ", N trk hits = " << muon->tpfmsTrack()->hitPattern().numberOfValidTrackerHits() << std::endl;
265  if (muon->pickyTrack().isNonnull())
266  edm::LogVerbatim("MuonTrackProducer")
267  << "(picky) pt = " << muon->pickyTrack()->pt() << ", eta = " << muon->pickyTrack()->eta()
268  << ", phi = " << muon->pickyTrack()->phi()
269  << ", N mu hits = " << muon->pickyTrack()->hitPattern().numberOfValidMuonHits()
270  << ", N trk hits = " << muon->pickyTrack()->hitPattern().numberOfValidTrackerHits() << std::endl;
271  if (muon->dytTrack().isNonnull())
272  edm::LogVerbatim("MuonTrackProducer")
273  << "(dyt) pt = " << muon->dytTrack()->pt() << ", eta = " << muon->dytTrack()->eta()
274  << ", phi = " << muon->dytTrack()->phi()
275  << ", N mu hits = " << muon->dytTrack()->hitPattern().numberOfValidMuonHits()
276  << ", N trk hits = " << muon->dytTrack()->hitPattern().numberOfValidTrackerHits() << std::endl;
277 
278  if (muon->isGlobalMuon() && muon->globalTrack()->hitPattern().numberOfValidMuonHits() > 0)
279  trackref = muon->globalTrack();
280  else if (muon->isTrackerMuon()) {
281  trackref = muon->innerTrack();
282  addMatchedMuonSegments = true;
283  } else if (muon->isPFMuon())
284  trackref = muon->muonBestTrack();
285  else if (muon->isStandAloneMuon())
286  trackref = muon->outerTrack();
287  else if (muon->isRPCMuon())
288  trackref = muon->innerTrack();
289  else if (muon->isGEMMuon())
290  trackref = muon->innerTrack();
291  else if (muon->isME0Muon())
292  trackref = muon->innerTrack();
293  else
294  trackref = muon->muonBestTrack();
295  }
296 
297  edm::LogVerbatim("MuonTrackProducer") << "\t *** Selected *** ";
298  const reco::Track *trk = &(*trackref);
299  // pointer to old track:
300  std::unique_ptr<reco::Track> newTrk(new reco::Track(*trk));
301 
302  newTrk->setExtra(reco::TrackExtraRef(rTrackExtras, idx++));
303  PropagationDirection seedDir = trk->seedDirection();
304  // new copy of track Extras
305  std::unique_ptr<reco::TrackExtra> newExtra(new reco::TrackExtra(trk->outerPosition(),
306  trk->outerMomentum(),
307  trk->outerOk(),
308  trk->innerPosition(),
309  trk->innerMomentum(),
310  trk->innerOk(),
311  trk->outerStateCovariance(),
312  trk->outerDetId(),
313  trk->innerStateCovariance(),
314  trk->innerDetId(),
315  seedDir));
316 
317  // new copy of the silicon hits; add hit refs to Extra and hits to hit
318  // collection
319 
320  // edm::LogVerbatim("MuonTrackProducer")<<"\n printing initial
321  // hit_pattern"; trk->hitPattern().print();
322  unsigned int nHitsToAdd = 0;
323  for (trackingRecHit_iterator iHit = trk->recHitsBegin(); iHit != trk->recHitsEnd(); iHit++) {
324  TrackingRecHit *hit = (*iHit)->clone();
325  selectedTrackHits->push_back(hit);
326  ++nHitsToAdd;
327  }
328 
329  if (addMatchedMuonSegments) {
330  int wheel, station, sector;
331  int endcap, /*station, */ ring, chamber;
332 
333  edm::LogVerbatim("MuonTrackProducer")
334  << "Number of chambers: " << muon->matches().size()
335  << ", arbitrated: " << muon->numberOfMatches(reco::Muon::SegmentAndTrackArbitration);
336  unsigned int index_chamber = 0;
337 
338  for (std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
339  chamberMatch != muon->matches().end();
340  ++chamberMatch, index_chamber++) {
341  std::stringstream chamberStr;
342  chamberStr << "\nchamber index: " << index_chamber;
343 
344  int subdet = chamberMatch->detector();
345  DetId did = chamberMatch->id;
346 
347  if (subdet == MuonSubdetId::DT) {
348  DTChamberId dtdetid = DTChamberId(did);
349  wheel = dtdetid.wheel();
350  station = dtdetid.station();
351  sector = dtdetid.sector();
352  chamberStr << ", DT chamber Wh:" << wheel << ",St:" << station << ",Se:" << sector;
353  } else if (subdet == MuonSubdetId::CSC) {
354  CSCDetId cscdetid = CSCDetId(did);
355  endcap = cscdetid.endcap();
356  station = cscdetid.station();
357  ring = cscdetid.ring();
358  chamber = cscdetid.chamber();
359  chamberStr << ", CSC chamber End:" << endcap << ",St:" << station << ",Ri:" << ring << ",Ch:" << chamber;
360  }
361 
362  chamberStr << ", Number of segments: " << chamberMatch->segmentMatches.size();
363  edm::LogVerbatim("MuonTrackProducer") << chamberStr.str();
364 
365  unsigned int index_segment = 0;
366 
367  for (std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch =
368  chamberMatch->segmentMatches.begin();
369  segmentMatch != chamberMatch->segmentMatches.end();
370  ++segmentMatch, index_segment++) {
371  float segmentX = segmentMatch->x;
372  float segmentY = segmentMatch->y;
373  float segmentdXdZ = segmentMatch->dXdZ;
374  float segmentdYdZ = segmentMatch->dYdZ;
375  float segmentXerr = segmentMatch->xErr;
376  float segmentYerr = segmentMatch->yErr;
377  float segmentdXdZerr = segmentMatch->dXdZErr;
378  float segmentdYdZerr = segmentMatch->dYdZErr;
379 
380  CSCSegmentRef segmentCSC = segmentMatch->cscSegmentRef;
381  DTRecSegment4DRef segmentDT = segmentMatch->dtSegmentRef;
382 
383  bool segment_arbitrated_Ok = (segmentMatch->isMask(reco::MuonSegmentMatch::BestInChamberByDR) &&
384  segmentMatch->isMask(reco::MuonSegmentMatch::BelongsToTrackByDR));
385 
386  std::string ARBITRATED(" ***Arbitrated Off*** ");
387  if (segment_arbitrated_Ok)
388  ARBITRATED = " ***ARBITRATED OK*** ";
389 
390  if (subdet == MuonSubdetId::DT) {
391  edm::LogVerbatim("MuonTrackProducer")
392  << "\n\t segment index: " << index_segment << ARBITRATED << "\n\t Local Position (X,Y)=("
393  << segmentX << "," << segmentY << ") +/- (" << segmentXerr << "," << segmentYerr << "), "
394  << "\n\t Local Direction (dXdZ,dYdZ)=(" << segmentdXdZ << "," << segmentdYdZ << ") +/- ("
395  << segmentdXdZerr << "," << segmentdYdZerr << ")";
396 
397  if (!segment_arbitrated_Ok)
398  continue;
399 
400  if (segmentDT.get() != nullptr) {
401  const DTRecSegment4D *segment = segmentDT.get();
402 
403  edm::LogVerbatim("MuonTrackProducer")
404  << "\t ===> MATCHING with DT segment with index = " << segmentDT.key();
405 
406  if (segment->hasPhi()) {
407  const DTChamberRecSegment2D *phiSeg = segment->phiSegment();
408  std::vector<const TrackingRecHit *> phiHits = phiSeg->recHits();
409  for (std::vector<const TrackingRecHit *>::const_iterator ihit = phiHits.begin();
410  ihit != phiHits.end();
411  ++ihit) {
412  TrackingRecHit *seghit = (*ihit)->clone();
413  newTrk->appendHitPattern(*seghit, ttopo);
414  // edm::LogVerbatim("MuonTrackProducer")<<"hit
415  // pattern for position "<<index_hit<<" set to:";
416  // newTrk->hitPattern().printHitPattern(index_hit,
417  // std::cout);
418  selectedTrackHits->push_back(seghit);
419  ++nHitsToAdd;
420  }
421  }
422 
423  if (segment->hasZed()) {
424  const DTSLRecSegment2D *zSeg = (*segment).zSegment();
425  std::vector<const TrackingRecHit *> zedHits = zSeg->recHits();
426  for (std::vector<const TrackingRecHit *>::const_iterator ihit = zedHits.begin();
427  ihit != zedHits.end();
428  ++ihit) {
429  TrackingRecHit *seghit = (*ihit)->clone();
430  newTrk->appendHitPattern(*seghit, ttopo);
431  // edm::LogVerbatim("MuonTrackProducer")<<"hit
432  // pattern for position "<<index_hit<<" set to:";
433  // newTrk->hitPattern().printHitPattern(index_hit,
434  // std::cout);
435  selectedTrackHits->push_back(seghit);
436  ++nHitsToAdd;
437  }
438  }
439  } else
440  edm::LogWarning("MuonTrackProducer") << "\n***WARNING: UNMATCHED DT segment ! \n";
441  } // if (subdet == MuonSubdetId::DT)
442 
443  else if (subdet == MuonSubdetId::CSC) {
444  edm::LogVerbatim("MuonTrackProducer")
445  << "\n\t segment index: " << index_segment << ARBITRATED << "\n\t Local Position (X,Y)=("
446  << segmentX << "," << segmentY << ") +/- (" << segmentXerr << "," << segmentYerr << "), "
447  << "\n\t Local Direction (dXdZ,dYdZ)=(" << segmentdXdZ << "," << segmentdYdZ << ") +/- ("
448  << segmentdXdZerr << "," << segmentdYdZerr << ")";
449 
450  if (!segment_arbitrated_Ok)
451  continue;
452 
453  if (segmentCSC.get() != nullptr) {
454  const CSCSegment *segment = segmentCSC.get();
455 
456  edm::LogVerbatim("MuonTrackProducer")
457  << "\t ===> MATCHING with CSC segment with index = " << segmentCSC.key();
458 
459  std::vector<const TrackingRecHit *> hits = segment->recHits();
460  for (std::vector<const TrackingRecHit *>::const_iterator ihit = hits.begin(); ihit != hits.end();
461  ++ihit) {
462  TrackingRecHit *seghit = (*ihit)->clone();
463  newTrk->appendHitPattern(*seghit, ttopo);
464  // edm::LogVerbatim("MuonTrackProducer")<<"hit
465  // pattern for position "<<index_hit<<" set to:";
466  // newTrk->hitPattern().printHitPattern(index_hit,
467  // std::cout);
468  selectedTrackHits->push_back(seghit);
469  ++nHitsToAdd;
470  }
471  } else
472  edm::LogWarning("MuonTrackProducer") << "\n***WARNING: UNMATCHED CSC segment ! \n";
473  } // else if (subdet == MuonSubdetId::CSC)
474 
475  } // loop on vector<MuonSegmentMatch>
476  } // loop on vector<MuonChamberMatch>
477  } // if (trackType == "innerTrackPlusSegments")
478 
479  // edm::LogVerbatim("MuonTrackProducer")<<"\n printing final
480  // hit_pattern"; newTrk->hitPattern().print();
481 
482  newExtra->setHits(rHits, hidx, nHitsToAdd);
483  hidx += nHitsToAdd;
484 
485  selectedTracks->push_back(*newTrk);
486  selectedTrackExtras->push_back(*newExtra);
487 
488  } // if (isGoodResult)
489  } // loop on reco::MuonCollection
490 
491  iEvent.put(std::move(selectedTracks));
492  iEvent.put(std::move(selectedTrackExtras));
493  iEvent.put(std::move(selectedTrackHits));
494  }
495 }
496 
int chamber() const
Definition: CSCDetId.h:62
Log< level::Info, true > LogVerbatim
float xx() const
Definition: LocalError.h:22
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: CSCSegment.cc:32
edm::EDGetTokenT< DTRecSegment4DCollection > inputDTRecSegment4DToken_
std::vector< std::string > selectionTags
std::string dump(unsigned int indent=0) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
edm::EDGetTokenT< reco::MuonCollection > muonsToken
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
T y() const
Definition: PV3DBase.h:60
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:53
PropagationDirection
key_type key() const
Accessor for product key.
Definition: Ref.h:250
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:62
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
SelectionType
Selector type.
Definition: MuonSelectors.h:18
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:56
int endcap() const
Definition: CSCDetId.h:85
bool getData(T &iHolder) const
Definition: EventSetup.h:128
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
int iEvent
Definition: GenABIO.cc:224
float yy() const
Definition: LocalError.h:24
T sqrt(T t)
Definition: SSEVec.h:19
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
Definition: Track.h:68
T z() const
Definition: PV3DBase.h:61
def move
Definition: eostools.py:511
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:79
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
static const unsigned int BestInChamberByDR
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
bool hasPhi() const
Does it have the Phi projection?
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:88
bool isValid() const
Definition: HandleBase.h:70
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
virtual TrackingRecHit * clone() const =0
MuonTrackProducer(const edm::ParameterSet &)
int ring() const
Definition: CSCDetId.h:68
bool hasZed() const
Does it have the Z projection?
Definition: DetId.h:17
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:65
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:50
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:148
SelectionType selectionTypeFromString(const std::string &label)
Definition: MuonSelectors.cc:9
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
Definition: Track.h:71
static const unsigned int BelongsToTrackByDR
int sector() const
Definition: DTChamberId.h:49
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:59
int station() const
Definition: CSCDetId.h:79
static constexpr int DT
Definition: MuonSubdetId.h:11
Log< level::Warning, false > LogWarning
int station() const
Return the station number.
Definition: DTChamberId.h:42
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
static constexpr int CSC
Definition: MuonSubdetId.h:12
T x() const
Definition: PV3DBase.h:59
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:82
edm::EDGetTokenT< CSCSegmentCollection > inputCSCSegmentToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91