ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/Fix/interface/Muon.h
Revision: 1.1
Committed: Fri Sep 10 00:19:24 2010 UTC (14 years, 7 months ago) by kukartse
Content type: text/plain
Branch: MAIN
CVS Tags: V00-00-01
Log Message:
variety of pat::Muon IPs added

File Contents

# User Rev Content
1 kukartse 1.1 //
2     // $Id: Muon.h,v 1.32 2010/05/12 12:31:38 rwolf Exp $
3     //
4    
5     #ifndef DataFormats_PatCandidates_Muon_h
6     #define DataFormats_PatCandidates_Muon_h
7    
8     /**
9     \class pat::Muon Muon.h "DataFormats/PatCandidates/interface/Muon.h"
10     \brief Analysis-level muon class
11    
12     pat::Muon implements the analysis-level muon class within the 'pat'
13     namespace.
14    
15     Please post comments and questions to the Physics Tools hypernews:
16     https://hypernews.cern.ch/HyperNews/CMS/get/physTools.html
17    
18     \author Steven Lowette, Giovanni Petrucciani, Frederic Ronga, Colin Bernet
19    
20     \version $Id: Muon.h,v 1.32 2010/05/12 12:31:38 rwolf Exp $
21     */
22    
23     #include "DataFormats/MuonReco/interface/Muon.h"
24     #include "DataFormats/MuonReco/interface/MuonFwd.h"
25     #include "DataFormats/MuonReco/interface/MuonSelectors.h"
26     #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
27    
28     #include "DataFormats/TrackReco/interface/Track.h"
29     #include "DataFormats/PatCandidates/interface/Lepton.h"
30     #include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidateFwd.h"
31     #include "DataFormats/ParticleFlowCandidate/interface/IsolatedPFCandidate.h"
32    
33    
34     // Define typedefs for convenience
35     namespace pat {
36     class Muon;
37     typedef std::vector<Muon> MuonCollection;
38     typedef edm::Ref<MuonCollection> MuonRef;
39     typedef edm::RefVector<MuonCollection> MuonRefVector;
40     }
41    
42    
43     // Class definition
44     namespace pat {
45    
46    
47     class Muon : public Lepton<reco::Muon> {
48    
49     public:
50    
51     /// default constructor
52     Muon();
53     /// constructor from a reco muon
54     Muon(const reco::Muon & aMuon);
55     /// constructor from a RefToBase to a reco muon (to be superseded by Ptr counterpart)
56     Muon(const edm::RefToBase<reco::Muon> & aMuonRef);
57     /// constructor from a Ptr to a reco muon
58     Muon(const edm::Ptr<reco::Muon> & aMuonRef);
59     /// destructor
60     virtual ~Muon();
61    
62     /// required reimplementation of the Candidate's clone method
63     virtual Muon * clone() const { return new Muon(*this); }
64    
65     // ---- methods for content embedding ----
66     /// reference to Track reconstructed in the tracker only (reimplemented from reco::Muon)
67     reco::TrackRef track() const;
68     using reco::RecoCandidate::track; // avoid hiding the base implementation
69     /// reference to Track reconstructed in the tracker only (reimplemented from reco::Muon)
70     reco::TrackRef innerTrack() const { return track(); }
71     /// reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon)
72     reco::TrackRef standAloneMuon() const;
73     /// reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon)
74     reco::TrackRef outerTrack() const { return standAloneMuon(); }
75     /// reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon)
76     reco::TrackRef combinedMuon() const;
77     /// reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon)
78     reco::TrackRef globalTrack() const { return combinedMuon(); }
79     /// set reference to Track reconstructed in the tracker only (reimplemented from reco::Muon)
80     void embedTrack();
81     /// set reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon)
82     void embedStandAloneMuon();
83     /// set reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon)
84     void embedCombinedMuon();
85    
86     // ---- methods for MuonMETCorrectionData ----
87     /// muon MET corrections for caloMET; returns the muon correction struct if embedded during pat tuple production or an empty element
88     reco::MuonMETCorrectionData caloMETMuonCorrs() const { return (embeddedCaloMETMuonCorrs_ ? caloMETMuonCorrs_.front() : reco::MuonMETCorrectionData());};
89     void embedCaloMETMuonCorrs(const reco::MuonMETCorrectionData& t);
90     /// muon MET corrections for tcMET; returns the muon correction struct if embedded during pat tuple production or an empty element
91     reco::MuonMETCorrectionData tcMETMuonCorrs() const {return (embeddedTCMETMuonCorrs_ ? tcMETMuonCorrs_.front() : reco::MuonMETCorrectionData());};
92     void embedTcMETMuonCorrs(const reco::MuonMETCorrectionData& t);
93    
94     // ---- methods for TeV refit tracks ----
95     /// reference to Track reconstructed using hits in the tracker + "good" muon hits
96     reco::TrackRef pickyMuon() const;
97     void setPickyMuon(const reco::TrackRef& t) { pickyMuonRef_ = t; }
98     /// reference to Track reconstructed using hits in the tracker + info from the first muon station that has hits
99     reco::TrackRef tpfmsMuon() const;
100     void setTpfmsMuon(const reco::TrackRef& t) { tpfmsMuonRef_ = t; }
101     /// embed reference to the above picky Track
102     void embedPickyMuon();
103     /// embed reference to the above tpfms Track
104     void embedTpfmsMuon();
105    
106     // ---- PF specific methods ----
107     /// reference to the source IsolatedPFCandidates
108     /// null if this has been built from a standard muon
109     reco::PFCandidateRef pfCandidateRef() const;
110     /// add a reference to the source IsolatedPFCandidate
111     void setPFCandidateRef(const reco::PFCandidateRef& ref) {
112     pfCandidateRef_ = ref;
113     }
114     /// embed the IsolatedPFCandidate pointed to by pfCandidateRef_
115     void embedPFCandidate();
116    
117     // ---- methods for accessing muon identification ----
118     /// accessor for the various muon id algorithms currently defined
119     /// in DataFormats/MuonReco/interface/MuonSelectors.h
120     /// e.g. bool result = patmuon.muonID("TMLastStationLoose")
121     bool muonID (const std::string& name) const;
122     /// wrapper for the muonID method to maintain backwards compatibility
123     /// with when the reco::Muon::isGood method existed
124     bool isGood (const std::string& name) const { return muonID(name); }
125     /// if muon id results are ever extracted from muon id value maps
126     /// then the isMuonIDAvailable method will be defined
127     //bool isMuonIDAvailable(const std::string& name) const;
128    
129     // ---- overload of isolation functions ----
130     /// Overload of pat::Lepton::trackIso(); returns the value of
131     /// the summed track pt in a cone of deltaR<0.3
132     float trackIso() const { return isolationR03().sumPt; }
133     /// Overload of pat::Lepton::trackIso(); returns the value of
134     /// the summed Et of all recHits in the ecal in a cone of
135     /// deltaR<0.3
136     float ecalIso() const { return isolationR03().emEt; }
137     /// Overload of pat::Lepton::trackIso(); returns the value of
138     /// the summed Et of all caloTowers in the hcal in a cone of
139     /// deltaR<0.4
140     float hcalIso() const { return isolationR03().hadEt; }
141     /// Overload of pat::Lepton::trackIso(); returns the sum of
142     /// ecalIso() and hcalIso
143     float caloIso() const { return ecalIso()+hcalIso(); }
144    
145     /// Muon High Level Selection
146     /// The user can choose to cache this info so they can drop the
147     /// global tracks. If the global track is present these should
148     /// not be set, but the "getters" will return the appropriate
149     /// value. The exception is dB which requires the beamline
150     /// as external input.
151    
152     // FIXME: modified by Gena Kukartsev
153     // embed various impact parameters with errors
154     //
155     // example:
156     //
157     // // this will return the muon inner track
158     // // transverse impact parameter
159     // // relative to the primary vertex
160     // muon->dB(pat::Muon::PV2D);
161     //
162     // // this will return the uncertainty
163     // // on the muon inner track
164     // // transverse impact parameter
165     // // relative to the primary vertex
166     // // or -1.0 if there is no valid PV in the event
167     // muon->edB(pat::Muon::PV2D);
168     //
169     // IpType defines the type of the impact parameter
170     // None is default and reverts to old behavior controlled by
171     // patMuons.usePV = True/False
172     typedef enum IPTYPE
173     {
174     None = 0, PV2D = 1, PV3D = 2, BS2D = 3, BS3D = 4
175     } IpType;
176     void init(void); // init defaults in a constructor
177     double dB(IpType type = None) const;
178     double edB(IpType type = None) const;
179     void setDB ( double dB, double edB, IpType type = None )
180     { dB_ = dB; edB_ = edB; if (type == None) cachedDB_ = true;
181     ip_[type] = dB; eip_[type] = edB; cachedIP_[type] = true;}
182    
183    
184     /// numberOfValidHits returns the number of valid hits on the global track.
185     unsigned int numberOfValidHits() const;
186     void setNumberOfValidHits(unsigned int numberOfValidHits )
187     { numberOfValidHits_ = numberOfValidHits; cachedNumberOfValidHits_ = true; }
188    
189     /// Norm chi2 gives the normalized chi2 of the global track.
190     double normChi2() const;
191     void setNormChi2 (double normChi2 )
192     { normChi2_ = normChi2; cachedNormChi2_ = true; }
193    
194     /// Returns the segment compatibility, using muon::segmentCompatibility (DataFormats/MuonReco/interface/MuonSelectors.h)
195     double segmentCompatibility(reco::Muon::ArbitrationType arbitrationType = reco::Muon::SegmentAndTrackArbitration) const ;
196    
197     protected:
198    
199     // ---- for content embedding ----
200     /// tracker of inner track detector
201     bool embeddedTrack_;
202     std::vector<reco::Track> track_;
203     /// track of muon system
204     bool embeddedStandAloneMuon_;
205     std::vector<reco::Track> standAloneMuon_;
206     /// track of combined fit
207     bool embeddedCombinedMuon_;
208     std::vector<reco::Track> combinedMuon_;
209    
210     /// muon MET corrections for tcMET
211     bool embeddedTCMETMuonCorrs_;
212     std::vector<reco::MuonMETCorrectionData> tcMETMuonCorrs_;
213     /// muon MET corrections for caloMET
214     bool embeddedCaloMETMuonCorrs_;
215     std::vector<reco::MuonMETCorrectionData> caloMETMuonCorrs_;
216    
217     // TeV refit tracks, which are not currently stored in the
218     // reco::Muon like the above tracks are. Also provide capability
219     // to embed them.
220     bool embeddedPickyMuon_;
221     bool embeddedTpfmsMuon_;
222     reco::TrackRef pickyMuonRef_;
223     reco::TrackRef tpfmsMuonRef_;
224     std::vector<reco::Track> pickyMuon_;
225     std::vector<reco::Track> tpfmsMuon_;
226    
227     // ---- PF specific members ----
228     /// true if the IsolatedPFCandidate is embedded
229     bool embeddedPFCandidate_;
230     /// if embeddedPFCandidate_, a copy of the source IsolatedPFCandidate
231     /// is stored in this vector
232     reco::PFCandidateCollection pfCandidate_;
233     /// reference to the IsolatedPFCandidate this has been built from
234     /// null if this has been built from a standard muon
235     reco::PFCandidateRef pfCandidateRef_;
236    
237     // V+Jets group selection variables.
238     bool cachedNormChi2_; /// has the normalized chi2 been cached?
239     bool cachedDB_; /// has the dB been cached?
240    
241     // FIXME: added by Gena Kukartsev
242     bool cachedIP_[5]; /// has the IP (former dB) been cached?
243    
244     bool cachedNumberOfValidHits_;/// has the numberOfValidHits been cached?
245     double normChi2_; /// globalTrack->chi2() / globalTrack->ndof()
246     double dB_; /// dB and edB are the impact parameter at the primary vertex,
247     double edB_; /// and its uncertainty as recommended by the tracking group
248    
249     // FIXME: added by Gena Kukartsev
250     double ip_[5]; /// dB and edB are the impact parameter at the primary vertex,
251     double eip_[5]; /// and its uncertainty as recommended by the tracking group
252    
253     unsigned int numberOfValidHits_;/// globalTrack->numberOfValidHits()
254    
255     };
256    
257    
258     }
259    
260     #endif