CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
PFMuonAlgo Class Reference

#include <PFMuonAlgo.h>

Classes

class  IndexPtComparator
 
class  TrackMETComparator
 
class  TrackPtErrorSorter
 

Public Member Functions

void addMissingMuons (edm::Handle< reco::MuonCollection >, reco::PFCandidateCollection *cands)
 
void changeTrack (reco::PFCandidate &, const MuonTrackTypePair &)
 
 PFMuonAlgo (edm::ParameterSet const &, bool postMuonCleaning)
 constructor More...
 
void postClean (reco::PFCandidateCollection *)
 
bool reconstructMuon (reco::PFCandidate &, const reco::MuonRef &, bool allowLoose=false)
 
void setInputsForCleaning (reco::VertexCollection const &)
 
std::unique_ptr< reco::PFCandidateCollectiontransferAddedMuonCandidates ()
 
std::unique_ptr< reco::PFCandidateCollectiontransferCleanedCosmicCandidates ()
 
std::unique_ptr< reco::PFCandidateCollectiontransferCleanedFakeCandidates ()
 
std::unique_ptr< reco::PFCandidateCollectiontransferCleanedTrackerAndGlobalCandidates ()
 
std::unique_ptr< reco::PFCandidateCollectiontransferPunchThroughCleanedHadronCandidates ()
 
std::unique_ptr< reco::PFCandidateCollectiontransferPunchThroughCleanedMuonCandidates ()
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &iDesc)
 
static bool hasValidTrack (const reco::MuonRef &muonRef, bool loose, double maxDPtOPt)
 
static bool isGlobalLooseMuon (const reco::MuonRef &muonRef)
 
static bool isGlobalLooseMuon (const reco::PFBlockElement &elt)
 
static bool isGlobalTightMuon (const reco::MuonRef &muonRef)
 
static bool isGlobalTightMuon (const reco::PFBlockElement &elt)
 
static bool isIsolatedMuon (const reco::MuonRef &muonRef)
 
static bool isIsolatedMuon (const reco::PFBlockElement &elt)
 
static bool isLooseMuon (const reco::MuonRef &muonRef)
 
static bool isLooseMuon (const reco::PFBlockElement &elt)
 
static bool isMuon (const reco::MuonRef &muonRef)
 
static bool isMuon (const reco::PFBlockElement &elt)
 
static bool isTightMuonPOG (const reco::MuonRef &muonRef)
 
static bool isTrackerLooseMuon (const reco::MuonRef &muonRef)
 
static bool isTrackerLooseMuon (const reco::PFBlockElement &elt)
 
static bool isTrackerTightMuon (const reco::MuonRef &muonRef)
 
static bool isTrackerTightMuon (const reco::PFBlockElement &elt)
 
static std::vector< reco::Muon::MuonTrackTypePairmuonTracks (const reco::MuonRef &muon, double maxDPtOPt=1e+9, bool includeSA=false)
 
static void printMuonProperties (const reco::MuonRef &muonRef)
 

Private Types

typedef reco::Muon::MuonTrackType MuonTrackType
 
typedef reco::Muon::MuonTrackTypePair MuonTrackTypePair
 

Private Member Functions

bool cleanMismeasured (reco::PFCandidate &, unsigned int)
 
bool cleanPunchThroughAndFakes (reco::PFCandidate &, reco::PFCandidateCollection *, unsigned int)
 
void estimateEventQuantities (const reco::PFCandidateCollection *)
 
std::pair< double, double > getMinMaxMET2 (const reco::PFCandidate &)
 
MuonTrackTypePair getTrackWithSmallestError (const std::vector< MuonTrackTypePair > &)
 
void removeDeadCandidates (reco::PFCandidateCollection *, const std::vector< unsigned int > &)
 
std::vector< MuonTrackTypePairtracksPointingAtMET (const std::vector< MuonTrackTypePair > &)
 
std::vector< MuonTrackTypePairtracksWithBetterMET (const std::vector< MuonTrackTypePair > &, const reco::PFCandidate &)
 

Private Attributes

const double cosmicRejDistance_
 
const double errorCompScale_
 
const double eventFactorCosmics_
 
const double eventFractionCleaning_
 
const double eventFractionRejection_
 
std::vector< unsigned int > maskedIndices_
 
const double maxDPtOPt_
 
const double metFactorCleaning_
 
const double metFactorFake_
 
const double metFactorHighEta_
 
const double metFactorRejection_
 
const double metSigForCleaning_
 
const double metSigForRejection_
 
double METX_
 
double METY_
 
const double minPostCleaningPt_
 
const double minPunchThroughEnergy_
 
const double minPunchThroughMomentum_
 
std::unique_ptr< reco::PFCandidateCollectionpfAddedMuonCandidates_
 the collection of added muon candidates More...
 
std::unique_ptr< reco::PFCandidateCollectionpfCleanedTrackerAndGlobalMuonCandidates_
 the collection of tracker/global cleaned muon candidates More...
 
std::unique_ptr< reco::PFCandidateCollectionpfCosmicsMuonCleanedCandidates_
 the collection of cosmics cleaned muon candidates More...
 
std::unique_ptr< reco::PFCandidateCollectionpfFakeMuonCleanedCandidates_
 the collection of fake cleaned muon candidates More...
 
std::unique_ptr< reco::PFCandidateCollectionpfPunchThroughHadronCleanedCandidates_
 the collection of punch-through cleaned neutral hadron candidates More...
 
std::unique_ptr< reco::PFCandidateCollectionpfPunchThroughMuonCleanedCandidates_
 the collection of punch-through cleaned muon candidates More...
 
const bool postCleaning_
 
const double ptFactorHighEta_
 
const double punchThroughFactor_
 
const double punchThroughMETFactor_
 
double sumet_
 
double sumetPU_
 
const reco::TrackBase::TrackQuality trackQuality_
 
const reco::VertexCollectionvertices_
 

Detailed Description

Definition at line 13 of file PFMuonAlgo.h.

Member Typedef Documentation

◆ MuonTrackType

Definition at line 15 of file PFMuonAlgo.h.

◆ MuonTrackTypePair

Definition at line 14 of file PFMuonAlgo.h.

Constructor & Destructor Documentation

◆ PFMuonAlgo()

PFMuonAlgo::PFMuonAlgo ( edm::ParameterSet const &  iConfig,
bool  postMuonCleaning 
)

constructor

Definition at line 17 of file PFMuonAlgo.cc.

19  : pfCosmicsMuonCleanedCandidates_(std::make_unique<reco::PFCandidateCollection>()),
20  pfCleanedTrackerAndGlobalMuonCandidates_(std::make_unique<reco::PFCandidateCollection>()),
21  pfFakeMuonCleanedCandidates_(std::make_unique<reco::PFCandidateCollection>()),
22  pfPunchThroughMuonCleanedCandidates_(std::make_unique<reco::PFCandidateCollection>()),
23  pfPunchThroughHadronCleanedCandidates_(std::make_unique<reco::PFCandidateCollection>()),
24  pfAddedMuonCandidates_(std::make_unique<reco::PFCandidateCollection>()),
25 
26  maxDPtOPt_(iConfig.getParameter<double>("maxDPtOPt")),
27  trackQuality_(reco::TrackBase::qualityByName(iConfig.getParameter<std::string>("trackQuality"))),
28  errorCompScale_(iConfig.getParameter<double>("ptErrorScale")),
29 
30  postCleaning_(postMuonCleaning), // disable by default (for HLT)
31  eventFractionCleaning_(iConfig.getParameter<double>("eventFractionForCleaning")),
32  minPostCleaningPt_(iConfig.getParameter<double>("minPtForPostCleaning")),
33  eventFactorCosmics_(iConfig.getParameter<double>("eventFactorForCosmics")),
34  metSigForCleaning_(iConfig.getParameter<double>("metSignificanceForCleaning")),
35  metSigForRejection_(iConfig.getParameter<double>("metSignificanceForRejection")),
36  metFactorCleaning_(iConfig.getParameter<double>("metFactorForCleaning")),
37  eventFractionRejection_(iConfig.getParameter<double>("eventFractionForRejection")),
38  metFactorRejection_(iConfig.getParameter<double>("metFactorForRejection")),
39  metFactorHighEta_(iConfig.getParameter<double>("metFactorForHighEta")),
40  ptFactorHighEta_(iConfig.getParameter<double>("ptFactorForHighEta")),
41  metFactorFake_(iConfig.getParameter<double>("metFactorForFakes")),
42  minPunchThroughMomentum_(iConfig.getParameter<double>("minMomentumForPunchThrough")),
43  minPunchThroughEnergy_(iConfig.getParameter<double>("minEnergyForPunchThrough")),
44  punchThroughFactor_(iConfig.getParameter<double>("punchThroughFactor")),
45  punchThroughMETFactor_(iConfig.getParameter<double>("punchThroughMETFactor")),
46  cosmicRejDistance_(iConfig.getParameter<double>("cosmicRejectionDistance")) {}

Member Function Documentation

◆ addMissingMuons()

void PFMuonAlgo::addMissingMuons ( edm::Handle< reco::MuonCollection muons,
reco::PFCandidateCollection cands 
)

Definition at line 717 of file PFMuonAlgo.cc.

717  {
718  if (!postCleaning_)
719  return;
720 
721  if (pfAddedMuonCandidates_.get())
722  pfAddedMuonCandidates_->clear();
723  else
724  pfAddedMuonCandidates_ = std::make_unique<reco::PFCandidateCollection>();
725 
726  for (unsigned imu = 0; imu < muons->size(); ++imu) {
727  reco::MuonRef muonRef(muons, imu);
728  bool used = false;
729  bool hadron = false;
730  for (unsigned i = 0; i < cands->size(); i++) {
731  const PFCandidate& pfc = cands->at(i);
732  if (!pfc.trackRef().isNonnull())
733  continue;
734  if (pfc.trackRef().isNonnull() && pfc.trackRef() == muonRef->track())
735  hadron = true;
736  if (!pfc.muonRef().isNonnull())
737  continue;
738 
739  if (pfc.muonRef()->innerTrack() == muonRef->innerTrack())
740  used = true;
741  else {
742  // Check if the stand-alone muon is not a spurious copy of an existing muon
743  // (Protection needed for HLT)
744  if (pfc.muonRef()->isStandAloneMuon() && muonRef->isStandAloneMuon()) {
745  double dEta = pfc.muonRef()->standAloneMuon()->eta() - muonRef->standAloneMuon()->eta();
746  double dPhi = pfc.muonRef()->standAloneMuon()->phi() - muonRef->standAloneMuon()->phi();
747  double dR = sqrt(dEta * dEta + dPhi * dPhi);
748  if (dR < 0.005) {
749  used = true;
750  }
751  }
752  }
753 
754  if (used)
755  break;
756  }
757 
758  if (used || hadron || (!muonRef.isNonnull()))
759  continue;
760 
761  TrackMETComparator comparator(METX_, METY_);
762  //Low pt dont need to be cleaned
763 
764  std::vector<reco::Muon::MuonTrackTypePair> tracks = muonTracks(muonRef, maxDPtOPt_, true);
765  //If there is at least 1 track choice try to change the track
766  if (!tracks.empty()) {
767  //Find tracks that change dramatically MET or Pt
768  std::vector<reco::Muon::MuonTrackTypePair> tracksThatChangeMET = tracksPointingAtMET(tracks);
769  //From those tracks get the one with smallest MET
770  if (!tracksThatChangeMET.empty()) {
771  reco::Muon::MuonTrackTypePair bestTrackType =
772  *std::min_element(tracksThatChangeMET.begin(), tracksThatChangeMET.end(), comparator);
773 
774  //Make sure it is not cosmic
775  if ((vertices_->empty()) || bestTrackType.first->dz(vertices_->at(0).position()) < cosmicRejDistance_) {
776  //make a pfcandidate
777  int charge = bestTrackType.first->charge() > 0 ? 1 : -1;
778  math::XYZTLorentzVector momentum(bestTrackType.first->px(),
779  bestTrackType.first->py(),
780  bestTrackType.first->pz(),
781  sqrt(bestTrackType.first->p() * bestTrackType.first->p() + 0.1057 * 0.1057));
782 
783  cands->push_back(PFCandidate(charge, momentum, reco::PFCandidate::mu));
784 
785  changeTrack(cands->back(), bestTrackType);
786 
787  if (muonRef->track().isNonnull())
788  cands->back().setTrackRef(muonRef->track());
789 
790  cands->back().setMuonRef(muonRef);
791 
792  pfAddedMuonCandidates_->push_back(cands->back());
793  }
794  }
795  }
796  }
797 }

References HLT_FULL_cff::cands, changeTrack(), ALCARECOTkAlJpsiMuMu_cff::charge, cosmicRejDistance_, HLT_FULL_cff::dEta, HLT_FULL_cff::dPhi, HGC3DClusterGenMatchSelector_cfi::dR, mps_fire::i, edm::Ref< C, T, F >::isNonnull(), maxDPtOPt_, METX_, METY_, reco::PFCandidate::mu, reco::PFCandidate::muonRef(), PDWG_BPHSkim_cff::muons, muonTracks(), pfAddedMuonCandidates_, pfElectronTranslator_cfi::PFCandidate, postCleaning_, mathSSE::sqrt(), reco::PFCandidate::trackRef(), PDWG_EXOHSCP_cff::tracks, tracksPointingAtMET(), and vertices_.

◆ changeTrack()

void PFMuonAlgo::changeTrack ( reco::PFCandidate candidate,
const MuonTrackTypePair track 
)

Definition at line 589 of file PFMuonAlgo.cc.

589  {
590  using namespace reco;
591  reco::TrackRef bestTrack = track.first;
592  MuonTrackType trackType = track.second;
593  //OK Now redefine the canddiate with that track
594  double px = bestTrack->px();
595  double py = bestTrack->py();
596  double pz = bestTrack->pz();
597  double energy = sqrt(bestTrack->p() * bestTrack->p() + 0.1057 * 0.1057);
598 
599  candidate.setCharge(bestTrack->charge() > 0 ? 1 : -1);
600  candidate.setP4(math::XYZTLorentzVector(px, py, pz, energy));
602  // candidate.setTrackRef( bestTrack );
603  candidate.setMuonTrackType(trackType);
604  candidate.setVertex(bestTrack->vertex());
605 }

References HCALHighEnergyHPDFilter_cfi::energy, reco::PFCandidate::mu, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, reco::LeafCandidate::setCharge(), reco::PFCandidate::setMuonTrackType(), reco::LeafCandidate::setP4(), reco::PFCandidate::setParticleType(), reco::LeafCandidate::setVertex(), mathSSE::sqrt(), HLT_FULL_cff::track, and PbPb_ZMuSkimMuonDPG_cff::trackType.

Referenced by addMissingMuons(), cleanMismeasured(), and reconstructMuon().

◆ cleanMismeasured()

bool PFMuonAlgo::cleanMismeasured ( reco::PFCandidate pfc,
unsigned int  i 
)
private

Definition at line 818 of file PFMuonAlgo.cc.

818  {
819  using namespace std;
820  using namespace reco;
821  bool cleaned = false;
822 
823  //First define the MET without this guy
824  double METNOX = METX_ - pfc.px();
825  double METNOY = METY_ - pfc.py();
826  double SUMETNO = sumet_ - pfc.pt();
827 
828  TrackMETComparator comparator(METNOX, METNOY);
829  //Low pt dont need to be cleaned
830  if (pfc.pt() < minPostCleaningPt_)
831  return false;
832  std::vector<reco::Muon::MuonTrackTypePair> tracks = muonTracks(pfc.muonRef(), maxDPtOPt_, false);
833 
834  //If there is more than 1 track choice try to change the track
835  if (tracks.size() > 1) {
836  //Find tracks that change dramatically MET or Pt
837  std::vector<reco::Muon::MuonTrackTypePair> tracksThatChangeMET = tracksWithBetterMET(tracks, pfc);
838  //From those tracks get the one with smallest MET
839  if (!tracksThatChangeMET.empty()) {
840  reco::Muon::MuonTrackTypePair bestTrackType =
841  *std::min_element(tracksThatChangeMET.begin(), tracksThatChangeMET.end(), comparator);
842  changeTrack(pfc, bestTrackType);
843 
845  //update eventquantities
846  METX_ = METNOX + pfc.px();
847  METY_ = METNOY + pfc.py();
848  sumet_ = SUMETNO + pfc.pt();
849  }
850  }
851 
852  //Now attempt to kill it
853  if (!(pfc.muonRef()->isGlobalMuon() && pfc.muonRef()->isTrackerMuon())) {
854  //define MET significance and SUM ET
855  double MET2 = METX_ * METX_ + METY_ * METY_;
856  double newMET2 = METNOX * METNOX + METNOY * METNOY;
857  double METSig = sqrt(MET2) / sqrt(sumet_ - sumetPU_);
858  if (METSig > metSigForRejection_)
859  if ((newMET2 < MET2 / metFactorRejection_) &&
860  ((SUMETNO - sumetPU_) / (sumet_ - sumetPU_) < eventFractionRejection_)) {
861  pfFakeMuonCleanedCandidates_->push_back(pfc);
862  maskedIndices_.push_back(i);
863  METX_ = METNOX;
864  METY_ = METNOY;
865  sumet_ = SUMETNO;
866  cleaned = true;
867  }
868  }
869  return cleaned;
870 }

References changeTrack(), eventFractionRejection_, mps_fire::i, maskedIndices_, maxDPtOPt_, metFactorRejection_, metSigForRejection_, METX_, METY_, minPostCleaningPt_, reco::PFCandidate::muonRef(), muonTracks(), pfCleanedTrackerAndGlobalMuonCandidates_, pfFakeMuonCleanedCandidates_, reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), mathSSE::sqrt(), sumet_, sumetPU_, PDWG_EXOHSCP_cff::tracks, and tracksWithBetterMET().

Referenced by postClean().

◆ cleanPunchThroughAndFakes()

bool PFMuonAlgo::cleanPunchThroughAndFakes ( reco::PFCandidate pfc,
reco::PFCandidateCollection cands,
unsigned int  imu 
)
private

Definition at line 916 of file PFMuonAlgo.cc.

918  {
919  using namespace reco;
920 
921  bool cleaned = false;
922 
923  if (pfc.pt() < minPostCleaningPt_)
924  return false;
925 
926  double METXNO = METX_ - pfc.pt();
927  double METYNO = METY_ - pfc.pt();
928  double MET2NO = METXNO * METXNO + METYNO * METYNO;
929  double MET2 = METX_ * METX_ + METY_ * METY_;
930  bool fake1 = false;
931 
932  std::pair<double, double> met2 = getMinMaxMET2(pfc);
933 
934  //Check for Fakes at high pseudorapidity
935  if (pfc.muonRef()->standAloneMuon().isNonnull())
936  fake1 = fabs(pfc.eta()) > 2.15 && met2.first < met2.second / 2 && MET2NO < MET2 / metFactorHighEta_ &&
937  pfc.muonRef()->standAloneMuon()->pt() < pfc.pt() / ptFactorHighEta_;
938 
939  double factor = std::max(2., 2000. / (sumet_ - pfc.pt() - sumetPU_));
940  bool fake2 =
941  (pfc.pt() / (sumet_ - sumetPU_) < 0.25 && MET2NO < MET2 / metFactorFake_ && met2.first < met2.second / factor);
942 
943  bool punchthrough = pfc.p() > minPunchThroughMomentum_ && pfc.rawHcalEnergy() > minPunchThroughEnergy_ &&
944  pfc.rawEcalEnergy() + pfc.rawHcalEnergy() > pfc.p() / punchThroughFactor_ &&
945  !isIsolatedMuon(pfc.muonRef()) && MET2NO < MET2 / punchThroughMETFactor_;
946 
947  if (fake1 || fake2 || punchthrough) {
948  // Find the block of the muon
949  const PFCandidate::ElementsInBlocks& eleInBlocks = pfc.elementsInBlocks();
950  if (!eleInBlocks.empty()) {
951  PFBlockRef blockRefMuon = eleInBlocks[0].first;
952  unsigned indexMuon = eleInBlocks[0].second;
953  if (eleInBlocks.size() > 1)
954  indexMuon = eleInBlocks[1].second;
955 
956  // Check if the muon gave rise to a neutral hadron
957  double iHad = 1E9;
958  bool hadron = false;
959  for (unsigned i = imu + 1; i < cands->size(); ++i) {
960  const PFCandidate& pfcn = cands->at(i);
962  if (ele.empty()) {
963  continue;
964  }
965  PFBlockRef blockRefHadron = ele[0].first;
966  unsigned indexHadron = ele[0].second;
967  // We are out of the block -> exit the loop
968  if (blockRefHadron.key() != blockRefMuon.key())
969  break;
970  // Check that this particle is a neutral hadron
971  if (indexHadron == indexMuon && pfcn.particleId() == reco::PFCandidate::h0) {
972  iHad = i;
973  hadron = true;
974  }
975  if (hadron)
976  break;
977  }
978 
979  if (hadron) {
980  double rescaleFactor = cands->at(iHad).p() / cands->at(imu).p();
981  METX_ -= cands->at(imu).px() + cands->at(iHad).px();
982  METY_ -= cands->at(imu).py() + cands->at(iHad).py();
983  sumet_ -= cands->at(imu).pt();
984  cands->at(imu).rescaleMomentum(rescaleFactor);
985  maskedIndices_.push_back(iHad);
986  pfPunchThroughHadronCleanedCandidates_->push_back(cands->at(iHad));
987  cands->at(imu).setParticleType(reco::PFCandidate::h);
988  pfPunchThroughMuonCleanedCandidates_->push_back(cands->at(imu));
989  METX_ += cands->at(imu).px();
990  METY_ += cands->at(imu).py();
991  sumet_ += cands->at(imu).pt();
992 
993  } else if (fake1 || fake2) {
994  METX_ -= cands->at(imu).px();
995  METY_ -= cands->at(imu).py();
996  sumet_ -= cands->at(imu).pt();
997  maskedIndices_.push_back(imu);
998  pfFakeMuonCleanedCandidates_->push_back(cands->at(imu));
999  cleaned = true;
1000  }
1001  }
1002  }
1003  return cleaned;
1004 }

References HLT_FULL_cff::cands, reco::PFCandidate::elementsInBlocks(), reco::LeafCandidate::eta(), DQMScaleToClient_cfi::factor, getMinMaxMET2(), reco::PFCandidate::h, reco::PFCandidate::h0, mps_fire::i, isIsolatedMuon(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), maskedIndices_, SiStripPI::max, metFactorFake_, metFactorHighEta_, METX_, METY_, minPostCleaningPt_, minPunchThroughEnergy_, minPunchThroughMomentum_, reco::PFCandidate::muonRef(), reco::LeafCandidate::p(), reco::PFCandidate::particleId(), pfFakeMuonCleanedCandidates_, pfPunchThroughHadronCleanedCandidates_, pfPunchThroughMuonCleanedCandidates_, reco::LeafCandidate::pt(), ptFactorHighEta_, punchThroughFactor_, punchThroughMETFactor_, reco::PFCandidate::rawEcalEnergy(), reco::PFCandidate::rawHcalEnergy(), edm::second(), sumet_, and sumetPU_.

Referenced by postClean().

◆ estimateEventQuantities()

void PFMuonAlgo::estimateEventQuantities ( const reco::PFCandidateCollection pfc)
private

Definition at line 613 of file PFMuonAlgo.cc.

613  {
614  //SUM ET
615  sumetPU_ = 0.0;
616  METX_ = 0.;
617  METY_ = 0.;
618  sumet_ = 0.0;
619  for (reco::PFCandidateCollection::const_iterator i = pfc->begin(); i != pfc->end(); ++i) {
620  sumet_ += i->pt();
621  METX_ += i->px();
622  METY_ += i->py();
623  }
624 }

References mps_fire::i, METX_, METY_, sumet_, and sumetPU_.

Referenced by postClean().

◆ fillPSetDescription()

void PFMuonAlgo::fillPSetDescription ( edm::ParameterSetDescription iDesc)
static

Definition at line 1016 of file PFMuonAlgo.cc.

1016  {
1017  // Muon ID and post cleaning parameters
1018  iDesc.add<double>("maxDPtOPt", 1.0);
1019  iDesc.add<std::string>("trackQuality", "highPurity");
1020  iDesc.add<double>("ptErrorScale", 8.0);
1021 
1022  iDesc.add<double>("eventFractionForCleaning", 0.5);
1023  iDesc.add<double>("minPtForPostCleaning", 20.0);
1024  iDesc.add<double>("eventFactorForCosmics", 10.0);
1025  iDesc.add<double>("metSignificanceForCleaning", 3.0);
1026  iDesc.add<double>("metSignificanceForRejection", 4.0);
1027  iDesc.add<double>("metFactorForCleaning", 4.0);
1028  iDesc.add<double>("eventFractionForRejection", 0.8);
1029  iDesc.add<double>("metFactorForRejection", 4.0);
1030  iDesc.add<double>("metFactorForHighEta", 25.0);
1031  iDesc.add<double>("ptFactorForHighEta", 2.0);
1032  iDesc.add<double>("metFactorForFakes", 4.0);
1033  iDesc.add<double>("minMomentumForPunchThrough", 100.0);
1034  iDesc.add<double>("minEnergyForPunchThrough", 100.0);
1035  iDesc.add<double>("punchThroughFactor", 3.0);
1036  iDesc.add<double>("punchThroughMETFactor", 4.0);
1037  iDesc.add<double>("cosmicRejectionDistance", 1.0);
1038 }

References edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PFProducer::fillDescriptions().

◆ getMinMaxMET2()

std::pair< double, double > PFMuonAlgo::getMinMaxMET2 ( const reco::PFCandidate pfc)
private

Definition at line 799 of file PFMuonAlgo.cc.

799  {
800  std::vector<reco::Muon::MuonTrackTypePair> tracks = muonTracks((pfc.muonRef()), maxDPtOPt_, true);
801 
802  double METXNO = METX_ - pfc.px();
803  double METYNO = METY_ - pfc.py();
804  std::vector<double> met2;
805  for (unsigned int i = 0; i < tracks.size(); ++i) {
806  met2.push_back(pow(METXNO + tracks.at(i).first->px(), 2) + pow(METYNO + tracks.at(i).first->py(), 2));
807  }
808 
809  //PROTECT for cases of only one track. If there is only one track it will crash .
810  //Has never happened but could likely happen!
811 
812  if (tracks.size() > 1)
813  return std::make_pair(*std::min_element(met2.begin(), met2.end()), *std::max_element(met2.begin(), met2.end()));
814  else
815  return std::make_pair(0, 0);
816 }

References mps_fire::i, maxDPtOPt_, METX_, METY_, reco::PFCandidate::muonRef(), muonTracks(), funct::pow(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), and PDWG_EXOHSCP_cff::tracks.

Referenced by cleanPunchThroughAndFakes().

◆ getTrackWithSmallestError()

reco::Muon::MuonTrackTypePair PFMuonAlgo::getTrackWithSmallestError ( const std::vector< MuonTrackTypePair > &  tracks)
private

Definition at line 607 of file PFMuonAlgo.cc.

608  {
609  TrackPtErrorSorter sorter;
610  return *std::min_element(tracks.begin(), tracks.end(), sorter);
611 }

References MCScenario_CRAFT1_22X::sorter(), and PDWG_EXOHSCP_cff::tracks.

Referenced by reconstructMuon().

◆ hasValidTrack()

bool PFMuonAlgo::hasValidTrack ( const reco::MuonRef muonRef,
bool  loose,
double  maxDPtOPt 
)
static

Definition at line 348 of file PFMuonAlgo.cc.

348  {
349  if (loose)
350  return !muonTracks(muonRef).empty();
351  else
352  return !muonTracks(muonRef, maxDPtOPt).empty();
353 }

References muonTracks().

Referenced by GeneralTracksImporter::importToBlock(), and GeneralTracksImporterWithVeto::importToBlock().

◆ isGlobalLooseMuon() [1/2]

bool PFMuonAlgo::isGlobalLooseMuon ( const reco::MuonRef muonRef)
static

Definition at line 197 of file PFMuonAlgo.cc.

197  {
198  if (!muonRef.isNonnull())
199  return false;
200  if (!muonRef->isGlobalMuon())
201  return false;
202  if (!muonRef->isStandAloneMuon())
203  return false;
204 
205  reco::TrackRef standAloneMu = muonRef->standAloneMuon();
206  reco::TrackRef combinedMu = muonRef->combinedMuon();
207  reco::TrackRef trackerMu = muonRef->track();
208 
209  unsigned nMuonHits =
210  standAloneMu->hitPattern().numberOfValidMuonDTHits() + 2 * standAloneMu->hitPattern().numberOfValidMuonCSCHits();
211 
212  bool quality = false;
213 
214  if (muonRef->isTrackerMuon()) {
215  bool result = combinedMu->normalizedChi2() < 100.;
216 
217  bool laststation = muon::isGoodMuon(*muonRef, muon::TMLastStationAngTight);
218 
219  int nMatches = muonRef->numberOfMatches();
220 
221  quality = laststation && nMuonHits > 12 && nMatches > 1;
222 
223  return result && quality;
224 
225  } else {
226  // Check the quality of the stand-alone muon :
227  // good chi**2 and large number of hits and good pt error
228  if (nMuonHits <= 15 || standAloneMu->normalizedChi2() > 10. ||
229  standAloneMu->ptError() / standAloneMu->pt() > 0.20) {
230  quality = false;
231  } else {
232  // If the stand-alone muon is good, check the global muon
233  if (combinedMu->normalizedChi2() > standAloneMu->normalizedChi2()) {
234  // If the combined muon is worse than the stand-alone, it
235  // means that either the corresponding tracker track was not
236  // reconstructed, or that the sta muon comes from a late
237  // pion decay (hence with a momentum smaller than the track)
238  // Take the stand-alone muon only if its momentum is larger
239  // than that of the track
240 
241  // Note that here we even take the standAlone if it has a smaller pT, in contrast to GlobalTight
242  if (standAloneMu->pt() > trackerMu->pt() || combinedMu->normalizedChi2() < 5.)
243  quality = true;
244  } else {
245  // If the combined muon is better (and good enough), take the
246  // global muon
247  if (combinedMu->ptError() / combinedMu->pt() < std::min(0.20, standAloneMu->ptError() / standAloneMu->pt()))
248  quality = true;
249  }
250  }
251  }
252 
253  return quality;
254 }

References muon::isGoodMuon(), edm::Ref< C, T, F >::isNonnull(), min(), TrackCollections2monitor_cff::normalizedChi2, qcdUeDQM_cfi::quality, mps_fire::result, and muon::TMLastStationAngTight.

◆ isGlobalLooseMuon() [2/2]

bool PFMuonAlgo::isGlobalLooseMuon ( const reco::PFBlockElement elt)
static

Definition at line 76 of file PFMuonAlgo.cc.

76  {
77  const reco::PFBlockElementTrack* eltTrack = dynamic_cast<const reco::PFBlockElementTrack*>(&elt);
78 
79  assert(eltTrack);
80  reco::MuonRef muonRef = eltTrack->muonRef();
81 
82  return isGlobalLooseMuon(muonRef);
83 }

References cms::cuda::assert(), and reco::PFBlockElementTrack::muonRef().

Referenced by isLooseMuon().

◆ isGlobalTightMuon() [1/2]

bool PFMuonAlgo::isGlobalTightMuon ( const reco::MuonRef muonRef)
static

Definition at line 111 of file PFMuonAlgo.cc.

111  {
112  if (!muonRef.isNonnull())
113  return false;
114 
115  if (!muonRef->isGlobalMuon())
116  return false;
117  if (!muonRef->isStandAloneMuon())
118  return false;
119 
120  if (muonRef->isTrackerMuon()) {
122 
123  bool isTM2DCompatibilityTight = muon::isGoodMuon(*muonRef, muon::TM2DCompatibilityTight);
124  int nMatches = muonRef->numberOfMatches();
125  bool quality = nMatches > 2 || isTM2DCompatibilityTight;
126 
127  return result && quality;
128 
129  } else {
130  reco::TrackRef standAloneMu = muonRef->standAloneMuon();
131 
132  // No tracker muon -> Request a perfect stand-alone muon, or an even better global muon
133  bool result = false;
134 
135  // Check the quality of the stand-alone muon :
136  // good chi**2 and large number of hits and good pt error
137  if ((standAloneMu->hitPattern().numberOfValidMuonDTHits() < 22 &&
138  standAloneMu->hitPattern().numberOfValidMuonCSCHits() < 15) ||
139  standAloneMu->normalizedChi2() > 10. || standAloneMu->ptError() / standAloneMu->pt() > 0.20) {
140  result = false;
141  } else {
142  reco::TrackRef combinedMu = muonRef->combinedMuon();
143  reco::TrackRef trackerMu = muonRef->track();
144 
145  // If the stand-alone muon is good, check the global muon
146  if (combinedMu->normalizedChi2() > standAloneMu->normalizedChi2()) {
147  // If the combined muon is worse than the stand-alone, it
148  // means that either the corresponding tracker track was not
149  // reconstructed, or that the sta muon comes from a late
150  // pion decay (hence with a momentum smaller than the track)
151  // Take the stand-alone muon only if its momentum is larger
152  // than that of the track
153  result = standAloneMu->pt() > trackerMu->pt();
154  } else {
155  // If the combined muon is better (and good enough), take the
156  // global muon
157  result =
158  combinedMu->ptError() / combinedMu->pt() < std::min(0.20, standAloneMu->ptError() / standAloneMu->pt());
159  }
160  }
161 
162  return result;
163  }
164 
165  return false;
166 }

References muon::GlobalMuonPromptTight, muon::isGoodMuon(), edm::Ref< C, T, F >::isNonnull(), min(), qcdUeDQM_cfi::quality, mps_fire::result, and muon::TM2DCompatibilityTight.

◆ isGlobalTightMuon() [2/2]

bool PFMuonAlgo::isGlobalTightMuon ( const reco::PFBlockElement elt)
static

Definition at line 67 of file PFMuonAlgo.cc.

67  {
68  const reco::PFBlockElementTrack* eltTrack = dynamic_cast<const reco::PFBlockElementTrack*>(&elt);
69 
70  assert(eltTrack);
71  reco::MuonRef muonRef = eltTrack->muonRef();
72 
73  return isGlobalTightMuon(muonRef);
74 }

References cms::cuda::assert(), and reco::PFBlockElementTrack::muonRef().

Referenced by isMuon().

◆ isIsolatedMuon() [1/2]

bool PFMuonAlgo::isIsolatedMuon ( const reco::MuonRef muonRef)
static

Definition at line 279 of file PFMuonAlgo.cc.

279  {
280  if (!muonRef.isNonnull())
281  return false;
282  if (!muonRef->isIsolationValid())
283  return false;
284 
285  // Isolated Muons which are missed by standard cuts are nearly always global+tracker
286  if (!muonRef->isGlobalMuon())
287  return false;
288 
289  // If it's not a tracker muon, only take it if there are valid muon hits
290 
291  reco::TrackRef standAloneMu = muonRef->standAloneMuon();
292 
293  if (!muonRef->isTrackerMuon()) {
294  if (standAloneMu->hitPattern().numberOfValidMuonDTHits() == 0 &&
295  standAloneMu->hitPattern().numberOfValidMuonCSCHits() == 0)
296  return false;
297  }
298 
299  // for isolation, take the smallest pt available to reject fakes
300 
301  reco::TrackRef combinedMu = muonRef->combinedMuon();
302  double smallestMuPt = combinedMu->pt();
303 
304  if (standAloneMu->pt() < smallestMuPt)
305  smallestMuPt = standAloneMu->pt();
306 
307  if (muonRef->isTrackerMuon()) {
308  reco::TrackRef trackerMu = muonRef->track();
309  if (trackerMu->pt() < smallestMuPt)
310  smallestMuPt = trackerMu->pt();
311  }
312 
313  double sumPtR03 = muonRef->isolationR03().sumPt;
314 
315  double relIso = sumPtR03 / smallestMuPt;
316 
317  if (relIso < 0.1)
318  return true;
319  else
320  return false;
321 }

References edm::Ref< C, T, F >::isNonnull(), and objects.autophobj::relIso.

◆ isIsolatedMuon() [2/2]

bool PFMuonAlgo::isIsolatedMuon ( const reco::PFBlockElement elt)
static

Definition at line 94 of file PFMuonAlgo.cc.

94  {
95  const reco::PFBlockElementTrack* eltTrack = dynamic_cast<const reco::PFBlockElementTrack*>(&elt);
96 
97  assert(eltTrack);
98  reco::MuonRef muonRef = eltTrack->muonRef();
99 
100  return isIsolatedMuon(muonRef);
101 }

References cms::cuda::assert(), and reco::PFBlockElementTrack::muonRef().

Referenced by cleanPunchThroughAndFakes(), PFAlgo::createCandidatesHCAL(), GreedyMuonPFCandidateFilter::filter(), and isMuon().

◆ isLooseMuon() [1/2]

bool PFMuonAlgo::isLooseMuon ( const reco::MuonRef muonRef)
static

Definition at line 107 of file PFMuonAlgo.cc.

107  {
108  return (isGlobalLooseMuon(muonRef) || isTrackerLooseMuon(muonRef));
109 }

References isGlobalLooseMuon(), and isTrackerLooseMuon().

◆ isLooseMuon() [2/2]

bool PFMuonAlgo::isLooseMuon ( const reco::PFBlockElement elt)
static

Definition at line 57 of file PFMuonAlgo.cc.

57  {
58  const reco::PFBlockElementTrack* eltTrack = dynamic_cast<const reco::PFBlockElementTrack*>(&elt);
59 
60  assert(eltTrack);
61 
62  reco::MuonRef muonRef = eltTrack->muonRef();
63 
64  return isLooseMuon(muonRef);
65 }

References cms::cuda::assert(), and reco::PFBlockElementTrack::muonRef().

Referenced by PFAlgo::createCandidatesHCAL(), GeneralTracksImporter::importToBlock(), GeneralTracksImporterWithVeto::importToBlock(), and reconstructMuon().

◆ isMuon() [1/2]

bool PFMuonAlgo::isMuon ( const reco::MuonRef muonRef)
static

Definition at line 103 of file PFMuonAlgo.cc.

103  {
104  return isGlobalTightMuon(muonRef) || isTrackerTightMuon(muonRef) || isIsolatedMuon(muonRef);
105 }

References isGlobalTightMuon(), isIsolatedMuon(), and isTrackerTightMuon().

◆ isMuon() [2/2]

bool PFMuonAlgo::isMuon ( const reco::PFBlockElement elt)
static

Definition at line 48 of file PFMuonAlgo.cc.

48  {
49  const auto* eltTrack = dynamic_cast<const reco::PFBlockElementTrack*>(&elt);
50 
51  assert(eltTrack);
52  reco::MuonRef muonRef = eltTrack->muonRef();
53 
54  return isMuon(muonRef);
55 }

References cms::cuda::assert().

Referenced by PFAlgo::createCandidatesHCAL(), GeneralTracksImporter::importToBlock(), GeneralTracksImporterWithVeto::importToBlock(), PFEGammaAlgo::isMuon(), reconstructMuon(), and PFAlgo::recoTracksNotHCAL().

◆ isTightMuonPOG()

bool PFMuonAlgo::isTightMuonPOG ( const reco::MuonRef muonRef)
static

Definition at line 323 of file PFMuonAlgo.cc.

323  {
325  return false;
326 
327  if (!muonRef->isTrackerMuon())
328  return false;
329 
330  if (muonRef->numberOfMatches() < 2)
331  return false;
332 
333  //const reco::TrackRef& combinedMuon = muonRef->combinedMuon();
334  const reco::TrackRef& combinedMuon = muonRef->globalTrack();
335 
336  if (combinedMuon->hitPattern().numberOfValidTrackerHits() < 11)
337  return false;
338 
339  if (combinedMuon->hitPattern().numberOfValidPixelHits() == 0)
340  return false;
341 
342  if (combinedMuon->hitPattern().numberOfValidMuonHits() == 0)
343  return false;
344 
345  return true;
346 }

References muon::GlobalMuonPromptTight, and muon::isGoodMuon().

◆ isTrackerLooseMuon() [1/2]

bool PFMuonAlgo::isTrackerLooseMuon ( const reco::MuonRef muonRef)
static

Definition at line 256 of file PFMuonAlgo.cc.

256  {
257  if (!muonRef.isNonnull())
258  return false;
259  if (!muonRef->isTrackerMuon())
260  return false;
261 
262  reco::TrackRef trackerMu = muonRef->track();
263 
264  if (trackerMu->ptError() / trackerMu->pt() > 0.20)
265  return false;
266 
267  // this doesn't seem to be necessary on the small samples looked at, but keep it around as insurance
268  if (trackerMu->pt() > 20.)
269  return false;
270 
271  bool isAllArbitrated = muon::isGoodMuon(*muonRef, muon::AllArbitrated);
272  bool isTMLastStationAngTight = muon::isGoodMuon(*muonRef, muon::TMLastStationAngTight);
273 
274  bool quality = isAllArbitrated && isTMLastStationAngTight;
275 
276  return quality;
277 }

References muon::AllArbitrated, muon::isGoodMuon(), edm::Ref< C, T, F >::isNonnull(), qcdUeDQM_cfi::quality, and muon::TMLastStationAngTight.

◆ isTrackerLooseMuon() [2/2]

static bool PFMuonAlgo::isTrackerLooseMuon ( const reco::PFBlockElement elt)
static

Referenced by isLooseMuon().

◆ isTrackerTightMuon() [1/2]

bool PFMuonAlgo::isTrackerTightMuon ( const reco::MuonRef muonRef)
static

Definition at line 168 of file PFMuonAlgo.cc.

168  {
169  if (!muonRef.isNonnull())
170  return false;
171 
172  if (!muonRef->isTrackerMuon())
173  return false;
174 
175  reco::TrackRef trackerMu = muonRef->track();
176  const reco::Track& track = *trackerMu;
177 
178  unsigned nTrackerHits = track.hitPattern().numberOfValidTrackerHits();
179 
180  if (nTrackerHits <= 12)
181  return false;
182 
183  bool isAllArbitrated = muon::isGoodMuon(*muonRef, muon::AllArbitrated);
184 
185  bool isTM2DCompatibilityTight = muon::isGoodMuon(*muonRef, muon::TM2DCompatibilityTight);
186 
187  if (!isAllArbitrated || !isTM2DCompatibilityTight)
188  return false;
189 
190  if ((trackerMu->ptError() / trackerMu->pt() > 0.10)) {
191  //std::cout<<" PT ERROR > 10 % "<< trackerMu->pt() <<std::endl;
192  return false;
193  }
194  return true;
195 }

References muon::AllArbitrated, muon::isGoodMuon(), edm::Ref< C, T, F >::isNonnull(), muon::TM2DCompatibilityTight, and HLT_FULL_cff::track.

◆ isTrackerTightMuon() [2/2]

bool PFMuonAlgo::isTrackerTightMuon ( const reco::PFBlockElement elt)
static

Definition at line 85 of file PFMuonAlgo.cc.

85  {
86  const reco::PFBlockElementTrack* eltTrack = dynamic_cast<const reco::PFBlockElementTrack*>(&elt);
87 
88  assert(eltTrack);
89  reco::MuonRef muonRef = eltTrack->muonRef();
90 
91  return isTrackerTightMuon(muonRef);
92 }

References cms::cuda::assert(), and reco::PFBlockElementTrack::muonRef().

Referenced by isMuon().

◆ muonTracks()

std::vector< reco::Muon::MuonTrackTypePair > PFMuonAlgo::muonTracks ( const reco::MuonRef muon,
double  maxDPtOPt = 1e+9,
bool  includeSA = false 
)
static

Definition at line 479 of file PFMuonAlgo.cc.

481  {
482  std::vector<reco::Muon::MuonTrackTypePair> out;
483 
484  if (muon->globalTrack().isNonnull() && muon->globalTrack()->pt() > 0)
485  if (muon->globalTrack()->ptError() / muon->globalTrack()->pt() < maxDPtOPt)
486  out.emplace_back(muon->globalTrack(), reco::Muon::CombinedTrack);
487 
488  if (muon->innerTrack().isNonnull() && muon->innerTrack()->pt() > 0)
489  if (muon->innerTrack()->ptError() / muon->innerTrack()->pt() < maxDPtOPt) //Here Loose!@
490  out.emplace_back(muon->innerTrack(), reco::Muon::InnerTrack);
491 
492  bool pickyExists = false;
493  double pickyDpt = 99999.;
494  if (muon->pickyTrack().isNonnull() && muon->pickyTrack()->pt() > 0) {
495  pickyDpt = muon->pickyTrack()->ptError() / muon->pickyTrack()->pt();
496  if (pickyDpt < maxDPtOPt)
497  out.emplace_back(muon->pickyTrack(), reco::Muon::Picky);
498  pickyExists = true;
499  }
500 
501  bool dytExists = false;
502  double dytDpt = 99999.;
503  if (muon->dytTrack().isNonnull() && muon->dytTrack()->pt() > 0) {
504  dytDpt = muon->dytTrack()->ptError() / muon->dytTrack()->pt();
505  if (dytDpt < maxDPtOPt)
506  out.emplace_back(muon->dytTrack(), reco::Muon::DYT);
507  dytExists = true;
508  }
509 
510  //Magic: TPFMS is not a really good track especially under misalignment
511  //IT is kind of crap because if mu system is displaced it can make a change
512  //So allow TPFMS if there is no picky or the error of tpfms is better than picky
513  //AND if there is no DYT or the error of tpfms is better than DYT
514  if (muon->tpfmsTrack().isNonnull() && muon->tpfmsTrack()->pt() > 0) {
515  double tpfmsDpt = muon->tpfmsTrack()->ptError() / muon->tpfmsTrack()->pt();
516  if (((pickyExists && tpfmsDpt < pickyDpt) || (!pickyExists)) &&
517  ((dytExists && tpfmsDpt < dytDpt) || (!dytExists)) && tpfmsDpt < maxDPtOPt)
518  out.emplace_back(muon->tpfmsTrack(), reco::Muon::TPFMS);
519  }
520 
521  if (includeSA && muon->outerTrack().isNonnull())
522  if (muon->outerTrack()->ptError() / muon->outerTrack()->pt() < maxDPtOPt)
523  out.emplace_back(muon->outerTrack(), reco::Muon::OuterTrack);
524 
525  return out;
526 }

References reco::Muon::CombinedTrack, reco::Muon::DYT, reco::Muon::InnerTrack, MillePedeFileConverter_cfg::out, reco::Muon::OuterTrack, reco::Muon::Picky, and reco::Muon::TPFMS.

Referenced by addMissingMuons(), cleanMismeasured(), getMinMaxMET2(), hasValidTrack(), and reconstructMuon().

◆ postClean()

void PFMuonAlgo::postClean ( reco::PFCandidateCollection cands)

Definition at line 626 of file PFMuonAlgo.cc.

626  {
627  using namespace std;
628  using namespace reco;
629  if (!postCleaning_)
630  return;
631 
632  //Initialize vectors
633 
636  else
637  pfCosmicsMuonCleanedCandidates_ = std::make_unique<reco::PFCandidateCollection>();
638 
641  else
642  pfCleanedTrackerAndGlobalMuonCandidates_ = std::make_unique<reco::PFCandidateCollection>();
643 
646  else
647  pfFakeMuonCleanedCandidates_ = std::make_unique<reco::PFCandidateCollection>();
648 
651  else
652  pfPunchThroughMuonCleanedCandidates_ = std::make_unique<reco::PFCandidateCollection>();
653 
656  else
657  pfPunchThroughHadronCleanedCandidates_ = std::make_unique<reco::PFCandidateCollection>();
658 
660 
661  maskedIndices_.clear();
662 
663  //Estimate MET and SumET
664 
666 
667  std::vector<int> muons;
668  std::vector<int> cosmics;
669  //get the muons
670  for (unsigned int i = 0; i < cands->size(); ++i) {
671  const reco::PFCandidate& cand = (*cands)[i];
672  if (cand.particleId() == reco::PFCandidate::mu)
673  muons.push_back(i);
674  }
675  //Then sort the muon indicess by decsending pt
676 
677  IndexPtComparator comparator(cands);
678  std::sort(muons.begin(), muons.end(), comparator);
679 
680  //first kill cosmics
681  double METXCosmics = 0;
682  double METYCosmics = 0;
683  double SUMETCosmics = 0.0;
684 
685  for (unsigned int i = 0; i < muons.size(); ++i) {
686  const PFCandidate& pfc = cands->at(muons[i]);
687  double origin = 0.0;
688  if (!vertices_->empty() && vertices_->at(0).isValid() && !vertices_->at(0).isFake())
689  origin = pfc.muonRef()->muonBestTrack()->dxy(vertices_->at(0).position());
690 
691  if (origin > cosmicRejDistance_) {
692  cosmics.push_back(muons[i]);
693  METXCosmics += pfc.px();
694  METYCosmics += pfc.py();
695  SUMETCosmics += pfc.pt();
696  }
697  }
698  double MET2Cosmics = METXCosmics * METXCosmics + METYCosmics * METYCosmics;
699 
700  if (SUMETCosmics > (sumet_ - sumetPU_) / eventFactorCosmics_ && MET2Cosmics < METX_ * METX_ + METY_ * METY_)
701  for (unsigned int i = 0; i < cosmics.size(); ++i) {
702  maskedIndices_.push_back(cosmics[i]);
704  }
705 
706  //Loop on the muons candidates and clean
707  for (unsigned int i = 0; i < muons.size(); ++i) {
708  if (cleanMismeasured(cands->at(muons[i]), muons[i]))
709  continue;
711  }
712 
713  //OK Now do the hard job ->remove the candidates that were cleaned
715 }

References HLT_FULL_cff::cands, cleanMismeasured(), cleanPunchThroughAndFakes(), cosmicRejDistance_, GlobalTrackerMuonAlignment_cfi::cosmics, estimateEventQuantities(), eventFactorCosmics_, mps_fire::i, maskedIndices_, METX_, METY_, reco::PFCandidate::mu, reco::PFCandidate::muonRef(), PDWG_BPHSkim_cff::muons, pfCleanedTrackerAndGlobalMuonCandidates_, pfCosmicsMuonCleanedCandidates_, pfFakeMuonCleanedCandidates_, pfPunchThroughHadronCleanedCandidates_, pfPunchThroughMuonCleanedCandidates_, postCleaning_, reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), removeDeadCandidates(), sumet_, sumetPU_, and vertices_.

◆ printMuonProperties()

void PFMuonAlgo::printMuonProperties ( const reco::MuonRef muonRef)
static

Definition at line 355 of file PFMuonAlgo.cc.

355  {
356  if (!muonRef.isNonnull())
357  return;
358 
359  bool isGL = muonRef->isGlobalMuon();
360  bool isTR = muonRef->isTrackerMuon();
361  bool isST = muonRef->isStandAloneMuon();
362 
363  std::cout << " GL: " << isGL << " TR: " << isTR << " ST: " << isST << std::endl;
364  std::cout << " nMatches " << muonRef->numberOfMatches() << std::endl;
365 
366  if (muonRef->isGlobalMuon()) {
367  reco::TrackRef combinedMu = muonRef->combinedMuon();
368  std::cout << " GL, pt: " << combinedMu->pt() << " +/- " << combinedMu->ptError() / combinedMu->pt()
369  << " chi**2 GBL : " << combinedMu->normalizedChi2() << std::endl;
370  std::cout << " Total Muon Hits : " << combinedMu->hitPattern().numberOfValidMuonHits() << "/"
371  << combinedMu->hitPattern().numberOfLostMuonHits()
372  << " DT Hits : " << combinedMu->hitPattern().numberOfValidMuonDTHits() << "/"
373  << combinedMu->hitPattern().numberOfLostMuonDTHits()
374  << " CSC Hits : " << combinedMu->hitPattern().numberOfValidMuonCSCHits() << "/"
375  << combinedMu->hitPattern().numberOfLostMuonCSCHits()
376  << " RPC Hits : " << combinedMu->hitPattern().numberOfValidMuonRPCHits() << "/"
377  << combinedMu->hitPattern().numberOfLostMuonRPCHits() << std::endl;
378 
379  std::cout << " # of Valid Tracker Hits " << combinedMu->hitPattern().numberOfValidTrackerHits() << std::endl;
380  std::cout << " # of Valid Pixel Hits " << combinedMu->hitPattern().numberOfValidPixelHits() << std::endl;
381  }
382  if (muonRef->isStandAloneMuon()) {
383  reco::TrackRef standAloneMu = muonRef->standAloneMuon();
384  std::cout << " ST, pt: " << standAloneMu->pt() << " +/- " << standAloneMu->ptError() / standAloneMu->pt()
385  << " eta : " << standAloneMu->eta()
386  << " DT Hits : " << standAloneMu->hitPattern().numberOfValidMuonDTHits() << "/"
387  << standAloneMu->hitPattern().numberOfLostMuonDTHits()
388  << " CSC Hits : " << standAloneMu->hitPattern().numberOfValidMuonCSCHits() << "/"
389  << standAloneMu->hitPattern().numberOfLostMuonCSCHits()
390  << " RPC Hits : " << standAloneMu->hitPattern().numberOfValidMuonRPCHits() << "/"
391  << standAloneMu->hitPattern().numberOfLostMuonRPCHits()
392  << " chi**2 STA : " << standAloneMu->normalizedChi2() << std::endl;
393  }
394 
395  if (muonRef->isTrackerMuon()) {
396  reco::TrackRef trackerMu = muonRef->track();
397  const reco::Track& track = *trackerMu;
398  std::cout << " TR, pt: " << trackerMu->pt() << " +/- " << trackerMu->ptError() / trackerMu->pt()
399  << " chi**2 TR : " << trackerMu->normalizedChi2() << std::endl;
400  std::cout << " nTrackerHits " << track.hitPattern().numberOfValidTrackerHits() << std::endl;
401  std::cout << "TMLastStationAngLoose " << muon::isGoodMuon(*muonRef, muon::TMLastStationAngLoose)
402  << std::endl
403  << "TMLastStationAngTight " << muon::isGoodMuon(*muonRef, muon::TMLastStationAngTight)
404  << std::endl
405  << "TMLastStationLoose " << muon::isGoodMuon(*muonRef, muon::TMLastStationLoose)
406  << std::endl
407  << "TMLastStationTight " << muon::isGoodMuon(*muonRef, muon::TMLastStationTight)
408  << std::endl
409  << "TMOneStationLoose " << muon::isGoodMuon(*muonRef, muon::TMOneStationLoose) << std::endl
410  << "TMOneStationTight " << muon::isGoodMuon(*muonRef, muon::TMOneStationTight) << std::endl
411  << "TMLastStationOptimizedLowPtLoose "
413  << "TMLastStationOptimizedLowPtTight "
415  << "TMLastStationOptimizedBarrelLowPtLoose "
417  << "TMLastStationOptimizedBarrelLowPtTight "
419  << std::endl;
420  }
421 
422  std::cout << "TM2DCompatibilityLoose " << muon::isGoodMuon(*muonRef, muon::TM2DCompatibilityLoose)
423  << std::endl
424  << "TM2DCompatibilityTight " << muon::isGoodMuon(*muonRef, muon::TM2DCompatibilityTight)
425  << std::endl;
426 
427  if (muonRef->isGlobalMuon() && muonRef->isTrackerMuon() && muonRef->isStandAloneMuon()) {
428  reco::TrackRef combinedMu = muonRef->combinedMuon();
429  reco::TrackRef trackerMu = muonRef->track();
430  reco::TrackRef standAloneMu = muonRef->standAloneMuon();
431 
432  double sigmaCombined = combinedMu->ptError() / (combinedMu->pt() * combinedMu->pt());
433  double sigmaTracker = trackerMu->ptError() / (trackerMu->pt() * trackerMu->pt());
434  double sigmaStandAlone = standAloneMu->ptError() / (standAloneMu->pt() * standAloneMu->pt());
435 
436  bool combined = combinedMu->ptError() / combinedMu->pt() < 0.20;
437  bool tracker = trackerMu->ptError() / trackerMu->pt() < 0.20;
438  bool standAlone = standAloneMu->ptError() / standAloneMu->pt() < 0.20;
439 
440  double delta1 = combined && tracker ? fabs(1. / combinedMu->pt() - 1. / trackerMu->pt()) /
441  sqrt(sigmaCombined * sigmaCombined + sigmaTracker * sigmaTracker)
442  : 100.;
443  double delta2 = combined && standAlone ? fabs(1. / combinedMu->pt() - 1. / standAloneMu->pt()) /
444  sqrt(sigmaCombined * sigmaCombined + sigmaStandAlone * sigmaStandAlone)
445  : 100.;
446  double delta3 = standAlone && tracker ? fabs(1. / standAloneMu->pt() - 1. / trackerMu->pt()) /
447  sqrt(sigmaStandAlone * sigmaStandAlone + sigmaTracker * sigmaTracker)
448  : 100.;
449 
450  double delta =
451  standAloneMu->hitPattern().numberOfValidMuonDTHits() + standAloneMu->hitPattern().numberOfValidMuonCSCHits() > 0
452  ? std::min(delta3, std::min(delta1, delta2))
453  : std::max(delta3, std::max(delta1, delta2));
454 
455  std::cout << "delta = " << delta << " delta1 " << delta1 << " delta2 " << delta2 << " delta3 " << delta3
456  << std::endl;
457 
458  double ratio = combinedMu->ptError() / combinedMu->pt() / (trackerMu->ptError() / trackerMu->pt());
459  //if ( ratio > 2. && delta < 3. ) std::cout << "ALARM ! " << ratio << ", " << delta << std::endl;
460  std::cout << " ratio " << ratio << " combined mu pt " << combinedMu->pt() << std::endl;
461  //bool quality3 = ( combinedMu->pt() < 50. || ratio < 2. ) && delta < 3.;
462  }
463 
464  double sumPtR03 = muonRef->isolationR03().sumPt;
465  double emEtR03 = muonRef->isolationR03().emEt;
466  double hadEtR03 = muonRef->isolationR03().hadEt;
467  double relIsoR03 = (sumPtR03 + emEtR03 + hadEtR03) / muonRef->pt();
468  double sumPtR05 = muonRef->isolationR05().sumPt;
469  double emEtR05 = muonRef->isolationR05().emEt;
470  double hadEtR05 = muonRef->isolationR05().hadEt;
471  double relIsoR05 = (sumPtR05 + emEtR05 + hadEtR05) / muonRef->pt();
472  std::cout << " 0.3 Radion Rel Iso: " << relIsoR03 << " sumPt " << sumPtR03 << " emEt " << emEtR03 << " hadEt "
473  << hadEtR03 << std::endl;
474  std::cout << " 0.5 Radion Rel Iso: " << relIsoR05 << " sumPt " << sumPtR05 << " emEt " << emEtR05 << " hadEt "
475  << hadEtR05 << std::endl;
476  return;
477 }

References gather_cfg::cout, dumpMFGeometry_cfg::delta, muon::isGoodMuon(), edm::Ref< C, T, F >::isNonnull(), SiStripPI::max, min(), particleFlowDisplacedVertex_cfi::ratio, mathSSE::sqrt(), egammaDQMOffline_cff::standAlone, muon::TM2DCompatibilityLoose, muon::TM2DCompatibilityTight, muon::TMLastStationAngLoose, muon::TMLastStationAngTight, muon::TMLastStationLoose, muon::TMLastStationOptimizedBarrelLowPtLoose, muon::TMLastStationOptimizedBarrelLowPtTight, muon::TMLastStationOptimizedLowPtLoose, muon::TMLastStationOptimizedLowPtTight, muon::TMLastStationTight, muon::TMOneStationLoose, muon::TMOneStationTight, HLT_FULL_cff::track, and PbPb_ZMuSkimMuonDPG_cff::tracker.

◆ reconstructMuon()

bool PFMuonAlgo::reconstructMuon ( reco::PFCandidate candidate,
const reco::MuonRef muon,
bool  allowLoose = false 
)

Definition at line 530 of file PFMuonAlgo.cc.

530  {
531  using namespace std;
532  using namespace reco;
533 
534  if (!muon.isNonnull())
535  return false;
536 
537  bool isMu = false;
538 
539  if (allowLoose)
541  else
542  isMu = isMuon(muon);
543 
544  if (!isMu)
545  return false;
546 
547  //get the valid tracks(without standalone except we allow loose muons)
548  //MIKE: Here we need to be careful. If we have a muon inside a dense
549  //jet environment often the track is badly measured. In this case
550  //we should not apply Dpt/Pt<1
551 
552  std::vector<reco::Muon::MuonTrackTypePair> validTracks = muonTracks(muon, maxDPtOPt_);
553  if (!allowLoose)
554  validTracks = muonTracks(muon, maxDPtOPt_);
555  else
556  validTracks = muonTracks(muon);
557 
558  if (validTracks.empty())
559  return false;
560 
561  //check what is the track used.Rerun TuneP
563 
564  TrackRef bestTrack = bestTrackPair.first;
565  MuonTrackType trackType = bestTrackPair.second;
566 
567  MuonTrackTypePair trackPairWithSmallestError = getTrackWithSmallestError(validTracks);
568  TrackRef trackWithSmallestError = trackPairWithSmallestError.first;
569 
571  (!bestTrack->quality(trackQuality_) ||
572  bestTrack->ptError() / bestTrack->pt() >
573  errorCompScale_ * trackWithSmallestError->ptError() / trackWithSmallestError->pt())) {
574  bestTrack = trackWithSmallestError;
575  trackType = trackPairWithSmallestError.second;
576  } else if (trackType != reco::Muon::InnerTrack &&
577  bestTrack->ptError() / bestTrack->pt() >
578  errorCompScale_ * trackWithSmallestError->ptError() / trackWithSmallestError->pt()) {
579  bestTrack = trackWithSmallestError;
580  trackType = trackPairWithSmallestError.second;
581  }
582 
583  changeTrack(candidate, std::make_pair(bestTrack, trackType));
584  candidate.setMuonRef(muon);
585 
586  return true;
587 }

References changeTrack(), errorCompScale_, getTrackWithSmallestError(), reco::Muon::InnerTrack, isLooseMuon(), jets_cff::isMu, isMuon(), maxDPtOPt_, muonTracks(), reco::PFCandidate::setMuonRef(), muon::tevOptimized(), trackQuality_, and PbPb_ZMuSkimMuonDPG_cff::trackType.

◆ removeDeadCandidates()

void PFMuonAlgo::removeDeadCandidates ( reco::PFCandidateCollection obj,
const std::vector< unsigned int > &  indices 
)
private

Definition at line 1006 of file PFMuonAlgo.cc.

1006  {
1007  size_t N = indices.size();
1008  size_t collSize = obj->size();
1009 
1010  for (size_t i = 0; i < N; ++i)
1011  obj->at(indices.at(i)) = obj->at(collSize - i - 1);
1012 
1013  obj->resize(collSize - indices.size());
1014 }

References mps_fire::i, bTagCombinedSVVariables_cff::indices, N, and getGTfromDQMFile::obj.

Referenced by postClean().

◆ setInputsForCleaning()

void PFMuonAlgo::setInputsForCleaning ( reco::VertexCollection const &  vertices)

Definition at line 914 of file PFMuonAlgo.cc.

914 { vertices_ = &vertices; }

References pwdgSkimBPark_cfi::vertices, and vertices_.

◆ tracksPointingAtMET()

std::vector< reco::Muon::MuonTrackTypePair > PFMuonAlgo::tracksPointingAtMET ( const std::vector< MuonTrackTypePair > &  tracks)
private

Definition at line 897 of file PFMuonAlgo.cc.

898  {
899  std::vector<reco::Muon::MuonTrackTypePair> outputTracks;
900 
901  double newMET2 = 0.0;
902 
903  for (unsigned int i = 0; i < tracks.size(); ++i) {
904  //calculate new SUM ET and MET2
905  newMET2 = pow(METX_ + tracks.at(i).first->px(), 2) + pow(METY_ + tracks.at(i).first->py(), 2);
906 
907  if (newMET2 < (METX_ * METX_ + METY_ * METY_) / metFactorCleaning_)
908  outputTracks.push_back(tracks.at(i));
909  }
910 
911  return outputTracks;
912 }

References mps_fire::i, metFactorCleaning_, METX_, METY_, funct::pow(), and PDWG_EXOHSCP_cff::tracks.

Referenced by addMissingMuons().

◆ tracksWithBetterMET()

std::vector< reco::Muon::MuonTrackTypePair > PFMuonAlgo::tracksWithBetterMET ( const std::vector< MuonTrackTypePair > &  tracks,
const reco::PFCandidate pfc 
)
private

Definition at line 872 of file PFMuonAlgo.cc.

873  {
874  std::vector<reco::Muon::MuonTrackTypePair> outputTracks;
875 
876  double METNOX = METX_ - pfc.px();
877  double METNOY = METY_ - pfc.py();
878  double SUMETNO = sumet_ - pfc.pt();
879  double MET2 = METX_ * METX_ + METY_ * METY_;
880  double newMET2 = 0.0;
881  double newSUMET = 0.0;
882  double METSIG = sqrt(MET2) / sqrt(sumet_ - sumetPU_);
883 
884  if (METSIG > metSigForCleaning_)
885  for (unsigned int i = 0; i < tracks.size(); ++i) {
886  //calculate new SUM ET and MET2
887  newSUMET = SUMETNO + tracks.at(i).first->pt() - sumetPU_;
888  newMET2 = pow(METNOX + tracks.at(i).first->px(), 2) + pow(METNOY + tracks.at(i).first->py(), 2);
889 
890  if (newSUMET / (sumet_ - sumetPU_) > eventFractionCleaning_ && newMET2 < MET2 / metFactorCleaning_)
891  outputTracks.push_back(tracks.at(i));
892  }
893 
894  return outputTracks;
895 }

References eventFractionCleaning_, mps_fire::i, metFactorCleaning_, metSigForCleaning_, METX_, METY_, funct::pow(), reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), mathSSE::sqrt(), sumet_, sumetPU_, and PDWG_EXOHSCP_cff::tracks.

Referenced by cleanMismeasured().

◆ transferAddedMuonCandidates()

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::transferAddedMuonCandidates ( )
inline

Definition at line 75 of file PFMuonAlgo.h.

75  {
77  }

References eostools::move(), and pfAddedMuonCandidates_.

◆ transferCleanedCosmicCandidates()

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::transferCleanedCosmicCandidates ( )
inline

Definition at line 55 of file PFMuonAlgo.h.

55  {
57  }

References eostools::move(), and pfCosmicsMuonCleanedCandidates_.

◆ transferCleanedFakeCandidates()

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::transferCleanedFakeCandidates ( )
inline

Definition at line 63 of file PFMuonAlgo.h.

63  {
65  }

References eostools::move(), and pfFakeMuonCleanedCandidates_.

◆ transferCleanedTrackerAndGlobalCandidates()

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::transferCleanedTrackerAndGlobalCandidates ( )
inline

Definition at line 59 of file PFMuonAlgo.h.

References eostools::move(), and pfCleanedTrackerAndGlobalMuonCandidates_.

◆ transferPunchThroughCleanedHadronCandidates()

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::transferPunchThroughCleanedHadronCandidates ( )
inline

Definition at line 71 of file PFMuonAlgo.h.

References eostools::move(), and pfPunchThroughHadronCleanedCandidates_.

◆ transferPunchThroughCleanedMuonCandidates()

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::transferPunchThroughCleanedMuonCandidates ( )
inline

Definition at line 67 of file PFMuonAlgo.h.

67  {
69  }

References eostools::move(), and pfPunchThroughMuonCleanedCandidates_.

Member Data Documentation

◆ cosmicRejDistance_

const double PFMuonAlgo::cosmicRejDistance_
private

Definition at line 143 of file PFMuonAlgo.h.

Referenced by addMissingMuons(), and postClean().

◆ errorCompScale_

const double PFMuonAlgo::errorCompScale_
private

Definition at line 125 of file PFMuonAlgo.h.

Referenced by reconstructMuon().

◆ eventFactorCosmics_

const double PFMuonAlgo::eventFactorCosmics_
private

Definition at line 130 of file PFMuonAlgo.h.

Referenced by postClean().

◆ eventFractionCleaning_

const double PFMuonAlgo::eventFractionCleaning_
private

Definition at line 128 of file PFMuonAlgo.h.

Referenced by tracksWithBetterMET().

◆ eventFractionRejection_

const double PFMuonAlgo::eventFractionRejection_
private

Definition at line 134 of file PFMuonAlgo.h.

Referenced by cleanMismeasured().

◆ maskedIndices_

std::vector<unsigned int> PFMuonAlgo::maskedIndices_
private

Definition at line 115 of file PFMuonAlgo.h.

Referenced by cleanMismeasured(), cleanPunchThroughAndFakes(), and postClean().

◆ maxDPtOPt_

const double PFMuonAlgo::maxDPtOPt_
private

Definition at line 122 of file PFMuonAlgo.h.

Referenced by addMissingMuons(), cleanMismeasured(), getMinMaxMET2(), and reconstructMuon().

◆ metFactorCleaning_

const double PFMuonAlgo::metFactorCleaning_
private

Definition at line 133 of file PFMuonAlgo.h.

Referenced by tracksPointingAtMET(), and tracksWithBetterMET().

◆ metFactorFake_

const double PFMuonAlgo::metFactorFake_
private

Definition at line 138 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ metFactorHighEta_

const double PFMuonAlgo::metFactorHighEta_
private

Definition at line 136 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ metFactorRejection_

const double PFMuonAlgo::metFactorRejection_
private

Definition at line 135 of file PFMuonAlgo.h.

Referenced by cleanMismeasured().

◆ metSigForCleaning_

const double PFMuonAlgo::metSigForCleaning_
private

Definition at line 131 of file PFMuonAlgo.h.

Referenced by tracksWithBetterMET().

◆ metSigForRejection_

const double PFMuonAlgo::metSigForRejection_
private

Definition at line 132 of file PFMuonAlgo.h.

Referenced by cleanMismeasured().

◆ METX_

double PFMuonAlgo::METX_
private

◆ METY_

double PFMuonAlgo::METY_
private

◆ minPostCleaningPt_

const double PFMuonAlgo::minPostCleaningPt_
private

Definition at line 129 of file PFMuonAlgo.h.

Referenced by cleanMismeasured(), and cleanPunchThroughAndFakes().

◆ minPunchThroughEnergy_

const double PFMuonAlgo::minPunchThroughEnergy_
private

Definition at line 140 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ minPunchThroughMomentum_

const double PFMuonAlgo::minPunchThroughMomentum_
private

Definition at line 139 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ pfAddedMuonCandidates_

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::pfAddedMuonCandidates_
private

the collection of added muon candidates

Definition at line 113 of file PFMuonAlgo.h.

Referenced by addMissingMuons(), and transferAddedMuonCandidates().

◆ pfCleanedTrackerAndGlobalMuonCandidates_

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::pfCleanedTrackerAndGlobalMuonCandidates_
private

the collection of tracker/global cleaned muon candidates

Definition at line 105 of file PFMuonAlgo.h.

Referenced by cleanMismeasured(), postClean(), and transferCleanedTrackerAndGlobalCandidates().

◆ pfCosmicsMuonCleanedCandidates_

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::pfCosmicsMuonCleanedCandidates_
private

the collection of cosmics cleaned muon candidates

Definition at line 103 of file PFMuonAlgo.h.

Referenced by postClean(), and transferCleanedCosmicCandidates().

◆ pfFakeMuonCleanedCandidates_

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::pfFakeMuonCleanedCandidates_
private

the collection of fake cleaned muon candidates

Definition at line 107 of file PFMuonAlgo.h.

Referenced by cleanMismeasured(), cleanPunchThroughAndFakes(), postClean(), and transferCleanedFakeCandidates().

◆ pfPunchThroughHadronCleanedCandidates_

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::pfPunchThroughHadronCleanedCandidates_
private

the collection of punch-through cleaned neutral hadron candidates

Definition at line 111 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes(), postClean(), and transferPunchThroughCleanedHadronCandidates().

◆ pfPunchThroughMuonCleanedCandidates_

std::unique_ptr<reco::PFCandidateCollection> PFMuonAlgo::pfPunchThroughMuonCleanedCandidates_
private

the collection of punch-through cleaned muon candidates

Definition at line 109 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes(), postClean(), and transferPunchThroughCleanedMuonCandidates().

◆ postCleaning_

const bool PFMuonAlgo::postCleaning_
private

Definition at line 127 of file PFMuonAlgo.h.

Referenced by addMissingMuons(), and postClean().

◆ ptFactorHighEta_

const double PFMuonAlgo::ptFactorHighEta_
private

Definition at line 137 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ punchThroughFactor_

const double PFMuonAlgo::punchThroughFactor_
private

Definition at line 141 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ punchThroughMETFactor_

const double PFMuonAlgo::punchThroughMETFactor_
private

Definition at line 142 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ sumet_

double PFMuonAlgo::sumet_
private

◆ sumetPU_

double PFMuonAlgo::sumetPU_
private

◆ trackQuality_

const reco::TrackBase::TrackQuality PFMuonAlgo::trackQuality_
private

Definition at line 124 of file PFMuonAlgo.h.

Referenced by reconstructMuon().

◆ vertices_

const reco::VertexCollection* PFMuonAlgo::vertices_
private

Definition at line 118 of file PFMuonAlgo.h.

Referenced by addMissingMuons(), postClean(), and setInputsForCleaning().

reco::PFCandidate::trackRef
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:408
PFMuonAlgo::metFactorFake_
const double metFactorFake_
Definition: PFMuonAlgo.h:138
PFMuonAlgo::cleanMismeasured
bool cleanMismeasured(reco::PFCandidate &, unsigned int)
Definition: PFMuonAlgo.cc:818
PFMuonAlgo::getTrackWithSmallestError
MuonTrackTypePair getTrackWithSmallestError(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:607
reco::Muon::CombinedTrack
Definition: Muon.h:36
bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
PFMuonAlgo::isTrackerLooseMuon
static bool isTrackerLooseMuon(const reco::PFBlockElement &elt)
PFMuonAlgo::pfCosmicsMuonCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfCosmicsMuonCleanedCandidates_
the collection of cosmics cleaned muon candidates
Definition: PFMuonAlgo.h:103
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
PFMuonAlgo::removeDeadCandidates
void removeDeadCandidates(reco::PFCandidateCollection *, const std::vector< unsigned int > &)
Definition: PFMuonAlgo.cc:1006
mps_fire.i
i
Definition: mps_fire.py:428
PFMuonAlgo::postCleaning_
const bool postCleaning_
Definition: PFMuonAlgo.h:127
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
reco::Muon::MuonTrackTypePair
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:38
PFMuonAlgo::isIsolatedMuon
static bool isIsolatedMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:94
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
egammaDQMOffline_cff.standAlone
standAlone
Definition: egammaDQMOffline_cff.py:13
muon::tevOptimized
reco::Muon::MuonTrackTypePair tevOptimized(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack, const reco::TrackRef &dytTrack, const double ptThreshold=200., const double tune1=17., const double tune2=40., const double dptcut=0.25)
Definition: MuonCocktails.cc:9
PFMuonAlgo::maskedIndices_
std::vector< unsigned int > maskedIndices_
Definition: PFMuonAlgo.h:115
HLT_FULL_cff.postMuonCleaning
postMuonCleaning
Definition: HLT_FULL_cff.py:13638
PFMuonAlgo::minPunchThroughEnergy_
const double minPunchThroughEnergy_
Definition: PFMuonAlgo.h:140
PFMuonAlgo::metFactorHighEta_
const double metFactorHighEta_
Definition: PFMuonAlgo.h:136
muon
Definition: MuonCocktails.h:17
reco::Muon::TPFMS
Definition: Muon.h:36
min
T min(T a, T b)
Definition: MathUtil.h:58
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
reco::Muon::DYT
Definition: Muon.h:36
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PFMuonAlgo::tracksPointingAtMET
std::vector< MuonTrackTypePair > tracksPointingAtMET(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:897
PFMuonAlgo::tracksWithBetterMET
std::vector< MuonTrackTypePair > tracksWithBetterMET(const std::vector< MuonTrackTypePair > &, const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:872
muon::GlobalMuonPromptTight
Definition: MuonSelectors.h:25
PFMuonAlgo::isGlobalTightMuon
static bool isGlobalTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:67
reco::PFCandidate::h
Definition: PFCandidate.h:46
cms::cuda::assert
assert(be >=bs)
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
PFMuonAlgo::minPostCleaningPt_
const double minPostCleaningPt_
Definition: PFMuonAlgo.h:129
muon::TMLastStationTight
Definition: MuonSelectors.h:27
PFMuonAlgo::metSigForRejection_
const double metSigForRejection_
Definition: PFMuonAlgo.h:132
PFMuonAlgo::maxDPtOPt_
const double maxDPtOPt_
Definition: PFMuonAlgo.h:122
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
HLT_FULL_cff.dPhi
dPhi
Definition: HLT_FULL_cff.py:13702
reco::PFCandidate::elementsInBlocks
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:636
PFMuonAlgo::metFactorCleaning_
const double metFactorCleaning_
Definition: PFMuonAlgo.h:133
edm::Ref< MuonCollection >
PFMuonAlgo::changeTrack
void changeTrack(reco::PFCandidate &, const MuonTrackTypePair &)
Definition: PFMuonAlgo.cc:589
reco::PFCandidate::rawHcalEnergy
double rawHcalEnergy() const
return raw Hcal energy
Definition: PFCandidate.h:236
PFMuonAlgo::isTrackerTightMuon
static bool isTrackerTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:85
PFMuonAlgo::trackQuality_
const reco::TrackBase::TrackQuality trackQuality_
Definition: PFMuonAlgo.h:124
pfElectronTranslator_cfi.PFCandidate
PFCandidate
Definition: pfElectronTranslator_cfi.py:6
muon::isGoodMuon
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
Definition: MuonSelectors.cc:649
reco::PFCandidate::muonRef
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:421
reco::PFCandidate::mu
Definition: PFCandidate.h:48
reco::Muon::OuterTrack
Definition: Muon.h:36
PFMuonAlgo::pfCleanedTrackerAndGlobalMuonCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfCleanedTrackerAndGlobalMuonCandidates_
the collection of tracker/global cleaned muon candidates
Definition: PFMuonAlgo.h:105
reco::LeafCandidate::py
double py() const final
y coordinate of momentum vector
Definition: LeafCandidate.h:142
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
objects.autophobj.relIso
relIso
Definition: autophobj.py:169
muon::TMLastStationOptimizedLowPtLoose
Definition: MuonSelectors.h:32
reco::Track
Definition: Track.h:27
N
#define N
Definition: blowfish.cc:9
PFMuonAlgo::cosmicRejDistance_
const double cosmicRejDistance_
Definition: PFMuonAlgo.h:143
reco::PFCandidate::rawEcalEnergy
double rawEcalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:224
PFMuonAlgo::pfFakeMuonCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfFakeMuonCleanedCandidates_
the collection of fake cleaned muon candidates
Definition: PFMuonAlgo.h:107
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
PFMuonAlgo::minPunchThroughMomentum_
const double minPunchThroughMomentum_
Definition: PFMuonAlgo.h:139
reco::LeafCandidate::setVertex
void setVertex(const Point &vertex) override
set vertex
Definition: LeafCandidate.h:173
PFMuonAlgo::eventFactorCosmics_
const double eventFactorCosmics_
Definition: PFMuonAlgo.h:130
reco::Muon::Picky
Definition: Muon.h:36
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
reco::PFCandidate::ElementsInBlocks
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:379
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PFMuonAlgo::MuonTrackTypePair
reco::Muon::MuonTrackTypePair MuonTrackTypePair
Definition: PFMuonAlgo.h:14
PFMuonAlgo::metFactorRejection_
const double metFactorRejection_
Definition: PFMuonAlgo.h:135
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15142
PFMuonAlgo::estimateEventQuantities
void estimateEventQuantities(const reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:613
muon::TMOneStationTight
Definition: MuonSelectors.h:31
PFMuonAlgo::isGlobalLooseMuon
static bool isGlobalLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:76
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
reco::PFCandidate::particleId
virtual ParticleType particleId() const
Definition: PFCandidate.h:367
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
muon::TMLastStationAngTight
Definition: MuonSelectors.h:38
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
PFMuonAlgo::errorCompScale_
const double errorCompScale_
Definition: PFMuonAlgo.h:125
PFMuonAlgo::vertices_
const reco::VertexCollection * vertices_
Definition: PFMuonAlgo.h:118
cand
Definition: decayParser.h:32
PFMuonAlgo::punchThroughFactor_
const double punchThroughFactor_
Definition: PFMuonAlgo.h:141
PFMuonAlgo::pfPunchThroughHadronCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfPunchThroughHadronCleanedCandidates_
the collection of punch-through cleaned neutral hadron candidates
Definition: PFMuonAlgo.h:111
PFMuonAlgo::METY_
double METY_
Definition: PFMuonAlgo.h:148
muon::TMLastStationOptimizedBarrelLowPtLoose
Definition: MuonSelectors.h:49
reco::Muon::InnerTrack
Definition: Muon.h:36
TrackCollections2monitor_cff.normalizedChi2
normalizedChi2
Definition: TrackCollections2monitor_cff.py:247
muon::TMOneStationLoose
Definition: MuonSelectors.h:30
PFMuonAlgo::sumetPU_
double sumetPU_
Definition: PFMuonAlgo.h:145
muon::AllArbitrated
Definition: MuonSelectors.h:24
PbPb_ZMuSkimMuonDPG_cff.trackType
trackType
Definition: PbPb_ZMuSkimMuonDPG_cff.py:36
muon::TMLastStationOptimizedBarrelLowPtTight
Definition: MuonSelectors.h:51
muon::TM2DCompatibilityTight
Definition: MuonSelectors.h:29
PFMuonAlgo::pfPunchThroughMuonCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfPunchThroughMuonCleanedCandidates_
the collection of punch-through cleaned muon candidates
Definition: PFMuonAlgo.h:109
PFMuonAlgo::sumet_
double sumet_
Definition: PFMuonAlgo.h:146
PFMuonAlgo::getMinMaxMET2
std::pair< double, double > getMinMaxMET2(const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:799
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
MCScenario_CRAFT1_22X.sorter
def sorter(a, b)
Definition: MCScenario_CRAFT1_22X.py:97
PFMuonAlgo::pfAddedMuonCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfAddedMuonCandidates_
the collection of added muon candidates
Definition: PFMuonAlgo.h:113
reco::LeafCandidate::setP4
void setP4(const LorentzVector &p4) final
set 4-momentum
Definition: LeafCandidate.h:158
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
PFMuonAlgo::punchThroughMETFactor_
const double punchThroughMETFactor_
Definition: PFMuonAlgo.h:142
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
PFMuonAlgo::isMuon
static bool isMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:48
HLT_FULL_cff.dEta
dEta
Definition: HLT_FULL_cff.py:13701
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
reco::PFCandidate::setMuonTrackType
void setMuonTrackType(const reco::Muon::MuonTrackType &type)
set the Best Muon Track Ref
Definition: PFCandidate.h:356
reco::PFCandidate::h0
Definition: PFCandidate.h:50
PFMuonAlgo::eventFractionRejection_
const double eventFractionRejection_
Definition: PFMuonAlgo.h:134
reco::LeafCandidate::p
double p() const final
magnitude of momentum vector
Definition: LeafCandidate.h:123
reco::LeafCandidate::setCharge
void setCharge(Charge q) final
set electric charge
Definition: LeafCandidate.h:108
reco::PFBlockElementTrack
Track Element.
Definition: PFBlockElementTrack.h:17
muon::TMLastStationLoose
Definition: MuonSelectors.h:26
PFMuonAlgo::ptFactorHighEta_
const double ptFactorHighEta_
Definition: PFMuonAlgo.h:137
reco::PFBlockElementTrack::muonRef
const reco::MuonRef & muonRef() const override
Definition: PFBlockElementTrack.h:82
PFMuonAlgo::eventFractionCleaning_
const double eventFractionCleaning_
Definition: PFMuonAlgo.h:128
muon::TMLastStationOptimizedLowPtTight
Definition: MuonSelectors.h:33
muon::TMLastStationAngLoose
Definition: MuonSelectors.h:37
PFMuonAlgo::muonTracks
static std::vector< reco::Muon::MuonTrackTypePair > muonTracks(const reco::MuonRef &muon, double maxDPtOPt=1e+9, bool includeSA=false)
Definition: PFMuonAlgo.cc:479
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
PFMuonAlgo::cleanPunchThroughAndFakes
bool cleanPunchThroughAndFakes(reco::PFCandidate &, reco::PFCandidateCollection *, unsigned int)
Definition: PFMuonAlgo.cc:916
mps_fire.result
result
Definition: mps_fire.py:311
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
reco::PFCandidate::setMuonRef
void setMuonRef(const reco::MuonRef &ref)
set muon reference
Definition: PFCandidate.cc:410
jets_cff.isMu
isMu
Definition: jets_cff.py:316
PFMuonAlgo::metSigForCleaning_
const double metSigForCleaning_
Definition: PFMuonAlgo.h:131
reco::LeafCandidate::px
double px() const final
x coordinate of momentum vector
Definition: LeafCandidate.h:140
GlobalTrackerMuonAlignment_cfi.cosmics
cosmics
Definition: GlobalTrackerMuonAlignment_cfi.py:5
reco::PFCandidate::setParticleType
void setParticleType(ParticleType type)
set Particle Type
Definition: PFCandidate.cc:256
PFMuonAlgo::isLooseMuon
static bool isLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:57
reco::MuonTrackType
MuonTrackType
Definition: MuonTrackType.h:28
PFMuonAlgo::METX_
double METX_
Definition: PFMuonAlgo.h:147
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
muon::TM2DCompatibilityLoose
Definition: MuonSelectors.h:28