ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootMuon.h
Revision: 1.4
Committed: Mon Dec 15 19:08:52 2008 UTC (16 years, 4 months ago) by lethuill
Content type: text/plain
Branch: MAIN
CVS Tags: pat_2_1_12_01
Changes since 1.3: +177 -132 lines
Log Message:
MC infos from Silvano

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