ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootMuon.h
Revision: 1.5
Committed: Wed Dec 17 16:23:49 2008 UTC (16 years, 4 months ago) by lethuill
Content type: text/plain
Branch: MAIN
Changes since 1.4: +216 -221 lines
Log Message:
Add reference (TRef) to mcParticle

File Contents

# User Rev Content
1 mlethuil 1.1 #ifndef TRootMuon_h
2     #define TRootMuon_h
3    
4     #include "../interface/TRootParticle.h"
5    
6    
7     using namespace std;
8    
9     class TRootMuon : public TRootParticle
10     {
11    
12     public:
13    
14 lethuill 1.2 TRootMuon() :
15 lethuill 1.5 TRootParticle()
16     ,et_em_(-9999.)
17     ,et_emS9_(-9999.)
18     ,et_had_(-9999.)
19     ,et_hadS9_(-9999.)
20     ,et_ho_(-9999.)
21     ,et_hoS9_(-9999.)
22     ,caloCompatibility_(-9999.)
23     ,isoR03_emEt_(-9999.)
24     ,isoR03_hadEt_(-9999.)
25     ,isoR03_hoEt_(-9999.)
26     ,isoR03_sumPt_(-9999.)
27     ,isoR03_nTracks_(-9999)
28     ,isoR03_nJets_(-9999)
29     ,isoR05_emEt_(-9999.)
30     ,isoR05_hadEt_(-9999.)
31     ,isoR05_hoEt_(-9999.)
32     ,isoR05_sumPt_(-9999.)
33     ,isoR05_nTracks_(-9999)
34     ,isoR05_nJets_(-9999)
35     ,energyValid_(false)
36     ,matchesValid_(false)
37     ,isolationValid_(false)
38     ,direction_(-9999)
39     ,algo_(-9999)
40     ,id_(-9999)
41     ,momentumMCMuon_()
42     ,vertexMCMuon_()
43     ,pdgIdMCMuon_(0)
44     {;}
45 mlethuil 1.1
46 lethuill 1.2 TRootMuon(const TRootMuon& muon) :
47 lethuill 1.5 TRootParticle(muon)
48     ,et_em_(muon.et_em_)
49     ,et_emS9_(muon.et_emS9_)
50     ,et_had_(muon.et_had_)
51     ,et_hadS9_(muon.et_hadS9_)
52     ,et_ho_(muon.et_ho_)
53     ,et_hoS9_(muon.et_hoS9_)
54     ,caloCompatibility_(muon.caloCompatibility_)
55     ,isoR03_emEt_(muon.isoR03_emEt_)
56     ,isoR03_hadEt_(muon.isoR03_hadEt_)
57     ,isoR03_hoEt_(muon.isoR03_hoEt_)
58     ,isoR03_sumPt_(muon.isoR03_sumPt_)
59     ,isoR03_nTracks_(muon.isoR03_nTracks_)
60     ,isoR03_nJets_(muon.isoR03_nJets_)
61     ,isoR05_emEt_(muon.isoR05_emEt_)
62     ,isoR05_hadEt_(muon.isoR05_hadEt_)
63     ,isoR05_hoEt_(muon.isoR05_hoEt_)
64     ,isoR05_sumPt_(muon.isoR05_sumPt_)
65     ,isoR05_nTracks_(muon.isoR05_nTracks_)
66     ,isoR05_nJets_(muon.isoR05_nJets_)
67     ,energyValid_(muon.energyValid_)
68     ,matchesValid_(muon.matchesValid_)
69     ,isolationValid_(muon.isolationValid_)
70     ,direction_(muon.direction_)
71     ,algo_(muon.algo_)
72     ,id_(muon.id_)
73     ,momentumMCMuon_(muon.momentumMCMuon_)
74     ,vertexMCMuon_(muon.vertexMCMuon_)
75     ,pdgIdMCMuon_(muon.pdgIdMCMuon_)
76     {;}
77 mlethuil 1.1
78 lethuill 1.2 TRootMuon(Double_t px, Double_t py, Double_t pz, Double_t e) :
79 lethuill 1.5 TRootParticle(px,py,pz,e)
80     ,et_em_(-9999.)
81     ,et_emS9_(-9999.)
82     ,et_had_(-9999.)
83     ,et_hadS9_(-9999.)
84     ,et_ho_(-9999.)
85     ,et_hoS9_(-9999.)
86     ,caloCompatibility_(-9999.)
87     ,isoR03_emEt_(-9999.)
88     ,isoR03_hadEt_(-9999.)
89     ,isoR03_hoEt_(-9999.)
90     ,isoR03_sumPt_(-9999.)
91     ,isoR03_nTracks_(-9999)
92     ,isoR03_nJets_(-9999)
93     ,isoR05_emEt_(-9999.)
94     ,isoR05_hadEt_(-9999.)
95     ,isoR05_hoEt_(-9999.)
96     ,isoR05_sumPt_(-9999.)
97     ,isoR05_nTracks_(-9999)
98     ,isoR05_nJets_(-9999)
99     ,energyValid_(false)
100     ,matchesValid_(false)
101     ,isolationValid_(false)
102     ,direction_(-9999)
103     ,algo_(-9999)
104     ,id_(-9999)
105     ,momentumMCMuon_()
106     ,vertexMCMuon_()
107     ,pdgIdMCMuon_(0)
108     {;}
109 lethuill 1.2
110     TRootMuon(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z) :
111 lethuill 1.5 TRootParticle(px,py,pz,e,vtx_x,vtx_y,vtx_z)
112     ,et_em_(-9999.)
113     ,et_emS9_(-9999.)
114     ,et_had_(-9999.)
115     ,et_hadS9_(-9999.)
116     ,et_ho_(-9999.)
117     ,et_hoS9_(-9999.)
118     ,caloCompatibility_(-9999.)
119     ,isoR03_emEt_(-9999.)
120     ,isoR03_hadEt_(-9999.)
121     ,isoR03_hoEt_(-9999.)
122     ,isoR03_sumPt_(-9999.)
123     ,isoR03_nTracks_(-9999)
124     ,isoR03_nJets_(-9999)
125     ,isoR05_emEt_(-9999.)
126     ,isoR05_hadEt_(-9999.)
127     ,isoR05_hoEt_(-9999.)
128     ,isoR05_sumPt_(-9999.)
129     ,isoR05_nTracks_(-9999)
130     ,isoR05_nJets_(-9999)
131     ,energyValid_(false)
132     ,matchesValid_(false)
133     ,isolationValid_(false)
134     ,direction_(-9999)
135     ,algo_(-9999)
136     ,id_(-9999)
137     ,momentumMCMuon_()
138     ,vertexMCMuon_()
139     ,pdgIdMCMuon_(0)
140     {;}
141 lethuill 1.2
142     TRootMuon(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z, Int_t type, Float_t charge) :
143 lethuill 1.5 TRootParticle(px,py,pz,e,vtx_x,vtx_y,vtx_z,type,charge)
144     ,et_em_(-9999.)
145     ,et_emS9_(-9999.)
146     ,et_had_(-9999.)
147     ,et_hadS9_(-9999.)
148     ,et_ho_(-9999.)
149     ,et_hoS9_(-9999.)
150     ,caloCompatibility_(-9999.)
151     ,isoR03_emEt_(-9999.)
152     ,isoR03_hadEt_(-9999.)
153     ,isoR03_hoEt_(-9999.)
154     ,isoR03_sumPt_(-9999.)
155     ,isoR03_nTracks_(-9999)
156     ,isoR03_nJets_(-9999)
157     ,isoR05_emEt_(-9999.)
158     ,isoR05_hadEt_(-9999.)
159     ,isoR05_hoEt_(-9999.)
160     ,isoR05_sumPt_(-9999.)
161     ,isoR05_nTracks_(-9999)
162     ,isoR05_nJets_(-9999)
163     ,energyValid_(false)
164     ,matchesValid_(false)
165     ,isolationValid_(false)
166     ,direction_(-9999)
167     ,algo_(-9999)
168     ,id_(-9999)
169     ,momentumMCMuon_()
170     ,vertexMCMuon_()
171     ,pdgIdMCMuon_(0)
172     {;}
173 lethuill 1.2
174     TRootMuon(const TLorentzVector &momentum) :
175 lethuill 1.5 TRootParticle(momentum)
176     ,et_em_(-9999.)
177     ,et_emS9_(-9999.)
178     ,et_had_(-9999.)
179     ,et_hadS9_(-9999.)
180     ,et_ho_(-9999.)
181     ,et_hoS9_(-9999.)
182     ,caloCompatibility_(-9999.)
183     ,isoR03_emEt_(-9999.)
184     ,isoR03_hadEt_(-9999.)
185     ,isoR03_hoEt_(-9999.)
186     ,isoR03_sumPt_(-9999.)
187     ,isoR03_nTracks_(-9999)
188     ,isoR03_nJets_(-9999)
189     ,isoR05_emEt_(-9999.)
190     ,isoR05_hadEt_(-9999.)
191     ,isoR05_hoEt_(-9999.)
192     ,isoR05_sumPt_(-9999.)
193     ,isoR05_nTracks_(-9999)
194     ,isoR05_nJets_(-9999)
195     ,energyValid_(false)
196     ,matchesValid_(false)
197     ,isolationValid_(false)
198     ,direction_(-9999)
199     ,algo_(-9999)
200     ,id_(-9999)
201     ,momentumMCMuon_()
202     ,vertexMCMuon_()
203     ,pdgIdMCMuon_(0)
204     {;}
205    
206 lethuill 1.2 TRootMuon(const TLorentzVector &momentum, const TVector3 &vertex, Int_t type, Float_t charge) :
207 lethuill 1.5 TRootParticle(momentum, vertex, type, charge)
208     ,et_em_(-9999.)
209     ,et_emS9_(-9999.)
210     ,et_had_(-9999.)
211     ,et_hadS9_(-9999.)
212     ,et_ho_(-9999.)
213     ,et_hoS9_(-9999.)
214     ,caloCompatibility_(-9999.)
215     ,isoR03_emEt_(-9999.)
216     ,isoR03_hadEt_(-9999.)
217     ,isoR03_hoEt_(-9999.)
218     ,isoR03_sumPt_(-9999.)
219     ,isoR03_nTracks_(-9999)
220     ,isoR03_nJets_(-9999)
221     ,isoR05_emEt_(-9999.)
222     ,isoR05_hadEt_(-9999.)
223     ,isoR05_hoEt_(-9999.)
224     ,isoR05_sumPt_(-9999.)
225     ,isoR05_nTracks_(-9999)
226     ,isoR05_nJets_(-9999)
227     ,energyValid_(false)
228     ,matchesValid_(false)
229     ,isolationValid_(false)
230     ,direction_(-9999)
231     ,algo_(-9999)
232     ,id_(-9999)
233     ,momentumMCMuon_()
234     ,vertexMCMuon_()
235     ,pdgIdMCMuon_(0)
236     {;}
237 mlethuil 1.1
238     ~TRootMuon() {;}
239    
240    
241 lethuill 1.2 Float_t et_em() const { return et_em_;}
242     Float_t et_emS9() const { return et_emS9_;}
243     Float_t et_had() const { return et_had_;}
244     Float_t et_hadS9() const { return et_hadS9_;}
245     Float_t et_ho() const { return et_ho_;}
246     Float_t et_hoS9() const { return et_hoS9_;}
247     Float_t caloCompatibility() const { return caloCompatibility_;}
248    
249     Float_t isoR03_emEt() const { return isoR03_emEt_;}
250     Float_t isoR03_hadEt() const { return isoR03_hadEt_;}
251     Float_t isoR03_hoEt() const { return isoR03_hoEt_;}
252     Float_t isoR03_sumPt() const { return isoR03_sumPt_;}
253     Int_t isoR03_nTracks() const { return isoR03_nTracks_;}
254     Int_t isoR03_nJets() const { return isoR03_nJets_;}
255    
256     Float_t isoR05_emEt() const { return isoR05_emEt_;}
257     Float_t isoR05_hadEt() const { return isoR05_hadEt_;}
258     Float_t isoR05_hoEt() const { return isoR05_hoEt_;}
259     Float_t isoR05_sumPt() const { return isoR05_sumPt_;}
260     Int_t isoR05_nTracks() const { return isoR05_nTracks_;}
261     Int_t isoR05_nJets() const { return isoR05_nJets_;}
262    
263     Bool_t energyValid() const { return energyValid_;}
264     Bool_t matchesValid() const { return matchesValid_;}
265     Bool_t isolationValid() const { return isolationValid_;}
266 mlethuil 1.1
267 lethuill 1.3 Int_t direction() const { return direction_;}
268     Int_t algo() const { return algo_;}
269    
270     Bool_t isGlobalMuon() const { return algo_ & 2; }
271     Bool_t isTrackerMuon() const { return algo_ & 4; }
272     Bool_t isStandAloneMuon() const { return algo_ & 8; }
273     Bool_t isCaloMuon() const { return algo_ & 16; }
274    
275     Int_t id() const { return id_;}
276     Bool_t idTrackerMuonArbitrated() const { return id_ & 1; }
277     Bool_t idAllArbitrated() const { return id_ & 2; }
278     Bool_t idGlobalMuonPromptTight() const { return id_ & 4; }
279     Bool_t idTMLastStationLoose() const { return id_ & 8; }
280     Bool_t idTMLastStationTight() const { return id_ & 16; }
281     Bool_t idTM2DCompatibilityLoose() const { return id_ & 32; }
282     Bool_t idTM2DCompatibilityTight() const { return id_ & 64; }
283    
284 lethuill 1.5 //TObject* genMuon() const { return genMuon_.GetObject() ;}
285     //Int_t muonMCIndex() const { return muonMCIndex_; }
286 lethuill 1.4 TLorentzVector momentumMCMuon() const { return momentumMCMuon_; }
287     TVector3 vertexMCMuon() const { return vertexMCMuon_; }
288     Int_t pdgIdMCMuon() const { return pdgIdMCMuon_; }
289    
290 lethuill 1.5 virtual TString typeName() const { return "TRootMuon"; }
291    
292 lethuill 1.4
293 mlethuil 1.1 void setCaloEnergy(Float_t et_em, Float_t et_emS9, Float_t et_had, Float_t et_hadS9, Float_t et_ho, Float_t et_hoS9, Float_t caloCompatibility)
294     {
295     et_em_ = et_em;
296     et_emS9_ = et_emS9;
297     et_had_ = et_had;
298     et_hadS9_ = et_hadS9;
299     et_ho_ = et_ho;
300     et_hoS9_ = et_hoS9;
301     caloCompatibility_ = caloCompatibility;
302     }
303    
304     void setIsoR03(Float_t isoR03_emEt, Float_t isoR03_hadEt, Float_t isoR03_hoEt, Float_t isoR03_sumPt, Int_t isoR03_nTracks, Int_t isoR03_nJets)
305     {
306     isoR03_emEt_ = isoR03_emEt;
307     isoR03_hadEt_ = isoR03_hadEt;
308     isoR03_hoEt_ = isoR03_hoEt;
309     isoR03_sumPt_ = isoR03_sumPt;
310     isoR03_nTracks_ = isoR03_nTracks;
311     isoR03_nJets_ = isoR03_nJets;
312     }
313    
314     void setIsoR05(Float_t isoR05_emEt, Float_t isoR05_hadEt, Float_t isoR05_hoEt, Float_t isoR05_sumPt, Int_t isoR05_nTracks, Int_t isoR05_nJets)
315     {
316     isoR05_emEt_ = isoR05_emEt;
317     isoR05_hadEt_ = isoR05_hadEt;
318     isoR05_hoEt_ = isoR05_hoEt;
319     isoR05_sumPt_ = isoR05_sumPt;
320     isoR05_nTracks_ = isoR05_nTracks;
321     isoR05_nJets_ = isoR05_nJets;
322     }
323    
324 lethuill 1.3 void setValidity(Bool_t energyValid, Bool_t matchesValid, Bool_t isolationValid)
325     {
326     energyValid_ = energyValid;
327     matchesValid_ = matchesValid;
328     isolationValid_ = isolationValid;
329     }
330    
331     void setDirection(Int_t direction) { direction_ = direction; }
332     void setAlgo(Int_t algo) { algo_ = algo; }
333     void setID(Int_t id) { id_ = id; }
334     void setID(
335     Int_t trackerMuonArbitrated
336     ,Int_t allArbitrated
337     ,Int_t globalMuonPromptTight
338     ,Int_t tmLastStationLoose
339     ,Int_t tmLastStationTight
340     ,Int_t tm2DCompatibilityLoose
341     ,Int_t tm2DCompatibilityTight
342     )
343     { id_ = trackerMuonArbitrated*1 + allArbitrated*2 + globalMuonPromptTight*4 + tmLastStationLoose*8 + tmLastStationTight*16 + tm2DCompatibilityLoose*32 + tm2DCompatibilityTight*64; }
344    
345 lethuill 1.5 //void setMuonMCIndex(Int_t muonMCIndex) { muonMCIndex_ = muonMCIndex; }
346 lethuill 1.4 void setMomentumMCMuon(Float_t px, Float_t py, Float_t pz , Float_t energy) { momentumMCMuon_ = TLorentzVector(px,py,pz,energy); }
347     void setVertexMCMuon(TVector3 vertexMCMuon) { vertexMCMuon_ = vertexMCMuon; }
348     void setPdgIdMCMuon(Int_t pdgIdMCMuon) { pdgIdMCMuon_ = pdgIdMCMuon; }
349    
350 lethuill 1.3
351 mlethuil 1.1 friend std::ostream& operator<< (std::ostream& stream, const TRootMuon& muon) {
352 lethuill 1.3 stream << "TRootMuon - Charge=" << muon.charge() << " (Et,eta,phi)=("<< muon.Et() <<","<< muon.Eta() <<","<< muon.Phi() << ") vertex(x,y,z)=("<< muon.vx() <<","<< muon.vy() <<","<< muon.vz() << ")" << endl
353     << " Type(G,T,S,C)=(" << muon.isGlobalMuon() << "," << muon.isTrackerMuon() << "," << muon.isStandAloneMuon() << "," << muon.isCaloMuon() << ") "
354     << " ID=(" << muon.idTrackerMuonArbitrated() << "," << muon.idAllArbitrated() << "," << muon.idGlobalMuonPromptTight() << "," << muon.idTMLastStationLoose()
355     << "," << muon.idTMLastStationTight() << "," << muon.idTM2DCompatibilityLoose() << "," << muon.idTM2DCompatibilityTight() << ")" << " Direction=" << muon.direction_
356     << " caloCompatibility="<< muon.caloCompatibility_ << " validity(energy,matches,isolation)=(" << muon.energyValid_ <<","<< muon.matchesValid_ <<","<< muon.isolationValid_ << ")" << endl
357 mlethuil 1.1 << " Et_em=" << muon.et_em_ << " Et_emS9=" << muon.et_emS9_ << " Et_had=" << muon.et_had_ << " Et_hadS9=" << muon.et_hadS9_ << " Et_ho=" << muon.et_ho_ << " Et_hoS9=" << muon.et_hoS9_ << endl
358     << " isolation cone 0.3: Et_em=" << muon.isoR03_emEt_ << " Et_had=" << muon.isoR03_hadEt_ <<" Et_ho=" << muon.isoR03_hoEt_ << " nTracks=" << muon.isoR03_nTracks_ <<" nJets=" << muon.isoR03_nJets_ << endl
359     << " isolation cone 0.5: Et_em=" << muon.isoR05_emEt_ << " Et_had=" << muon.isoR05_hadEt_ <<" Et_ho=" << muon.isoR05_hoEt_ << " nTracks=" << muon.isoR05_nTracks_ <<" nJets=" << muon.isoR05_nJets_;
360     return stream;
361     };
362    
363    
364     private:
365    
366 lethuill 1.4 // Variables from reco::Muon
367 mlethuil 1.1 Float_t et_em_;
368     Float_t et_emS9_;
369     Float_t et_had_;
370     Float_t et_hadS9_;
371     Float_t et_ho_;
372     Float_t et_hoS9_;
373     Float_t caloCompatibility_;
374    
375     Float_t isoR03_emEt_;
376     Float_t isoR03_hadEt_;
377     Float_t isoR03_hoEt_;
378     Float_t isoR03_sumPt_;
379     Int_t isoR03_nTracks_;
380     Int_t isoR03_nJets_;
381    
382     Float_t isoR05_emEt_;
383     Float_t isoR05_hadEt_;
384     Float_t isoR05_hoEt_;
385     Float_t isoR05_sumPt_;
386     Int_t isoR05_nTracks_;
387     Int_t isoR05_nJets_;
388    
389     Bool_t energyValid_;
390     Bool_t matchesValid_;
391     Bool_t isolationValid_;
392 lethuill 1.3
393     Int_t direction_; // OutsideIn = -1, Undefined = 0, InsideOut = 1
394     Int_t algo_; // binary => GlobalMuon=00010 , TrackerMuon=00100 , StandAloneMuon=01000 , CaloMuon=10000
395     // MuonId coded in binary word id_ ==> TrackerMuonArbitrated=0000001 , AllArbitrated=0000010 , GlobalMuonPromptTight=0000100 ,
396     // TMLastStationLoose=0001000 , TMLastStationTight=0010000 , TM2DCompatibilityLoose=0100000 , TM2DCompatibilityTight=1000000
397     Int_t id_;
398    
399 lethuill 1.4 TLorentzVector momentumMCMuon_;
400     TVector3 vertexMCMuon_;
401     Int_t pdgIdMCMuon_;
402    
403 mlethuil 1.1 ClassDef (TRootMuon,1);
404     };
405    
406     #endif
407    
408