CMS 3D CMS Logo

GlobalMuonRefitter.cc
Go to the documentation of this file.
1 
18 
19 //---------------
20 // C++ Headers --
21 //---------------
22 
23 #include <iostream>
24 #include <iomanip>
25 #include <algorithm>
26 
27 //-------------------------------
28 // Collaborating Class Headers --
29 //-------------------------------
30 
32 
42 
57 
67 
68 using namespace std;
69 using namespace edm;
70 
71 //----------------
72 // Constructors --
73 //----------------
74 
78  : theCosmicFlag(par.getParameter<bool>("PropDirForCosmics")),
79  theDTRecHitLabel(par.getParameter<InputTag>("DTRecSegmentLabel")),
80  theCSCRecHitLabel(par.getParameter<InputTag>("CSCRecSegmentLabel")),
81  theGEMRecHitLabel(par.getParameter<InputTag>("GEMRecHitLabel")),
82  theME0RecHitLabel(par.getParameter<InputTag>("ME0RecHitLabel")),
83  theService(service) {
84  theCategory = par.getUntrackedParameter<string>("Category", "Muon|RecoMuon|GlobalMuon|GlobalMuonRefitter");
85 
86  theHitThreshold = par.getParameter<int>("HitThreshold");
87  theDTChi2Cut = par.getParameter<double>("Chi2CutDT");
88  theCSCChi2Cut = par.getParameter<double>("Chi2CutCSC");
89  theRPCChi2Cut = par.getParameter<double>("Chi2CutRPC");
90  theGEMChi2Cut = par.getParameter<double>("Chi2CutGEM");
91  theME0Chi2Cut = par.getParameter<double>("Chi2CutME0");
92 
93  // Refit direction
94  string refitDirectionName = par.getParameter<string>("RefitDirection");
95 
96  if (refitDirectionName == "insideOut")
98  else if (refitDirectionName == "outsideIn")
100  else
101  throw cms::Exception("TrackTransformer constructor")
102  << "Wrong refit direction chosen in TrackTransformer ParameterSet"
103  << "\n"
104  << "Possible choices are:"
105  << "\n"
106  << "RefitDirection = insideOut or RefitDirection = outsideIn";
107 
108  theFitterToken = iC.esConsumes(edm::ESInputTag("", par.getParameter<string>("Fitter")));
109  thePropagatorName = par.getParameter<string>("Propagator");
110 
111  theSkipStation = par.getParameter<int>("SkipStation");
112  theTrackerSkipSystem = par.getParameter<int>("TrackerSkipSystem");
113  theTrackerSkipSection = par.getParameter<int>("TrackerSkipSection"); //layer, wheel, or disk depending on the system
114 
115  theTrackerRecHitBuilderToken = iC.esConsumes(edm::ESInputTag("", par.getParameter<string>("TrackerRecHitBuilder")));
116  theMuonRecHitBuilderToken = iC.esConsumes(edm::ESInputTag("", par.getParameter<string>("MuonRecHitBuilder")));
117 
118  theRPCInTheFit = par.getParameter<bool>("RefitRPCHits");
119 
120  theDYTthrs = par.getParameter<std::vector<int> >("DYTthrs");
121  theDYTselector = par.getParameter<int>("DYTselector");
122  theDYTupdator = par.getParameter<bool>("DYTupdator");
123  theDYTuseAPE = par.getParameter<bool>("DYTuseAPE");
124  theDYTParThrsMode = par.getParameter<bool>("DYTuseThrsParametrization");
125  if (theDYTParThrsMode)
126  theDYTthrsParameters = par.getParameter<edm::ParameterSet>("DYTthrsParameters");
127  dytInfo = new reco::DYTInfo();
128 
129  if (par.existsAs<double>("RescaleErrorFactor")) {
130  theRescaleErrorFactor = par.getParameter<double>("RescaleErrorFactor");
131  edm::LogWarning("GlobalMuonRefitter") << "using error rescale factor " << theRescaleErrorFactor;
132  } else
133  theRescaleErrorFactor = 1000.;
134 
135  theCacheId_TRH = 0;
142 }
143 
144 //--------------
145 // Destructor --
146 //--------------
147 
149 
150 //
151 // set Event
152 //
154  theEvent = &event;
155  event.getByToken(theDTRecHitToken, theDTRecHits);
156  event.getByToken(theCSCRecHitToken, theCSCRecHits);
157  event.getByToken(theGEMRecHitToken, theGEMRecHits);
158  event.getByToken(theME0RecHitToken, theME0RecHits);
159  event.getByToken(CSCSegmentsToken, CSCSegments);
160  event.getByToken(all4DSegmentsToken, all4DSegments);
161 }
162 
164  theFitter = setup.getData(theFitterToken).clone();
165 
166  // Transient Rechit Builders
167  unsigned long long newCacheId_TRH = setup.get<TransientRecHitRecord>().cacheIdentifier();
168  if (newCacheId_TRH != theCacheId_TRH) {
169  LogDebug(theCategory) << "TransientRecHitRecord changed!";
172  hitCloner = static_cast<TkTransientTrackingRecHitBuilder const*>(theTrackerRecHitBuilder)->cloner();
173  }
174  theFitter->setHitCloner(&hitCloner);
175 }
176 
177 //
178 // build a combined tracker-muon trajectory
179 //
181  const int theMuonHitsOption,
182  const TrackerTopology* tTopo) const {
183  LogTrace(theCategory) << " *** GlobalMuonRefitter *** option " << theMuonHitsOption << endl;
184 
185  ConstRecHitContainer allRecHitsTemp; // all muon rechits temp
186 
187  reco::TransientTrack track(globalTrack, &*(theService->magneticField()), theService->trackingGeometry());
188 
189  auto tkbuilder = static_cast<TkTransientTrackingRecHitBuilder const*>(theTrackerRecHitBuilder);
190 
191  for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit)
192  if ((*hit)->isValid()) {
193  if ((*hit)->geographicalId().det() == DetId::Tracker)
194  allRecHitsTemp.push_back((**hit).cloneForFit(*tkbuilder->geometry()->idToDet((**hit).geographicalId())));
195  else if ((*hit)->geographicalId().det() == DetId::Muon) {
196  if ((*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit) {
197  LogTrace(theCategory) << "RPC Rec Hit discarged";
198  continue;
199  }
200  allRecHitsTemp.push_back(theMuonRecHitBuilder->build(&**hit));
201  }
202  }
203  vector<Trajectory> refitted = refit(globalTrack, track, allRecHitsTemp, theMuonHitsOption, tTopo);
204  return refitted;
205 }
206 
207 //
208 // build a combined tracker-muon trajectory
209 //
212  const TransientTrackingRecHit::ConstRecHitContainer& allRecHitsTemp,
213  const int theMuonHitsOption,
214  const TrackerTopology* tTopo) const {
215  // MuonHitsOption: 0 - tracker only
216  // 1 - include all muon hits
217  // 2 - include only first muon hit(s)
218  // 3 - include only selected muon hits
219  // 4 - redo pattern recognition with dynamic truncation
220 
221  vector<int> stationHits(4, 0);
222  map<DetId, int> hitMap;
223 
224  ConstRecHitContainer allRecHits; // all muon rechits
225  ConstRecHitContainer fmsRecHits; // only first muon rechits
226  ConstRecHitContainer selectedRecHits; // selected muon rechits
227  ConstRecHitContainer DYTRecHits; // rec hits from dynamic truncation algorithm
228 
229  LogTrace(theCategory) << " *** GlobalMuonRefitter *** option " << theMuonHitsOption << endl;
230  LogTrace(theCategory) << " Track momentum before refit: " << globalTrack.pt() << endl;
231  LogTrace(theCategory) << " Hits size before : " << allRecHitsTemp.size() << endl;
232 
233  allRecHits = getRidOfSelectStationHits(allRecHitsTemp, tTopo);
234  // printHits(allRecHits);
235  LogTrace(theCategory) << " Hits size: " << allRecHits.size() << endl;
236 
237  vector<Trajectory> outputTraj;
238 
239  if ((theMuonHitsOption == 1) || (theMuonHitsOption == 3) || (theMuonHitsOption == 4)) {
240  // refit the full track with all muon hits
241  vector<Trajectory> globalTraj = transform(globalTrack, track, allRecHits);
242 
243  if (globalTraj.empty()) {
244  LogTrace(theCategory) << "No trajectory from the TrackTransformer!" << endl;
245  return vector<Trajectory>();
246  }
247 
248  LogTrace(theCategory) << " Initial trajectory state: "
249  << globalTraj.front().lastMeasurement().updatedState().freeState()->parameters() << endl;
250 
251  if (theMuonHitsOption == 1)
252  outputTraj.push_back(globalTraj.front());
253 
254  if (theMuonHitsOption == 3) {
255  checkMuonHits(globalTrack, allRecHits, hitMap);
256  selectedRecHits = selectMuonHits(globalTraj.front(), hitMap);
257  LogTrace(theCategory) << " Selected hits size: " << selectedRecHits.size() << endl;
258  outputTraj = transform(globalTrack, track, selectedRecHits);
259  }
260 
261  if (theMuonHitsOption == 4) {
262  //
263  // DYT 2.0
264  //
266  dytRefit.setProd(all4DSegments, CSCSegments);
267  dytRefit.setSelector(theDYTselector);
268  dytRefit.setThr(theDYTthrs);
269  dytRefit.setUpdateState(theDYTupdator);
270  dytRefit.setUseAPE(theDYTuseAPE);
271  if (theDYTParThrsMode) {
274  dytRefit.setRecoP(globalTrack.p());
275  dytRefit.setRecoEta(globalTrack.eta());
276  }
277  DYTRecHits = dytRefit.filter(globalTraj.front());
278  dytInfo->CopyFrom(dytRefit.getDYTInfo());
279  if ((DYTRecHits.size() > 1) &&
280  (DYTRecHits.front()->globalPosition().mag() > DYTRecHits.back()->globalPosition().mag()))
281  stable_sort(DYTRecHits.begin(), DYTRecHits.end(), RecHitLessByDet(alongMomentum));
282  outputTraj = transform(globalTrack, track, DYTRecHits);
283  }
284 
285  } else if (theMuonHitsOption == 2) {
286  getFirstHits(globalTrack, allRecHits, fmsRecHits);
287  outputTraj = transform(globalTrack, track, fmsRecHits);
288  }
289 
290  if (!outputTraj.empty()) {
291  LogTrace(theCategory) << "Refitted pt: "
292  << outputTraj.front().firstMeasurement().updatedState().globalParameters().momentum().perp()
293  << endl;
294  return outputTraj;
295  } else {
296  LogTrace(theCategory) << "No refitted Tracks... " << endl;
297  return vector<Trajectory>();
298  }
299 }
300 
301 //
302 //
303 //
306  map<DetId, int>& hitMap) const {
307  LogTrace(theCategory) << " GlobalMuonRefitter::checkMuonHits " << endl;
308 
309  float coneSize = 20.0;
310 
311  // loop through all muon hits and calculate the maximum # of hits in each chamber
312  for (ConstRecHitContainer::const_iterator imrh = all.begin(); imrh != all.end(); imrh++) {
313  if ((*imrh != nullptr) && !(*imrh)->isValid())
314  continue;
315 
316  int detRecHits = 0;
317  MuonRecHitContainer dRecHits;
318 
319  DetId id = (*imrh)->geographicalId();
320  DetId chamberId;
321 
322  // Skip tracker hits
323  if (id.det() != DetId::Muon)
324  continue;
325 
326  if (id.subdetId() == MuonSubdetId::DT) {
327  DTChamberId did(id.rawId());
328  chamberId = did;
329 
330  if ((*imrh)->dimension() > 1) {
331  std::vector<const TrackingRecHit*> hits2d = (*imrh)->recHits();
332  for (std::vector<const TrackingRecHit*>::const_iterator hit2d = hits2d.begin(); hit2d != hits2d.end();
333  hit2d++) {
334  if ((*hit2d)->dimension() > 1) {
335  std::vector<const TrackingRecHit*> hits1d = (*hit2d)->recHits();
336  for (std::vector<const TrackingRecHit*>::const_iterator hit1d = hits1d.begin(); hit1d != hits1d.end();
337  hit1d++) {
338  DetId id1 = (*hit1d)->geographicalId();
339  DTLayerId lid(id1.rawId());
340  // Get the 1d DT RechHits from this layer
341  DTRecHitCollection::range dRecHits = theDTRecHits->get(lid);
342  int layerHits = 0;
343  for (DTRecHitCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++) {
344  double rhitDistance = fabs(ir->localPosition().x() - (**hit1d).localPosition().x());
345  if (rhitDistance < coneSize)
346  layerHits++;
347  LogTrace(theCategory) << " " << (ir)->localPosition() << " " << (**hit1d).localPosition()
348  << " Distance: " << rhitDistance << " recHits: " << layerHits
349  << " SL: " << lid.superLayer() << endl;
350  }
351  if (layerHits > detRecHits)
352  detRecHits = layerHits;
353  }
354  } else {
355  DTLayerId lid(id.rawId());
356  // Get the 1d DT RechHits from this layer
357  DTRecHitCollection::range dRecHits = theDTRecHits->get(lid);
358  for (DTRecHitCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++) {
359  double rhitDistance = fabs(ir->localPosition().x() - (**imrh).localPosition().x());
360  if (rhitDistance < coneSize)
361  detRecHits++;
362  LogTrace(theCategory) << " " << (ir)->localPosition() << " " << (**imrh).localPosition()
363  << " Distance: " << rhitDistance << " recHits: " << detRecHits << endl;
364  }
365  }
366  }
367 
368  } else {
369  DTLayerId lid(id.rawId());
370 
371  // Get the 1d DT RechHits from this layer
372  DTRecHitCollection::range dRecHits = theDTRecHits->get(lid);
373 
374  for (DTRecHitCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++) {
375  double rhitDistance = fabs(ir->localPosition().x() - (**imrh).localPosition().x());
376  if (rhitDistance < coneSize)
377  detRecHits++;
378  LogTrace(theCategory) << " " << (ir)->localPosition() << " " << (**imrh).localPosition()
379  << " Distance: " << rhitDistance << " recHits: " << detRecHits << endl;
380  }
381  }
382  } // end of if DT
383  else if (id.subdetId() == MuonSubdetId::CSC) {
384  CSCDetId did(id.rawId());
385  chamberId = did.chamberId();
386 
387  if ((*imrh)->recHits().size() > 1) {
388  std::vector<const TrackingRecHit*> hits2d = (*imrh)->recHits();
389  for (std::vector<const TrackingRecHit*>::const_iterator hit2d = hits2d.begin(); hit2d != hits2d.end();
390  hit2d++) {
391  DetId id1 = (*hit2d)->geographicalId();
392  CSCDetId lid(id1.rawId());
393 
394  // Get the CSC Rechits from this layer
395  CSCRecHit2DCollection::range dRecHits = theCSCRecHits->get(lid);
396  int layerHits = 0;
397 
398  for (CSCRecHit2DCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++) {
399  double rhitDistance = (ir->localPosition() - (**hit2d).localPosition()).mag();
400  if (rhitDistance < coneSize)
401  layerHits++;
402  LogTrace(theCategory) << ir->localPosition() << " " << (**hit2d).localPosition()
403  << " Distance: " << rhitDistance << " recHits: " << layerHits << endl;
404  }
405  if (layerHits > detRecHits)
406  detRecHits = layerHits;
407  }
408  } else {
409  // Get the CSC Rechits from this layer
410  CSCRecHit2DCollection::range dRecHits = theCSCRecHits->get(did);
411 
412  for (CSCRecHit2DCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++) {
413  double rhitDistance = (ir->localPosition() - (**imrh).localPosition()).mag();
414  if (rhitDistance < coneSize)
415  detRecHits++;
416  LogTrace(theCategory) << ir->localPosition() << " " << (**imrh).localPosition()
417  << " Distance: " << rhitDistance << " recHits: " << detRecHits << endl;
418  }
419  }
420  } //end of CSC if
421  else if (id.subdetId() == MuonSubdetId::GEM) {
422  GEMDetId did(id.rawId());
423  chamberId = did.chamberId();
424 
425  if ((*imrh)->recHits().size() > 1) {
426  std::vector<const TrackingRecHit*> hits2d = (*imrh)->recHits();
427  for (std::vector<const TrackingRecHit*>::const_iterator hit2d = hits2d.begin(); hit2d != hits2d.end();
428  hit2d++) {
429  DetId id1 = (*hit2d)->geographicalId();
430  GEMDetId lid(id1.rawId());
431 
432  // Get the GEM Rechits from this layer
433  GEMRecHitCollection::range dRecHits = theGEMRecHits->get(lid);
434  int layerHits = 0;
435 
436  for (GEMRecHitCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++) {
437  double rhitDistance = (ir->localPosition() - (**hit2d).localPosition()).mag();
438  if (rhitDistance < coneSize)
439  layerHits++;
440  LogTrace(theCategory) << ir->localPosition() << " " << (**hit2d).localPosition()
441  << " Distance: " << rhitDistance << " recHits: " << layerHits << endl;
442  }
443  if (layerHits > detRecHits)
444  detRecHits = layerHits;
445  }
446  } else {
447  // Get the GEM Rechits from this layer
448  GEMRecHitCollection::range dRecHits = theGEMRecHits->get(did);
449 
450  for (GEMRecHitCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++) {
451  double rhitDistance = (ir->localPosition() - (**imrh).localPosition()).mag();
452  if (rhitDistance < coneSize)
453  detRecHits++;
454  LogTrace(theCategory) << ir->localPosition() << " " << (**imrh).localPosition()
455  << " Distance: " << rhitDistance << " recHits: " << detRecHits << endl;
456  }
457  }
458  } //end of GEM if
459  else if (id.subdetId() == MuonSubdetId::ME0) {
460  ME0DetId did(id.rawId());
461  chamberId = did.chamberId();
462 
463  if ((*imrh)->recHits().size() > 1) {
464  std::vector<const TrackingRecHit*> hits2d = (*imrh)->recHits();
465  for (std::vector<const TrackingRecHit*>::const_iterator hit2d = hits2d.begin(); hit2d != hits2d.end();
466  hit2d++) {
467  DetId id1 = (*hit2d)->geographicalId();
468  ME0DetId lid(id1.rawId());
469 
470  // Get the ME0 Rechits from this layer
471  ME0SegmentCollection::range dRecHits = theME0RecHits->get(lid);
472  int layerHits = 0;
473 
474  for (ME0SegmentCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++) {
475  double rhitDistance = (ir->localPosition() - (**hit2d).localPosition()).mag();
476  if (rhitDistance < coneSize)
477  layerHits++;
478  LogTrace(theCategory) << ir->localPosition() << " " << (**hit2d).localPosition()
479  << " Distance: " << rhitDistance << " recHits: " << layerHits << endl;
480  }
481  if (layerHits > detRecHits)
482  detRecHits = layerHits;
483  }
484  } else {
485  // Get the ME0 Rechits from this layer
486  ME0SegmentCollection::range dRecHits = theME0RecHits->get(did);
487 
488  for (ME0SegmentCollection::const_iterator ir = dRecHits.first; ir != dRecHits.second; ir++) {
489  double rhitDistance = (ir->localPosition() - (**imrh).localPosition()).mag();
490  if (rhitDistance < coneSize)
491  detRecHits++;
492  LogTrace(theCategory) << ir->localPosition() << " " << (**imrh).localPosition()
493  << " Distance: " << rhitDistance << " recHits: " << detRecHits << endl;
494  }
495  }
496  } //end of ME0 if
497  else {
498  if (id.subdetId() != MuonSubdetId::RPC)
499  LogError(theCategory) << " Wrong Hit Type ";
500  continue;
501  }
502 
503  map<DetId, int>::iterator imap = hitMap.find(chamberId);
504  if (imap != hitMap.end()) {
505  if (detRecHits > imap->second)
506  imap->second = detRecHits;
507  } else
508  hitMap[chamberId] = detRecHits;
509 
510  } // end of loop over muon rechits
511 
512  for (map<DetId, int>::iterator imap = hitMap.begin(); imap != hitMap.end(); imap++)
513  LogTrace(theCategory) << " Station " << imap->first.rawId() << ": " << imap->second << endl;
514 
515  LogTrace(theCategory) << "CheckMuonHits: " << all.size();
516 
517  // check order of muon measurements
518  if ((all.size() > 1) && (all.front()->globalPosition().mag() > all.back()->globalPosition().mag())) {
519  LogTrace(theCategory) << "reverse order: ";
520  stable_sort(all.begin(), all.end(), RecHitLessByDet(alongMomentum));
521  }
522 }
523 
524 //
525 // Get the hits from the first muon station (containing hits)
526 //
529  ConstRecHitContainer& first) const {
530  LogTrace(theCategory) << " GlobalMuonRefitter::getFirstHits\nall rechits length:" << all.size() << endl;
531  first.clear();
532 
533  int station_to_keep = 999;
534  vector<int> stations;
535  for (ConstRecHitContainer::const_iterator ihit = all.begin(); ihit != all.end(); ++ihit) {
536  int station = 0;
537  bool use_it = true;
538  DetId id = (*ihit)->geographicalId();
539  unsigned raw_id = id.rawId();
540  if (!(*ihit)->isValid())
541  station = -1;
542  else {
543  if (id.det() == DetId::Muon) {
544  switch (id.subdetId()) {
545  case MuonSubdetId::DT:
546  station = DTChamberId(raw_id).station();
547  break;
548  case MuonSubdetId::CSC:
549  station = CSCDetId(raw_id).station();
550  break;
551  case MuonSubdetId::GEM:
552  station = GEMDetId(raw_id).station();
553  break;
554  case MuonSubdetId::ME0:
555  station = ME0DetId(raw_id).station();
556  break;
557  case MuonSubdetId::RPC:
558  station = RPCDetId(raw_id).station();
559  use_it = false;
560  break;
561  }
562  }
563  }
564 
565  if (use_it && station > 0 && station < station_to_keep)
566  station_to_keep = station;
567  stations.push_back(station);
568  LogTrace(theCategory) << "rawId: " << raw_id << " station = " << station << " station_to_keep is now "
569  << station_to_keep;
570  }
571 
572  if (station_to_keep <= 0 || station_to_keep > 4 || stations.size() != all.size())
573  LogInfo(theCategory) << "failed to getFirstHits (all muon hits are outliers/bad ?)! station_to_keep = "
574  << station_to_keep << " stations.size " << stations.size() << " all.size " << all.size();
575 
576  for (unsigned i = 0; i < stations.size(); ++i)
577  if (stations[i] >= 0 && stations[i] <= station_to_keep)
578  first.push_back(all[i]);
579 
580  return;
581 }
582 
583 //
584 // select muon hits compatible with trajectory;
585 // check hits in chambers with showers
586 //
588  const map<DetId, int>& hitMap) const {
589  ConstRecHitContainer muonRecHits;
590  const double globalChi2Cut = 200.0;
591 
592  vector<TrajectoryMeasurement> muonMeasurements = traj.measurements();
593 
594  // loop through all muon hits and skip hits with bad chi2 in chambers with high occupancy
595  for (std::vector<TrajectoryMeasurement>::const_iterator im = muonMeasurements.begin(); im != muonMeasurements.end();
596  im++) {
597  if (!(*im).recHit()->isValid())
598  continue;
599  if ((*im).recHit()->det()->geographicalId().det() != DetId::Muon) {
600  // if ( ( chi2ndf < globalChi2Cut ) )
601  muonRecHits.push_back((*im).recHit());
602  continue;
603  }
604  const MuonTransientTrackingRecHit* immrh = dynamic_cast<const MuonTransientTrackingRecHit*>((*im).recHit().get());
605 
606  DetId id = immrh->geographicalId();
607  DetId chamberId;
608  int threshold = 0;
609  double chi2Cut = 0.0;
610 
611  // get station of hit if it is in DT
612  if ((*immrh).isDT()) {
613  DTChamberId did(id.rawId());
614  chamberId = did;
617  }
618  // get station of hit if it is in CSC
619  else if ((*immrh).isCSC()) {
620  CSCDetId did(id.rawId());
621  chamberId = did.chamberId();
624  }
625  // get station of hit if it is in GEM
626  else if ((*immrh).isGEM()) {
627  GEMDetId did(id.rawId());
628  chamberId = did.chamberId();
631  }
632  // get station of hit if it is in ME0
633  else if ((*immrh).isME0()) {
634  ME0DetId did(id.rawId());
635  chamberId = did.chamberId();
638  }
639  // get station of hit if it is in RPC
640  else if ((*immrh).isRPC()) {
641  RPCDetId rpcid(id.rawId());
642  chamberId = rpcid;
645  } else
646  continue;
647 
648  double chi2ndf = (*im).estimate() / (*im).recHit()->dimension();
649 
650  bool keep = true;
651  map<DetId, int>::const_iterator imap = hitMap.find(chamberId);
652  if (imap != hitMap.end())
653  if (imap->second > threshold)
654  keep = false;
655 
656  if ((keep || (chi2ndf < chi2Cut)) && (chi2ndf < globalChi2Cut)) {
657  muonRecHits.push_back((*im).recHit());
658  } else {
659  LogTrace(theCategory) << "Skip hit: " << id.rawId() << " chi2=" << chi2ndf << " ( threshold: " << chi2Cut
660  << ") Det: " << imap->second << endl;
661  }
662  }
663 
664  // check order of rechits
665  reverse(muonRecHits.begin(), muonRecHits.end());
666  return muonRecHits;
667 }
668 
669 //
670 // print RecHits
671 //
673  LogTrace(theCategory) << "Used RecHits: " << hits.size();
674  for (ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++) {
675  if (!(*ir)->isValid()) {
676  LogTrace(theCategory) << "invalid RecHit";
677  continue;
678  }
679 
680  const GlobalPoint& pos = (*ir)->globalPosition();
681 
682  LogTrace(theCategory) << "r = " << sqrt(pos.x() * pos.x() + pos.y() * pos.y()) << " z = " << pos.z()
683  << " dimension = " << (*ir)->dimension()
684  << " det = " << (*ir)->det()->geographicalId().det()
685  << " subdet = " << (*ir)->det()->subDetector()
686  << " raw id = " << (*ir)->det()->geographicalId().rawId();
687  }
688 }
689 
690 //
691 // add Trajectory* to TrackCand if not already present
692 //
695  if (!recHits.empty()) {
696  ConstRecHitContainer::const_iterator frontHit = recHits.begin();
697  ConstRecHitContainer::const_iterator backHit = recHits.end() - 1;
698  while (!(*frontHit)->isValid() && frontHit != backHit) {
699  frontHit++;
700  }
701  while (!(*backHit)->isValid() && backHit != frontHit) {
702  backHit--;
703  }
704 
705  double rFirst = (*frontHit)->globalPosition().mag();
706  double rLast = (*backHit)->globalPosition().mag();
707 
708  if (rFirst < rLast)
709  return insideOut;
710  else if (rFirst > rLast)
711  return outsideIn;
712  else {
713  LogError(theCategory) << "Impossible determine the rechits order" << endl;
714  return undetermined;
715  }
716  } else {
717  LogError(theCategory) << "Impossible determine the rechits order" << endl;
718  return undetermined;
719  }
720 }
721 
722 //
723 // Convert Tracks into Trajectories with a given set of hits
724 //
725 vector<Trajectory> GlobalMuonRefitter::transform(
726  const reco::Track& newTrack,
728  const TransientTrackingRecHit::ConstRecHitContainer& urecHitsForReFit) const {
729  TransientTrackingRecHit::ConstRecHitContainer recHitsForReFit = urecHitsForReFit;
730  LogTrace(theCategory) << "GlobalMuonRefitter::transform: " << recHitsForReFit.size() << " hits:";
731  printHits(recHitsForReFit);
732 
733  if (recHitsForReFit.size() < 2)
734  return vector<Trajectory>();
735 
736  // Check the order of the rechits
737  RefitDirection recHitsOrder = checkRecHitsOrdering(recHitsForReFit);
738 
739  LogTrace(theCategory) << "checkRecHitsOrdering() returned " << recHitsOrder << ", theRefitDirection is "
740  << theRefitDirection << " (insideOut == " << insideOut << ", outsideIn == " << outsideIn << ")";
741 
742  // Reverse the order in the case of inconsistency between the fit direction and the rechit order
743  if (theRefitDirection != recHitsOrder)
744  reverse(recHitsForReFit.begin(), recHitsForReFit.end());
745 
746  // Even though we checked the rechits' ordering above, we may have
747  // already flipped them elsewhere (getFirstHits() is such a
748  // culprit). Use the global positions of the states and the desired
749  // refit direction to find the starting TSOS.
750  TrajectoryStateOnSurface firstTSOS, lastTSOS;
751  unsigned int innerId; //UNUSED: outerId;
752  bool order_swapped = track.outermostMeasurementState().globalPosition().mag() <
753  track.innermostMeasurementState().globalPosition().mag();
754  bool inner_is_first;
755  LogTrace(theCategory) << "order swapped? " << order_swapped;
756 
757  // Fill the starting state, depending on the ordering above.
758  if ((theRefitDirection == insideOut && !order_swapped) || (theRefitDirection == outsideIn && order_swapped)) {
759  innerId = newTrack.innerDetId();
760  //UNUSED: outerId = newTrack.outerDetId();
761  firstTSOS = track.innermostMeasurementState();
762  lastTSOS = track.outermostMeasurementState();
763  inner_is_first = true;
764  } else {
765  innerId = newTrack.outerDetId();
766  //UNUSED: outerId = newTrack.innerDetId();
767  firstTSOS = track.outermostMeasurementState();
768  lastTSOS = track.innermostMeasurementState();
769  inner_is_first = false;
770  }
771 
772  LogTrace(theCategory) << "firstTSOS: inner_is_first? " << inner_is_first << " globalPosition is "
773  << firstTSOS.globalPosition() << " innerId is " << innerId;
774 
775  if (!firstTSOS.isValid()) {
776  LogWarning(theCategory) << "Error wrong initial state!" << endl;
777  return vector<Trajectory>();
778  }
779 
780  firstTSOS.rescaleError(theRescaleErrorFactor);
781 
782  // This is the only way to get a TrajectorySeed with settable propagation direction
783  PTrajectoryStateOnDet garbage1;
785 
786  // These lines cause the code to ignore completely what was set
787  // above, and force propDir for tracks from collisions!
788  // if(propDir == alongMomentum && theRefitDirection == outsideIn) propDir=oppositeToMomentum;
789  // if(propDir == oppositeToMomentum && theRefitDirection == insideOut) propDir=alongMomentum;
790 
791  const TrajectoryStateOnSurface& tsosForDir = inner_is_first ? lastTSOS : firstTSOS;
792  PropagationDirection propDir =
793  (tsosForDir.globalPosition().basicVector().dot(tsosForDir.globalMomentum().basicVector()) > 0)
794  ? alongMomentum
796  LogTrace(theCategory) << "propDir based on firstTSOS x dot p is " << propDir << " (alongMomentum == " << alongMomentum
797  << ", oppositeToMomentum == " << oppositeToMomentum << ")";
798 
799  // Additional propagation diretcion determination logic for cosmic muons
800  if (theCosmicFlag) {
801  PropagationDirection propDir_first =
802  (firstTSOS.globalPosition().basicVector().dot(firstTSOS.globalMomentum().basicVector()) > 0)
803  ? alongMomentum
805  PropagationDirection propDir_last =
806  (lastTSOS.globalPosition().basicVector().dot(lastTSOS.globalMomentum().basicVector()) > 0) ? alongMomentum
808  LogTrace(theCategory) << "propDir_first " << propDir_first << ", propdir_last " << propDir_last << " : they "
809  << (propDir_first == propDir_last ? "agree" : "disagree");
810 
811  int y_count = 0;
812  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator it = recHitsForReFit.begin();
813  it != recHitsForReFit.end();
814  ++it) {
815  if ((*it)->globalPosition().y() > 0)
816  ++y_count;
817  else
818  --y_count;
819  }
820 
821  PropagationDirection propDir_ycount = alongMomentum;
822  if (y_count > 0) {
824  propDir_ycount = oppositeToMomentum;
825  else if (theRefitDirection == outsideIn)
826  propDir_ycount = alongMomentum;
827  } else {
829  propDir_ycount = alongMomentum;
830  else if (theRefitDirection == outsideIn)
831  propDir_ycount = oppositeToMomentum;
832  }
833 
834  LogTrace(theCategory) << "y_count = " << y_count << "; based on geometrically-outermost TSOS, propDir is "
835  << propDir << ": " << (propDir == propDir_ycount ? "agrees" : "disagrees")
836  << " with ycount determination";
837 
838  if (propDir_first != propDir_last) {
839  LogTrace(theCategory) << "since first/last disagreed, using y_count propDir";
840  propDir = propDir_ycount;
841  }
842  }
843 
844  TrajectorySeed seed(garbage1, garbage2, propDir);
845 
846  if (recHitsForReFit.front()->geographicalId() != DetId(innerId)) {
847  LogDebug(theCategory) << "Propagation occured" << endl;
848  LogTrace(theCategory) << "propagating firstTSOS at " << firstTSOS.globalPosition()
849  << " to first rechit with surface pos "
850  << recHitsForReFit.front()->det()->surface().toGlobal(LocalPoint(0, 0, 0));
851  firstTSOS =
852  theService->propagator(thePropagatorName)->propagate(firstTSOS, recHitsForReFit.front()->det()->surface());
853  if (!firstTSOS.isValid()) {
854  LogDebug(theCategory) << "Propagation error!" << endl;
855  return vector<Trajectory>();
856  }
857  }
858 
859  LogDebug(theCategory) << " GlobalMuonRefitter : theFitter " << propDir << endl;
860  LogDebug(theCategory) << " First TSOS: " << firstTSOS.globalPosition()
861  << " p=" << firstTSOS.globalMomentum() << " = " << firstTSOS.globalMomentum().mag() << endl;
862 
863  LogDebug(theCategory) << " Starting seed: "
864  << " nHits= " << seed.nHits() << " tsos: " << seed.startingState().parameters().position()
865  << " p=" << seed.startingState().parameters().momentum() << endl;
866 
867  LogDebug(theCategory) << " RecHits: " << recHitsForReFit.size() << endl;
868 
869  vector<Trajectory> trajectories = theFitter->fit(seed, recHitsForReFit, firstTSOS);
870 
871  if (trajectories.empty()) {
872  LogDebug(theCategory) << "No Track refitted!" << endl;
873  return vector<Trajectory>();
874  }
875  return trajectories;
876 }
877 
878 //
879 // Remove Selected Station Rec Hits
880 //
882  const ConstRecHitContainer& hits, const TrackerTopology* tTopo) const {
884  ConstRecHitContainer::const_iterator it = hits.begin();
885  for (; it != hits.end(); it++) {
886  DetId id = (*it)->geographicalId();
887 
888  //Check that this is a Muon hit that we're toying with -- else pass on this because the hacker is a moron / not careful
889 
890  if (id.det() == DetId::Tracker && theTrackerSkipSystem > 0) {
891  int layer = -999;
892  int disk = -999;
893  int wheel = -999;
894  if (id.subdetId() == theTrackerSkipSystem) {
895  // continue; //caveat that just removes the whole system from refitting
896 
897  if (theTrackerSkipSystem == PXB) {
898  layer = tTopo->pxbLayer(id);
899  }
900  if (theTrackerSkipSystem == TIB) {
901  layer = tTopo->tibLayer(id);
902  }
903 
904  if (theTrackerSkipSystem == TOB) {
905  layer = tTopo->tobLayer(id);
906  }
907  if (theTrackerSkipSystem == PXF) {
908  disk = tTopo->pxfDisk(id);
909  }
910  if (theTrackerSkipSystem == TID) {
911  wheel = tTopo->tidWheel(id);
912  }
913  if (theTrackerSkipSystem == TEC) {
914  wheel = tTopo->tecWheel(id);
915  }
916  if (theTrackerSkipSection >= 0 && layer == theTrackerSkipSection)
917  continue;
918  if (theTrackerSkipSection >= 0 && disk == theTrackerSkipSection)
919  continue;
921  continue;
922  }
923  }
924 
925  if (id.det() == DetId::Muon && theSkipStation) {
926  int station = -999;
927  //UNUSED: int wheel = -999;
928  if (id.subdetId() == MuonSubdetId::DT) {
929  DTChamberId did(id.rawId());
930  station = did.station();
931  //UNUSED: wheel = did.wheel();
932  } else if (id.subdetId() == MuonSubdetId::CSC) {
933  CSCDetId did(id.rawId());
934  station = did.station();
935  } else if (id.subdetId() == MuonSubdetId::GEM) {
936  GEMDetId did(id.rawId());
937  station = did.station();
938  } else if (id.subdetId() == MuonSubdetId::ME0) {
939  ME0DetId did(id.rawId());
940  station = did.station();
941  } else if (id.subdetId() == MuonSubdetId::RPC) {
942  RPCDetId rpcid(id.rawId());
943  station = rpcid.station();
944  }
945  if (station == theSkipStation)
946  continue;
947  }
948  results.push_back(*it);
949  }
950  return results;
951 }
GEMRecHitCollection
MuonSubdetId::GEM
static constexpr int GEM
Definition: MuonSubdetId.h:14
DynamicTruncation::setUpdateState
void setUpdateState(bool)
Definition: DynamicTruncation.cc:128
TrajectoryStateOnSurface.h
service
Definition: service.py:1
GlobalMuonRefitter::theRescaleErrorFactor
double theRescaleErrorFactor
Definition: GlobalMuonRefitter.h:162
GlobalMuonRefitter::transform
std::vector< Trajectory > transform(const reco::Track &newTrack, const reco::TransientTrack track, const TransientTrackingRecHit::ConstRecHitContainer &recHitsForReFit) const
refit the track with a new set of RecHits
Definition: GlobalMuonRefitter.cc:725
cutBasedMuonId_MuonPOG_V0_cff.globalTrack
globalTrack
Definition: cutBasedMuonId_MuonPOG_V0_cff.py:135
MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
reco::Track::outerDetId
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:79
ZMuMuCategoriesSequences_cff.chi2Cut
chi2Cut
Definition: ZMuMuCategoriesSequences_cff.py:141
electrons_cff.bool
bool
Definition: electrons_cff.py:393
CSCRecHit2DCollection
mps_fire.i
i
Definition: mps_fire.py:428
GlobalMuonRefitter.h
edm::ESInputTag
Definition: ESInputTag.h:87
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
GlobalMuonRefitter::theME0Chi2Cut
float theME0Chi2Cut
Definition: GlobalMuonRefitter.h:136
MessageLogger.h
RPCDetId::station
int station() const
Definition: RPCDetId.h:78
TrackExtraFwd.h
GlobalMuonRefitter::CSCSegments
edm::Handle< CSCSegmentCollection > CSCSegments
Definition: GlobalMuonRefitter.h:189
GEMRecHit.h
GlobalMuonRefitter::theME0RecHitToken
edm::EDGetTokenT< ME0SegmentCollection > theME0RecHitToken
Definition: GlobalMuonRefitter.h:150
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
DynamicTruncation::setThr
void setThr(const std::vector< int > &)
Definition: DynamicTruncation.cc:130
GlobalMuonRefitter::theCategory
std::string theCategory
Definition: GlobalMuonRefitter.h:124
GlobalMuonRefitter::checkMuonHits
void checkMuonHits(const reco::Track &, ConstRecHitContainer &, std::map< DetId, int > &) const
check muon RecHits, calculate chamber occupancy and select hits to be used in the final fit
Definition: GlobalMuonRefitter.cc:304
muon
Definition: MuonCocktails.h:17
GlobalMuonRefitter::theGEMRecHitToken
edm::EDGetTokenT< GEMRecHitCollection > theGEMRecHitToken
Definition: GlobalMuonRefitter.h:149
DynamicTruncation::setProd
void setProd(const edm::Handle< DTRecSegment4DCollection > &DTSegProd, const edm::Handle< CSCSegmentCollection > &CSCSegProd)
Definition: DynamicTruncation.h:56
DynamicTruncation::setRecoP
void setRecoP(double p)
Definition: DynamicTruncation.h:68
GlobalMuonRefitter::theFitterToken
edm::ESGetToken< TrajectoryFitter, TrajectoryFitterRecord > theFitterToken
Definition: GlobalMuonRefitter.h:174
relativeConstraints.station
station
Definition: relativeConstraints.py:67
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
GlobalMuonRefitter::theGEMRecHits
edm::Handle< GEMRecHitCollection > theGEMRecHits
Definition: GlobalMuonRefitter.h:145
TransientRecHitRecord.h
ME0DetId.h
globals_cff.id1
id1
Definition: globals_cff.py:33
RPCDetId
Definition: RPCDetId.h:16
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
GlobalMuonRefitter::theDTRecHits
edm::Handle< DTRecHitCollection > theDTRecHits
Definition: GlobalMuonRefitter.h:143
pos
Definition: PixelAliasList.h:18
DynamicTruncation.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
TransientRecHitRecord
Definition: TransientRecHitRecord.h:14
GlobalMuonRefitter::theMuonRecHitBuilderToken
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theMuonRecHitBuilderToken
Definition: GlobalMuonRefitter.h:181
GlobalMuonRefitter::GlobalMuonRefitter
GlobalMuonRefitter(const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &)
constructor with Parameter Set and MuonServiceProxy
Definition: GlobalMuonRefitter.cc:75
GlobalMuonRefitter::theRPCChi2Cut
float theRPCChi2Cut
Definition: GlobalMuonRefitter.h:134
oppositeToMomentum
Definition: PropagationDirection.h:4
ChiSquaredProbability.h
bookConverter.results
results
Definition: bookConverter.py:144
TrajectoryMeasurement.h
FastTrackerRecHitMaskProducer_cfi.trajectories
trajectories
Definition: FastTrackerRecHitMaskProducer_cfi.py:7
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
CSCSegmentCollection
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
MuonTransientTrackingRecHit
Definition: MuonTransientTrackingRecHit.h:19
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
MuonTransientTrackingRecHit.h
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
TransientTrack.h
TransientTrackingRecHitBuilder::build
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
GlobalMuonRefitter::theDYTupdator
bool theDYTupdator
Definition: GlobalMuonRefitter.h:168
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
GlobalMuonRefitter::getFirstHits
void getFirstHits(const reco::Track &, ConstRecHitContainer &, ConstRecHitContainer &) const
get the RecHits in the tracker and the first muon chamber with hits
Definition: GlobalMuonRefitter.cc:527
GlobalMuonRefitter::theDYTthrs
std::vector< int > theDYTthrs
Definition: GlobalMuonRefitter.h:166
GlobalMuonRefitter::theDYTParThrsMode
bool theDYTParThrsMode
Definition: GlobalMuonRefitter.h:170
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
GlobalMuonRefitter::getRidOfSelectStationHits
ConstRecHitContainer getRidOfSelectStationHits(const ConstRecHitContainer &hits, const TrackerTopology *tTopo) const
Definition: GlobalMuonRefitter.cc:881
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:26
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
MuonServiceProxy_cff.MuonServiceProxy
MuonServiceProxy
Definition: MuonServiceProxy_cff.py:14
CSCDetId.h
DynamicTruncation::setSelector
void setSelector(int)
Definition: DynamicTruncation.cc:117
groupFilesInBlocks.reverse
reverse
Definition: groupFilesInBlocks.py:131
TrackerTopology::tidWheel
unsigned int tidWheel(const DetId &id) const
Definition: TrackerTopology.h:201
TrackerTopology::pxbLayer
unsigned int pxbLayer(const DetId &id) const
Definition: TrackerTopology.h:144
DynamicTruncation::setRecoEta
void setRecoEta(double eta)
Definition: DynamicTruncation.h:69
fileCollector.seed
seed
Definition: fileCollector.py:127
GlobalMuonRefitter::PXF
Definition: GlobalMuonRefitter.h:66
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrackerTopology.h
reco::DYTInfo::CopyFrom
void CopyFrom(const DYTInfo &)
copy from another DYTInfo
Definition: DYTInfo.cc:14
reco::DYTInfo
Definition: DYTInfo.h:11
Track.h
DTRecHitCollection
GlobalMuonRefitter::theDYTselector
int theDYTselector
Definition: GlobalMuonRefitter.h:167
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
GlobalMuonRefitter::theFitter
std::unique_ptr< TrajectoryFitter > theFitter
Definition: GlobalMuonRefitter.h:175
reco::Track
Definition: Track.h:27
GlobalMuonRefitter::theTrackerRecHitBuilderToken
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theTrackerRecHitBuilderToken
Definition: GlobalMuonRefitter.h:177
Basic3DVector::dot
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
Definition: extBasic3DVector.h:189
GlobalMuonRefitter::theCSCRecHitToken
edm::EDGetTokenT< CSCRecHit2DCollection > theCSCRecHitToken
Definition: GlobalMuonRefitter.h:148
TrajectoryFitter.h
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
MuonSubdetId::DT
static constexpr int DT
Definition: MuonSubdetId.h:11
Point3DBase< float, GlobalTag >
DTRecSegment4DCollection
GlobalMuonRefitter::theTrackerSkipSection
int theTrackerSkipSection
Definition: GlobalMuonRefitter.h:154
DTChamberId.h
DynamicTruncation::setUseAPE
void setUseAPE(bool)
Definition: DynamicTruncation.cc:126
DTLayerId
Definition: DTLayerId.h:12
DynamicTruncation::setParThrsMode
void setParThrsMode(bool dytParThrsMode)
Definition: DynamicTruncation.h:67
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
GlobalMuonRefitter::theCSCRecHitLabel
edm::InputTag theCSCRecHitLabel
Definition: GlobalMuonRefitter.h:140
DTLayer.h
GlobalMuonRefitter::theMuonRecHitBuilder
const TransientTrackingRecHitBuilder * theMuonRecHitBuilder
Definition: GlobalMuonRefitter.h:182
GlobalMuonRefitter::theDTChi2Cut
float theDTChi2Cut
Definition: GlobalMuonRefitter.h:132
DTGeometry.h
GlobalMuonRefitter::PXB
Definition: GlobalMuonRefitter.h:66
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
RPCDetId.h
GlobalMuonRefitter::checkRecHitsOrdering
RefitDirection checkRecHitsOrdering(const ConstRecHitContainer &) const
Definition: GlobalMuonRefitter.cc:693
GlobalMuonRefitter::TOB
Definition: GlobalMuonRefitter.h:66
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
GlobalMuonRefitter::RefitDirection
RefitDirection
Definition: GlobalMuonRefitter.h:105
GlobalMuonRefitter::undetermined
Definition: GlobalMuonRefitter.h:105
DetId::Tracker
Definition: DetId.h:25
HLT_FULL_cff.coneSize
coneSize
Definition: HLT_FULL_cff.py:50845
GlobalMuonRefitter::all4DSegmentsToken
edm::EDGetTokenT< DTRecSegment4DCollection > all4DSegmentsToken
Definition: GlobalMuonRefitter.h:188
Event.h
GlobalMuonRefitter::theGEMRecHitLabel
edm::InputTag theGEMRecHitLabel
Definition: GlobalMuonRefitter.h:141
TrackingRecHit::ConstRecHitContainer
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: TrackingRecHit.h:32
MuonCandidate.h
GlobalMuonRefitter::theTrackerRecHitBuilder
const TransientTrackingRecHitBuilder * theTrackerRecHitBuilder
Definition: GlobalMuonRefitter.h:178
GlobalMuonRefitter::theSkipStation
int theSkipStation
Definition: GlobalMuonRefitter.h:152
GEMDetId
Definition: GEMDetId.h:18
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
DynamicTruncation::setThrsMap
void setThrsMap(const edm::ParameterSet &)
Definition: DynamicTruncation.cc:143
GlobalMuonRefitter::theGEMChi2Cut
float theGEMChi2Cut
Definition: GlobalMuonRefitter.h:135
GlobalMuonRefitter::outsideIn
Definition: GlobalMuonRefitter.h:105
CSCDetId
Definition: CSCDetId.h:26
GlobalMuonRefitter::theDYTthrsParameters
edm::ParameterSet theDYTthrsParameters
Definition: GlobalMuonRefitter.h:171
edmPickEvents.event
event
Definition: edmPickEvents.py:273
GlobalMuonRefitter::theService
const MuonServiceProxy * theService
Definition: GlobalMuonRefitter.h:184
GlobalMuonRefitter::theCosmicFlag
bool theCosmicFlag
Definition: GlobalMuonRefitter.h:137
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
GlobalMuonRefitter::TEC
Definition: GlobalMuonRefitter.h:66
GlobalMuonRefitter::theRefitDirection
RefitDirection theRefitDirection
Definition: GlobalMuonRefitter.h:164
RefitDirection
Definition: RefitDirection.h:13
ME0DetId::station
int station() const
Definition: ME0DetId.h:58
TrackerTopology::pxfDisk
unsigned int pxfDisk(const DetId &id) const
Definition: TrackerTopology.h:446
reco::Track::innerDetId
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:82
GlobalMuonRefitter::thePropagatorName
std::string thePropagatorName
Definition: GlobalMuonRefitter.h:158
GlobalMuonRefitter::hitCloner
TkClonerImpl hitCloner
Definition: GlobalMuonRefitter.h:179
CSCDetId::chamberId
CSCDetId chamberId() const
Definition: CSCDetId.h:47
IdealGeometryRecord.h
GlobalMuonRefitter::theTrackerSkipSystem
int theTrackerSkipSystem
Definition: GlobalMuonRefitter.h:153
edm::EventSetup
Definition: EventSetup.h:57
ME0DetId
Definition: ME0DetId.h:16
ME0Segment.h
MuonSubdetId::ME0
static constexpr int ME0
Definition: MuonSubdetId.h:15
GlobalMuonRefitter::setServices
void setServices(const edm::EventSetup &)
set the services needed by the TrackTransformer
Definition: GlobalMuonRefitter.cc:163
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
GlobalMuonRefitter::theDTRecHitLabel
edm::InputTag theDTRecHitLabel
Definition: GlobalMuonRefitter.h:139
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
GlobalMuonRefitter::CSCSegmentsToken
edm::EDGetTokenT< CSCSegmentCollection > CSCSegmentsToken
Definition: GlobalMuonRefitter.h:187
ME0DetId::chamberId
ME0DetId chamberId() const
Return the corresponding ChamberId (mask layers)
Definition: ME0DetId.h:53
DynamicTruncation::filter
TransientTrackingRecHit::ConstRecHitContainer filter(const Trajectory &)
Definition: DynamicTruncation.cc:153
GlobalMuonRefitter::theME0RecHitLabel
edm::InputTag theME0RecHitLabel
Definition: GlobalMuonRefitter.h:142
RecHitLessByDet
Definition: RecHitLessByDet.h:16
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
TrackerTopology::tobLayer
unsigned int tobLayer(const DetId &id) const
Definition: TrackerTopology.h:147
GEMDetId.h
edm::RangeMap::range
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
GlobalMuonRefitter::setEvent
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
Definition: GlobalMuonRefitter.cc:153
reco::TransientTrack
Definition: TransientTrack.h:19
CSCLayer.h
GlobalMuonRefitter::theRPCInTheFit
bool theRPCInTheFit
Definition: GlobalMuonRefitter.h:160
DetId.h
Trajectory
Definition: Trajectory.h:38
MuonDetLayerMeasurements.h
MuonSubdetId::RPC
static constexpr int RPC
Definition: MuonSubdetId.h:13
MuonTransientTrackingRecHitBuilder.h
TrackingComponentsRecord.h
GEMDetId::chamberId
constexpr GEMDetId chamberId() const
Definition: GEMDetId.h:196
Exception
Definition: hltDiff.cc:246
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
MuonServiceProxy.h
GlobalMuonRefitter::printHits
void printHits(const ConstRecHitContainer &) const
print all RecHits of a trajectory
Definition: GlobalMuonRefitter.cc:672
GlobalMuonRefitter::theHitThreshold
int theHitThreshold
Definition: GlobalMuonRefitter.h:131
TrajectorySeed
Definition: TrajectorySeed.h:18
GlobalMuonRefitter::theCacheId_TRH
unsigned long long theCacheId_TRH
Definition: GlobalMuonRefitter.h:156
GlobalMuonRefitter::dytInfo
reco::DYTInfo * dytInfo
Definition: GlobalMuonRefitter.h:172
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrajectoryStateTransform.h
GlobalMuonRefitter::ConstRecHitContainer
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: GlobalMuonRefitter.h:54
GlobalMuonRefitter::theME0RecHits
edm::Handle< ME0SegmentCollection > theME0RecHits
Definition: GlobalMuonRefitter.h:146
GlobalMuonRefitter::TID
Definition: GlobalMuonRefitter.h:66
GlobalMuonRefitter::theMuonHitsOption
int theMuonHitsOption
Definition: GlobalMuonRefitter.h:129
GlobalMuonRefitter::theCSCChi2Cut
float theCSCChi2Cut
Definition: GlobalMuonRefitter.h:133
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:176
CSCRecHit2D.h
GlobalMuonRefitter::theEvent
const edm::Event * theEvent
Definition: GlobalMuonRefitter.h:185
DetId::Muon
Definition: DetId.h:26
DTChamberId
Definition: DTChamberId.h:14
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
GlobalMuonRefitter::TIB
Definition: GlobalMuonRefitter.h:66
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
DynamicTruncation::getDYTInfo
reco::DYTInfo getDYTInfo()
Definition: DynamicTruncation.h:78
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
RecHitLessByDet.h
event
Definition: event.py:1
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
GlobalMuonRefitter::refit
std::vector< Trajectory > refit(const reco::Track &globalTrack, const int theMuonHitsOption, const TrackerTopology *tTopo) const
build combined trajectory from sta Track and tracker RecHits
Definition: GlobalMuonRefitter.cc:180
edm::Event
Definition: Event.h:73
TrackerTopology::tecWheel
unsigned int tecWheel(const DetId &id) const
Definition: TrackerTopology.h:198
DynamicTruncation
Definition: DynamicTruncation.h:47
ME0SegmentCollection
keep
const int keep
Definition: GenParticlePruner.cc:48
GlobalMuonRefitter::all4DSegments
edm::Handle< DTRecSegment4DCollection > all4DSegments
Definition: GlobalMuonRefitter.h:190
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
alongMomentum
Definition: PropagationDirection.h:4
GlobalMuonRefitter::selectMuonHits
ConstRecHitContainer selectMuonHits(const Trajectory &, const std::map< DetId, int > &) const
select muon hits compatible with trajectory; check hits in chambers with showers
Definition: GlobalMuonRefitter.cc:587
GlobalMuonRefitter::theCSCRecHits
edm::Handle< CSCRecHit2DCollection > theCSCRecHits
Definition: GlobalMuonRefitter.h:144
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
hit
Definition: SiStripHitEffFromCalibTree.cc:88
GlobalMuonRefitter::MuonRecHitContainer
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
Definition: GlobalMuonRefitter.h:60
edm::OwnVector< TrackingRecHit >
GlobalMuonRefitter::~GlobalMuonRefitter
virtual ~GlobalMuonRefitter()
destructor
Definition: GlobalMuonRefitter.cc:148
GlobalMuonRefitter::theDTRecHitToken
edm::EDGetTokenT< DTRecHitCollection > theDTRecHitToken
Definition: GlobalMuonRefitter.h:147
TrackerTopology::tibLayer
unsigned int tibLayer(const DetId &id) const
Definition: TrackerTopology.h:150
GlobalMuonRefitter::insideOut
Definition: GlobalMuonRefitter.h:105
GlobalMuonRefitter::theDYTuseAPE
bool theDYTuseAPE
Definition: GlobalMuonRefitter.h:169