CMS 3D CMS Logo

PFMuonAlgo.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFProducer_PFMuonAlgo_h
2 #define RecoParticleFlow_PFProducer_PFMuonAlgo_h
12 
13 class PFMuonAlgo {
16 
17 public:
20 
22 
24  static bool isMuon(const reco::PFBlockElement& elt);
25  static bool isLooseMuon(const reco::PFBlockElement& elt);
26  static bool isGlobalTightMuon(const reco::PFBlockElement& elt);
27  static bool isGlobalLooseMuon(const reco::PFBlockElement& elt);
28  static bool isTrackerTightMuon(const reco::PFBlockElement& elt);
29  static bool isTrackerLooseMuon(const reco::PFBlockElement& elt);
30  static bool isIsolatedMuon(const reco::PFBlockElement& elt);
31  static bool isMuon(const reco::MuonRef& muonRef);
32  static bool isLooseMuon(const reco::MuonRef& muonRef);
33  static bool isGlobalTightMuon(const reco::MuonRef& muonRef);
34  static bool isGlobalLooseMuon(const reco::MuonRef& muonRef);
35 
36  static bool isTrackerTightMuon(const reco::MuonRef& muonRef);
37  static bool isTrackerLooseMuon(const reco::MuonRef& muonRef);
38  static bool isIsolatedMuon(const reco::MuonRef& muonRef);
39  static bool isTightMuonPOG(const reco::MuonRef& muonRef);
40  static void printMuonProperties(const reco::MuonRef& muonRef);
41 
43  bool hasValidTrack(const reco::MuonRef& muonRef, bool loose = false);
44 
45  //Make a PF Muon : Basic method
46  bool reconstructMuon(reco::PFCandidate&, const reco::MuonRef&, bool allowLoose = false);
47 
48  //Assign a different track to the muon
50  //PF Post cleaning algorithm
54 
55  std::unique_ptr<reco::PFCandidateCollection> transferCleanedCosmicCandidates() {
57  }
58 
59  std::unique_ptr<reco::PFCandidateCollection> transferCleanedTrackerAndGlobalCandidates() {
61  }
62 
63  std::unique_ptr<reco::PFCandidateCollection> transferCleanedFakeCandidates() {
65  }
66 
67  std::unique_ptr<reco::PFCandidateCollection> transferPunchThroughCleanedMuonCandidates() {
69  }
70 
71  std::unique_ptr<reco::PFCandidateCollection> transferPunchThroughCleanedHadronCandidates() {
73  }
74 
75  std::unique_ptr<reco::PFCandidateCollection> transferAddedMuonCandidates() {
77  }
78 
79 private:
80  //Gives the track with the smallest Dpt/Pt
81  MuonTrackTypePair getTrackWithSmallestError(const std::vector<MuonTrackTypePair>&);
82 
83  std::vector<reco::Muon::MuonTrackTypePair> muonTracks(const reco::MuonRef& muon,
84  bool includeSA = false,
85  double dpt = 1e+9);
86 
87  //Gets the good tracks
88  std::vector<reco::Muon::MuonTrackTypePair> goodMuonTracks(const reco::MuonRef& muon, bool includeSA = false);
89 
90  //Estimate MET and SUmET for post cleaning
92 
93  //Post cleaning Sub-methods
94  bool cleanMismeasured(reco::PFCandidate&, unsigned int);
96 
97  void removeDeadCandidates(reco::PFCandidateCollection*, const std::vector<unsigned int>&);
98 
99  //helpers
100  std::pair<double, double> getMinMaxMET2(const reco::PFCandidate&);
101  std::vector<MuonTrackTypePair> tracksWithBetterMET(const std::vector<MuonTrackTypePair>&, const reco::PFCandidate&);
102  std::vector<MuonTrackTypePair> tracksPointingAtMET(const std::vector<MuonTrackTypePair>&);
103 
104  //Output collections for post cleaning
106  std::unique_ptr<reco::PFCandidateCollection> pfCosmicsMuonCleanedCandidates_;
108  std::unique_ptr<reco::PFCandidateCollection> pfCleanedTrackerAndGlobalMuonCandidates_;
110  std::unique_ptr<reco::PFCandidateCollection> pfFakeMuonCleanedCandidates_;
112  std::unique_ptr<reco::PFCandidateCollection> pfPunchThroughMuonCleanedCandidates_;
114  std::unique_ptr<reco::PFCandidateCollection> pfPunchThroughHadronCleanedCandidates_;
116  std::unique_ptr<reco::PFCandidateCollection> pfAddedMuonCandidates_;
117 
118  std::vector<unsigned int> maskedIndices_;
119 
122 
123  //Configurables
124  // for PFMuonAlgo::goodMuonTracks/muonTracks
125  const double maxDPtOPt_;
126  // for PFMuonAlgo::reconstructMuon
128  const double errorCompScale_;
129  // for postCleaning (postClean/addMissingMuons)
130  const bool postCleaning_;
132  const double minPostCleaningPt_;
133  const double eventFactorCosmics_;
134  const double metSigForCleaning_;
135  const double metSigForRejection_;
136  const double metFactorCleaning_;
138  const double metFactorRejection_;
139  const double metFactorHighEta_;
140  const double ptFactorHighEta_;
141  const double metFactorFake_;
144  const double punchThroughFactor_;
146  const double cosmicRejDistance_;
147 
148  double sumetPU_;
149  double sumet_;
150  double METX_;
151  double METY_;
152 
154 
156  public:
157  TrackMETComparator(double METX, double METY) {
158  metx_ = METX;
159  mety_ = METY;
160  }
162 
163  bool operator()(const MuonTrackTypePair& mu1, const MuonTrackTypePair& mu2) {
164  return pow(metx_ + mu1.first->px(), 2) + pow(mety_ + mu1.first->py(), 2) <
165  pow(metx_ + mu2.first->px(), 2) + pow(mety_ + mu2.first->py(), 2);
166  }
167 
168  private:
169  double metx_;
170  double mety_;
171  };
172 
174  public:
177 
178  bool operator()(int mu1, int mu2) { return coll_->at(mu1).pt() > coll_->at(mu2).pt(); }
179 
180  private:
182  };
183 
185  public:
188 
189  bool operator()(const MuonTrackTypePair& mu1, const MuonTrackTypePair& mu2) {
190  return mu1.first->ptError() / mu1.first->pt() < mu2.first->ptError() / mu2.first->pt();
191  }
192  };
193 };
194 
195 #endif
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
PFMuonAlgo::IndexPtComparator::~IndexPtComparator
~IndexPtComparator()
Definition: PFMuonAlgo.h:176
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
PFMuonAlgo::hasValidTrack
bool hasValidTrack(const reco::MuonRef &muonRef, bool loose=false)
Definition: PFMuonAlgo.cc:356
Handle.h
PFMuonAlgo::removeDeadCandidates
void removeDeadCandidates(reco::PFCandidateCollection *, const std::vector< unsigned int > &)
Definition: PFMuonAlgo.cc:1027
PFMuonAlgo::postCleaning_
const bool postCleaning_
Definition: PFMuonAlgo.h:130
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
Muon.h
PFMuonAlgo::MuonTrackType
reco::Muon::MuonTrackType MuonTrackType
Definition: PFMuonAlgo.h:15
PFMuonAlgo::TrackPtErrorSorter::operator()
bool operator()(const MuonTrackTypePair &mu1, const MuonTrackTypePair &mu2)
Definition: PFMuonAlgo.h:189
PFMuonAlgo::maskedIndices_
std::vector< unsigned int > maskedIndices_
Definition: PFMuonAlgo.h:118
reco::Muon::MuonTrackType
MuonTrackType
map for Global Muon refitters
Definition: Muon.h:36
PFMuonAlgo::minPunchThroughEnergy_
const double minPunchThroughEnergy_
Definition: PFMuonAlgo.h:143
PFMuonAlgo::metFactorHighEta_
const double metFactorHighEta_
Definition: PFMuonAlgo.h:139
muon
Definition: MuonCocktails.h:17
PFMuonAlgo::transferCleanedCosmicCandidates
std::unique_ptr< reco::PFCandidateCollection > transferCleanedCosmicCandidates()
Definition: PFMuonAlgo.h:55
PFCandidate.h
PFMuonAlgo::TrackPtErrorSorter
Definition: PFMuonAlgo.h:184
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
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
PFMuonAlgo::TrackPtErrorSorter::~TrackPtErrorSorter
~TrackPtErrorSorter()
Definition: PFMuonAlgo.h:187
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PFMuonAlgo::isGlobalTightMuon
static bool isGlobalTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:75
PFMuonAlgo::TrackMETComparator
Definition: PFMuonAlgo.h:155
PFMuonAlgo::TrackMETComparator::mety_
double mety_
Definition: PFMuonAlgo.h:170
reco::TrackBase::TrackQuality
TrackQuality
track quality
Definition: TrackBase.h:150
PFMuonAlgo::minPostCleaningPt_
const double minPostCleaningPt_
Definition: PFMuonAlgo.h:132
PFMuonAlgo::metSigForRejection_
const double metSigForRejection_
Definition: PFMuonAlgo.h:135
PFMuonAlgo::maxDPtOPt_
const double maxDPtOPt_
Definition: PFMuonAlgo.h:125
PFMuonAlgo::reconstructMuon
bool reconstructMuon(reco::PFCandidate &, const reco::MuonRef &, bool allowLoose=false)
Definition: PFMuonAlgo.cc:542
HLT_2018_cff.postMuonCleaning
postMuonCleaning
Definition: HLT_2018_cff.py:12310
edm::Handle< reco::MuonCollection >
PFMuonAlgo::metFactorCleaning_
const double metFactorCleaning_
Definition: PFMuonAlgo.h:136
edm::Ref< MuonCollection >
PFMuonAlgo::changeTrack
void changeTrack(reco::PFCandidate &, const MuonTrackTypePair &)
Definition: PFMuonAlgo.cc:601
PFMuonAlgo::isTrackerTightMuon
static bool isTrackerTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:93
PFMuonAlgo::trackQuality_
const reco::TrackBase::TrackQuality trackQuality_
Definition: PFMuonAlgo.h:127
PFMuonAlgo::IndexPtComparator::operator()
bool operator()(int mu1, int mu2)
Definition: PFMuonAlgo.h:178
PFMuonAlgo::pfCleanedTrackerAndGlobalMuonCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfCleanedTrackerAndGlobalMuonCandidates_
the collection of tracker/global cleaned muon candidates
Definition: PFMuonAlgo.h:108
MuonFwd.h
PFBlockElement.h
PFMuonAlgo::TrackMETComparator::TrackMETComparator
TrackMETComparator(double METX, double METY)
Definition: PFMuonAlgo.h:157
PFMuonAlgo::cosmicRejDistance_
const double cosmicRejDistance_
Definition: PFMuonAlgo.h:146
PFMuonAlgo::pfFakeMuonCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfFakeMuonCleanedCandidates_
the collection of fake cleaned muon candidates
Definition: PFMuonAlgo.h:110
PFMuonAlgo::minPunchThroughMomentum_
const double minPunchThroughMomentum_
Definition: PFMuonAlgo.h:142
ParameterSetDescription.h
PFMuonAlgo::TrackPtErrorSorter::TrackPtErrorSorter
TrackPtErrorSorter()
Definition: PFMuonAlgo.h:186
PFMuonAlgo::eventFactorCosmics_
const double eventFactorCosmics_
Definition: PFMuonAlgo.h:133
Vertex.h
PFMuonAlgo::MuonTrackTypePair
reco::Muon::MuonTrackTypePair MuonTrackTypePair
Definition: PFMuonAlgo.h:14
PFMuonAlgo::metFactorRejection_
const double metFactorRejection_
Definition: PFMuonAlgo.h:138
PFMuonAlgo::IndexPtComparator::coll_
const reco::PFCandidateCollection * coll_
Definition: PFMuonAlgo.h:181
PFMuonAlgo
Definition: PFMuonAlgo.h:13
PFMuonAlgo::TrackMETComparator::~TrackMETComparator
~TrackMETComparator()
Definition: PFMuonAlgo.h:161
PFMuonAlgo::transferAddedMuonCandidates
std::unique_ptr< reco::PFCandidateCollection > transferAddedMuonCandidates()
Definition: PFMuonAlgo.h:75
PFMuonAlgo::estimateEventQuantities
void estimateEventQuantities(const reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:634
PFMuonAlgo::transferCleanedFakeCandidates
std::unique_ptr< reco::PFCandidateCollection > transferCleanedFakeCandidates()
Definition: PFMuonAlgo.h:63
PFMuonAlgo::printMuonProperties
static void printMuonProperties(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:363
edm::ParameterSet
Definition: ParameterSet.h:36
PFMuonAlgo::isGlobalLooseMuon
static bool isGlobalLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:84
PFMuonAlgo::transferCleanedTrackerAndGlobalCandidates
std::unique_ptr< reco::PFCandidateCollection > transferCleanedTrackerAndGlobalCandidates()
Definition: PFMuonAlgo.h:59
PFMuonAlgo::muonTracks
std::vector< reco::Muon::MuonTrackTypePair > muonTracks(const reco::MuonRef &muon, bool includeSA=false, double dpt=1e+9)
Definition: PFMuonAlgo.cc:491
PFMuonAlgo::setInputsForCleaning
void setInputsForCleaning(reco::VertexCollection const &)
Definition: PFMuonAlgo.cc:935
PFMuonAlgo::errorCompScale_
const double errorCompScale_
Definition: PFMuonAlgo.h:128
PFMuonAlgo::vertices_
const reco::VertexCollection * vertices_
Definition: PFMuonAlgo.h:121
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::transferPunchThroughCleanedMuonCandidates
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedMuonCandidates()
Definition: PFMuonAlgo.h:67
PFMuonAlgo::METY_
double METY_
Definition: PFMuonAlgo.h:151
PFMuonAlgo::PFMuonAlgo
PFMuonAlgo(edm::ParameterSet const &, bool postMuonCleaning)
constructor
Definition: PFMuonAlgo.cc:25
PFMuonAlgo::sumetPU_
double sumetPU_
Definition: PFMuonAlgo.h:148
reco::PFBlockElement
Abstract base class for a PFBlock element (track, cluster...)
Definition: PFBlockElement.h:26
PFMuonAlgo::IndexPtComparator::IndexPtComparator
IndexPtComparator(const reco::PFCandidateCollection *coll)
Definition: PFMuonAlgo.h:175
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::TrackMETComparator::metx_
double metx_
Definition: PFMuonAlgo.h:169
PFMuonAlgo::getMinMaxMET2
std::pair< double, double > getMinMaxMET2(const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:820
VertexFwd.h
PFMuonAlgo::pfAddedMuonCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfAddedMuonCandidates_
the collection of added muon candidates
Definition: PFMuonAlgo.h:116
eostools.move
def move(src, dest)
Definition: eostools.py:511
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
PFMuonAlgo::isMuon
static bool isMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:56
PFMuonAlgo::TrackMETComparator::operator()
bool operator()(const MuonTrackTypePair &mu1, const MuonTrackTypePair &mu2)
Definition: PFMuonAlgo.h:163
PFMuonAlgo::eventFractionRejection_
const double eventFractionRejection_
Definition: PFMuonAlgo.h:137
reco::PFCandidateCollection
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Definition: PFCandidateFwd.h:12
PFMuonAlgo::ptFactorHighEta_
const double ptFactorHighEta_
Definition: PFMuonAlgo.h:140
HLT_2018_cff.cands
cands
Definition: HLT_2018_cff.py:13762
PFMuonAlgo::addMissingMuons
void addMissingMuons(edm::Handle< reco::MuonCollection >, reco::PFCandidateCollection *cands)
Definition: PFMuonAlgo.cc:738
PFMuonAlgo::eventFractionCleaning_
const double eventFractionCleaning_
Definition: PFMuonAlgo.h:131
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
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
PFMuonAlgo::postClean
void postClean(reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:647
ParameterSet.h
PFMuonAlgo::IndexPtComparator
Definition: PFMuonAlgo.h:173
PFMuonAlgo::isTightMuonPOG
static bool isTightMuonPOG(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:331
PFMuonAlgo::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
Definition: PFMuonAlgo.cc:1037
PFMuonAlgo::transferPunchThroughCleanedHadronCandidates
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedHadronCandidates()
Definition: PFMuonAlgo.h:71
PFMuonAlgo::metSigForCleaning_
const double metSigForCleaning_
Definition: PFMuonAlgo.h:134
PFMuonAlgo::isLooseMuon
static bool isLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:65
PFMuonAlgo::METX_
double METX_
Definition: PFMuonAlgo.h:150
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37