CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonIdProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonIdentification
4 // Class: MuonIdProducer
5 //
6 //
7 // Original Author: Dmytro Kovalskyi
8 // $Id: MuonIdProducer.cc,v 1.69 2012/07/19 13:23:21 slava77 Exp $
9 //
10 //
11 
12 
13 // system include files
14 #include <memory>
15 
16 // user include files
19 
22 
24 
35 
38 
39 #include <boost/regex.hpp>
44 
47 
48 #include <algorithm>
49 
54 
56 
58 
60 muIsoExtractorCalo_(0),muIsoExtractorTrack_(0),muIsoExtractorJet_(0)
61 {
62  produces<reco::MuonCollection>();
63  produces<reco::CaloMuonCollection>();
64  produces<reco::MuonTimeExtraMap>("combined");
65  produces<reco::MuonTimeExtraMap>("dt");
66  produces<reco::MuonTimeExtraMap>("csc");
67 
68  minPt_ = iConfig.getParameter<double>("minPt");
69  minP_ = iConfig.getParameter<double>("minP");
70  minPCaloMuon_ = iConfig.getParameter<double>("minPCaloMuon");
71  minNumberOfMatches_ = iConfig.getParameter<int>("minNumberOfMatches");
72  addExtraSoftMuons_ = iConfig.getParameter<bool>("addExtraSoftMuons");
73  maxAbsEta_ = iConfig.getParameter<double>("maxAbsEta");
74  maxAbsDx_ = iConfig.getParameter<double>("maxAbsDx");
75  maxAbsPullX_ = iConfig.getParameter<double>("maxAbsPullX");
76  maxAbsDy_ = iConfig.getParameter<double>("maxAbsDy");
77  maxAbsPullY_ = iConfig.getParameter<double>("maxAbsPullY");
78  fillCaloCompatibility_ = iConfig.getParameter<bool>("fillCaloCompatibility");
79  fillEnergy_ = iConfig.getParameter<bool>("fillEnergy");
80  fillMatching_ = iConfig.getParameter<bool>("fillMatching");
81  fillIsolation_ = iConfig.getParameter<bool>("fillIsolation");
82  writeIsoDeposits_ = iConfig.getParameter<bool>("writeIsoDeposits");
83  fillGlobalTrackQuality_ = iConfig.getParameter<bool>("fillGlobalTrackQuality");
84  fillGlobalTrackRefits_ = iConfig.getParameter<bool>("fillGlobalTrackRefits");
85  //SK: (maybe temporary) run it only if the global is also run
86  fillTrackerKink_ = false;
87  if (fillGlobalTrackQuality_) fillTrackerKink_ = iConfig.getParameter<bool>("fillTrackerKink");
88 
89  ptThresholdToFillCandidateP4WithGlobalFit_ = iConfig.getParameter<double>("ptThresholdToFillCandidateP4WithGlobalFit");
90  sigmaThresholdToFillCandidateP4WithGlobalFit_ = iConfig.getParameter<double>("sigmaThresholdToFillCandidateP4WithGlobalFit");
91  caloCut_ = iConfig.getParameter<double>("minCaloCompatibility"); //CaloMuons
92  arbClean_ = iConfig.getParameter<bool>("runArbitrationCleaner"); // muon mesh
93 
94  // Load TrackDetectorAssociator parameters
95  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
96  parameters_.loadParameters( parameters );
97 
98  // Load parameters for the TimingFiller
99  edm::ParameterSet timingParameters = iConfig.getParameter<edm::ParameterSet>("TimingFillerParameters");
100  theTimingFiller_ = new MuonTimingFiller(timingParameters);
101 
102  if (fillCaloCompatibility_){
103  // Load MuonCaloCompatibility parameters
104  parameters = iConfig.getParameter<edm::ParameterSet>("MuonCaloCompatibility");
105  muonCaloCompatibility_.configure( parameters );
106  }
107 
108  if (fillIsolation_){
109  // Load MuIsoExtractor parameters
110  edm::ParameterSet caloExtractorPSet = iConfig.getParameter<edm::ParameterSet>("CaloExtractorPSet");
111  std::string caloExtractorName = caloExtractorPSet.getParameter<std::string>("ComponentName");
112  muIsoExtractorCalo_ = IsoDepositExtractorFactory::get()->create( caloExtractorName, caloExtractorPSet);
113 
114  edm::ParameterSet trackExtractorPSet = iConfig.getParameter<edm::ParameterSet>("TrackExtractorPSet");
115  std::string trackExtractorName = trackExtractorPSet.getParameter<std::string>("ComponentName");
116  muIsoExtractorTrack_ = IsoDepositExtractorFactory::get()->create( trackExtractorName, trackExtractorPSet);
117 
118  edm::ParameterSet jetExtractorPSet = iConfig.getParameter<edm::ParameterSet>("JetExtractorPSet");
119  std::string jetExtractorName = jetExtractorPSet.getParameter<std::string>("ComponentName");
120  muIsoExtractorJet_ = IsoDepositExtractorFactory::get()->create( jetExtractorName, jetExtractorPSet);
121  }
122  if (fillIsolation_ && writeIsoDeposits_){
123  trackDepositName_ = iConfig.getParameter<std::string>("trackDepositName");
124  produces<reco::IsoDepositMap>(trackDepositName_);
125  ecalDepositName_ = iConfig.getParameter<std::string>("ecalDepositName");
126  produces<reco::IsoDepositMap>(ecalDepositName_);
127  hcalDepositName_ = iConfig.getParameter<std::string>("hcalDepositName");
128  produces<reco::IsoDepositMap>(hcalDepositName_);
129  hoDepositName_ = iConfig.getParameter<std::string>("hoDepositName");
130  produces<reco::IsoDepositMap>(hoDepositName_);
131  jetDepositName_ = iConfig.getParameter<std::string>("jetDepositName");
132  produces<reco::IsoDepositMap>(jetDepositName_);
133  }
134 
135  inputCollectionLabels_ = iConfig.getParameter<std::vector<edm::InputTag> >("inputCollectionLabels");
136  inputCollectionTypes_ = iConfig.getParameter<std::vector<std::string> >("inputCollectionTypes");
137  if (inputCollectionLabels_.size() != inputCollectionTypes_.size())
138  throw cms::Exception("ConfigurationError") << "Number of input collection labels is different from number of types. " <<
139  "For each collection label there should be exactly one collection type specified.";
140  if (inputCollectionLabels_.size()>7 ||inputCollectionLabels_.empty())
141  throw cms::Exception("ConfigurationError") << "Number of input collections should be from 1 to 7.";
142 
143  debugWithTruthMatching_ = iConfig.getParameter<bool>("debugWithTruthMatching");
144  if (debugWithTruthMatching_) edm::LogWarning("MuonIdentification")
145  << "========================================================================\n"
146  << "Debugging mode with truth matching is turned on!!! Make sure you understand what you are doing!\n"
147  << "========================================================================\n";
148  if (fillGlobalTrackQuality_){
149  globalTrackQualityInputTag_ = iConfig.getParameter<edm::InputTag>("globalTrackQualityInputTag");
150  }
151 
152  if (fillTrackerKink_) {
153  trackerKinkFinder_.reset(new MuonKinkFinder(iConfig.getParameter<edm::ParameterSet>("TrackerKinkFinderParameters")));
154  }
155 
156  //create mesh holder
157  meshAlgo_ = new MuonMesh(iConfig.getParameter<edm::ParameterSet>("arbitrationCleanerOptions"));
158 }
159 
160 
162 {
167  if (meshAlgo_) delete meshAlgo_;
168  // TimingReport::current()->dump(std::cout);
169 }
170 
172 {
173  // TimerStack timers;
174  // timers.push("MuonIdProducer::produce::init");
175 
180 
184 
185 
186  // timers.push("MuonIdProducer::produce::init::getPropagator");
188  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny", propagator);
189  trackAssociator_.setPropagator(propagator.product());
190 
191  if (fillTrackerKink_) trackerKinkFinder_->init(iSetup);
192 
193  // timers.pop_and_push("MuonIdProducer::produce::init::getInputCollections");
194  for ( unsigned int i = 0; i < inputCollectionLabels_.size(); ++i ) {
195  if ( inputCollectionTypes_[i] == "inner tracks" ) {
198  throw cms::Exception("FatalError") << "Failed to get input track collection with label: " << inputCollectionLabels_[i];
199  LogTrace("MuonIdentification") << "Number of input inner tracks: " << innerTrackCollectionHandle_->size();
200  continue;
201  }
202  if ( inputCollectionTypes_[i] == "outer tracks" ) {
205  throw cms::Exception("FatalError") << "Failed to get input track collection with label: " << inputCollectionLabels_[i];
206  LogTrace("MuonIdentification") << "Number of input outer tracks: " << outerTrackCollectionHandle_->size();
207  continue;
208  }
209  if ( inputCollectionTypes_[i] == "links" ) {
212  throw cms::Exception("FatalError") << "Failed to get input link collection with label: " << inputCollectionLabels_[i];
213  LogTrace("MuonIdentification") << "Number of input links: " << linkCollectionHandle_->size();
214  continue;
215  }
216  if ( inputCollectionTypes_[i] == "muons" ) {
219  throw cms::Exception("FatalError") << "Failed to get input muon collection with label: " << inputCollectionLabels_[i];
220  LogTrace("MuonIdentification") << "Number of input muons: " << muonCollectionHandle_->size();
221  continue;
222  }
223  if ( fillGlobalTrackRefits_ && inputCollectionTypes_[i] == "tev firstHit" ) {
226  throw cms::Exception("FatalError") << "Failed to get input muon collection with label: " << inputCollectionLabels_[i];
227  LogTrace("MuonIdentification") << "Number of input muons: " << tpfmsCollectionHandle_->size();
228  continue;
229  }
230 
231  if ( fillGlobalTrackRefits_ && inputCollectionTypes_[i] == "tev picky" ) {
234  throw cms::Exception("FatalError") << "Failed to get input muon collection with label: " << inputCollectionLabels_[i];
235  LogTrace("MuonIdentification") << "Number of input muons: " << pickyCollectionHandle_->size();
236  continue;
237  }
238 
239  if ( fillGlobalTrackRefits_ && inputCollectionTypes_[i] == "tev dyt" ) {
241  if (! dytCollectionHandle_.isValid())
242  throw cms::Exception("FatalError") << "Failed to get input muon collection with label: " << inputCollectionLabels_[i];
243  LogTrace("MuonIdentification") << "Number of input muons: " << dytCollectionHandle_->size();
244  continue;
245  }
246  throw cms::Exception("FatalError") << "Unknown input collection type: " << inputCollectionTypes_[i];
247  }
248 }
249 
252 {
253  LogTrace("MuonIdentification") << "Creating a muon from a track " << track.get()->pt() <<
254  " Pt (GeV), eta: " << track.get()->eta();
255  reco::Muon aMuon( makeMuon( *(track.get()) ) );
256 
257  aMuon.setMuonTrack(type,track);
258  aMuon.setBestTrack(type);
259  return aMuon;
260 }
261 
262 
264 {
265  reco::CaloMuon aMuon;
266  aMuon.setInnerTrack( muon.innerTrack() );
267 
268  if (muon.isEnergyValid()) aMuon.setCalEnergy( muon.calEnergy() );
269  // get calo compatibility
271  return aMuon;
272 }
273 
274 
276 {
277  LogTrace("MuonIdentification") << "Creating a muon from a link to tracks object";
278 
279  reco::Muon aMuon;
280  reco::Muon::MuonTrackTypePair chosenTrack;
281  reco::TrackRef tpfmsRef;
282  reco::TrackRef pickyRef;
283  bool useSigmaSwitch = false;
284 
287 
290 
291  if (tpfmsRef.isNull() && pickyRef.isNull()){
292  edm::LogWarning("MakeMuonWithTEV")<<"Failed to get TEV refits, fall back to sigma switch.";
293  useSigmaSwitch = true;
294  }
295  } else {
296  useSigmaSwitch = true;
297  }
298 
299  if (useSigmaSwitch){
300  chosenTrack = muon::sigmaSwitch( links.globalTrack(), links.trackerTrack(),
303  } else {
304  chosenTrack = muon::tevOptimized( links.globalTrack(), links.trackerTrack(),
305  tpfmsRef, pickyRef,
307  }
308  aMuon = makeMuon(*chosenTrack.first);
309  aMuon.setInnerTrack( links.trackerTrack() );
310  aMuon.setOuterTrack( links.standAloneTrack() );
311  aMuon.setGlobalTrack( links.globalTrack() );
312  aMuon.setBestTrack(chosenTrack.second);
313 
317  if (it != tpfmsCollectionHandle_->end()) aMuon.setMuonTrack(reco::Muon::TPFMS, (it->val));
318  }
321  if (it != pickyCollectionHandle_->end()) aMuon.setMuonTrack(reco::Muon::Picky, (it->val));
322  }
325  if (it != dytCollectionHandle_->end()) aMuon.setMuonTrack(reco::Muon::DYT, (it->val));
326  }
327  }
328  return aMuon;
329 }
330 
331 
333 {
334  // Pt and absolute momentum requirement
335  if (track.pt() < minPt_ || (track.p() < minP_ && track.p() < minPCaloMuon_)){
336  LogTrace("MuonIdentification") << "Skipped low momentum track (Pt,P): " << track.pt() <<
337  ", " << track.p() << " GeV";
338  return false;
339  }
340 
341  // Eta requirement
342  if ( fabs(track.eta()) > maxAbsEta_ ){
343  LogTrace("MuonIdentification") << "Skipped track with large pseudo rapidity (Eta: " << track.eta() << " )";
344  return false;
345  }
346  return true;
347 }
348 
349 unsigned int MuonIdProducer::chamberId( const DetId& id )
350 {
351  switch ( id.det() ) {
352  case DetId::Muon:
353  switch ( id.subdetId() ) {
354  case MuonSubdetId::DT:
355  {
356  DTChamberId detId(id.rawId());
357  return detId.rawId();
358  }
359  break;
360  case MuonSubdetId::CSC:
361  {
362  CSCDetId detId(id.rawId());
363  return detId.chamberId().rawId();
364  }
365  break;
366  default:
367  return 0;
368  }
369  default:
370  return 0;
371  }
372  return 0;
373 }
374 
375 
377 {
378  int numberOfCommonDetIds = 0;
379  if ( ! muon.isMatchesValid() ||
380  track.extra().isNull() ||
381  track.extra()->recHits().isNull() ) return numberOfCommonDetIds;
382  const std::vector<reco::MuonChamberMatch>& matches( muon.matches() );
383  for ( std::vector<reco::MuonChamberMatch>::const_iterator match = matches.begin();
384  match != matches.end(); ++match )
385  {
386  if ( match->segmentMatches.empty() ) continue;
387  bool foundCommonDetId = false;
388 
389  for ( TrackingRecHitRefVector::const_iterator hit = track.extra()->recHitsBegin();
390  hit != track.extra()->recHitsEnd(); ++hit )
391  {
392  // LogTrace("MuonIdentification") << "hit DetId: " << std::hex << hit->get()->geographicalId().rawId() <<
393  // "\t hit chamber DetId: " << getChamberId(hit->get()->geographicalId()) <<
394  // "\t segment DetId: " << match->id.rawId() << std::dec;
395 
396  if ( chamberId(hit->get()->geographicalId()) == match->id.rawId() ) {
397  foundCommonDetId = true;
398  break;
399  }
400  }
401  if ( foundCommonDetId ) {
402  numberOfCommonDetIds++;
403  break;
404  }
405  }
406  return numberOfCommonDetIds;
407 }
408 
410 {
411  edm::ESHandle<CSCGeometry> geomHandle;
412  iSetup.get<MuonGeometryRecord>().get(geomHandle);
413 
414  meshAlgo_->setCSCGeometry(geomHandle.product());
415 
416 }
417 
419  const reco::MuonTrackLinks& badMuon )
420 {
421  if ( std::min(goodMuon.globalTrack()->hitPattern().numberOfValidMuonHits(),
422  badMuon.globalTrack()->hitPattern().numberOfValidMuonHits()) > 10 ){
423  if ( goodMuon.globalTrack()->normalizedChi2() >
424  badMuon.globalTrack()->normalizedChi2() )
425  return false;
426  else
427  return true;
428  }
429  if ( goodMuon.globalTrack()->hitPattern().numberOfValidMuonHits() <
430  badMuon.globalTrack()->hitPattern().numberOfValidMuonHits() ) return false;
431  return true;
432 }
433 
435 {
436  // TimerStack timers;
437  // timers.push("MuonIdProducer::produce");
438 
439  std::auto_ptr<reco::MuonCollection> outputMuons(new reco::MuonCollection);
440  std::auto_ptr<reco::CaloMuonCollection> caloMuons( new reco::CaloMuonCollection );
441 
442  init(iEvent, iSetup);
443 
444  std::auto_ptr<reco::MuonTimeExtraMap> muonTimeMap(new reco::MuonTimeExtraMap());
445  reco::MuonTimeExtraMap::Filler filler(*muonTimeMap);
446  std::auto_ptr<reco::MuonTimeExtraMap> muonTimeMapDT(new reco::MuonTimeExtraMap());
447  reco::MuonTimeExtraMap::Filler fillerDT(*muonTimeMapDT);
448  std::auto_ptr<reco::MuonTimeExtraMap> muonTimeMapCSC(new reco::MuonTimeExtraMap());
449  reco::MuonTimeExtraMap::Filler fillerCSC(*muonTimeMapCSC);
450 
451  std::auto_ptr<reco::IsoDepositMap> trackDepMap(new reco::IsoDepositMap());
452  reco::IsoDepositMap::Filler trackDepFiller(*trackDepMap);
453  std::auto_ptr<reco::IsoDepositMap> ecalDepMap(new reco::IsoDepositMap());
454  reco::IsoDepositMap::Filler ecalDepFiller(*ecalDepMap);
455  std::auto_ptr<reco::IsoDepositMap> hcalDepMap(new reco::IsoDepositMap());
456  reco::IsoDepositMap::Filler hcalDepFiller(*hcalDepMap);
457  std::auto_ptr<reco::IsoDepositMap> hoDepMap(new reco::IsoDepositMap());
458  reco::IsoDepositMap::Filler hoDepFiller(*hoDepMap);
459  std::auto_ptr<reco::IsoDepositMap> jetDepMap(new reco::IsoDepositMap());
460  reco::IsoDepositMap::Filler jetDepFiller(*jetDepMap);
461 
462  // loop over input collections
463 
464  // muons first - no cleaning, take as is.
466  for ( reco::MuonCollection::const_iterator muon = muonCollectionHandle_->begin();
467  muon != muonCollectionHandle_->end(); ++muon )
468  outputMuons->push_back(*muon);
469 
470  // links second ( assume global muon type )
472  std::vector<bool> goodmuons(linkCollectionHandle_->size(),true);
473  if ( goodmuons.size()>1 ){
474  // check for shared tracker tracks
475  for ( unsigned int i=0; i<linkCollectionHandle_->size()-1; ++i ){
476  if (!checkLinks(&linkCollectionHandle_->at(i))) continue;
477  for ( unsigned int j=i+1; j<linkCollectionHandle_->size(); ++j ){
478  if (!checkLinks(&linkCollectionHandle_->at(j))) continue;
479  if ( linkCollectionHandle_->at(i).trackerTrack().isNonnull() &&
480  linkCollectionHandle_->at(i).trackerTrack() ==
481  linkCollectionHandle_->at(j).trackerTrack() )
482  {
483  // Tracker track is the essential part that dominates muon resolution
484  // so taking either muon is fine. All that is important is to preserve
485  // the muon identification information. If number of hits is small,
486  // keep the one with large number of hits, otherwise take the smalest chi2/ndof
488  goodmuons[j] = false;
489  else
490  goodmuons[i] = false;
491  }
492  }
493  }
494  // check for shared stand-alone muons.
495  for ( unsigned int i=0; i<linkCollectionHandle_->size()-1; ++i ){
496  if ( !goodmuons[i] ) continue;
497  if (!checkLinks(&linkCollectionHandle_->at(i))) continue;
498  for ( unsigned int j=i+1; j<linkCollectionHandle_->size(); ++j ){
499  if ( !goodmuons[j] ) continue;
500  if (!checkLinks(&linkCollectionHandle_->at(j))) continue;
501  if ( linkCollectionHandle_->at(i).standAloneTrack().isNonnull() &&
502  linkCollectionHandle_->at(i).standAloneTrack() ==
503  linkCollectionHandle_->at(j).standAloneTrack() )
504  {
506  goodmuons[j] = false;
507  else
508  goodmuons[i] = false;
509  }
510  }
511  }
512  }
513  for ( unsigned int i=0; i<linkCollectionHandle_->size(); ++i ){
514  if ( !goodmuons[i] ) continue;
515  const reco::MuonTrackLinks* links = &linkCollectionHandle_->at(i);
516  if ( ! checkLinks(links)) continue;
517  // check if this muon is already in the list
518  bool newMuon = true;
519  for ( reco::MuonCollection::const_iterator muon = outputMuons->begin();
520  muon != outputMuons->end(); ++muon )
521  if ( muon->track() == links->trackerTrack() &&
522  muon->standAloneMuon() == links->standAloneTrack() &&
523  muon->combinedMuon() == links->globalTrack() )
524  newMuon = false;
525  if ( newMuon ) {
526  outputMuons->push_back( makeMuon( *links ) );
527  outputMuons->back().setType(reco::Muon::GlobalMuon | reco::Muon::StandAloneMuon);
528  }
529  }
530  }
531 
532  // tracker and calo muons are next
534  LogTrace("MuonIdentification") << "Creating tracker muons";
535  for ( unsigned int i = 0; i < innerTrackCollectionHandle_->size(); ++i )
536  {
537  const reco::Track& track = innerTrackCollectionHandle_->at(i);
538  if ( ! isGoodTrack( track ) ) continue;
539  bool splitTrack = false;
540  if ( track.extra().isAvailable() &&
541  TrackDetectorAssociator::crossedIP( track ) ) splitTrack = true;
542  std::vector<TrackDetectorAssociator::Direction> directions;
543  if ( splitTrack ) {
544  directions.push_back(TrackDetectorAssociator::InsideOut);
545  directions.push_back(TrackDetectorAssociator::OutsideIn);
546  } else {
547  directions.push_back(TrackDetectorAssociator::Any);
548  }
549  for ( std::vector<TrackDetectorAssociator::Direction>::const_iterator direction = directions.begin();
550  direction != directions.end(); ++direction )
551  {
552  // make muon
553  // timers.push("MuonIdProducer::produce::fillMuonId");
555  trackerMuon.setType( reco::Muon::TrackerMuon );
556  fillMuonId(iEvent, iSetup, trackerMuon, *direction);
557  // timers.pop();
558 
559  if ( debugWithTruthMatching_ ) {
560  // add MC hits to a list of matched segments.
561  // Since it's debugging mode - code is slow
562  MuonIdTruthInfo::truthMatchMuon(iEvent, iSetup, trackerMuon);
563  }
564 
565  // check if this muon is already in the list
566  // have to check where muon hits are really located
567  // to match properly
568  bool newMuon = true;
569  bool goodTrackerMuon = isGoodTrackerMuon( trackerMuon );
570  for ( reco::MuonCollection::iterator muon = outputMuons->begin();
571  muon != outputMuons->end(); ++muon )
572  {
573  if ( muon->innerTrack().get() == trackerMuon.innerTrack().get() &&
575  phiOfMuonIneteractionRegion(trackerMuon)) > 0 )
576  {
577  newMuon = false;
578  muon->setMatches( trackerMuon.matches() );
579  if (trackerMuon.isTimeValid()) muon->setTime( trackerMuon.time() );
580  if (trackerMuon.isEnergyValid()) muon->setCalEnergy( trackerMuon.calEnergy() );
581  if (goodTrackerMuon) muon->setType( muon->type() | reco::Muon::TrackerMuon );
582  LogTrace("MuonIdentification") << "Found a corresponding global muon. Set energy, matches and move on";
583  break;
584  }
585  }
586  if ( newMuon ) {
587  if ( goodTrackerMuon ){
588  outputMuons->push_back( trackerMuon );
589  } else {
590  LogTrace("MuonIdentification") << "track failed minimal number of muon matches requirement";
591  const reco::CaloMuon& caloMuon = makeCaloMuon(trackerMuon);
592  if ( ! caloMuon.isCaloCompatibilityValid() || caloMuon.caloCompatibility() < caloCut_ || caloMuon.p() < minPCaloMuon_) continue;
593  caloMuons->push_back( caloMuon );
594  }
595  }
596  }
597  }
598  }
599 
600  // and at last the stand alone muons
602  LogTrace("MuonIdentification") << "Looking for new muons among stand alone muon tracks";
603  for ( unsigned int i = 0; i < outerTrackCollectionHandle_->size(); ++i )
604  {
605  // check if this muon is already in the list of global muons
606  bool newMuon = true;
607  for ( reco::MuonCollection::iterator muon = outputMuons->begin();
608  muon != outputMuons->end(); ++muon )
609  {
610  if ( ! muon->standAloneMuon().isNull() ) {
611  // global muon
612  if ( muon->standAloneMuon().get() == &(outerTrackCollectionHandle_->at(i)) ) {
613  newMuon = false;
614  break;
615  }
616  } else {
617  // tracker muon - no direct links to the standalone muon
618  // since we have only a few real muons in an event, matching
619  // the stand alone muon to the tracker muon by DetIds should
620  // be good enough for association. At the end it's up to a
621  // user to redefine the association and what it means. Here
622  // we would like to avoid obvious double counting and we
623  // tolerate a potential miss association
624  if ( overlap(*muon,outerTrackCollectionHandle_->at(i))>0 ) {
625  LogTrace("MuonIdentification") << "Found associated tracker muon. Set a reference and move on";
626  newMuon = false;
627  muon->setOuterTrack( reco::TrackRef( outerTrackCollectionHandle_, i ) );
628  muon->setType( muon->type() | reco::Muon::StandAloneMuon );
629  break;
630  }
631  }
632  }
633  if ( newMuon ) {
634  LogTrace("MuonIdentification") << "No associated stand alone track is found. Making a muon";
635  outputMuons->push_back( makeMuon(iEvent, iSetup,
637  outputMuons->back().setType( reco::Muon::StandAloneMuon );
638  }
639  }
640  }
641 
642  LogTrace("MuonIdentification") << "Dress up muons if it's necessary";
643 
644  int nMuons=outputMuons->size();
645 
646  std::vector<reco::MuonTimeExtra> dtTimeColl(nMuons);
647  std::vector<reco::MuonTimeExtra> cscTimeColl(nMuons);
648  std::vector<reco::MuonTimeExtra> combinedTimeColl(nMuons);
649  std::vector<reco::IsoDeposit> trackDepColl(nMuons);
650  std::vector<reco::IsoDeposit> ecalDepColl(nMuons);
651  std::vector<reco::IsoDeposit> hcalDepColl(nMuons);
652  std::vector<reco::IsoDeposit> hoDepColl(nMuons);
653  std::vector<reco::IsoDeposit> jetDepColl(nMuons);
654 
655  // Fill various information
656  unsigned int i=0;
657  for ( reco::MuonCollection::iterator muon = outputMuons->begin(); muon != outputMuons->end(); ++muon )
658  {
659  // Fill muonID
660  // timers.push("MuonIdProducer::produce::fillMuonId");
661  if ( ( fillMatching_ && ! muon->isMatchesValid() ) ||
662  ( fillEnergy_ && !muon->isEnergyValid() ) )
663  {
664  // predict direction based on the muon interaction region location
665  // if it's available
666  if ( muon->isStandAloneMuon() ) {
667  if ( cos(phiOfMuonIneteractionRegion(*muon) - muon->phi()) > 0 )
669  else
671  } else {
672  LogTrace("MuonIdentification") << "THIS SHOULD NEVER HAPPEN";
673  fillMuonId(iEvent, iSetup, *muon);
674  }
675  }
676 
678  // Fill global quality information
679  fillGlbQuality(iEvent, iSetup, *muon);
680  }
681  LogDebug("MuonIdentification");
682 
683  if (fillTrackerKink_) {
685  }
686 
687  // timers.push("MuonIdProducer::produce::fillCaloCompatibility");
688  if ( fillCaloCompatibility_ ) muon->setCaloCompatibility( muonCaloCompatibility_.evaluate(*muon) );
689  // timers.pop();
690 
691  // timers.push("MuonIdProducer::produce::fillIsolation");
692  if ( fillIsolation_ ) fillMuonIsolation(iEvent, iSetup, *muon,
693  trackDepColl[i], ecalDepColl[i], hcalDepColl[i], hoDepColl[i], jetDepColl[i]);
694  // timers.pop();
695 
696  // fill timing information
697  reco::MuonTime muonTime;
698  reco::MuonTimeExtra dtTime;
699  reco::MuonTimeExtra cscTime;
700  reco::MuonTimeExtra combinedTime;
701 
702  theTimingFiller_->fillTiming(*muon, dtTime, cscTime, combinedTime, iEvent, iSetup);
703 
704  muonTime.nDof=combinedTime.nDof();
705  muonTime.timeAtIpInOut=combinedTime.timeAtIpInOut();
706  muonTime.timeAtIpInOutErr=combinedTime.timeAtIpInOutErr();
707  muonTime.timeAtIpOutIn=combinedTime.timeAtIpOutIn();
708  muonTime.timeAtIpOutInErr=combinedTime.timeAtIpOutInErr();
709 
710  muon->setTime( muonTime);
711  dtTimeColl[i] = dtTime;
712  cscTimeColl[i] = cscTime;
713  combinedTimeColl[i] = combinedTime;
714 
715  i++;
716 
717  }
718 
719  LogTrace("MuonIdentification") << "number of muons produced: " << outputMuons->size();
720  // timers.push("MuonIdProducer::produce::fillArbitration");
721  if ( fillMatching_ ) fillArbitrationInfo( outputMuons.get() );
722  // timers.pop();
723  edm::OrphanHandle<reco::MuonCollection> muonHandle = iEvent.put(outputMuons);
724 
725  filler.insert(muonHandle, combinedTimeColl.begin(), combinedTimeColl.end());
726  filler.fill();
727  fillerDT.insert(muonHandle, dtTimeColl.begin(), dtTimeColl.end());
728  fillerDT.fill();
729  fillerCSC.insert(muonHandle, cscTimeColl.begin(), cscTimeColl.end());
730  fillerCSC.fill();
731 
732  iEvent.put(muonTimeMap,"combined");
733  iEvent.put(muonTimeMapDT,"dt");
734  iEvent.put(muonTimeMapCSC,"csc");
735 
737  trackDepFiller.insert(muonHandle, trackDepColl.begin(), trackDepColl.end());
738  trackDepFiller.fill();
739  iEvent.put(trackDepMap, trackDepositName_);
740  ecalDepFiller.insert(muonHandle, ecalDepColl.begin(), ecalDepColl.end());
741  ecalDepFiller.fill();
742  iEvent.put(ecalDepMap, ecalDepositName_);
743  hcalDepFiller.insert(muonHandle, hcalDepColl.begin(), hcalDepColl.end());
744  hcalDepFiller.fill();
745  iEvent.put(hcalDepMap, hcalDepositName_);
746  hoDepFiller.insert(muonHandle, hoDepColl.begin(), hoDepColl.end());
747  hoDepFiller.fill();
748  iEvent.put(hoDepMap, hoDepositName_);
749  jetDepFiller.insert(muonHandle, jetDepColl.begin(), jetDepColl.end());
750  jetDepFiller.fill();
751  iEvent.put(jetDepMap, jetDepositName_);
752  }
753 
754  iEvent.put(caloMuons);
755 }
756 
757 
759 {
760  if(muon.track()->pt() < minPt_ || muon.track()->p() < minP_) return false;
761  if ( addExtraSoftMuons_ &&
762  muon.pt()<5 && fabs(muon.eta())<1.5 &&
763  muon.numberOfMatches( reco::Muon::NoArbitration ) >= 1 ) return true;
765 }
766 
768  reco::Muon& aMuon,
770 {
771  // perform track - detector association
772  const reco::Track* track = 0;
773  if ( ! aMuon.track().isNull() )
774  track = aMuon.track().get();
775  else
776  {
777  if ( ! aMuon.standAloneMuon().isNull() )
778  track = aMuon.standAloneMuon().get();
779  else
780  throw cms::Exception("FatalError") << "Failed to fill muon id information for a muon with undefined references to tracks";
781  }
782 
783  TrackDetMatchInfo info = trackAssociator_.associate(iEvent, iSetup, *track, parameters_, direction);
784 
785  if ( fillEnergy_ ) {
786  reco::MuonEnergy muonEnergy;
789  muonEnergy.ho = info.crossedEnergy(TrackDetMatchInfo::HORecHits);
791  muonEnergy.emS9 = info.nXnEnergy(TrackDetMatchInfo::EcalRecHits,1); // 3x3 energy
792  muonEnergy.emS25 = info.nXnEnergy(TrackDetMatchInfo::EcalRecHits,2); // 5x5 energy
793  muonEnergy.hadS9 = info.nXnEnergy(TrackDetMatchInfo::HcalRecHits,1); // 3x3 energy
794  muonEnergy.hoS9 = info.nXnEnergy(TrackDetMatchInfo::HORecHits,1); // 3x3 energy
795  muonEnergy.towerS9 = info.nXnEnergy(TrackDetMatchInfo::TowerTotal,1); // 3x3 energy
796  muonEnergy.ecal_position = info.trkGlobPosAtEcal;
797  muonEnergy.hcal_position = info.trkGlobPosAtHcal;
798  if (! info.crossedEcalIds.empty() ) muonEnergy.ecal_id = info.crossedEcalIds.front();
799  if (! info.crossedHcalIds.empty() ) muonEnergy.hcal_id = info.crossedHcalIds.front();
800  // find maximal energy depositions and their time
801  DetId emMaxId = info.findMaxDeposition(TrackDetMatchInfo::EcalRecHits,2); // max energy deposit in 5x5 shape
802  for(std::vector<const EcalRecHit*>::const_iterator hit=info.ecalRecHits.begin();
803  hit!=info.ecalRecHits.end(); ++hit) {
804  if ((*hit)->id() != emMaxId) continue;
805  muonEnergy.emMax = (*hit)->energy();
806  muonEnergy.ecal_time = (*hit)->time();
807  }
808  DetId hadMaxId = info.findMaxDeposition(TrackDetMatchInfo::HcalRecHits,1); // max energy deposit in 3x3 shape
809  for(std::vector<const HBHERecHit*>::const_iterator hit=info.hcalRecHits.begin();
810  hit!=info.hcalRecHits.end(); ++hit) {
811  if ((*hit)->id() != hadMaxId) continue;
812  muonEnergy.hadMax = (*hit)->energy();
813  muonEnergy.hcal_time = (*hit)->time();
814  }
815  aMuon.setCalEnergy( muonEnergy );
816  }
817  if ( ! fillMatching_ && ! aMuon.isTrackerMuon() ) return;
818 
819  // fill muon match info
820  std::vector<reco::MuonChamberMatch> muonChamberMatches;
821  unsigned int nubmerOfMatchesAccordingToTrackAssociator = 0;
822  for( std::vector<TAMuonChamberMatch>::const_iterator chamber=info.chambers.begin();
823  chamber!=info.chambers.end(); chamber++ )
824  {
825  reco::MuonChamberMatch matchedChamber;
826 
827  LocalError localError = chamber->tState.localError().positionError();
828  matchedChamber.x = chamber->tState.localPosition().x();
829  matchedChamber.y = chamber->tState.localPosition().y();
830  matchedChamber.xErr = sqrt( localError.xx() );
831  matchedChamber.yErr = sqrt( localError.yy() );
832 
833  matchedChamber.dXdZ = chamber->tState.localDirection().z()!=0?chamber->tState.localDirection().x()/chamber->tState.localDirection().z():9999;
834  matchedChamber.dYdZ = chamber->tState.localDirection().z()!=0?chamber->tState.localDirection().y()/chamber->tState.localDirection().z():9999;
835  // DANGEROUS - compiler cannot guaranty parameters ordering
836  AlgebraicSymMatrix55 trajectoryCovMatrix = chamber->tState.localError().matrix();
837  matchedChamber.dXdZErr = trajectoryCovMatrix(1,1)>0?sqrt(trajectoryCovMatrix(1,1)):0;
838  matchedChamber.dYdZErr = trajectoryCovMatrix(2,2)>0?sqrt(trajectoryCovMatrix(2,2)):0;
839 
840  matchedChamber.edgeX = chamber->localDistanceX;
841  matchedChamber.edgeY = chamber->localDistanceY;
842 
843  matchedChamber.id = chamber->id;
844  if ( ! chamber->segments.empty() ) ++nubmerOfMatchesAccordingToTrackAssociator;
845 
846  // fill segments
847  for( std::vector<TAMuonSegmentMatch>::const_iterator segment = chamber->segments.begin();
848  segment != chamber->segments.end(); segment++ )
849  {
850  reco::MuonSegmentMatch matchedSegment;
851  matchedSegment.x = segment->segmentLocalPosition.x();
852  matchedSegment.y = segment->segmentLocalPosition.y();
853  matchedSegment.dXdZ = segment->segmentLocalDirection.z()?segment->segmentLocalDirection.x()/segment->segmentLocalDirection.z():0;
854  matchedSegment.dYdZ = segment->segmentLocalDirection.z()?segment->segmentLocalDirection.y()/segment->segmentLocalDirection.z():0;
855  matchedSegment.xErr = segment->segmentLocalErrorXX>0?sqrt(segment->segmentLocalErrorXX):0;
856  matchedSegment.yErr = segment->segmentLocalErrorYY>0?sqrt(segment->segmentLocalErrorYY):0;
857  matchedSegment.dXdZErr = segment->segmentLocalErrorDxDz>0?sqrt(segment->segmentLocalErrorDxDz):0;
858  matchedSegment.dYdZErr = segment->segmentLocalErrorDyDz>0?sqrt(segment->segmentLocalErrorDyDz):0;
859  matchedSegment.t0 = segment->t0;
860  matchedSegment.mask = 0;
861  matchedSegment.dtSegmentRef = segment->dtSegmentRef;
862  matchedSegment.cscSegmentRef = segment->cscSegmentRef;
863  matchedSegment.hasZed_ = segment->hasZed;
864  matchedSegment.hasPhi_ = segment->hasPhi;
865  // test segment
866  bool matchedX = false;
867  bool matchedY = false;
868  LogTrace("MuonIdentification") << " matching local x, segment x: " << matchedSegment.x <<
869  ", chamber x: " << matchedChamber.x << ", max: " << maxAbsDx_;
870  LogTrace("MuonIdentification") << " matching local y, segment y: " << matchedSegment.y <<
871  ", chamber y: " << matchedChamber.y << ", max: " << maxAbsDy_;
872  if (matchedSegment.xErr>0 && matchedChamber.xErr>0 )
873  LogTrace("MuonIdentification") << " xpull: " <<
874  fabs(matchedSegment.x - matchedChamber.x)/sqrt(pow(matchedSegment.xErr,2) + pow(matchedChamber.xErr,2));
875  if (matchedSegment.yErr>0 && matchedChamber.yErr>0 )
876  LogTrace("MuonIdentification") << " ypull: " <<
877  fabs(matchedSegment.y - matchedChamber.y)/sqrt(pow(matchedSegment.yErr,2) + pow(matchedChamber.yErr,2));
878 
879  if (fabs(matchedSegment.x - matchedChamber.x) < maxAbsDx_) matchedX = true;
880  if (fabs(matchedSegment.y - matchedChamber.y) < maxAbsDy_) matchedY = true;
881  if (matchedSegment.xErr>0 && matchedChamber.xErr>0 &&
882  fabs(matchedSegment.x - matchedChamber.x)/sqrt(pow(matchedSegment.xErr,2) + pow(matchedChamber.xErr,2)) < maxAbsPullX_) matchedX = true;
883  if (matchedSegment.yErr>0 && matchedChamber.yErr>0 &&
884  fabs(matchedSegment.y - matchedChamber.y)/sqrt(pow(matchedSegment.yErr,2) + pow(matchedChamber.yErr,2)) < maxAbsPullY_) matchedY = true;
885  if (matchedX && matchedY) matchedChamber.segmentMatches.push_back(matchedSegment);
886  }
887  muonChamberMatches.push_back(matchedChamber);
888  }
889  aMuon.setMatches(muonChamberMatches);
890 
891  LogTrace("MuonIdentification") << "number of muon chambers: " << aMuon.matches().size() << "\n"
892  << "number of chambers with segments according to the associator requirements: " <<
893  nubmerOfMatchesAccordingToTrackAssociator;
894  LogTrace("MuonIdentification") << "number of segment matches with the producer requirements: " <<
896 
897  // fillTime( iEvent, iSetup, aMuon );
898 }
899 
901 {
902  //
903  // apply segment flags
904  //
905  std::vector<std::pair<reco::MuonChamberMatch*,reco::MuonSegmentMatch*> > chamberPairs; // for chamber segment sorting
906  std::vector<std::pair<reco::MuonChamberMatch*,reco::MuonSegmentMatch*> > stationPairs; // for station segment sorting
907  std::vector<std::pair<reco::MuonChamberMatch*,reco::MuonSegmentMatch*> > arbitrationPairs; // for muon segment arbitration
908 
909  // muonIndex1
910  for( unsigned int muonIndex1 = 0; muonIndex1 < pOutputMuons->size(); ++muonIndex1 )
911  {
912  // chamberIter1
913  for( std::vector<reco::MuonChamberMatch>::iterator chamberIter1 = pOutputMuons->at(muonIndex1).matches().begin();
914  chamberIter1 != pOutputMuons->at(muonIndex1).matches().end(); ++chamberIter1 )
915  {
916  if(chamberIter1->segmentMatches.empty()) continue;
917  chamberPairs.clear();
918 
919  // segmentIter1
920  for( std::vector<reco::MuonSegmentMatch>::iterator segmentIter1 = chamberIter1->segmentMatches.begin();
921  segmentIter1 != chamberIter1->segmentMatches.end(); ++segmentIter1 )
922  {
923  chamberPairs.push_back(std::make_pair(&(*chamberIter1), &(*segmentIter1)));
924  if(!segmentIter1->isMask()) // has not yet been arbitrated
925  {
926  arbitrationPairs.clear();
927  arbitrationPairs.push_back(std::make_pair(&(*chamberIter1), &(*segmentIter1)));
928 
929 
930 
931  // find identical segments with which to arbitrate
932  // tracker muons only
933  if (pOutputMuons->at(muonIndex1).isTrackerMuon()) {
934  // muonIndex2
935  for( unsigned int muonIndex2 = muonIndex1+1; muonIndex2 < pOutputMuons->size(); ++muonIndex2 )
936  {
937  // tracker muons only
938  if (! pOutputMuons->at(muonIndex2).isTrackerMuon()) continue;
939  // chamberIter2
940  for( std::vector<reco::MuonChamberMatch>::iterator chamberIter2 = pOutputMuons->at(muonIndex2).matches().begin();
941  chamberIter2 != pOutputMuons->at(muonIndex2).matches().end(); ++chamberIter2 )
942  {
943  // segmentIter2
944  for( std::vector<reco::MuonSegmentMatch>::iterator segmentIter2 = chamberIter2->segmentMatches.begin();
945  segmentIter2 != chamberIter2->segmentMatches.end(); ++segmentIter2 )
946  {
947  if(segmentIter2->isMask()) continue; // has already been arbitrated
948  if(fabs(segmentIter2->x - segmentIter1->x ) < 1E-3 &&
949  fabs(segmentIter2->y - segmentIter1->y ) < 1E-3 &&
950  fabs(segmentIter2->dXdZ - segmentIter1->dXdZ ) < 1E-3 &&
951  fabs(segmentIter2->dYdZ - segmentIter1->dYdZ ) < 1E-3 &&
952  fabs(segmentIter2->xErr - segmentIter1->xErr ) < 1E-3 &&
953  fabs(segmentIter2->yErr - segmentIter1->yErr ) < 1E-3 &&
954  fabs(segmentIter2->dXdZErr - segmentIter1->dXdZErr) < 1E-3 &&
955  fabs(segmentIter2->dYdZErr - segmentIter1->dYdZErr) < 1E-3)
956  arbitrationPairs.push_back(std::make_pair(&(*chamberIter2), &(*segmentIter2)));
957  } // segmentIter2
958  } // chamberIter2
959  } // muonIndex2
960  }
961 
962  // arbitration segment sort
963  if(arbitrationPairs.empty()) continue; // this should never happen
964  if(arbitrationPairs.size()==1) {
965  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDRSlope);
966  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDXSlope);
967  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDR);
968  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDX);
969  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::Arbitrated);
970  } else {
971  sort(arbitrationPairs.begin(), arbitrationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BelongsToTrackByDRSlope));
972  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDRSlope);
973  sort(arbitrationPairs.begin(), arbitrationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BelongsToTrackByDXSlope));
974  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDXSlope);
975  sort(arbitrationPairs.begin(), arbitrationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BelongsToTrackByDR));
976  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDR);
977  sort(arbitrationPairs.begin(), arbitrationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BelongsToTrackByDX));
978  arbitrationPairs.front().second->setMask(reco::MuonSegmentMatch::BelongsToTrackByDX);
979  for( unsigned int it = 0; it < arbitrationPairs.size(); ++it )
980  arbitrationPairs.at(it).second->setMask(reco::MuonSegmentMatch::Arbitrated);
981  }
982  }
983 
984  // setup me1a cleaning for later
985  if( chamberIter1->id.subdetId() == MuonSubdetId::CSC && arbClean_ ) {
986  CSCDetId cscid(chamberIter1->id);
987  if(cscid.ring() == 4)
988  for( std::vector<reco::MuonSegmentMatch>::iterator segmentIter2 = chamberIter1->segmentMatches.begin();
989  segmentIter2 != chamberIter1->segmentMatches.end(); ++segmentIter2 ) {
990  if( segmentIter1->cscSegmentRef.isNonnull() && segmentIter2->cscSegmentRef.isNonnull() )
991  if( meshAlgo_->isDuplicateOf(segmentIter1->cscSegmentRef,segmentIter2->cscSegmentRef) &&
992  (segmentIter2->mask & 0x1e0000) &&
993  (segmentIter1->mask & 0x1e0000) )
995  //if the track has lost the segment already through normal arbitration no need to do it again.
996  }
997  }// mark all ME1/a duplicates that this track owns
998 
999  } // segmentIter1
1000 
1001  // chamber segment sort
1002  if(chamberPairs.empty()) continue; // this should never happen
1003  if(chamberPairs.size()==1) {
1004  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDRSlope);
1005  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDXSlope);
1006  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDR);
1007  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDX);
1008  } else {
1009  sort(chamberPairs.begin(), chamberPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInChamberByDRSlope));
1010  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDRSlope);
1011  sort(chamberPairs.begin(), chamberPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInChamberByDXSlope));
1012  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDXSlope);
1013  sort(chamberPairs.begin(), chamberPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInChamberByDR));
1014  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDR);
1015  sort(chamberPairs.begin(), chamberPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInChamberByDX));
1016  chamberPairs.front().second->setMask(reco::MuonSegmentMatch::BestInChamberByDX);
1017  }
1018  } // chamberIter1
1019 
1020  // station segment sort
1021  for( int stationIndex = 1; stationIndex < 5; ++stationIndex )
1022  for( int detectorIndex = 1; detectorIndex < 4; ++detectorIndex )
1023  {
1024  stationPairs.clear();
1025 
1026  // chamberIter
1027  for( std::vector<reco::MuonChamberMatch>::iterator chamberIter = pOutputMuons->at(muonIndex1).matches().begin();
1028  chamberIter != pOutputMuons->at(muonIndex1).matches().end(); ++chamberIter )
1029  {
1030  if(!(chamberIter->station()==stationIndex && chamberIter->detector()==detectorIndex)) continue;
1031  if(chamberIter->segmentMatches.empty()) continue;
1032 
1033  for( std::vector<reco::MuonSegmentMatch>::iterator segmentIter = chamberIter->segmentMatches.begin();
1034  segmentIter != chamberIter->segmentMatches.end(); ++segmentIter )
1035  stationPairs.push_back(std::make_pair(&(*chamberIter), &(*segmentIter)));
1036  } // chamberIter
1037 
1038  if(stationPairs.empty()) continue; // this may very well happen
1039  if(stationPairs.size()==1) {
1040  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDRSlope);
1041  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDXSlope);
1042  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDR);
1043  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDX);
1044  } else {
1045  sort(stationPairs.begin(), stationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInStationByDRSlope));
1046  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDRSlope);
1047  sort(stationPairs.begin(), stationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInStationByDXSlope));
1048  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDXSlope);
1049  sort(stationPairs.begin(), stationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInStationByDR));
1050  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDR);
1051  sort(stationPairs.begin(), stationPairs.end(), SortMuonSegmentMatches(reco::MuonSegmentMatch::BestInStationByDX));
1052  stationPairs.front().second->setMask(reco::MuonSegmentMatch::BestInStationByDX);
1053  }
1054  }
1055 
1056  } // muonIndex1
1057 
1058  if(arbClean_) {
1059  // clear old mesh, create and prune new mesh!
1060  meshAlgo_->clearMesh();
1061  meshAlgo_->runMesh(pOutputMuons);
1062  }
1063 }
1064 
1066  reco::IsoDeposit& trackDep, reco::IsoDeposit& ecalDep, reco::IsoDeposit& hcalDep, reco::IsoDeposit& hoDep,
1067  reco::IsoDeposit& jetDep)
1068 {
1069  reco::MuonIsolation isoR03, isoR05;
1070  const reco::Track* track = 0;
1071  if ( ! aMuon.track().isNull() )
1072  track = aMuon.track().get();
1073  else
1074  {
1075  if ( ! aMuon.standAloneMuon().isNull() )
1076  track = aMuon.standAloneMuon().get();
1077  else
1078  throw cms::Exception("FatalError") << "Failed to compute muon isolation information for a muon with undefined references to tracks";
1079  }
1080 
1081  // get deposits
1082  reco::IsoDeposit depTrk = muIsoExtractorTrack_->deposit(iEvent, iSetup, *track );
1083  std::vector<reco::IsoDeposit> caloDeps = muIsoExtractorCalo_->deposits(iEvent, iSetup, *track);
1084  reco::IsoDeposit depJet = muIsoExtractorJet_->deposit(iEvent, iSetup, *track );
1085 
1086  if(caloDeps.size()!=3) {
1087  LogTrace("MuonIdentification") << "Failed to fill vector of calorimeter isolation deposits!";
1088  return;
1089  }
1090 
1091  reco::IsoDeposit depEcal = caloDeps.at(0);
1092  reco::IsoDeposit depHcal = caloDeps.at(1);
1093  reco::IsoDeposit depHo = caloDeps.at(2);
1094 
1095  trackDep = depTrk;
1096  ecalDep = depEcal;
1097  hcalDep = depHcal;
1098  hoDep = depHo;
1099  jetDep = depJet;
1100 
1101  isoR03.sumPt = depTrk.depositWithin(0.3);
1102  isoR03.emEt = depEcal.depositWithin(0.3);
1103  isoR03.hadEt = depHcal.depositWithin(0.3);
1104  isoR03.hoEt = depHo.depositWithin(0.3);
1105  isoR03.nTracks = depTrk.depositAndCountWithin(0.3).second;
1106  isoR03.nJets = depJet.depositAndCountWithin(0.3).second;
1107  isoR03.trackerVetoPt = depTrk.candEnergy();
1108  isoR03.emVetoEt = depEcal.candEnergy();
1109  isoR03.hadVetoEt = depHcal.candEnergy();
1110  isoR03.hoVetoEt = depHo.candEnergy();
1111 
1112  isoR05.sumPt = depTrk.depositWithin(0.5);
1113  isoR05.emEt = depEcal.depositWithin(0.5);
1114  isoR05.hadEt = depHcal.depositWithin(0.5);
1115  isoR05.hoEt = depHo.depositWithin(0.5);
1116  isoR05.nTracks = depTrk.depositAndCountWithin(0.5).second;
1117  isoR05.nJets = depJet.depositAndCountWithin(0.5).second;
1118  isoR05.trackerVetoPt = depTrk.candEnergy();
1119  isoR05.emVetoEt = depEcal.candEnergy();
1120  isoR05.hadVetoEt = depHcal.candEnergy();
1121  isoR05.hoVetoEt = depHo.candEnergy();
1122 
1123 
1124  aMuon.setIsolation(isoR03, isoR05);
1125 
1126 }
1127 
1129 {
1130  //FIXME: E = sqrt(p^2 + m^2), where m == 0.105658369(9)GeV
1131  double energy = sqrt(track.p() * track.p() + 0.011163691);
1132  math::XYZTLorentzVector p4(track.px(),
1133  track.py(),
1134  track.pz(),
1135  energy);
1136  return reco::Muon( track.charge(), p4, track.vertex() );
1137 }
1138 
1140 {
1141  double phi = 0;
1142  if( id.subdetId() == MuonSubdetId::DT ) { // DT
1143  DTChamberId muonId(id.rawId());
1144  if ( muonId.sector() <= 12 )
1145  phi = (muonId.sector()-1)/6.*M_PI;
1146  if ( muonId.sector() == 13 ) phi = 3/6.*M_PI;
1147  if ( muonId.sector() == 14 ) phi = 9/6.*M_PI;
1148  }
1149  if( id.subdetId() == MuonSubdetId::CSC ) { // CSC
1150  CSCDetId muonId(id.rawId());
1151  phi = M_PI/4+(muonId.triggerSector()-1)/3.*M_PI;
1152  }
1153  if ( phi > M_PI ) phi -= 2*M_PI;
1154  return phi;
1155 }
1156 
1158 {
1159  if ( muon.isStandAloneMuon() ) return muon.standAloneMuon()->innerPosition().phi();
1160  // the rest is tracker muon only
1161  if ( muon.matches().empty() ){
1162  if ( muon.innerTrack().isAvailable() &&
1163  muon.innerTrack()->extra().isAvailable() )
1164  return muon.innerTrack()->outerPosition().phi();
1165  else
1166  return muon.phi(); // makes little sense, but what else can I use
1167  }
1168  return sectorPhi(muon.matches().at(0).id);
1169 }
1170 
1172 {
1174  iEvent.getByLabel(globalTrackQualityInputTag_, glbQualH);
1175 
1176  if(aMuon.isGlobalMuon() && glbQualH.isValid() && !glbQualH.failedToGet()) {
1177  aMuon.setCombinedQuality((*glbQualH)[aMuon.combinedMuon()]);
1178  }
1179 
1180  LogDebug("MuonIdentification") << "tkChiVal " << aMuon.combinedQuality().trkRelChi2;
1181 
1182 }
1183 
1185  // skip muons with no tracks
1186  if (aMuon.innerTrack().isNull()) return;
1187  // get quality from muon if already there, otherwise make empty one
1188  reco::MuonQuality quality = (aMuon.isQualityValid() ? aMuon.combinedQuality() : reco::MuonQuality());
1189  // fill it
1190  bool filled = trackerKinkFinder_->fillTrkKink(quality, *aMuon.innerTrack());
1191  // if quality was there, or if we filled it, commit to the muon
1192  if (filled || aMuon.isQualityValid()) aMuon.setCombinedQuality(quality);
1193 }
1194 
1196  bool trackBAD = links->trackerTrack().isNull();
1197  bool staBAD = links->standAloneTrack().isNull();
1198  bool glbBAD = links->globalTrack().isNull();
1199  if (trackBAD || staBAD || glbBAD )
1200  {
1201  edm::LogWarning("muonIDbadLinks") << "Global muon links to constituent tracks are invalid: trkBad "
1202  <<trackBAD <<" standaloneBad "<<staBAD<<" globalBad "<<glbBAD
1203  <<". There should be no such object. Muon is skipped.";
1204  return false;
1205  }
1206  return true;
1207 }
#define LogDebug(id)
std::string hoDepositName_
double p() const
momentum vector magnitude
Definition: TrackBase.h:129
type
Definition: HCALResponse.h:22
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
T getParameter(std::string const &) const
static const unsigned int BelongsToTrackByME1aClean
std::string jetDepositName_
double candEnergy() const
Get energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:131
int i
Definition: DBlmapReader.cc:9
float xx() const
Definition: LocalError.h:24
reco::Muon makeMuon(edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::TrackRef &track, TrackType type)
dictionary parameters
Definition: Parameters.py:2
static const unsigned int GlobalMuon
Definition: Muon.h:200
void fillMuonIsolation(edm::Event &, const edm::EventSetup &, reco::Muon &aMuon, reco::IsoDeposit &trackDep, reco::IsoDeposit &ecalDep, reco::IsoDeposit &hcalDep, reco::IsoDeposit &hoDep, reco::IsoDeposit &jetDep)
static void truthMatchMuon(const edm::Event &iEvent, const edm::EventSetup &iSetup, reco::Muon &aMuon)
DTRecSegment4DRef dtSegmentRef
void runMesh(std::vector< reco::Muon > *p)
Definition: MuonMesh.h:39
static bool crossedIP(const reco::Track &track)
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
virtual void setOuterTrack(const TrackRef &t)
set reference to Track
Definition: Muon.cc:752
void setType(unsigned int type)
Definition: Muon.h:207
TrackDetectorAssociator trackAssociator_
CSCSegmentRef cscSegmentRef
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:97
static const unsigned int Arbitrated
segment mask flags
void fillMuonId(edm::Event &, const edm::EventSetup &, reco::Muon &, TrackDetectorAssociator::Direction direction=TrackDetectorAssociator::InsideOut)
reco::isodeposit::IsoDepositExtractor * muIsoExtractorCalo_
virtual TrackRef innerTrack() const
Definition: Muon.h:49
edm::Handle< reco::MuonTrackLinksCollection > linkCollectionHandle_
bool isTrackerMuon() const
Definition: Muon.h:212
int overlap(const reco::Muon &muon, const reco::Track &track)
bool fillCaloCompatibility_
std::vector< const EcalRecHit * > ecalRecHits
hits in the cone
virtual void setInnerTrack(const TrackRef &t)
set reference to Track
Definition: Muon.cc:753
std::vector< DetId > crossedEcalIds
std::string trackDepositName_
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
double phiOfMuonIneteractionRegion(const reco::Muon &muon) const
std::vector< CaloMuon > CaloMuonCollection
collection of Muon objects
Definition: MuonFwd.h:27
DetId findMaxDeposition(EnergyType)
Find detector elements with highest energy deposition.
float hadVetoEt
hcal sum-et in the veto region in r-phi
Definition: MuonIsolation.h:15
virtual TrackRef track() const
reference to a Track
Definition: Muon.h:50
bool isGlobalMuon() const
Definition: Muon.h:211
float emS9
energy deposited in 3x3 ECAL crystal shape around central crystal
Definition: MuonEnergy.h:18
std::vector< std::string > inputCollectionTypes_
double evaluate(const reco::Muon &)
MuonCaloCompatibility muonCaloCompatibility_
static const unsigned int BestInStationByDRSlope
float timeAtIpOutInErr() const
Definition: MuonTimeExtra.h:50
bool isMatchesValid() const
Definition: Muon.h:139
#define min(a, b)
Definition: mlp_lapack.h:161
void setIsolation(const MuonIsolation &isoR03, const MuonIsolation &isoR05)
Definition: Muon.cc:728
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:133
bool isAvailable() const
Definition: Ref.h:276
static const unsigned int BelongsToTrackByDXSlope
bool isStandAloneMuon() const
Definition: Muon.h:213
void setCalEnergy(const MuonEnergy &calEnergy)
set energy deposition information
Definition: Muon.h:114
void fillGlbQuality(edm::Event &, const edm::EventSetup &, reco::Muon &aMuon)
int nDof() const
number of measurements used in timing calculation
Definition: MuonTimeExtra.h:23
float timeAtIpOutInErr
Definition: MuonTime.h:18
std::vector< DetId > crossedHcalIds
float trkRelChi2
chi2 value for the inner track stub with respect to the global track
Definition: MuonQuality.h:15
std::auto_ptr< MuonKinkFinder > trackerKinkFinder_
double nXnEnergy(const DetId &, EnergyType, int gridSize=1)
get energy of the NxN shape (N = 2*gridSize + 1) around given detector element
float towerS9
total energy in 3x3 tower shape
Definition: MuonEnergy.h:12
static const unsigned int BestInStationByDR
virtual double eta() const
momentum pseudorapidity
MuonTime time() const
get timing information
Definition: Muon.h:132
virtual void beginRun(edm::Run &, const edm::EventSetup &)
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
math::XYZPoint trkGlobPosAtHcal
void clearMesh()
Definition: MuonMesh.h:41
float ecal_time
Calorimeter timing.
Definition: MuonEnergy.h:37
float ho
energy deposited in crossed HO towers
Definition: MuonEnergy.h:32
MuonMesh * meshAlgo_
double depositWithin(double coneSize, const Vetos &vetos=Vetos(), bool skipDepositVeto=false) const
Get deposit.
Definition: IsoDeposit.cc:34
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
void setCSCGeometry(const CSCGeometry *pg)
Definition: MuonMesh.h:43
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
void init(edm::Event &, const edm::EventSetup &)
DetId hcal_id
DetId of the central HCAL tower with smallest depth.
Definition: MuonEnergy.h:50
int iEvent
Definition: GenABIO.cc:243
static const int CSC
Definition: MuonSubdetId.h:15
bool isNull() const
Checks for null.
Definition: Ref.h:247
double ptThresholdToFillCandidateP4WithGlobalFit_
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
reco::Muon::MuonTrackTypePair sigmaSwitch(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const double nSigma=2., const double ptThreshold=200.)
TrackAssociatorParameters parameters_
bool isCaloCompatibilityValid() const
Definition: CaloMuon.h:45
void fillArbitrationInfo(reco::MuonCollection *)
void fillTrackerKink(reco::Muon &aMuon)
void setPropagator(const Propagator *)
use a user configured propagator
float yy() const
Definition: LocalError.h:26
float emS25
energy deposited in 5x5 ECAL crystal shape around central crystal
Definition: MuonEnergy.h:20
double p() const
momentum vector magnitude
Definition: CaloMuon.h:52
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
T sqrt(T t)
Definition: SSEVec.h:46
double p4[4]
Definition: TauolaWrapper.h:92
bool isGoodTrackerMuon(const reco::Muon &muon)
double pt() const
track transverse momentum
Definition: TrackBase.h:131
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
bool checkLinks(const reco::MuonTrackLinks *) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float timeAtIpInOutErr
Definition: MuonTime.h:15
std::vector< TAMuonChamberMatch > chambers
int nJets
number of jets in the cone
Definition: MuonIsolation.h:12
std::vector< const HBHERecHit * > hcalRecHits
static const unsigned int BestInChamberByDX
std::string ecalDepositName_
MuonQuality combinedQuality() const
get energy deposition information
Definition: Muon.h:122
float timeAtIpOutIn
b) particle is moving from outside in
Definition: MuonTime.h:17
int nDof
number of muon stations used
Definition: MuonTime.h:10
float timeAtIpInOutErr() const
Definition: MuonTimeExtra.h:45
int j
Definition: DBlmapReader.cc:9
CSCDetId chamberId() const
Definition: CSCDetId.h:55
float hoEt
ho sum-Et
Definition: MuonIsolation.h:10
float hoS9
energy deposited in 3x3 HO tower shape around central tower
Definition: MuonEnergy.h:34
static const unsigned int BestInChamberByDR
bool isQualityValid() const
Definition: Muon.h:120
edm::Handle< reco::TrackToTrackMap > dytCollectionHandle_
bool isValid() const
Definition: HandleBase.h:76
edm::Handle< reco::TrackCollection > outerTrackCollectionHandle_
void setMuonTrack(const MuonTrackType &, const TrackRef &)
Definition: Muon.cc:776
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double crossedEnergy(EnergyType)
energy in detector elements crossed by the track by types
#define LogTrace(id)
static const unsigned int BestInStationByDXSlope
math::XYZPointF hcal_position
Definition: MuonEnergy.h:44
bool fillGlobalTrackRefits_
static double sectorPhi(const DetId &id)
bool isEnergyValid() const
Definition: Muon.h:110
float hoVetoEt
ho sum-et in the veto region in r-phi
Definition: MuonIsolation.h:16
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
Definition: Muon.cc:56
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:137
MuonEnergy calEnergy() const
get energy deposition information
Definition: Muon.h:112
reco::CaloMuon makeCaloMuon(const reco::Muon &)
virtual ~MuonIdProducer()
int nTracks
number of tracks in the cone (excluding veto region)
Definition: MuonIsolation.h:11
static const unsigned int BestInChamberByDXSlope
float emMax
maximal energy of ECAL crystal in the 5x5 shape
Definition: MuonEnergy.h:22
reco::isodeposit::IsoDepositExtractor * muIsoExtractorTrack_
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:156
int ring() const
Definition: CSCDetId.h:77
bool failedToGet() const
Definition: HandleBase.h:80
void setCaloCompatibility(float input)
Definition: CaloMuon.h:44
Definition: DetId.h:20
#define M_PI
Definition: BFit3D.cc:3
bool isTimeValid() const
Definition: Muon.h:130
virtual TrackRef combinedMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:56
static const unsigned int TrackerMuon
Definition: Muon.h:201
float emVetoEt
ecal sum-et in the veto region in r-phi
Definition: MuonIsolation.h:14
void configure(const edm::ParameterSet &)
reco::isodeposit::IsoDepositExtractor * muIsoExtractorJet_
bool isDuplicateOf(const CSCSegmentRef &lhs, const CSCSegmentRef &rhs) const
Definition: MuonMesh.cc:342
MuonTimingFiller * theTimingFiller_
float timeAtIpInOut() const
Definition: MuonTimeExtra.h:44
float hadMax
maximal energy of HCAL tower in the 3x3 shape
Definition: MuonEnergy.h:30
virtual double pt() const
transverse momentum
virtual std::vector< reco::IsoDeposit > deposits(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
static const unsigned int BelongsToTrackByDRSlope
virtual void setInnerTrack(const TrackRef &t)
set reference to Track
Definition: CaloMuon.h:31
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void setCombinedQuality(const MuonQuality &combinedQuality)
set energy deposition information
Definition: Muon.h:124
std::vector< edm::InputTag > inputCollectionLabels_
std::vector< MuonChamberMatch > & matches()
get muon matching information
Definition: Muon.h:141
void setCalEnergy(const MuonEnergy &calEnergy)
set energy deposition information
Definition: CaloMuon.h:38
int triggerSector() const
Definition: CSCDetId.cc:47
MuonIdProducer(const edm::ParameterSet &)
std::vector< reco::MuonSegmentMatch > segmentMatches
bool fillGlobalTrackQuality_
DetId ecal_id
DetId of the central ECAL crystal.
Definition: MuonEnergy.h:47
static const unsigned int BelongsToTrackByDR
std::string hcalDepositName_
unsigned int chamberId(const DetId &)
reco::TrackRef getTevRefitTrack(const reco::TrackRef &combinedTrack, const reco::TrackToTrackMap &map)
static const unsigned int BelongsToTrackByDX
virtual void setBestTrack(MuonTrackType muonType)
Definition: Muon.h:94
functor predicate for standard library sort algorithm
int sector() const
Definition: DTChamberId.h:63
std::pair< double, int > depositAndCountWithin(double coneSize, const Vetos &vetos=Vetos(), double threshold=-1e+36, bool skipDepositVeto=false) const
Get deposit.
Definition: IsoDeposit.cc:44
edm::Handle< reco::TrackToTrackMap > tpfmsCollectionHandle_
def stationIndex
Definition: plotscripts.py:353
static const unsigned int BestInStationByDX
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
edm::Handle< reco::TrackCollection > innerTrackCollectionHandle_
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
reco::Muon::MuonTrackTypePair tevOptimized(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
Definition: MuonCocktails.cc:9
int charge() const
track electric charge
Definition: TrackBase.h:113
static const int DT
Definition: MuonSubdetId.h:14
bool isGoodTrack(const reco::Track &track)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
MuonTrackType
map for Global Muon refitters
Definition: Muon.h:39
double sigmaThresholdToFillCandidateP4WithGlobalFit_
static const unsigned int StandAloneMuon
Definition: Muon.h:202
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const =0
float timeAtIpOutIn() const
b) particle is moving from outside in
Definition: MuonTimeExtra.h:49
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:41
void setMatches(const std::vector< MuonChamberMatch > &matches)
set muon matching information
Definition: Muon.h:144
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
virtual void setGlobalTrack(const TrackRef &t)
set reference to Track
Definition: Muon.cc:756
void fillTiming(const reco::Muon &muon, reco::MuonTimeExtra &dtTime, reco::MuonTimeExtra &cscTime, reco::MuonTimeExtra &combinedTime, edm::Event &iEvent, const edm::EventSetup &iSetup)
math::XYZPointF ecal_position
Trajectory position at the calorimeter.
Definition: MuonEnergy.h:43
virtual void produce(edm::Event &, const edm::EventSetup &)
virtual double phi() const
momentum azimuthal angle
static const unsigned int BestInChamberByDRSlope
float caloCompatibility() const
Definition: CaloMuon.h:43
bool validateGlobalMuonPair(const reco::MuonTrackLinks &goodMuon, const reco::MuonTrackLinks &badMuon)
bool debugWithTruthMatching_
float timeAtIpInOut
Definition: MuonTime.h:14
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
float trackerVetoPt
(sum-)pt inside the veto region in r-phi
Definition: MuonIsolation.h:13
float hadS9
energy deposited in 3x3 HCAL tower shape around central tower
Definition: MuonEnergy.h:28
T get(const Candidate &c)
Definition: component.h:56
edm::InputTag globalTrackQualityInputTag_
edm::Handle< reco::MuonCollection > muonCollectionHandle_
void loadParameters(const edm::ParameterSet &)
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:135
Definition: Run.h:33
edm::Handle< reco::TrackToTrackMap > pickyCollectionHandle_
Definition: DDAxes.h:10
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:53