CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
20  PFMuonAlgo();
21 
22  void setParameters(const edm::ParameterSet&);
23 
24 
25 
27  virtual ~PFMuonAlgo() {;}
28 
30 
31  static bool isMuon( const reco::PFBlockElement& elt );
32 
33  static bool isLooseMuon( const reco::PFBlockElement& elt );
34 
35  static bool isGlobalTightMuon( const reco::PFBlockElement& elt );
36 
37  static bool isGlobalLooseMuon( const reco::PFBlockElement& elt );
38 
39  static bool isTrackerTightMuon( const reco::PFBlockElement& elt );
40 
41  static bool isTrackerLooseMuon( const reco::PFBlockElement& elt );
42 
43  static bool isIsolatedMuon( const reco::PFBlockElement& elt );
44 
45  static bool hasValidTracks(const reco::MuonRef& );
46 
47  static bool isMuon( const reco::MuonRef& muonRef );
48 
49  static bool isLooseMuon( const reco::MuonRef& muonRef );
50 
51  static bool isGlobalTightMuon( const reco::MuonRef& muonRef );
52 
53  static bool isGlobalLooseMuon( const reco::MuonRef& muonRef );
54 
55  static bool isTrackerTightMuon( const reco::MuonRef& muonRef );
56 
57  static bool isTrackerLooseMuon( const reco::MuonRef& muonRef );
58 
59  static bool isIsolatedMuon( const reco::MuonRef& muonRef );
60 
61  static bool isTightMuonPOG(const reco::MuonRef& muonRef);
62 
63  static void printMuonProperties( const reco::MuonRef& muonRef );
64 
65 
66 
67 
69 
70  //Make a PF Muon : Basic method
71  bool reconstructMuon(reco::PFCandidate&, const reco::MuonRef&,bool allowLoose = false);
72 
73 
74  //Assign a different track to the muon
76  //PF Post cleaning algorithm
80 
81  std::auto_ptr<reco::PFCandidateCollection>& transferCleanedCosmicCandidates() {
83  }
84 
85  std::auto_ptr<reco::PFCandidateCollection>& transferCleanedTrackerAndGlobalCandidates() {
87  }
88 
89  std::auto_ptr<reco::PFCandidateCollection>& transferCleanedFakeCandidates() {
91  }
92 
93  std::auto_ptr<reco::PFCandidateCollection>& transferPunchThroughCleanedMuonCandidates() {
95  }
96 
97  std::auto_ptr<reco::PFCandidateCollection>& transferPunchThroughCleanedHadronCandidates() {
99  }
100 
101  std::auto_ptr<reco::PFCandidateCollection>& transferAddedMuonCandidates() {
102  return pfAddedMuonCandidates_;
103  }
104 
105  private:
106  //Gives the track with the smallest Dpt/Pt
107  MuonTrackTypePair getTrackWithSmallestError(const std::vector<MuonTrackTypePair>&);
108 
109  std::vector<reco::Muon::MuonTrackTypePair> muonTracks(const reco::MuonRef& muon,bool includeSA = false,double dpt = 1e+9);
110 
111  //Gets the good tracks
112  std::vector<reco::Muon::MuonTrackTypePair> goodMuonTracks(const reco::MuonRef& muon,bool includeSA = false);
113 
114 
115  //Estimate MET and SUmET for post cleaning
117 
118  //Post cleaning Sub-methods
119  bool cleanMismeasured(reco::PFCandidate&,unsigned int);
121 
122  void removeDeadCandidates(reco::PFCandidateCollection*, const std::vector<unsigned int>&);
123 
124 
125 
126  //helpers
127  std::pair<double,double> getMinMaxMET2(const reco::PFCandidate&);
128  std::vector<MuonTrackTypePair> tracksWithBetterMET(const std::vector<MuonTrackTypePair>& ,const reco::PFCandidate&);
129  std::vector<MuonTrackTypePair> tracksPointingAtMET(const std::vector<MuonTrackTypePair>&);
130 
131  //Output collections for post cleaning
133  std::auto_ptr< reco::PFCandidateCollection > pfCosmicsMuonCleanedCandidates_;
135  std::auto_ptr< reco::PFCandidateCollection > pfCleanedTrackerAndGlobalMuonCandidates_;
137  std::auto_ptr< reco::PFCandidateCollection > pfFakeMuonCleanedCandidates_;
139  std::auto_ptr< reco::PFCandidateCollection > pfPunchThroughMuonCleanedCandidates_;
141  std::auto_ptr< reco::PFCandidateCollection > pfPunchThroughHadronCleanedCandidates_;
143  std::auto_ptr< reco::PFCandidateCollection > pfAddedMuonCandidates_;
144 
145  std::vector<unsigned int > maskedIndices_;
146 
147 
150 
151 
152 
153  //Configurables
154  double maxDPtOPt_;
158 
161  double sumetPU_;
162  double dzPV_;
179 
180  double sumet_;
181  double METX_;
182  double METY_;
183 
184 
186 
188  public:
189  TrackMETComparator(double METX,double METY) {metx_ = METX; mety_=METY;}
191 
192  bool operator()(const MuonTrackTypePair& mu1,const MuonTrackTypePair& mu2) {
193  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);
194  }
195  private:
196  double metx_;
197  double mety_;
198 
199 
200  };
201 
202 
204  public:
205 
207  }
209 
210  bool operator()(int mu1,int mu2) {
211  return coll_->at(mu1).pt() > coll_->at(mu2).pt();
212  }
213 
214  private:
216 
217  };
218 
219 
220 
221 
223  public:
226 
227  bool operator()(const MuonTrackTypePair& mu1,const MuonTrackTypePair& mu2) {
228  return mu1.first->ptError()/mu1.first->pt() < mu2.first->ptError()/mu2.first->pt();
229  }
230  };
231 
232 
233 
234 };
235 
236 #endif
Abstract base class for a PFBlock element (track, cluster...)
static bool isIsolatedMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:224
double punchThroughMETFactor_
Definition: PFMuonAlgo.h:177
bool cleanMismeasured(reco::PFCandidate &, unsigned int)
Definition: PFMuonAlgo.cc:1046
std::auto_ptr< reco::PFCandidateCollection > pfPunchThroughMuonCleanedCandidates_
the collection of punch-through cleaned muon candidates
Definition: PFMuonAlgo.h:139
static bool isTightMuonPOG(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:474
double metFactorHighEta_
Definition: PFMuonAlgo.h:171
double maxDPtOPt_
Definition: PFMuonAlgo.h:154
double sumet_
Definition: PFMuonAlgo.h:180
void removeDeadCandidates(reco::PFCandidateCollection *, const std::vector< unsigned int > &)
Definition: PFMuonAlgo.cc:1250
double minPunchThroughMomentum_
Definition: PFMuonAlgo.h:174
double minPunchThroughEnergy_
Definition: PFMuonAlgo.h:175
void addMissingMuons(edm::Handle< reco::MuonCollection >, reco::PFCandidateCollection *cands)
Definition: PFMuonAlgo.cc:938
static bool hasValidTracks(const reco::MuonRef &)
bool operator()(int mu1, int mu2)
Definition: PFMuonAlgo.h:210
static bool isMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:153
double eventFactorCosmics_
Definition: PFMuonAlgo.h:165
double metFactorFake_
Definition: PFMuonAlgo.h:173
static bool isTrackerLooseMuon(const reco::PFBlockElement &elt)
TrackQuality
track quality
Definition: TrackBase.h:133
std::auto_ptr< reco::PFCandidateCollection > & transferPunchThroughCleanedMuonCandidates()
Definition: PFMuonAlgo.h:93
std::auto_ptr< reco::PFCandidateCollection > & transferAddedMuonCandidates()
Definition: PFMuonAlgo.h:101
void setParameters(const edm::ParameterSet &)
Definition: PFMuonAlgo.cc:29
double eventFractionCleaning_
Definition: PFMuonAlgo.h:160
static bool isGlobalLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:198
bool cleanPunchThroughAndFakes(reco::PFCandidate &, reco::PFCandidateCollection *, unsigned int)
Definition: PFMuonAlgo.cc:1157
double metSigForCleaning_
Definition: PFMuonAlgo.h:166
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
reco::Muon::MuonTrackTypePair MuonTrackTypePair
Definition: PFMuonAlgo.h:14
double eventFractionRejection_
Definition: PFMuonAlgo.h:169
static void printMuonProperties(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:496
double metSigForRejection_
Definition: PFMuonAlgo.h:167
double minPostCleaningPt_
Definition: PFMuonAlgo.h:164
std::vector< MuonTrackTypePair > tracksPointingAtMET(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:1133
std::auto_ptr< reco::PFCandidateCollection > pfFakeMuonCleanedCandidates_
the collection of fake cleaned muon candidates
Definition: PFMuonAlgo.h:137
static bool isGlobalTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:185
std::auto_ptr< reco::PFCandidateCollection > pfAddedMuonCandidates_
the collection of added muon candidates
Definition: PFMuonAlgo.h:143
TrackMETComparator(double METX, double METY)
Definition: PFMuonAlgo.h:189
MuonTrackTypePair getTrackWithSmallestError(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:799
std::auto_ptr< reco::PFCandidateCollection > & transferPunchThroughCleanedHadronCandidates()
Definition: PFMuonAlgo.h:97
std::auto_ptr< reco::PFCandidateCollection > pfCosmicsMuonCleanedCandidates_
the collection of cosmics cleaned muon candidates
Definition: PFMuonAlgo.h:133
virtual ~PFMuonAlgo()
destructor
Definition: PFMuonAlgo.h:27
std::auto_ptr< reco::PFCandidateCollection > pfCleanedTrackerAndGlobalMuonCandidates_
the collection of tracker/global cleaned muon candidates
Definition: PFMuonAlgo.h:135
double cosmicRejDistance_
Definition: PFMuonAlgo.h:178
std::auto_ptr< reco::PFCandidateCollection > & transferCleanedTrackerAndGlobalCandidates()
Definition: PFMuonAlgo.h:85
std::vector< reco::Muon::MuonTrackTypePair > goodMuonTracks(const reco::MuonRef &muon, bool includeSA=false)
Definition: PFMuonAlgo.cc:633
std::auto_ptr< reco::PFCandidateCollection > pfPunchThroughHadronCleanedCandidates_
the collection of punch-through cleaned neutral hadron candidates
Definition: PFMuonAlgo.h:141
double dzPV_
Definition: PFMuonAlgo.h:162
void estimateEventQuantities(const reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:808
void changeTrack(reco::PFCandidate &, const MuonTrackTypePair &)
Definition: PFMuonAlgo.cc:770
double punchThroughFactor_
Definition: PFMuonAlgo.h:176
std::auto_ptr< reco::PFCandidateCollection > & transferCleanedCosmicCandidates()
Definition: PFMuonAlgo.h:81
double ptFactorHighEta_
Definition: PFMuonAlgo.h:172
bool operator()(const MuonTrackTypePair &mu1, const MuonTrackTypePair &mu2)
Definition: PFMuonAlgo.h:227
IndexPtComparator(const reco::PFCandidateCollection *coll)
Definition: PFMuonAlgo.h:206
double metFactorCleaning_
Definition: PFMuonAlgo.h:168
double metFactorRejection_
Definition: PFMuonAlgo.h:170
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
JetCorrectorParametersCollection coll
Definition: classes.h:10
std::vector< unsigned int > maskedIndices_
Definition: PFMuonAlgo.h:145
reco::TrackBase::TrackQuality trackQuality_
Definition: PFMuonAlgo.h:157
std::auto_ptr< reco::PFCandidateCollection > & transferCleanedFakeCandidates()
Definition: PFMuonAlgo.h:89
static bool isLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:166
double METX_
Definition: PFMuonAlgo.h:181
std::pair< double, double > getMinMaxMET2(const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:1026
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
reco::Muon::MuonTrackType MuonTrackType
Definition: PFMuonAlgo.h:15
double sumetPU_
Definition: PFMuonAlgo.h:161
const reco::PFCandidateCollection * coll_
Definition: PFMuonAlgo.h:215
double errorCompScale_
Definition: PFMuonAlgo.h:159
int minPixelHits_
Definition: PFMuonAlgo.h:156
const reco::VertexCollection * vertices_
Definition: PFMuonAlgo.h:149
PFMuonAlgo()
constructor
Definition: PFMuonAlgo.cc:17
MuonTrackType
map for Global Muon refitters
Definition: Muon.h:38
int minTrackerHits_
Definition: PFMuonAlgo.h:155
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:40
std::vector< MuonTrackTypePair > tracksWithBetterMET(const std::vector< MuonTrackTypePair > &, const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:1105
void postClean(reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:827
bool operator()(const MuonTrackTypePair &mu1, const MuonTrackTypePair &mu2)
Definition: PFMuonAlgo.h:192
void setInputsForCleaning(const reco::VertexCollection *)
Definition: PFMuonAlgo.cc:1153
std::vector< reco::Muon::MuonTrackTypePair > muonTracks(const reco::MuonRef &muon, bool includeSA=false, double dpt=1e+9)
Definition: PFMuonAlgo.cc:639
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
bool postCleaning_
Definition: PFMuonAlgo.h:163
static bool isTrackerTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:211
bool reconstructMuon(reco::PFCandidate &, const reco::MuonRef &, bool allowLoose=false)
Definition: PFMuonAlgo.cc:701
double METY_
Definition: PFMuonAlgo.h:182