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 &)
 
bool hasValidTrack (const reco::MuonRef &muonRef, bool loose=false)
 
 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 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 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 > &)
 
std::vector< reco::Muon::MuonTrackTypePairgoodMuonTracks (const reco::MuonRef &muon, bool includeSA=false)
 
std::vector< reco::Muon::MuonTrackTypePairmuonTracks (const reco::MuonRef &muon, bool includeSA=false, double dpt=1e+9)
 
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 25 of file PFMuonAlgo.cc.

27  : pfCosmicsMuonCleanedCandidates_(std::make_unique<reco::PFCandidateCollection>()),
28  pfCleanedTrackerAndGlobalMuonCandidates_(std::make_unique<reco::PFCandidateCollection>()),
29  pfFakeMuonCleanedCandidates_(std::make_unique<reco::PFCandidateCollection>()),
30  pfPunchThroughMuonCleanedCandidates_(std::make_unique<reco::PFCandidateCollection>()),
31  pfPunchThroughHadronCleanedCandidates_(std::make_unique<reco::PFCandidateCollection>()),
32  pfAddedMuonCandidates_(std::make_unique<reco::PFCandidateCollection>()),
33 
34  maxDPtOPt_(getParameter<double>(iConfig, "maxDPtOPt", 1.0)),
35  trackQuality_(reco::TrackBase::qualityByName(getParameter<std::string>(iConfig, "trackQuality", "highPurity"))),
36  errorCompScale_(getParameter<double>(iConfig, "ptErrorScale", 8.0)),
37 
38  postCleaning_(postMuonCleaning), // disable by default (for HLT)
39  eventFractionCleaning_(getParameter<double>(iConfig, "eventFractionForCleaning", 0.5)),
40  minPostCleaningPt_(getParameter<double>(iConfig, "minPtForPostCleaning", 20.)),
41  eventFactorCosmics_(getParameter<double>(iConfig, "eventFactorForCosmics", 10.)),
42  metSigForCleaning_(getParameter<double>(iConfig, "metSignificanceForCleaning", 3.)),
43  metSigForRejection_(getParameter<double>(iConfig, "metSignificanceForRejection", 4.)),
44  metFactorCleaning_(getParameter<double>(iConfig, "metFactorForCleaning", 4.)),
45  eventFractionRejection_(getParameter<double>(iConfig, "eventFractionForRejection", 0.8)),
46  metFactorRejection_(getParameter<double>(iConfig, "metFactorForRejection", 4.)),
47  metFactorHighEta_(getParameter<double>(iConfig, "metFactorForHighEta", 25.)),
48  ptFactorHighEta_(getParameter<double>(iConfig, "ptFactorForHighEta", 2.)),
49  metFactorFake_(getParameter<double>(iConfig, "metFactorForFakes", 4.)),
50  minPunchThroughMomentum_(getParameter<double>(iConfig, "minMomentumForPunchThrough", 100.)),
51  minPunchThroughEnergy_(getParameter<double>(iConfig, "minEnergyForPunchThrough", 100.)),
52  punchThroughFactor_(getParameter<double>(iConfig, "punchThroughFactor", 3.)),
53  punchThroughMETFactor_(getParameter<double>(iConfig, "punchThroughMETFactor", 4.)),
54  cosmicRejDistance_(getParameter<double>(iConfig, "cosmicRejectionDistance", 1.)) {}

Member Function Documentation

◆ addMissingMuons()

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

Definition at line 738 of file PFMuonAlgo.cc.

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

References HLT_2018_cff::cands, changeTrack(), ALCARECOTkAlJpsiMuMu_cff::charge, cosmicRejDistance_, HLT_2018_cff::dEta, HLT_2018_cff::dPhi, HGC3DClusterGenMatchSelector_cfi::dR, goodMuonTracks(), mps_fire::i, edm::Ref< C, T, F >::isNonnull(), METX_, METY_, reco::PFCandidate::mu, reco::PFCandidate::muonRef(), PDWG_BPHSkim_cff::muons, 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 601 of file PFMuonAlgo.cc.

601  {
602  using namespace reco;
603  reco::TrackRef bestTrack = track.first;
604  MuonTrackType trackType = track.second;
605  //OK Now redefine the canddiate with that track
606  double px = bestTrack->px();
607  double py = bestTrack->py();
608  double pz = bestTrack->pz();
609  double energy = sqrt(bestTrack->p() * bestTrack->p() + 0.1057 * 0.1057);
610 
611  candidate.setCharge(bestTrack->charge() > 0 ? 1 : -1);
612  candidate.setP4(math::XYZTLorentzVector(px, py, pz, energy));
614  // candidate.setTrackRef( bestTrack );
615  candidate.setMuonTrackType(trackType);
617  candidate.setVertexSource(PFCandidate::kTrkMuonVertex);
619  candidate.setVertexSource(PFCandidate::kComMuonVertex);
620  else if (trackType == reco::Muon::TPFMS)
621  candidate.setVertexSource(PFCandidate::kTPFMSMuonVertex);
622  else if (trackType == reco::Muon::Picky)
623  candidate.setVertexSource(PFCandidate::kPickyMuonVertex);
624  else if (trackType == reco::Muon::DYT)
625  candidate.setVertexSource(PFCandidate::kDYTMuonVertex);
626 }

References reco::Muon::CombinedTrack, reco::Muon::DYT, HCALHighEnergyHPDFilter_cfi::energy, reco::Muon::InnerTrack, reco::PFCandidate::mu, reco::Muon::Picky, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, reco::LeafCandidate::setCharge(), reco::PFCandidate::setMuonTrackType(), reco::LeafCandidate::setP4(), reco::PFCandidate::setParticleType(), reco::PFCandidate::setVertexSource(), mathSSE::sqrt(), reco::Muon::TPFMS, HLT_2018_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 839 of file PFMuonAlgo.cc.

839  {
840  using namespace std;
841  using namespace reco;
842  bool cleaned = false;
843 
844  //First define the MET without this guy
845  double METNOX = METX_ - pfc.px();
846  double METNOY = METY_ - pfc.py();
847  double SUMETNO = sumet_ - pfc.pt();
848 
849  TrackMETComparator comparator(METNOX, METNOY);
850  //Low pt dont need to be cleaned
851  if (pfc.pt() < minPostCleaningPt_)
852  return false;
853  std::vector<reco::Muon::MuonTrackTypePair> tracks = goodMuonTracks(pfc.muonRef(), false);
854 
855  //If there is more than 1 track choice try to change the track
856  if (tracks.size() > 1) {
857  //Find tracks that change dramatically MET or Pt
858  std::vector<reco::Muon::MuonTrackTypePair> tracksThatChangeMET = tracksWithBetterMET(tracks, pfc);
859  //From those tracks get the one with smallest MET
860  if (!tracksThatChangeMET.empty()) {
861  reco::Muon::MuonTrackTypePair bestTrackType =
862  *std::min_element(tracksThatChangeMET.begin(), tracksThatChangeMET.end(), comparator);
863  changeTrack(pfc, bestTrackType);
864 
866  //update eventquantities
867  METX_ = METNOX + pfc.px();
868  METY_ = METNOY + pfc.py();
869  sumet_ = SUMETNO + pfc.pt();
870  }
871  }
872 
873  //Now attempt to kill it
874  if (!(pfc.muonRef()->isGlobalMuon() && pfc.muonRef()->isTrackerMuon())) {
875  //define MET significance and SUM ET
876  double MET2 = METX_ * METX_ + METY_ * METY_;
877  double newMET2 = METNOX * METNOX + METNOY * METNOY;
878  double METSig = sqrt(MET2) / sqrt(sumet_ - sumetPU_);
879  if (METSig > metSigForRejection_)
880  if ((newMET2 < MET2 / metFactorRejection_) &&
881  ((SUMETNO - sumetPU_) / (sumet_ - sumetPU_) < eventFractionRejection_)) {
882  pfFakeMuonCleanedCandidates_->push_back(pfc);
883  maskedIndices_.push_back(i);
884  METX_ = METNOX;
885  METY_ = METNOY;
886  sumet_ = SUMETNO;
887  cleaned = true;
888  }
889  }
890  return cleaned;
891 }

References changeTrack(), eventFractionRejection_, goodMuonTracks(), mps_fire::i, maskedIndices_, metFactorRejection_, metSigForRejection_, METX_, METY_, minPostCleaningPt_, reco::PFCandidate::muonRef(), 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 937 of file PFMuonAlgo.cc.

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

References HLT_2018_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 634 of file PFMuonAlgo.cc.

634  {
635  //SUM ET
636  sumetPU_ = 0.0;
637  METX_ = 0.;
638  METY_ = 0.;
639  sumet_ = 0.0;
640  for (reco::PFCandidateCollection::const_iterator i = pfc->begin(); i != pfc->end(); ++i) {
641  sumet_ += i->pt();
642  METX_ += i->px();
643  METY_ += i->py();
644  }
645 }

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

Referenced by postClean().

◆ fillPSetDescription()

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

Definition at line 1037 of file PFMuonAlgo.cc.

1037  {
1038  // Muon ID and post cleaning parameters
1039  iDesc.add<double>("maxDPtOPt", 1.0);
1040  iDesc.add<std::string>("trackQuality", "highPurity");
1041  iDesc.add<double>("ptErrorScale", 8.0);
1042 
1043  iDesc.add<double>("eventFractionForCleaning", 0.5);
1044  iDesc.add<double>("minPtForPostCleaning", 20.0);
1045  iDesc.add<double>("eventFactorForCosmics", 10.0);
1046  iDesc.add<double>("metSignificanceForCleaning", 3.0);
1047  iDesc.add<double>("metSignificanceForRejection", 4.0);
1048  iDesc.add<double>("metFactorForCleaning", 4.0);
1049  iDesc.add<double>("eventFractionForRejection", 0.8);
1050  iDesc.add<double>("metFactorForRejection", 4.0);
1051  iDesc.add<double>("metFactorForHighEta", 25.0);
1052  iDesc.add<double>("ptFactorForHighEta", 2.0);
1053  iDesc.add<double>("metFactorForFakes", 4.0);
1054  iDesc.add<double>("minMomentumForPunchThrough", 100.0);
1055  iDesc.add<double>("minEnergyForPunchThrough", 100.0);
1056  iDesc.add<double>("punchThroughFactor", 3.0);
1057  iDesc.add<double>("punchThroughMETFactor", 4.0);
1058  iDesc.add<double>("cosmicRejectionDistance", 1.0);
1059 }

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

◆ getMinMaxMET2()

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

Definition at line 820 of file PFMuonAlgo.cc.

820  {
821  std::vector<reco::Muon::MuonTrackTypePair> tracks = goodMuonTracks((pfc.muonRef()), true);
822 
823  double METXNO = METX_ - pfc.px();
824  double METYNO = METY_ - pfc.py();
825  std::vector<double> met2;
826  for (unsigned int i = 0; i < tracks.size(); ++i) {
827  met2.push_back(pow(METXNO + tracks.at(i).first->px(), 2) + pow(METYNO + tracks.at(i).first->py(), 2));
828  }
829 
830  //PROTECT for cases of only one track. If there is only one track it will crash .
831  //Has never happened but could likely happen!
832 
833  if (tracks.size() > 1)
834  return std::make_pair(*std::min_element(met2.begin(), met2.end()), *std::max_element(met2.begin(), met2.end()));
835  else
836  return std::make_pair(0, 0);
837 }

References goodMuonTracks(), mps_fire::i, METX_, METY_, reco::PFCandidate::muonRef(), 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 628 of file PFMuonAlgo.cc.

629  {
630  TrackPtErrorSorter sorter;
631  return *std::min_element(tracks.begin(), tracks.end(), sorter);
632 }

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

Referenced by reconstructMuon().

◆ goodMuonTracks()

std::vector< reco::Muon::MuonTrackTypePair > PFMuonAlgo::goodMuonTracks ( const reco::MuonRef muon,
bool  includeSA = false 
)
private

Definition at line 487 of file PFMuonAlgo.cc.

487  {
488  return muonTracks(muon, includeSA, maxDPtOPt_);
489 }

References maxDPtOPt_, and muonTracks().

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

◆ hasValidTrack()

bool PFMuonAlgo::hasValidTrack ( const reco::MuonRef muonRef,
bool  loose = false 
)

Definition at line 356 of file PFMuonAlgo.cc.

356  {
357  if (loose)
358  return !muonTracks(muonRef).empty();
359  else
360  return !goodMuonTracks(muonRef).empty();
361 }

References goodMuonTracks(), and muonTracks().

◆ isGlobalLooseMuon() [1/2]

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

Definition at line 205 of file PFMuonAlgo.cc.

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

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 84 of file PFMuonAlgo.cc.

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

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 119 of file PFMuonAlgo.cc.

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

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 75 of file PFMuonAlgo.cc.

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

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 287 of file PFMuonAlgo.cc.

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

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 102 of file PFMuonAlgo.cc.

102  {
103  const reco::PFBlockElementTrack* eltTrack = dynamic_cast<const reco::PFBlockElementTrack*>(&elt);
104 
105  assert(eltTrack);
106  reco::MuonRef muonRef = eltTrack->muonRef();
107 
108  return isIsolatedMuon(muonRef);
109 }

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 115 of file PFMuonAlgo.cc.

115  {
116  return (isGlobalLooseMuon(muonRef) || isTrackerLooseMuon(muonRef));
117 }

References isGlobalLooseMuon(), and isTrackerLooseMuon().

◆ isLooseMuon() [2/2]

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

Definition at line 65 of file PFMuonAlgo.cc.

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

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 111 of file PFMuonAlgo.cc.

111  {
112  return isGlobalTightMuon(muonRef) || isTrackerTightMuon(muonRef) || isIsolatedMuon(muonRef);
113 }

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

◆ isMuon() [2/2]

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

Definition at line 56 of file PFMuonAlgo.cc.

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

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 331 of file PFMuonAlgo.cc.

331  {
333  return false;
334 
335  if (!muonRef->isTrackerMuon())
336  return false;
337 
338  if (muonRef->numberOfMatches() < 2)
339  return false;
340 
341  //const reco::TrackRef& combinedMuon = muonRef->combinedMuon();
342  const reco::TrackRef& combinedMuon = muonRef->globalTrack();
343 
344  if (combinedMuon->hitPattern().numberOfValidTrackerHits() < 11)
345  return false;
346 
347  if (combinedMuon->hitPattern().numberOfValidPixelHits() == 0)
348  return false;
349 
350  if (combinedMuon->hitPattern().numberOfValidMuonHits() == 0)
351  return false;
352 
353  return true;
354 }

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

◆ isTrackerLooseMuon() [1/2]

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

Definition at line 264 of file PFMuonAlgo.cc.

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

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 176 of file PFMuonAlgo.cc.

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

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

◆ isTrackerTightMuon() [2/2]

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

Definition at line 93 of file PFMuonAlgo.cc.

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

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

Referenced by isMuon().

◆ muonTracks()

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

Definition at line 491 of file PFMuonAlgo.cc.

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

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 goodMuonTracks(), hasValidTrack(), and reconstructMuon().

◆ postClean()

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

Definition at line 647 of file PFMuonAlgo.cc.

647  {
648  using namespace std;
649  using namespace reco;
650  if (!postCleaning_)
651  return;
652 
653  //Initialize vectors
654 
657  else
659 
662  else
664 
667  else
669 
672  else
674 
677  else
679 
681 
682  maskedIndices_.clear();
683 
684  //Estimate MET and SumET
685 
687 
688  std::vector<int> muons;
689  std::vector<int> cosmics;
690  //get the muons
691  for (unsigned int i = 0; i < cands->size(); ++i) {
692  const reco::PFCandidate& cand = (*cands)[i];
693  if (cand.particleId() == reco::PFCandidate::mu)
694  muons.push_back(i);
695  }
696  //Then sort the muon indicess by decsending pt
697 
698  IndexPtComparator comparator(cands);
699  std::sort(muons.begin(), muons.end(), comparator);
700 
701  //first kill cosmics
702  double METXCosmics = 0;
703  double METYCosmics = 0;
704  double SUMETCosmics = 0.0;
705 
706  for (unsigned int i = 0; i < muons.size(); ++i) {
707  const PFCandidate& pfc = cands->at(muons[i]);
708  double origin = 0.0;
709  if (!vertices_->empty() && vertices_->at(0).isValid() && !vertices_->at(0).isFake())
710  origin = pfc.muonRef()->muonBestTrack()->dxy(vertices_->at(0).position());
711 
712  if (origin > cosmicRejDistance_) {
713  cosmics.push_back(muons[i]);
714  METXCosmics += pfc.px();
715  METYCosmics += pfc.py();
716  SUMETCosmics += pfc.pt();
717  }
718  }
719  double MET2Cosmics = METXCosmics * METXCosmics + METYCosmics * METYCosmics;
720 
721  if (SUMETCosmics > (sumet_ - sumetPU_) / eventFactorCosmics_ && MET2Cosmics < METX_ * METX_ + METY_ * METY_)
722  for (unsigned int i = 0; i < cosmics.size(); ++i) {
723  maskedIndices_.push_back(cosmics[i]);
725  }
726 
727  //Loop on the muons candidates and clean
728  for (unsigned int i = 0; i < muons.size(); ++i) {
729  if (cleanMismeasured(cands->at(muons[i]), muons[i]))
730  continue;
732  }
733 
734  //OK Now do the hard job ->remove the candidates that were cleaned
736 }

References HLT_2018_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 363 of file PFMuonAlgo.cc.

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

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_2018_cff::track, and PbPb_ZMuSkimMuonDPG_cff::tracker.

◆ reconstructMuon()

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

Definition at line 542 of file PFMuonAlgo.cc.

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

References changeTrack(), errorCompScale_, getTrackWithSmallestError(), goodMuonTracks(), reco::Muon::InnerTrack, isLooseMuon(), jets_cff::isMu, isMuon(), 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 1027 of file PFMuonAlgo.cc.

1027  {
1028  size_t N = indices.size();
1029  size_t collSize = obj->size();
1030 
1031  for (size_t i = 0; i < N; ++i)
1032  obj->at(indices.at(i)) = obj->at(collSize - i - 1);
1033 
1034  obj->resize(collSize - indices.size());
1035 }

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 935 of file PFMuonAlgo.cc.

935 { 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 918 of file PFMuonAlgo.cc.

919  {
920  std::vector<reco::Muon::MuonTrackTypePair> outputTracks;
921 
922  double newMET2 = 0.0;
923 
924  for (unsigned int i = 0; i < tracks.size(); ++i) {
925  //calculate new SUM ET and MET2
926  newMET2 = pow(METX_ + tracks.at(i).first->px(), 2) + pow(METY_ + tracks.at(i).first->py(), 2);
927 
928  if (newMET2 < (METX_ * METX_ + METY_ * METY_) / metFactorCleaning_)
929  outputTracks.push_back(tracks.at(i));
930  }
931 
932  return outputTracks;
933 }

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 893 of file PFMuonAlgo.cc.

894  {
895  std::vector<reco::Muon::MuonTrackTypePair> outputTracks;
896 
897  double METNOX = METX_ - pfc.px();
898  double METNOY = METY_ - pfc.py();
899  double SUMETNO = sumet_ - pfc.pt();
900  double MET2 = METX_ * METX_ + METY_ * METY_;
901  double newMET2 = 0.0;
902  double newSUMET = 0.0;
903  double METSIG = sqrt(MET2) / sqrt(sumet_ - sumetPU_);
904 
905  if (METSIG > metSigForCleaning_)
906  for (unsigned int i = 0; i < tracks.size(); ++i) {
907  //calculate new SUM ET and MET2
908  newSUMET = SUMETNO + tracks.at(i).first->pt() - sumetPU_;
909  newMET2 = pow(METNOX + tracks.at(i).first->px(), 2) + pow(METNOY + tracks.at(i).first->py(), 2);
910 
911  if (newSUMET / (sumet_ - sumetPU_) > eventFractionCleaning_ && newMET2 < MET2 / metFactorCleaning_)
912  outputTracks.push_back(tracks.at(i));
913  }
914 
915  return outputTracks;
916 }

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 146 of file PFMuonAlgo.h.

Referenced by addMissingMuons(), and postClean().

◆ errorCompScale_

const double PFMuonAlgo::errorCompScale_
private

Definition at line 128 of file PFMuonAlgo.h.

Referenced by reconstructMuon().

◆ eventFactorCosmics_

const double PFMuonAlgo::eventFactorCosmics_
private

Definition at line 133 of file PFMuonAlgo.h.

Referenced by postClean().

◆ eventFractionCleaning_

const double PFMuonAlgo::eventFractionCleaning_
private

Definition at line 131 of file PFMuonAlgo.h.

Referenced by tracksWithBetterMET().

◆ eventFractionRejection_

const double PFMuonAlgo::eventFractionRejection_
private

Definition at line 137 of file PFMuonAlgo.h.

Referenced by cleanMismeasured().

◆ maskedIndices_

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

Definition at line 118 of file PFMuonAlgo.h.

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

◆ maxDPtOPt_

const double PFMuonAlgo::maxDPtOPt_
private

Definition at line 125 of file PFMuonAlgo.h.

Referenced by goodMuonTracks().

◆ metFactorCleaning_

const double PFMuonAlgo::metFactorCleaning_
private

Definition at line 136 of file PFMuonAlgo.h.

Referenced by tracksPointingAtMET(), and tracksWithBetterMET().

◆ metFactorFake_

const double PFMuonAlgo::metFactorFake_
private

Definition at line 141 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ metFactorHighEta_

const double PFMuonAlgo::metFactorHighEta_
private

Definition at line 139 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ metFactorRejection_

const double PFMuonAlgo::metFactorRejection_
private

Definition at line 138 of file PFMuonAlgo.h.

Referenced by cleanMismeasured().

◆ metSigForCleaning_

const double PFMuonAlgo::metSigForCleaning_
private

Definition at line 134 of file PFMuonAlgo.h.

Referenced by tracksWithBetterMET().

◆ metSigForRejection_

const double PFMuonAlgo::metSigForRejection_
private

Definition at line 135 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 132 of file PFMuonAlgo.h.

Referenced by cleanMismeasured(), and cleanPunchThroughAndFakes().

◆ minPunchThroughEnergy_

const double PFMuonAlgo::minPunchThroughEnergy_
private

Definition at line 143 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ minPunchThroughMomentum_

const double PFMuonAlgo::minPunchThroughMomentum_
private

Definition at line 142 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 116 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 108 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 106 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 110 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 114 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 112 of file PFMuonAlgo.h.

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

◆ postCleaning_

const bool PFMuonAlgo::postCleaning_
private

Definition at line 130 of file PFMuonAlgo.h.

Referenced by addMissingMuons(), and postClean().

◆ ptFactorHighEta_

const double PFMuonAlgo::ptFactorHighEta_
private

Definition at line 140 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ punchThroughFactor_

const double PFMuonAlgo::punchThroughFactor_
private

Definition at line 144 of file PFMuonAlgo.h.

Referenced by cleanPunchThroughAndFakes().

◆ punchThroughMETFactor_

const double PFMuonAlgo::punchThroughMETFactor_
private

Definition at line 145 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 127 of file PFMuonAlgo.h.

Referenced by reconstructMuon().

◆ vertices_

const reco::VertexCollection* PFMuonAlgo::vertices_
private

Definition at line 121 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:141
PFMuonAlgo::cleanMismeasured
bool cleanMismeasured(reco::PFCandidate &, unsigned int)
Definition: PFMuonAlgo.cc:839
PFMuonAlgo::getTrackWithSmallestError
MuonTrackTypePair getTrackWithSmallestError(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:628
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:106
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:1027
mps_fire.i
i
Definition: mps_fire.py:355
PFMuonAlgo::postCleaning_
const bool postCleaning_
Definition: PFMuonAlgo.h:130
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:102
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:118
PFMuonAlgo::minPunchThroughEnergy_
const double minPunchThroughEnergy_
Definition: PFMuonAlgo.h:143
PFMuonAlgo::metFactorHighEta_
const double metFactorHighEta_
Definition: PFMuonAlgo.h:139
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:918
PFMuonAlgo::tracksWithBetterMET
std::vector< MuonTrackTypePair > tracksWithBetterMET(const std::vector< MuonTrackTypePair > &, const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:893
muon::GlobalMuonPromptTight
Definition: MuonSelectors.h:26
PFMuonAlgo::isGlobalTightMuon
static bool isGlobalTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:75
reco::PFCandidate::h
Definition: PFCandidate.h:45
cms::cuda::assert
assert(be >=bs)
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
PFMuonAlgo::minPostCleaningPt_
const double minPostCleaningPt_
Definition: PFMuonAlgo.h:132
muon::TMLastStationTight
Definition: MuonSelectors.h:28
PFMuonAlgo::metSigForRejection_
const double metSigForRejection_
Definition: PFMuonAlgo.h:135
PFMuonAlgo::maxDPtOPt_
const double maxDPtOPt_
Definition: PFMuonAlgo.h:125
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::PFCandidate::elementsInBlocks
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:636
HLT_2018_cff.postMuonCleaning
postMuonCleaning
Definition: HLT_2018_cff.py:12310
HLT_2018_cff.dEta
dEta
Definition: HLT_2018_cff.py:12289
PFMuonAlgo::metFactorCleaning_
const double metFactorCleaning_
Definition: PFMuonAlgo.h:136
edm::Ref< MuonCollection >
PFMuonAlgo::changeTrack
void changeTrack(reco::PFCandidate &, const MuonTrackTypePair &)
Definition: PFMuonAlgo.cc:601
reco::PFCandidate::rawHcalEnergy
double rawHcalEnergy() const
return raw Hcal energy
Definition: PFCandidate.h:235
PFMuonAlgo::isTrackerTightMuon
static bool isTrackerTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:93
PFMuonAlgo::trackQuality_
const reco::TrackBase::TrackQuality trackQuality_
Definition: PFMuonAlgo.h:127
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:664
reco::PFCandidate::muonRef
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:421
reco::PFCandidate::mu
Definition: PFCandidate.h:47
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:108
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:33
HLT_2018_cff.dPhi
dPhi
Definition: HLT_2018_cff.py:12290
reco::Track
Definition: Track.h:27
N
#define N
Definition: blowfish.cc:9
PFMuonAlgo::cosmicRejDistance_
const double cosmicRejDistance_
Definition: PFMuonAlgo.h:146
reco::PFCandidate::rawEcalEnergy
double rawEcalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:223
PFMuonAlgo::pfFakeMuonCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfFakeMuonCleanedCandidates_
the collection of fake cleaned muon candidates
Definition: PFMuonAlgo.h:110
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:142
PFMuonAlgo::eventFactorCosmics_
const double eventFactorCosmics_
Definition: PFMuonAlgo.h:133
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:378
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:138
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
PFMuonAlgo::estimateEventQuantities
void estimateEventQuantities(const reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:634
muon::TMOneStationTight
Definition: MuonSelectors.h:32
PFMuonAlgo::isGlobalLooseMuon
static bool isGlobalLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:84
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PFMuonAlgo::muonTracks
std::vector< reco::Muon::MuonTrackTypePair > muonTracks(const reco::MuonRef &muon, bool includeSA=false, double dpt=1e+9)
Definition: PFMuonAlgo.cc:491
reco::PFCandidate::particleId
virtual ParticleType particleId() const
Definition: PFCandidate.h:366
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
muon::TMLastStationAngTight
Definition: MuonSelectors.h:39
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
PFMuonAlgo::errorCompScale_
const double errorCompScale_
Definition: PFMuonAlgo.h:128
PFMuonAlgo::vertices_
const reco::VertexCollection * vertices_
Definition: PFMuonAlgo.h:121
cand
Definition: decayParser.h:34
PFMuonAlgo::punchThroughFactor_
const double punchThroughFactor_
Definition: PFMuonAlgo.h:144
PFMuonAlgo::pfPunchThroughHadronCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfPunchThroughHadronCleanedCandidates_
the collection of punch-through cleaned neutral hadron candidates
Definition: PFMuonAlgo.h:114
PFMuonAlgo::METY_
double METY_
Definition: PFMuonAlgo.h:151
muon::TMLastStationOptimizedBarrelLowPtLoose
Definition: MuonSelectors.h:50
reco::Muon::InnerTrack
Definition: Muon.h:36
TrackCollections2monitor_cff.normalizedChi2
normalizedChi2
Definition: TrackCollections2monitor_cff.py:247
muon::TMOneStationLoose
Definition: MuonSelectors.h:31
PFMuonAlgo::sumetPU_
double sumetPU_
Definition: PFMuonAlgo.h:148
muon::AllArbitrated
Definition: MuonSelectors.h:25
PbPb_ZMuSkimMuonDPG_cff.trackType
trackType
Definition: PbPb_ZMuSkimMuonDPG_cff.py:36
muon::TMLastStationOptimizedBarrelLowPtTight
Definition: MuonSelectors.h:52
muon::TM2DCompatibilityTight
Definition: MuonSelectors.h:30
PFMuonAlgo::pfPunchThroughMuonCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfPunchThroughMuonCleanedCandidates_
the collection of punch-through cleaned muon candidates
Definition: PFMuonAlgo.h:112
PFMuonAlgo::sumet_
double sumet_
Definition: PFMuonAlgo.h:149
PFMuonAlgo::getMinMaxMET2
std::pair< double, double > getMinMaxMET2(const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:820
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
reco::PFCandidate::setVertexSource
void setVertexSource(PFVertexType vt)
Definition: PFCandidate.h:397
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:116
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::goodMuonTracks
std::vector< reco::Muon::MuonTrackTypePair > goodMuonTracks(const reco::MuonRef &muon, bool includeSA=false)
Definition: PFMuonAlgo.cc:487
PFMuonAlgo::punchThroughMETFactor_
const double punchThroughMETFactor_
Definition: PFMuonAlgo.h:145
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
PFMuonAlgo::isMuon
static bool isMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:56
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:355
reco::PFCandidate::h0
Definition: PFCandidate.h:49
PFMuonAlgo::eventFractionRejection_
const double eventFractionRejection_
Definition: PFMuonAlgo.h:137
reco::LeafCandidate::p
double p() const final
magnitude of momentum vector
Definition: LeafCandidate.h:123
reco::PFCandidateCollection
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Definition: PFCandidateFwd.h:12
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:27
PFMuonAlgo::ptFactorHighEta_
const double ptFactorHighEta_
Definition: PFMuonAlgo.h:140
HLT_2018_cff.cands
cands
Definition: HLT_2018_cff.py:13762
reco::PFBlockElementTrack::muonRef
const reco::MuonRef & muonRef() const override
Definition: PFBlockElementTrack.h:82
PFMuonAlgo::eventFractionCleaning_
const double eventFractionCleaning_
Definition: PFMuonAlgo.h:131
muon::TMLastStationOptimizedLowPtTight
Definition: MuonSelectors.h:34
muon::TMLastStationAngLoose
Definition: MuonSelectors.h:38
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
PFMuonAlgo::cleanPunchThroughAndFakes
bool cleanPunchThroughAndFakes(reco::PFCandidate &, reco::PFCandidateCollection *, unsigned int)
Definition: PFMuonAlgo.cc:937
mps_fire.result
result
Definition: mps_fire.py:303
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:288
PFMuonAlgo::metSigForCleaning_
const double metSigForCleaning_
Definition: PFMuonAlgo.h:134
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:65
reco::MuonTrackType
MuonTrackType
Definition: MuonTrackType.h:28
PFMuonAlgo::METX_
double METX_
Definition: PFMuonAlgo.h:150
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
muon::TM2DCompatibilityLoose
Definition: MuonSelectors.h:29