test
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 isMuon( const reco::MuonRef& muonRef );
46 
47  static bool isLooseMuon( const reco::MuonRef& muonRef );
48 
49  static bool isGlobalTightMuon( const reco::MuonRef& muonRef );
50 
51  static bool isGlobalLooseMuon( const reco::MuonRef& muonRef );
52 
53 
54 
55 
56  static bool isTrackerTightMuon( const reco::MuonRef& muonRef );
57 
58  static bool isTrackerLooseMuon( const reco::MuonRef& muonRef );
59 
60  static bool isIsolatedMuon( const reco::MuonRef& muonRef );
61 
62  static bool isTightMuonPOG(const reco::MuonRef& muonRef);
63 
64  static void printMuonProperties( const reco::MuonRef& muonRef );
65 
66 
67 
68 
70  bool hasValidTrack(const reco::MuonRef& muonRef,bool loose =false);
71 
72 
73 
74 
75  //Make a PF Muon : Basic method
76  bool reconstructMuon(reco::PFCandidate&, const reco::MuonRef&,bool allowLoose = false);
77 
78 
79  //Assign a different track to the muon
81  //PF Post cleaning algorithm
85 
86  std::auto_ptr<reco::PFCandidateCollection>& transferCleanedCosmicCandidates() {
88  }
89 
90  std::auto_ptr<reco::PFCandidateCollection>& transferCleanedTrackerAndGlobalCandidates() {
92  }
93 
94  std::auto_ptr<reco::PFCandidateCollection>& transferCleanedFakeCandidates() {
96  }
97 
98  std::auto_ptr<reco::PFCandidateCollection>& transferPunchThroughCleanedMuonCandidates() {
100  }
101 
102  std::auto_ptr<reco::PFCandidateCollection>& transferPunchThroughCleanedHadronCandidates() {
104  }
105 
106  std::auto_ptr<reco::PFCandidateCollection>& transferAddedMuonCandidates() {
107  return pfAddedMuonCandidates_;
108  }
109 
110  private:
111  //Gives the track with the smallest Dpt/Pt
112  MuonTrackTypePair getTrackWithSmallestError(const std::vector<MuonTrackTypePair>&);
113 
114  std::vector<reco::Muon::MuonTrackTypePair> muonTracks(const reco::MuonRef& muon,bool includeSA = false,double dpt = 1e+9);
115 
116  //Gets the good tracks
117  std::vector<reco::Muon::MuonTrackTypePair> goodMuonTracks(const reco::MuonRef& muon,bool includeSA = false);
118 
119 
120  //Estimate MET and SUmET for post cleaning
122 
123  //Post cleaning Sub-methods
124  bool cleanMismeasured(reco::PFCandidate&,unsigned int);
126 
127  void removeDeadCandidates(reco::PFCandidateCollection*, const std::vector<unsigned int>&);
128 
129 
130 
131  //helpers
132  std::pair<double,double> getMinMaxMET2(const reco::PFCandidate&);
133  std::vector<MuonTrackTypePair> tracksWithBetterMET(const std::vector<MuonTrackTypePair>& ,const reco::PFCandidate&);
134  std::vector<MuonTrackTypePair> tracksPointingAtMET(const std::vector<MuonTrackTypePair>&);
135 
136  //Output collections for post cleaning
138  std::auto_ptr< reco::PFCandidateCollection > pfCosmicsMuonCleanedCandidates_;
140  std::auto_ptr< reco::PFCandidateCollection > pfCleanedTrackerAndGlobalMuonCandidates_;
142  std::auto_ptr< reco::PFCandidateCollection > pfFakeMuonCleanedCandidates_;
144  std::auto_ptr< reco::PFCandidateCollection > pfPunchThroughMuonCleanedCandidates_;
146  std::auto_ptr< reco::PFCandidateCollection > pfPunchThroughHadronCleanedCandidates_;
148  std::auto_ptr< reco::PFCandidateCollection > pfAddedMuonCandidates_;
149 
150  std::vector<unsigned int > maskedIndices_;
151 
152 
155 
156 
157 
158  //Configurables
159  double maxDPtOPt_;
163 
166  double sumetPU_;
167  double dzPV_;
184 
185  double sumet_;
186  double METX_;
187  double METY_;
188 
189 
191 
193  public:
194  TrackMETComparator(double METX,double METY) {metx_ = METX; mety_=METY;}
196 
197  bool operator()(const MuonTrackTypePair& mu1,const MuonTrackTypePair& mu2) {
198  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);
199  }
200  private:
201  double metx_;
202  double mety_;
203 
204 
205  };
206 
207 
209  public:
210 
212  }
214 
215  bool operator()(int mu1,int mu2) {
216  return coll_->at(mu1).pt() > coll_->at(mu2).pt();
217  }
218 
219  private:
221 
222  };
223 
224 
225 
226 
228  public:
231 
232  bool operator()(const MuonTrackTypePair& mu1,const MuonTrackTypePair& mu2) {
233  return mu1.first->ptError()/mu1.first->pt() < mu2.first->ptError()/mu2.first->pt();
234  }
235  };
236 
237 
238 
239 };
240 
241 #endif
Abstract base class for a PFBlock element (track, cluster...)
static bool isIsolatedMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:227
double punchThroughMETFactor_
Definition: PFMuonAlgo.h:182
bool cleanMismeasured(reco::PFCandidate &, unsigned int)
Definition: PFMuonAlgo.cc:1061
std::auto_ptr< reco::PFCandidateCollection > pfPunchThroughMuonCleanedCandidates_
the collection of punch-through cleaned muon candidates
Definition: PFMuonAlgo.h:144
static bool isTightMuonPOG(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:479
double metFactorHighEta_
Definition: PFMuonAlgo.h:176
double maxDPtOPt_
Definition: PFMuonAlgo.h:159
double sumet_
Definition: PFMuonAlgo.h:185
void removeDeadCandidates(reco::PFCandidateCollection *, const std::vector< unsigned int > &)
Definition: PFMuonAlgo.cc:1265
double minPunchThroughMomentum_
Definition: PFMuonAlgo.h:179
double minPunchThroughEnergy_
Definition: PFMuonAlgo.h:180
void addMissingMuons(edm::Handle< reco::MuonCollection >, reco::PFCandidateCollection *cands)
Definition: PFMuonAlgo.cc:953
bool operator()(int mu1, int mu2)
Definition: PFMuonAlgo.h:215
static bool isMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:155
double eventFactorCosmics_
Definition: PFMuonAlgo.h:170
double metFactorFake_
Definition: PFMuonAlgo.h:178
static bool isTrackerLooseMuon(const reco::PFBlockElement &elt)
TrackQuality
track quality
Definition: TrackBase.h:151
std::auto_ptr< reco::PFCandidateCollection > & transferPunchThroughCleanedMuonCandidates()
Definition: PFMuonAlgo.h:98
std::auto_ptr< reco::PFCandidateCollection > & transferAddedMuonCandidates()
Definition: PFMuonAlgo.h:106
void setParameters(const edm::ParameterSet &)
Definition: PFMuonAlgo.cc:29
double eventFractionCleaning_
Definition: PFMuonAlgo.h:165
static bool isGlobalLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:201
bool cleanPunchThroughAndFakes(reco::PFCandidate &, reco::PFCandidateCollection *, unsigned int)
Definition: PFMuonAlgo.cc:1172
double metSigForCleaning_
Definition: PFMuonAlgo.h:171
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:174
static void printMuonProperties(const reco::MuonRef &muonRef)
Definition: PFMuonAlgo.cc:512
double metSigForRejection_
Definition: PFMuonAlgo.h:172
double minPostCleaningPt_
Definition: PFMuonAlgo.h:169
std::vector< MuonTrackTypePair > tracksPointingAtMET(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:1148
std::auto_ptr< reco::PFCandidateCollection > pfFakeMuonCleanedCandidates_
the collection of fake cleaned muon candidates
Definition: PFMuonAlgo.h:142
bool hasValidTrack(const reco::MuonRef &muonRef, bool loose=false)
Definition: PFMuonAlgo.cc:502
static bool isGlobalTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:188
std::auto_ptr< reco::PFCandidateCollection > pfAddedMuonCandidates_
the collection of added muon candidates
Definition: PFMuonAlgo.h:148
TrackMETComparator(double METX, double METY)
Definition: PFMuonAlgo.h:194
MuonTrackTypePair getTrackWithSmallestError(const std::vector< MuonTrackTypePair > &)
Definition: PFMuonAlgo.cc:821
std::auto_ptr< reco::PFCandidateCollection > & transferPunchThroughCleanedHadronCandidates()
Definition: PFMuonAlgo.h:102
std::auto_ptr< reco::PFCandidateCollection > pfCosmicsMuonCleanedCandidates_
the collection of cosmics cleaned muon candidates
Definition: PFMuonAlgo.h:138
virtual ~PFMuonAlgo()
destructor
Definition: PFMuonAlgo.h:27
std::auto_ptr< reco::PFCandidateCollection > pfCleanedTrackerAndGlobalMuonCandidates_
the collection of tracker/global cleaned muon candidates
Definition: PFMuonAlgo.h:140
double cosmicRejDistance_
Definition: PFMuonAlgo.h:183
std::auto_ptr< reco::PFCandidateCollection > & transferCleanedTrackerAndGlobalCandidates()
Definition: PFMuonAlgo.h:90
std::vector< reco::Muon::MuonTrackTypePair > goodMuonTracks(const reco::MuonRef &muon, bool includeSA=false)
Definition: PFMuonAlgo.cc:649
std::auto_ptr< reco::PFCandidateCollection > pfPunchThroughHadronCleanedCandidates_
the collection of punch-through cleaned neutral hadron candidates
Definition: PFMuonAlgo.h:146
double dzPV_
Definition: PFMuonAlgo.h:167
void estimateEventQuantities(const reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:830
void changeTrack(reco::PFCandidate &, const MuonTrackTypePair &)
Definition: PFMuonAlgo.cc:792
double punchThroughFactor_
Definition: PFMuonAlgo.h:181
std::auto_ptr< reco::PFCandidateCollection > & transferCleanedCosmicCandidates()
Definition: PFMuonAlgo.h:86
double ptFactorHighEta_
Definition: PFMuonAlgo.h:177
bool operator()(const MuonTrackTypePair &mu1, const MuonTrackTypePair &mu2)
Definition: PFMuonAlgo.h:232
IndexPtComparator(const reco::PFCandidateCollection *coll)
Definition: PFMuonAlgo.h:211
double metFactorCleaning_
Definition: PFMuonAlgo.h:173
double metFactorRejection_
Definition: PFMuonAlgo.h:175
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
JetCorrectorParametersCollection coll
Definition: classes.h:10
std::vector< unsigned int > maskedIndices_
Definition: PFMuonAlgo.h:150
reco::TrackBase::TrackQuality trackQuality_
Definition: PFMuonAlgo.h:162
std::auto_ptr< reco::PFCandidateCollection > & transferCleanedFakeCandidates()
Definition: PFMuonAlgo.h:94
static bool isLooseMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:168
double METX_
Definition: PFMuonAlgo.h:186
std::pair< double, double > getMinMaxMET2(const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:1041
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
reco::Muon::MuonTrackType MuonTrackType
Definition: PFMuonAlgo.h:15
double sumetPU_
Definition: PFMuonAlgo.h:166
const reco::PFCandidateCollection * coll_
Definition: PFMuonAlgo.h:220
double errorCompScale_
Definition: PFMuonAlgo.h:164
int minPixelHits_
Definition: PFMuonAlgo.h:161
const reco::VertexCollection * vertices_
Definition: PFMuonAlgo.h:154
PFMuonAlgo()
constructor
Definition: PFMuonAlgo.cc:17
MuonTrackType
map for Global Muon refitters
Definition: Muon.h:38
int minTrackerHits_
Definition: PFMuonAlgo.h:160
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:40
std::vector< MuonTrackTypePair > tracksWithBetterMET(const std::vector< MuonTrackTypePair > &, const reco::PFCandidate &)
Definition: PFMuonAlgo.cc:1120
void postClean(reco::PFCandidateCollection *)
Definition: PFMuonAlgo.cc:849
bool operator()(const MuonTrackTypePair &mu1, const MuonTrackTypePair &mu2)
Definition: PFMuonAlgo.h:197
void setInputsForCleaning(const reco::VertexCollection *)
Definition: PFMuonAlgo.cc:1168
std::vector< reco::Muon::MuonTrackTypePair > muonTracks(const reco::MuonRef &muon, bool includeSA=false, double dpt=1e+9)
Definition: PFMuonAlgo.cc:655
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
bool postCleaning_
Definition: PFMuonAlgo.h:168
static bool isTrackerTightMuon(const reco::PFBlockElement &elt)
Definition: PFMuonAlgo.cc:214
bool reconstructMuon(reco::PFCandidate &, const reco::MuonRef &, bool allowLoose=false)
Definition: PFMuonAlgo.cc:717
double METY_
Definition: PFMuonAlgo.h:187