CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Muon.h
Go to the documentation of this file.
1 //
2 // $Id: Muon.h,v 1.39.2.1 2012/12/13 09:56:16 bellan Exp $
3 //
4 
5 #ifndef DataFormats_PatCandidates_Muon_h
6 #define DataFormats_PatCandidates_Muon_h
7 
27 
32 
33 
34 // Define typedefs for convenience
35 namespace pat {
36  class Muon;
37  typedef std::vector<Muon> MuonCollection;
40 }
41 
42 namespace reco {
44  std::ostream& operator<<(std::ostream& out, const pat::Muon& obj);
45 }
46 
47 // Class definition
48 namespace pat {
49 
50 
51  class Muon : public Lepton<reco::Muon> {
52 
53  public:
54 
56  Muon();
58  Muon(const reco::Muon & aMuon);
60  Muon(const edm::RefToBase<reco::Muon> & aMuonRef);
62  Muon(const edm::Ptr<reco::Muon> & aMuonRef);
64  virtual ~Muon();
65 
67  virtual Muon * clone() const { return new Muon(*this); }
68 
69  // ---- methods for content embedding ----
71  reco::TrackRef track() const;
72  using reco::RecoCandidate::track; // avoid hiding the base implementation
74  reco::TrackRef innerTrack() const { return track(); }
82  reco::TrackRef globalTrack() const { return combinedMuon(); }
87 
88  // get reference to the Improved Best Track
90  // set reference to the Improved Best Track
91  virtual void setImprovedBestTrack(MuonTrackType muonType) {improvedMuonBestTrackType_ = muonType;}
92 
94  void embedMuonBestTrack();
98  void embedTrack();
100  void embedStandAloneMuon();
102  void embedCombinedMuon();
103 
104  // ---- methods for MuonMETCorrectionData ----
111 
112  // ---- methods for TeV refit tracks ----
113 
115  reco::TrackRef pickyTrack() const;
117  reco::TrackRef tpfmsTrack() const;
119  reco::TrackRef dytTrack() const;
121  reco::TrackRef pickyMuon() const { return pickyTrack(); } // JMTBAD gcc deprecated attribute?
122  reco::TrackRef tpfmsMuon() const { return tpfmsTrack(); } // JMTBAD gcc deprecated attribute?
124  void embedPickyMuon();
126  void embedTpfmsMuon();
128  void embedDytMuon();
129 
130  // ---- PF specific methods ----
136  pfCandidateRef_ = ref;
137  }
139  void embedPFCandidate();
142  return pfCandidateRef_.isNonnull() ? 1 : 0;
143  }
146 
147  // ---- methods for accessing muon identification ----
151  bool muonID (const std::string& name) const;
154  bool isGood (const std::string& name) const { return muonID(name); }
157  //bool isMuonIDAvailable(const std::string& name) const;
158 
161  bool isTightMuon(const reco::Vertex&) const;
162  bool isLooseMuon() const;
163  bool isSoftMuon(const reco::Vertex&) const;
164 
169  bool isHighPtMuon(const reco::Vertex&, reco::TunePType) const;
170 
171  // ---- overload of isolation functions ----
174  float trackIso() const { return isolationR03().sumPt; }
178  float ecalIso() const { return isolationR03().emEt; }
182  float hcalIso() const { return isolationR03().hadEt; }
185  float caloIso() const { return ecalIso()+hcalIso(); }
186 
192  // as external input.
193 
194  // ---- embed various impact parameters with errors ----
195  //
196  // example:
197  //
198  // // this will return the muon inner track
199  // // transverse impact parameter
200  // // relative to the primary vertex
201  // muon->dB(pat::Muon::PV2D);
202  //
203  // // this will return the uncertainty
204  // // on the muon inner track
205  // // transverse impact parameter
206  // // relative to the primary vertex
207  // // or -1.0 if there is no valid PV in the event
208  // muon->edB(pat::Muon::PV2D);
209  //
210  // IpType defines the type of the impact parameter
211  // None is default and reverts to old behavior controlled by
212  // patMuons.usePV = True/False
213  typedef enum IPTYPE
214  {
215  None = 0, PV2D = 1, PV3D = 2, BS2D = 3, BS3D = 4
216  } IpType;
217  void initImpactParameters(void); // init IP defaults in a constructor
218  double dB(IpType type = None) const;
219  double edB(IpType type = None) const;
220  void setDB ( double dB, double edB, IpType type = None ) {
221  if (type == None) {
222  dB_ = dB; edB_ = edB;
223  cachedDB_ = true;
224  }
225  ip_[type] = dB; eip_[type] = edB; cachedIP_[type] = true;
226  }
227 
229  unsigned int numberOfValidHits() const;
232 
234  double normChi2() const;
235  void setNormChi2 (double normChi2 )
236  { normChi2_ = normChi2; cachedNormChi2_ = true; }
237 
240 
242  friend std::ostream& reco::operator<<(std::ostream& out, const pat::Muon& obj);
243 
244  protected:
245 
246  // ---- for content embedding ----
247 
250  std::vector<reco::Track> muonBestTrack_;
253  std::vector<reco::Track> improvedMuonBestTrack_;
257  std::vector<reco::Track> track_;
260  std::vector<reco::Track> standAloneMuon_;
263  std::vector<reco::Track> combinedMuon_;
264 
267  std::vector<reco::MuonMETCorrectionData> tcMETMuonCorrs_;
270  std::vector<reco::MuonMETCorrectionData> caloMETMuonCorrs_;
271 
272  // Capability to embed TeV refit tracks as the inner/outer/combined ones.
276  std::vector<reco::Track> pickyMuon_;
277  std::vector<reco::Track> tpfmsMuon_;
278  std::vector<reco::Track> dytMuon_;
279 
280  // ---- PF specific members ----
289 
290  // V+Jets group selection variables.
292  bool cachedDB_;
293 
295  double normChi2_;
296  double dB_;
297  double edB_; // and its uncertainty as recommended by the tracking group
298 
299  // ---- cached impact parameters ----
300  std::vector<bool> cachedIP_; // has the IP (former dB) been cached?
301  std::vector<double> ip_; // dB and edB are the impact parameter at the primary vertex,
302  std::vector<double> eip_; // and its uncertainty as recommended by the tracking group
303 
304  unsigned int numberOfValidHits_;
305 
306  };
307 
308 
309 }
310 
311 #endif
type
Definition: HCALResponse.h:22
double normChi2() const
Norm chi2 gives the normalized chi2 of the global track.
Definition: Muon.cc:363
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
int i
Definition: DBlmapReader.cc:9
void embedStandAloneMuon()
set reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon) ...
Definition: Muon.cc:282
float ecalIso() const
Definition: Muon.h:178
reco::PFCandidateRef pfCandidateRef_
Definition: Muon.h:288
unsigned int numberOfValidHits() const
numberOfValidHits returns the number of valid hits on the global track.
Definition: Muon.cc:376
reco::TrackRef innerTrack() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.h:74
bool embeddedTCMETMuonCorrs_
muon MET corrections for tcMET
Definition: Muon.h:266
bool embeddedImprovedMuonBestTrack_
best muon track, after new tuneP
Definition: Muon.h:252
edm::RefVector< MuonCollection > MuonRefVector
Definition: Muon.h:39
MuonTrackType improvedMuonBestTrackType_
Definition: Muon.h:254
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
void embedPFCandidate()
embed the IsolatedPFCandidate pointed to by pfCandidateRef_
Definition: Muon.cc:345
size_t size_type
Definition: Candidate.h:31
reco::TrackRef tpfmsMuon() const
Definition: Muon.h:122
bool muonID(const std::string &name) const
Definition: Muon.cc:353
unsigned int numberOfValidHits_
Definition: Muon.h:304
size_t numberOfSourceCandidatePtrs() const
get the number of non-null PF candidates
Definition: Muon.h:141
bool embeddedTrack_
track of inner track detector
Definition: Muon.h:256
std::vector< reco::MuonMETCorrectionData > tcMETMuonCorrs_
Definition: Muon.h:267
bool cachedNumberOfValidHits_
has the dB been cached?
Definition: Muon.h:294
double segmentCompatibility(reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration) const
Returns the segment compatibility, using muon::segmentCompatibility (DataFormats/MuonReco/interface/M...
Definition: Muon.cc:435
bool embeddedStandAloneMuon_
track of muon system
Definition: Muon.h:259
edm::Ref< MuonCollection > MuonRef
Definition: Muon.h:38
bool isGood(const std::string &name) const
Definition: Muon.h:154
reco::TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon) ...
Definition: Muon.h:78
bool embeddedPickyMuon_
Definition: Muon.h:273
void setPFCandidateRef(const reco::PFCandidateRef &ref)
add a reference to the source IsolatedPFCandidate
Definition: Muon.h:135
std::vector< reco::Track > improvedMuonBestTrack_
Definition: Muon.h:253
reco::TrackRef improvedMuonBestTrack() const
reference to the Best Track reconstructed in both tracked and muon detector (reimplemented from reco:...
Definition: Muon.cc:221
float caloIso() const
Definition: Muon.h:185
Muon()
default constructor
Definition: Muon.cc:17
void embedPickyMuon()
embed reference to the above picky Track
Definition: Muon.cc:315
float trackIso() const
Definition: Muon.h:174
virtual reco::TrackRef track() const
reference to a Track
void embedCombinedMuon()
set reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon...
Definition: Muon.cc:292
float hcalIso() const
Definition: Muon.h:182
std::vector< reco::Track > pickyMuon_
Definition: Muon.h:276
void embedCaloMETMuonCorrs(const reco::MuonMETCorrectionData &t)
embed the MuonMETCorrectionData for muon corrected caloMET
Definition: Muon.cc:301
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
reco::CandidatePtr sourceCandidatePtr(size_type i) const
get the candidate pointer with index i
Definition: Muon.cc:241
bool embeddedTpfmsMuon_
Definition: Muon.h:274
bool cachedNormChi2_
Definition: Muon.h:291
reco::PFCandidateRef pfCandidateRef() const
reference to the source IsolatedPFCandidates
Definition: Muon.cc:232
std::vector< reco::MuonMETCorrectionData > caloMETMuonCorrs_
Definition: Muon.h:270
reco::PFCandidateCollection pfCandidate_
Definition: Muon.h:285
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:72
std::vector< reco::Track > dytMuon_
Definition: Muon.h:278
double normChi2_
has the numberOfValidHits been cached?
Definition: Muon.h:295
bool isLooseMuon() const
Definition: Muon.cc:446
enum pat::Muon::IPTYPE IpType
void embedTrack()
set reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.cc:272
ArbitrationType
define arbitration schemes
Definition: Muon.h:173
void embedTcMETMuonCorrs(const reco::MuonMETCorrectionData &t)
embed the MuonMETCorrectionData for tcMET
Definition: Muon.cc:308
Analysis-level lepton class.
Definition: Lepton.h:32
float emEt
ecal sum-Et
Definition: MuonIsolation.h:8
reco::MuonMETCorrectionData tcMETMuonCorrs() const
muon MET corrections for tcMET; returns the muon correction struct if embedded during pat tuple produ...
Definition: Muon.h:109
bool embeddedDytMuon_
Definition: Muon.h:275
std::vector< bool > cachedIP_
Definition: Muon.h:300
bool embeddedPFCandidate_
true if the IsolatedPFCandidate is embedded
Definition: Muon.h:282
double dB(IpType type=None) const
Definition: Muon.cc:389
reco::TrackRef tpfmsTrack() const
reference to Track reconstructed using hits in the tracker + info from the first muon station that ha...
Definition: Muon.cc:194
reco::TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
Definition: Muon.h:82
bool embeddedCaloMETMuonCorrs_
muon MET corrections for caloMET
Definition: Muon.h:269
bool isHighPtMuon(const reco::Vertex &, reco::TunePType) const
Definition: Muon.cc:456
reco::TrackRef combinedMuon() const
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
Definition: Muon.cc:176
tuple out
Definition: dbtoconf.py:99
reco::TrackRef standAloneMuon() const
reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon) ...
Definition: Muon.cc:166
bool isTightMuon(const reco::Vertex &) const
Definition: Muon.cc:442
void embedTpfmsMuon()
embed reference to the above tpfms Track
Definition: Muon.cc:325
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::vector< double > ip_
Definition: Muon.h:301
reco::TrackRef muonBestTrack() const
reference to the Best Track reconstructed in both tracked and muon detector (reimplemented from reco:...
Definition: Muon.cc:211
bool embeddedCombinedMuon_
track of combined fit
Definition: Muon.h:262
bool isSoftMuon(const reco::Vertex &) const
Definition: Muon.cc:451
IPTYPE
Definition: Muon.h:213
void embedDytMuon()
embed reference to the above dyt Track
Definition: Muon.cc:335
double edB(IpType type=None) const
Definition: Muon.cc:414
std::vector< double > eip_
Definition: Muon.h:302
void embedMuonBestTrack()
set reference to Track selected to be the best measurement of the muon parameters (reimplemented from...
Definition: Muon.cc:250
bool cachedDB_
has the normalized chi2 been cached?
Definition: Muon.h:292
void embedImprovedMuonBestTrack()
set reference to Track selected to be the best measurement of the muon parameters (reimplemented from...
Definition: Muon.cc:259
std::vector< reco::Track > muonBestTrack_
Definition: Muon.h:250
reco::TrackRef dytTrack() const
reference to Track reconstructed using DYT algorithm
Definition: Muon.cc:203
std::vector< Muon > MuonCollection
Definition: Muon.h:36
std::vector< reco::Track > track_
Definition: Muon.h:257
virtual MuonTrackType improvedMuonBestTrackType() const
Definition: Muon.h:89
std::vector< reco::Track > combinedMuon_
Definition: Muon.h:263
void setNormChi2(double normChi2)
Definition: Muon.h:235
std::vector< reco::Track > standAloneMuon_
Definition: Muon.h:260
virtual ~Muon()
destructor
Definition: Muon.cc:125
double edB_
dB and edB are the impact parameter at the primary vertex,
Definition: Muon.h:297
reco::TrackRef pickyTrack() const
reference to Track reconstructed using hits in the tracker + &quot;good&quot; muon hits (reimplemented from rec...
Definition: Muon.cc:185
unsigned int type() const
Definition: Muon.h:208
reco::TrackRef pickyMuon() const
Deprecated accessors to call the corresponding above two functions; no dytMuon since this naming is d...
Definition: Muon.h:121
MuonTrackType
map for Global Muon refitters
Definition: Muon.h:39
double dB_
globalTrack-&gt;chi2() / globalTrack-&gt;ndof()
Definition: Muon.h:296
virtual Muon * clone() const
required reimplementation of the Candidate&#39;s clone method
Definition: Muon.h:67
TunePType
Definition: MuonFwd.h:32
void setNumberOfValidHits(unsigned int numberOfValidHits)
Definition: Muon.h:230
Analysis-level muon class.
Definition: Muon.h:51
bool embeddedMuonBestTrack_
best muon track
Definition: Muon.h:249
void setDB(double dB, double edB, IpType type=None)
Definition: Muon.h:220
reco::TrackRef track() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.cc:156
const MuonIsolation & isolationR03() const
Definition: Muon.h:159
std::vector< reco::Track > tpfmsMuon_
Definition: Muon.h:277
virtual void setImprovedBestTrack(MuonTrackType muonType)
Definition: Muon.h:91
void initImpactParameters(void)
Definition: Muon.cc:146
reco::MuonMETCorrectionData caloMETMuonCorrs() const
muon MET corrections for caloMET; returns the muon correction struct if embedded during pat tuple pro...
Definition: Muon.h:106