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  static bool hasValidTrack(const reco::MuonRef& muonRef, bool loose, double maxDPtOPt);
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  static std::vector<reco::Muon::MuonTrackTypePair> muonTracks(const reco::MuonRef& muon,
80  double maxDPtOPt = 1e+9,
81  bool includeSA = false);
82 
83 private:
84  //Give the track with the smallest Dpt/Pt
85  MuonTrackTypePair getTrackWithSmallestError(const std::vector<MuonTrackTypePair>&);
86 
87  //Estimate MET and SUmET for post cleaning
89 
90  //Post cleaning Sub-methods
91  bool cleanMismeasured(reco::PFCandidate&, unsigned int);
93 
94  void removeDeadCandidates(reco::PFCandidateCollection*, const std::vector<unsigned int>&);
95 
96  //helpers
97  std::pair<double, double> getMinMaxMET2(const reco::PFCandidate&);
98  std::vector<MuonTrackTypePair> tracksWithBetterMET(const std::vector<MuonTrackTypePair>&, const reco::PFCandidate&);
99  std::vector<MuonTrackTypePair> tracksPointingAtMET(const std::vector<MuonTrackTypePair>&);
100 
101  //Output collections for post cleaning
103  std::unique_ptr<reco::PFCandidateCollection> pfCosmicsMuonCleanedCandidates_;
105  std::unique_ptr<reco::PFCandidateCollection> pfCleanedTrackerAndGlobalMuonCandidates_;
107  std::unique_ptr<reco::PFCandidateCollection> pfFakeMuonCleanedCandidates_;
109  std::unique_ptr<reco::PFCandidateCollection> pfPunchThroughMuonCleanedCandidates_;
111  std::unique_ptr<reco::PFCandidateCollection> pfPunchThroughHadronCleanedCandidates_;
113  std::unique_ptr<reco::PFCandidateCollection> pfAddedMuonCandidates_;
114 
115  std::vector<unsigned int> maskedIndices_;
116 
119 
120  //Configurables
121  // for PFMuonAlgo::goodMuonTracks/muonTracks
122  const double maxDPtOPt_;
123  // for PFMuonAlgo::reconstructMuon
125  const double errorCompScale_;
126  // for postCleaning (postClean/addMissingMuons)
127  const bool postCleaning_;
129  const double minPostCleaningPt_;
130  const double eventFactorCosmics_;
131  const double metSigForCleaning_;
132  const double metSigForRejection_;
133  const double metFactorCleaning_;
135  const double metFactorRejection_;
136  const double metFactorHighEta_;
137  const double ptFactorHighEta_;
138  const double metFactorFake_;
141  const double punchThroughFactor_;
143  const double cosmicRejDistance_;
144 
145  double sumetPU_;
146  double sumet_;
147  double METX_;
148  double METY_;
149 
151 
153  public:
154  TrackMETComparator(double METX, double METY) {
155  metx_ = METX;
156  mety_ = METY;
157  }
159 
160  bool operator()(const MuonTrackTypePair& mu1, const MuonTrackTypePair& mu2) {
161  return pow(metx_ + mu1.first->px(), 2) + pow(mety_ + mu1.first->py(), 2) <
162  pow(metx_ + mu2.first->px(), 2) + pow(mety_ + mu2.first->py(), 2);
163  }
164 
165  private:
166  double metx_;
167  double mety_;
168  };
169 
171  public:
174 
175  bool operator()(int mu1, int mu2) { return coll_->at(mu1).pt() > coll_->at(mu2).pt(); }
176 
177  private:
179  };
180 
182  public:
185 
186  bool operator()(const MuonTrackTypePair& mu1, const MuonTrackTypePair& mu2) {
187  return mu1.first->ptError() / mu1.first->pt() < mu2.first->ptError() / mu2.first->pt();
188  }
189  };
190 };
191 
192 #endif
PFMuonAlgo::metFactorFake_
const double metFactorFake_
Definition: PFMuonAlgo.h:138
PFMuonAlgo::cleanMismeasured
bool cleanMismeasured(reco::PFCandidate &, unsigned int)
Definition: PFMuonAlgo.cc:818
PFMuonAlgo::getTrackWithSmallestError
MuonTrackTypePair getTrackWithSmallestError(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:607
PFMuonAlgo::IndexPtComparator::~IndexPtComparator
~IndexPtComparator()
Definition: PFMuonAlgo.h:173
PFMuonAlgo::isTrackerLooseMuon
static bool isTrackerLooseMuon(const reco::PFBlockElement &elt)
PFMuonAlgo::pfCosmicsMuonCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfCosmicsMuonCleanedCandidates_
the collection of cosmics cleaned muon candidates
Definition: PFMuonAlgo.h:103
Handle.h
PFMuonAlgo::removeDeadCandidates
void removeDeadCandidates(reco::PFCandidateCollection *, const std::vector< unsigned int > &)
Definition: PFMuonAlgo.cc:1006
PFMuonAlgo::postCleaning_
const bool postCleaning_
Definition: PFMuonAlgo.h:127
reco::Muon::MuonTrackTypePair
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:38
PFMuonAlgo::isIsolatedMuon
static bool isIsolatedMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:94
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:186
PFMuonAlgo::maskedIndices_
std::vector< unsigned int > maskedIndices_
Definition: PFMuonAlgo.h:115
reco::Muon::MuonTrackType
MuonTrackType
map for Global Muon refitters
Definition: Muon.h:36
HLT_FULL_cff.postMuonCleaning
postMuonCleaning
Definition: HLT_FULL_cff.py:13704
PFMuonAlgo::minPunchThroughEnergy_
const double minPunchThroughEnergy_
Definition: PFMuonAlgo.h:140
PFMuonAlgo::metFactorHighEta_
const double metFactorHighEta_
Definition: PFMuonAlgo.h:136
muon
Definition: MuonCocktails.h:17
PFMuonAlgo::transferCleanedCosmicCandidates
std::unique_ptr< reco::PFCandidateCollection > transferCleanedCosmicCandidates()
Definition: PFMuonAlgo.h:55
PFCandidate.h
PFMuonAlgo::TrackPtErrorSorter
Definition: PFMuonAlgo.h:181
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:897
PFMuonAlgo::tracksWithBetterMET
std::vector< MuonTrackTypePair > tracksWithBetterMET(const std::vector< MuonTrackTypePair > &, const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:872
PFMuonAlgo::TrackPtErrorSorter::~TrackPtErrorSorter
~TrackPtErrorSorter()
Definition: PFMuonAlgo.h:184
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PFMuonAlgo::isGlobalTightMuon
static bool isGlobalTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:67
PFMuonAlgo::TrackMETComparator
Definition: PFMuonAlgo.h:152
PFMuonAlgo::TrackMETComparator::mety_
double mety_
Definition: PFMuonAlgo.h:167
reco::TrackBase::TrackQuality
TrackQuality
track quality
Definition: TrackBase.h:150
PFMuonAlgo::minPostCleaningPt_
const double minPostCleaningPt_
Definition: PFMuonAlgo.h:129
PFMuonAlgo::metSigForRejection_
const double metSigForRejection_
Definition: PFMuonAlgo.h:132
PFMuonAlgo::maxDPtOPt_
const double maxDPtOPt_
Definition: PFMuonAlgo.h:122
PFMuonAlgo::reconstructMuon
bool reconstructMuon(reco::PFCandidate &, const reco::MuonRef &, bool allowLoose=false)
Definition: PFMuonAlgo.cc:530
edm::Handle< reco::MuonCollection >
PFMuonAlgo::metFactorCleaning_
const double metFactorCleaning_
Definition: PFMuonAlgo.h:133
edm::Ref< MuonCollection >
PFMuonAlgo::changeTrack
void changeTrack(reco::PFCandidate &, const MuonTrackTypePair &)
Definition: PFMuonAlgo.cc:589
PFMuonAlgo::isTrackerTightMuon
static bool isTrackerTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:85
PFMuonAlgo::trackQuality_
const reco::TrackBase::TrackQuality trackQuality_
Definition: PFMuonAlgo.h:124
PFMuonAlgo::IndexPtComparator::operator()
bool operator()(int mu1, int mu2)
Definition: PFMuonAlgo.h:175
PFMuonAlgo::pfCleanedTrackerAndGlobalMuonCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfCleanedTrackerAndGlobalMuonCandidates_
the collection of tracker/global cleaned muon candidates
Definition: PFMuonAlgo.h:105
MuonFwd.h
PFBlockElement.h
PFMuonAlgo::TrackMETComparator::TrackMETComparator
TrackMETComparator(double METX, double METY)
Definition: PFMuonAlgo.h:154
PFMuonAlgo::cosmicRejDistance_
const double cosmicRejDistance_
Definition: PFMuonAlgo.h:143
PFMuonAlgo::pfFakeMuonCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfFakeMuonCleanedCandidates_
the collection of fake cleaned muon candidates
Definition: PFMuonAlgo.h:107
PFMuonAlgo::minPunchThroughMomentum_
const double minPunchThroughMomentum_
Definition: PFMuonAlgo.h:139
ParameterSetDescription.h
PFMuonAlgo::TrackPtErrorSorter::TrackPtErrorSorter
TrackPtErrorSorter()
Definition: PFMuonAlgo.h:183
PFMuonAlgo::eventFactorCosmics_
const double eventFactorCosmics_
Definition: PFMuonAlgo.h:130
Vertex.h
PFMuonAlgo::MuonTrackTypePair
reco::Muon::MuonTrackTypePair MuonTrackTypePair
Definition: PFMuonAlgo.h:14
PFMuonAlgo::metFactorRejection_
const double metFactorRejection_
Definition: PFMuonAlgo.h:135
PFMuonAlgo::IndexPtComparator::coll_
const reco::PFCandidateCollection * coll_
Definition: PFMuonAlgo.h:178
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15208
PFMuonAlgo
Definition: PFMuonAlgo.h:13
PFMuonAlgo::TrackMETComparator::~TrackMETComparator
~TrackMETComparator()
Definition: PFMuonAlgo.h:158
PFMuonAlgo::transferAddedMuonCandidates
std::unique_ptr< reco::PFCandidateCollection > transferAddedMuonCandidates()
Definition: PFMuonAlgo.h:75
PFMuonAlgo::estimateEventQuantities
void estimateEventQuantities(const reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:613
PFMuonAlgo::transferCleanedFakeCandidates
std::unique_ptr< reco::PFCandidateCollection > transferCleanedFakeCandidates()
Definition: PFMuonAlgo.h:63
PFMuonAlgo::printMuonProperties
static void printMuonProperties(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:355
edm::ParameterSet
Definition: ParameterSet.h:47
PFMuonAlgo::isGlobalLooseMuon
static bool isGlobalLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:76
PFMuonAlgo::transferCleanedTrackerAndGlobalCandidates
std::unique_ptr< reco::PFCandidateCollection > transferCleanedTrackerAndGlobalCandidates()
Definition: PFMuonAlgo.h:59
PFMuonAlgo::setInputsForCleaning
void setInputsForCleaning(reco::VertexCollection const &)
Definition: PFMuonAlgo.cc:914
PFMuonAlgo::hasValidTrack
static bool hasValidTrack(const reco::MuonRef &muonRef, bool loose, double maxDPtOPt)
Definition: PFMuonAlgo.cc:348
PFMuonAlgo::errorCompScale_
const double errorCompScale_
Definition: PFMuonAlgo.h:125
PFMuonAlgo::vertices_
const reco::VertexCollection * vertices_
Definition: PFMuonAlgo.h:118
PFMuonAlgo::punchThroughFactor_
const double punchThroughFactor_
Definition: PFMuonAlgo.h:141
PFMuonAlgo::pfPunchThroughHadronCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfPunchThroughHadronCleanedCandidates_
the collection of punch-through cleaned neutral hadron candidates
Definition: PFMuonAlgo.h:111
PFMuonAlgo::transferPunchThroughCleanedMuonCandidates
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedMuonCandidates()
Definition: PFMuonAlgo.h:67
PFMuonAlgo::METY_
double METY_
Definition: PFMuonAlgo.h:148
PFMuonAlgo::PFMuonAlgo
PFMuonAlgo(edm::ParameterSet const &, bool postMuonCleaning)
constructor
Definition: PFMuonAlgo.cc:17
PFMuonAlgo::sumetPU_
double sumetPU_
Definition: PFMuonAlgo.h:145
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:172
PFMuonAlgo::pfPunchThroughMuonCleanedCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfPunchThroughMuonCleanedCandidates_
the collection of punch-through cleaned muon candidates
Definition: PFMuonAlgo.h:109
PFMuonAlgo::sumet_
double sumet_
Definition: PFMuonAlgo.h:146
PFMuonAlgo::TrackMETComparator::metx_
double metx_
Definition: PFMuonAlgo.h:166
PFMuonAlgo::getMinMaxMET2
std::pair< double, double > getMinMaxMET2(const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:799
VertexFwd.h
PFMuonAlgo::pfAddedMuonCandidates_
std::unique_ptr< reco::PFCandidateCollection > pfAddedMuonCandidates_
the collection of added muon candidates
Definition: PFMuonAlgo.h:113
eostools.move
def move(src, dest)
Definition: eostools.py:511
PFMuonAlgo::punchThroughMETFactor_
const double punchThroughMETFactor_
Definition: PFMuonAlgo.h:142
PFMuonAlgo::isMuon
static bool isMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:48
PFMuonAlgo::TrackMETComparator::operator()
bool operator()(const MuonTrackTypePair &mu1, const MuonTrackTypePair &mu2)
Definition: PFMuonAlgo.h:160
PFMuonAlgo::eventFractionRejection_
const double eventFractionRejection_
Definition: PFMuonAlgo.h:134
reco::PFCandidateCollection
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Definition: PFCandidateFwd.h:12
PFMuonAlgo::ptFactorHighEta_
const double ptFactorHighEta_
Definition: PFMuonAlgo.h:137
PFMuonAlgo::addMissingMuons
void addMissingMuons(edm::Handle< reco::MuonCollection >, reco::PFCandidateCollection *cands)
Definition: PFMuonAlgo.cc:717
PFMuonAlgo::eventFractionCleaning_
const double eventFractionCleaning_
Definition: PFMuonAlgo.h:128
PFMuonAlgo::muonTracks
static std::vector< reco::Muon::MuonTrackTypePair > muonTracks(const reco::MuonRef &muon, double maxDPtOPt=1e+9, bool includeSA=false)
Definition: PFMuonAlgo.cc:479
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
PFMuonAlgo::cleanPunchThroughAndFakes
bool cleanPunchThroughAndFakes(reco::PFCandidate &, reco::PFCandidateCollection *, unsigned int)
Definition: PFMuonAlgo.cc:916
PFMuonAlgo::postClean
void postClean(reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:626
ParameterSet.h
PFMuonAlgo::IndexPtComparator
Definition: PFMuonAlgo.h:170
PFMuonAlgo::isTightMuonPOG
static bool isTightMuonPOG(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:323
PFMuonAlgo::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
Definition: PFMuonAlgo.cc:1016
PFMuonAlgo::transferPunchThroughCleanedHadronCandidates
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedHadronCandidates()
Definition: PFMuonAlgo.h:71
PFMuonAlgo::metSigForCleaning_
const double metSigForCleaning_
Definition: PFMuonAlgo.h:131
PFMuonAlgo::isLooseMuon
static bool isLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:57
PFMuonAlgo::METX_
double METX_
Definition: PFMuonAlgo.h:147
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37