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
11 
12 class PFMuonAlgo {
13 
16 
17  public:
18 
21 
23  static bool isMuon( const reco::PFBlockElement& elt );
24  static bool isLooseMuon( const reco::PFBlockElement& elt );
25  static bool isGlobalTightMuon( const reco::PFBlockElement& elt );
26  static bool isGlobalLooseMuon( const reco::PFBlockElement& elt );
27  static bool isTrackerTightMuon( const reco::PFBlockElement& elt );
28  static bool isTrackerLooseMuon( const reco::PFBlockElement& elt );
29  static bool isIsolatedMuon( const reco::PFBlockElement& elt );
30  static bool isMuon( const reco::MuonRef& muonRef );
31  static bool isLooseMuon( const reco::MuonRef& muonRef );
32  static bool isGlobalTightMuon( const reco::MuonRef& muonRef );
33  static bool isGlobalLooseMuon( const reco::MuonRef& muonRef );
34 
35  static bool isTrackerTightMuon( const reco::MuonRef& muonRef );
36  static bool isTrackerLooseMuon( const reco::MuonRef& muonRef );
37  static bool isIsolatedMuon( const reco::MuonRef& muonRef );
38  static bool isTightMuonPOG(const reco::MuonRef& muonRef);
39  static void printMuonProperties( const reco::MuonRef& muonRef );
40 
41 
43  bool hasValidTrack(const reco::MuonRef& muonRef,bool loose =false);
44 
45 
46 
47 
48  //Make a PF Muon : Basic method
49  bool reconstructMuon(reco::PFCandidate&, const reco::MuonRef&,bool allowLoose = false);
50 
51 
52  //Assign a different track to the muon
53  void changeTrack(reco::PFCandidate&,const MuonTrackTypePair&);
54  //PF Post cleaning algorithm
58 
59  std::unique_ptr<reco::PFCandidateCollection> transferCleanedCosmicCandidates() {
61  }
62 
63  std::unique_ptr<reco::PFCandidateCollection> transferCleanedTrackerAndGlobalCandidates() {
65  }
66 
67  std::unique_ptr<reco::PFCandidateCollection> transferCleanedFakeCandidates() {
69  }
70 
71  std::unique_ptr<reco::PFCandidateCollection> transferPunchThroughCleanedMuonCandidates() {
73  }
74 
75  std::unique_ptr<reco::PFCandidateCollection> transferPunchThroughCleanedHadronCandidates() {
77  }
78 
79  std::unique_ptr<reco::PFCandidateCollection> transferAddedMuonCandidates() {
81  }
82 
83  private:
84  //Gives the track with the smallest Dpt/Pt
85  MuonTrackTypePair getTrackWithSmallestError(const std::vector<MuonTrackTypePair>&);
86 
87  std::vector<reco::Muon::MuonTrackTypePair> muonTracks(const reco::MuonRef& muon,bool includeSA = false,double dpt = 1e+9);
88 
89  //Gets the good tracks
90  std::vector<reco::Muon::MuonTrackTypePair> goodMuonTracks(const reco::MuonRef& muon,bool includeSA = false);
91 
92 
93  //Estimate MET and SUmET for post cleaning
95 
96  //Post cleaning Sub-methods
97  bool cleanMismeasured(reco::PFCandidate&,unsigned int);
99 
100  void removeDeadCandidates(reco::PFCandidateCollection*, const std::vector<unsigned int>&);
101 
102 
103 
104  //helpers
105  std::pair<double,double> getMinMaxMET2(const reco::PFCandidate&);
106  std::vector<MuonTrackTypePair> tracksWithBetterMET(const std::vector<MuonTrackTypePair>& ,const reco::PFCandidate&);
107  std::vector<MuonTrackTypePair> tracksPointingAtMET(const std::vector<MuonTrackTypePair>&);
108 
109  //Output collections for post cleaning
111  std::unique_ptr<reco::PFCandidateCollection> pfCosmicsMuonCleanedCandidates_;
113  std::unique_ptr<reco::PFCandidateCollection> pfCleanedTrackerAndGlobalMuonCandidates_;
115  std::unique_ptr<reco::PFCandidateCollection> pfFakeMuonCleanedCandidates_;
117  std::unique_ptr<reco::PFCandidateCollection> pfPunchThroughMuonCleanedCandidates_;
119  std::unique_ptr<reco::PFCandidateCollection> pfPunchThroughHadronCleanedCandidates_;
121  std::unique_ptr<reco::PFCandidateCollection> pfAddedMuonCandidates_;
122 
123  std::vector<unsigned int > maskedIndices_;
124 
125 
128 
129 
130 
131  //Configurables
132  const double maxDPtOPt_;
133  const int minTrackerHits_;
134  const int minPixelHits_;
136  const double errorCompScale_;
138  const double dzPV_;
139  const bool postCleaning_;
140  const double minPostCleaningPt_;
141  const double eventFactorCosmics_;
142  const double metSigForCleaning_;
143  const double metSigForRejection_;
144  const double metFactorCleaning_;
146  const double metFactorRejection_;
147  const double metFactorHighEta_;
148  const double ptFactorHighEta_;
149  const double metFactorFake_;
152  const double punchThroughFactor_;
154  const double cosmicRejDistance_;
155 
156  double sumetPU_;
157  double sumet_;
158  double METX_;
159  double METY_;
160 
161 
163 
165  public:
166  TrackMETComparator(double METX,double METY) {metx_ = METX; mety_=METY;}
168 
169  bool operator()(const MuonTrackTypePair& mu1,const MuonTrackTypePair& mu2) {
170  return pow(metx_+mu1.first->px(),2)+pow(mety_+mu1.first->py(),2) < pow(metx_+mu2.first->px(),2)+pow(mety_+mu2.first->py(),2);
171  }
172  private:
173  double metx_;
174  double mety_;
175 
176 
177  };
178 
179 
181  public:
182 
184  }
186 
187  bool operator()(int mu1,int mu2) {
188  return coll_->at(mu1).pt() > coll_->at(mu2).pt();
189  }
190 
191  private:
193 
194  };
195 
196 
197 
198 
200  public:
203 
204  bool operator()(const MuonTrackTypePair& mu1,const MuonTrackTypePair& mu2) {
205  return mu1.first->ptError()/mu1.first->pt() < mu2.first->ptError()/mu2.first->pt();
206  }
207  };
208 
209 
210 
211 };
212 
213 #endif
Abstract base class for a PFBlock element (track, cluster...)
static bool isIsolatedMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:137
bool cleanMismeasured(reco::PFCandidate &, unsigned int)
Definition: PFMuonAlgo.cc:971
static bool isTightMuonPOG(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:389
double sumet_
Definition: PFMuonAlgo.h:157
void removeDeadCandidates(reco::PFCandidateCollection *, const std::vector< unsigned int > &)
Definition: PFMuonAlgo.cc:1173
std::unique_ptr< reco::PFCandidateCollection > pfPunchThroughMuonCleanedCandidates_
the collection of punch-through cleaned muon candidates
Definition: PFMuonAlgo.h:117
void addMissingMuons(edm::Handle< reco::MuonCollection >, reco::PFCandidateCollection *cands)
Definition: PFMuonAlgo.cc:863
bool operator()(int mu1, int mu2)
Definition: PFMuonAlgo.h:187
static bool isMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:66
const double minPunchThroughEnergy_
Definition: PFMuonAlgo.h:151
static bool isTrackerLooseMuon(const reco::PFBlockElement &elt)
const double metFactorRejection_
Definition: PFMuonAlgo.h:146
TrackQuality
track quality
Definition: TrackBase.h:151
std::unique_ptr< reco::PFCandidateCollection > transferAddedMuonCandidates()
Definition: PFMuonAlgo.h:79
const bool postCleaning_
Definition: PFMuonAlgo.h:139
PFMuonAlgo(edm::ParameterSet const &)
constructor
Definition: PFMuonAlgo.cc:26
std::unique_ptr< reco::PFCandidateCollection > pfFakeMuonCleanedCandidates_
the collection of fake cleaned muon candidates
Definition: PFMuonAlgo.h:115
static bool isGlobalLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:111
const double minPunchThroughMomentum_
Definition: PFMuonAlgo.h:150
std::unique_ptr< reco::PFCandidateCollection > transferCleanedTrackerAndGlobalCandidates()
Definition: PFMuonAlgo.h:63
bool cleanPunchThroughAndFakes(reco::PFCandidate &, reco::PFCandidateCollection *, unsigned int)
Definition: PFMuonAlgo.cc:1080
void setInputsForCleaning(reco::VertexCollection const &)
Definition: PFMuonAlgo.cc:1078
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
reco::Muon::MuonTrackTypePair MuonTrackTypePair
Definition: PFMuonAlgo.h:14
const double punchThroughFactor_
Definition: PFMuonAlgo.h:152
std::unique_ptr< reco::PFCandidateCollection > pfCleanedTrackerAndGlobalMuonCandidates_
the collection of tracker/global cleaned muon candidates
Definition: PFMuonAlgo.h:113
const double maxDPtOPt_
Definition: PFMuonAlgo.h:132
const double metFactorCleaning_
Definition: PFMuonAlgo.h:144
static void printMuonProperties(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:422
std::vector< MuonTrackTypePair > tracksPointingAtMET(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:1058
bool hasValidTrack(const reco::MuonRef &muonRef, bool loose=false)
Definition: PFMuonAlgo.cc:412
static bool isGlobalTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:98
TrackMETComparator(double METX, double METY)
Definition: PFMuonAlgo.h:166
MuonTrackTypePair getTrackWithSmallestError(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:731
const int minTrackerHits_
Definition: PFMuonAlgo.h:133
const double metFactorHighEta_
Definition: PFMuonAlgo.h:147
const double cosmicRejDistance_
Definition: PFMuonAlgo.h:154
const double minPostCleaningPt_
Definition: PFMuonAlgo.h:140
std::vector< reco::Muon::MuonTrackTypePair > goodMuonTracks(const reco::MuonRef &muon, bool includeSA=false)
Definition: PFMuonAlgo.cc:559
const double dzPV_
Definition: PFMuonAlgo.h:138
void estimateEventQuantities(const reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:740
const double ptFactorHighEta_
Definition: PFMuonAlgo.h:148
void changeTrack(reco::PFCandidate &, const MuonTrackTypePair &)
Definition: PFMuonAlgo.cc:702
const double eventFractionCleaning_
Definition: PFMuonAlgo.h:137
std::unique_ptr< reco::PFCandidateCollection > pfAddedMuonCandidates_
the collection of added muon candidates
Definition: PFMuonAlgo.h:121
bool operator()(const MuonTrackTypePair &mu1, const MuonTrackTypePair &mu2)
Definition: PFMuonAlgo.h:204
IndexPtComparator(const reco::PFCandidateCollection *coll)
Definition: PFMuonAlgo.h:183
const double metFactorFake_
Definition: PFMuonAlgo.h:149
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
JetCorrectorParametersCollection coll
Definition: classes.h:10
std::vector< unsigned int > maskedIndices_
Definition: PFMuonAlgo.h:123
static bool isLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:78
const int minPixelHits_
Definition: PFMuonAlgo.h:134
double METX_
Definition: PFMuonAlgo.h:158
const double eventFactorCosmics_
Definition: PFMuonAlgo.h:141
std::pair< double, double > getMinMaxMET2(const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:951
std::unique_ptr< reco::PFCandidateCollection > transferCleanedCosmicCandidates()
Definition: PFMuonAlgo.h:59
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
std::unique_ptr< reco::PFCandidateCollection > transferCleanedFakeCandidates()
Definition: PFMuonAlgo.h:67
reco::Muon::MuonTrackType MuonTrackType
Definition: PFMuonAlgo.h:15
double sumetPU_
Definition: PFMuonAlgo.h:156
const reco::PFCandidateCollection * coll_
Definition: PFMuonAlgo.h:192
const reco::VertexCollection * vertices_
Definition: PFMuonAlgo.h:127
MuonTrackType
map for Global Muon refitters
Definition: Muon.h:38
const double punchThroughMETFactor_
Definition: PFMuonAlgo.h:153
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:40
std::unique_ptr< reco::PFCandidateCollection > pfCosmicsMuonCleanedCandidates_
the collection of cosmics cleaned muon candidates
Definition: PFMuonAlgo.h:111
std::vector< MuonTrackTypePair > tracksWithBetterMET(const std::vector< MuonTrackTypePair > &, const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:1030
void postClean(reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:759
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedHadronCandidates()
Definition: PFMuonAlgo.h:75
bool operator()(const MuonTrackTypePair &mu1, const MuonTrackTypePair &mu2)
Definition: PFMuonAlgo.h:169
std::vector< reco::Muon::MuonTrackTypePair > muonTracks(const reco::MuonRef &muon, bool includeSA=false, double dpt=1e+9)
Definition: PFMuonAlgo.cc:565
const double eventFractionRejection_
Definition: PFMuonAlgo.h:145
const double errorCompScale_
Definition: PFMuonAlgo.h:136
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
def move(src, dest)
Definition: eostools.py:511
const double metSigForCleaning_
Definition: PFMuonAlgo.h:142
static bool isTrackerTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:124
const reco::TrackBase::TrackQuality trackQuality_
Definition: PFMuonAlgo.h:135
const double metSigForRejection_
Definition: PFMuonAlgo.h:143
std::unique_ptr< reco::PFCandidateCollection > pfPunchThroughHadronCleanedCandidates_
the collection of punch-through cleaned neutral hadron candidates
Definition: PFMuonAlgo.h:119
bool reconstructMuon(reco::PFCandidate &, const reco::MuonRef &, bool allowLoose=false)
Definition: PFMuonAlgo.cc:627
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedMuonCandidates()
Definition: PFMuonAlgo.h:71
double METY_
Definition: PFMuonAlgo.h:159