ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/devildog/SWonAnalysis3/Thesis/src/TCElectron.cc
Revision: 1.1
Committed: Thu Apr 7 02:02:29 2011 UTC (14 years ago) by devildog
Content type: text/plain
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 devildog 1.1 /*
2     * File: TCElectron.cc
3     * Author: S. Won
4     */
5    
6     #include "TCElectron.h"
7     #include <iostream>
8    
9     TCElectron::TCElectron() {
10     }
11    
12     TCElectron::TCElectron(const TCElectron& orig) {
13     }
14    
15     TCElectron::~TCElectron() {
16     }
17    
18     // "get" methods -------------------------------------
19    
20     TVector3 TCElectron::Position() const {
21     return _position;
22     }
23    
24     TLorentzVector TCElectron::P4() const {
25     return _p4;
26     }
27    
28     TVector2 TCElectron::P2() const {
29     TVector2 v2(_p4.Px(), _p4.Py());
30     return v2;
31     }
32    
33     float TCElectron::Et() const {
34     return _p4.Et();
35     }
36    
37     float TCElectron::Pt() const {
38     return _p4.Pt();
39     }
40    
41     int TCElectron::Charge() const{
42     return charge;
43     }
44    
45     float TCElectron::SumPt03() const {
46     return sumPt03;
47     }
48    
49     float TCElectron::EmEt03() const {
50     return emEt03;
51     }
52    
53     float TCElectron::HadEt03() const {
54     return hadEt03;
55     }
56    
57     float TCElectron::Phi() const {
58     return _p4.Phi();
59     }
60    
61     int TCElectron::CutLevel(int lvl) const{
62     if(lvl==95){
63     return Cut95;
64     }else if(lvl==90) {
65     return Cut90;
66     }else if(lvl==85) {
67     return Cut85;
68     }else if(lvl==80) {
69     return Cut80;
70     }else if(lvl==70) {
71     return Cut70;
72     }else if(lvl==60) {
73     return Cut60;
74     }else{
75     return -99;
76     }
77     }
78    
79     bool TCElectron::passID(int lvl) const {
80     int c = CutLevel(lvl);
81     if(c < 0) return false;
82     if( (c == 1) || (c == 3) || (c == 5) || (c == 7)) return true;
83     return false;
84     }
85    
86     bool TCElectron::passConversion(int lvl) const {
87     int c = CutLevel(lvl);
88     if(c < 0) return false;
89     if( (c == 4) || (c == 5) || (c == 6) || (c == 7)) return true;
90     return false;
91     }
92    
93     bool TCElectron::passIsolation(int lvl) const {
94     int c = CutLevel(lvl);
95     if(c < 0) return false;
96     if( (c == 2) || (c == 3) || (c == 6) || (c == 7)) return true;
97     return false;
98     }
99    
100     bool TCElectron::isEB() const {
101     return isEB_;
102     }
103    
104     bool TCElectron::isEE() const {
105     return isEE_;
106     }
107    
108     bool TCElectron::isInGap() const {
109     return isInGap_;
110     }
111    
112     int TCElectron::numberOfValidPixelHits() const {
113     return numberOfValidPixelHits_;
114     }
115    
116     int TCElectron::numberOfValidTrackerHits() const {
117     return numberOfValidTrackerHits_;
118     }
119    
120     int TCElectron::numberOfMissingPixelHits() const {
121     return numberOfMissingPixelHits_;
122     }
123    
124     int TCElectron::numberOfMissingTrackerHits() const {
125     return numberOfMissingTrackerHits_;
126     }
127    
128     float TCElectron::PFRelIso(float coneSize) const {
129     float relIso = 0;
130     if (fabs(coneSize - 0.3) < 0.01)
131     relIso = (PFiso_Pt03 + PFiso_Gamma03 + PFiso_Neutral03) / _p4.Pt();
132     if (fabs(coneSize - 0.4) < 0.01)
133     relIso = (PFiso_Pt04 + PFiso_Gamma04 + PFiso_Neutral04) / _p4.Pt();
134     if (fabs(coneSize - 0.5) < 0.01)
135     relIso = (PFiso_Pt05 + PFiso_Gamma05 + PFiso_Neutral05) / _p4.Pt();
136     return relIso;
137     }
138    
139     float TCElectron::PFSumPt(float coneSize) const {
140     float sumPt = 0;
141     if (fabs(coneSize - 0.3) < 0.01) sumPt = PFiso_Pt03;
142     if (fabs(coneSize - 0.4) < 0.01) sumPt = PFiso_Pt04;
143     if (fabs(coneSize - 0.5) < 0.01) sumPt = PFiso_Pt05;
144     return sumPt;
145     }
146    
147     float TCElectron::PFENeutral(float coneSize) const {
148     float neutral = 0;
149     if (fabs(coneSize - 0.3) < 0.01) neutral = PFiso_Neutral03;
150     if (fabs(coneSize - 0.4) < 0.01) neutral = PFiso_Neutral04;
151     if (fabs(coneSize - 0.5) < 0.01) neutral = PFiso_Neutral05;
152     return neutral;
153     }
154    
155     float TCElectron::PFEGamma(float coneSize) const {
156     float gamma = 0;
157     if (fabs(coneSize - 0.3) < 0.01) gamma = PFiso_Gamma03;
158     if (fabs(coneSize - 0.4) < 0.01) gamma = PFiso_Gamma04;
159     if (fabs(coneSize - 0.5) < 0.01) gamma = PFiso_Gamma05;
160     return gamma;
161     }
162    
163     // "set" methods ---------------------------------------------
164    
165     void TCElectron::SetPosition(float x, float y, float z) {
166     TVector3 p(x, y, z);
167     _position = p;
168     }
169    
170     void TCElectron::SetP4(TLorentzVector p4) {
171     _p4 = p4;
172     }
173    
174     void TCElectron::SetP4(float px, float py, float pz, float e) {
175     TLorentzVector p4(px, py, pz, e);
176     _p4 = p4;
177     }
178    
179     void TCElectron::SetsumPt03(float s) {
180     sumPt03 = s;
181     }
182    
183     void TCElectron::SetemEt03(float s) {
184     emEt03 = s;
185     }
186    
187     void TCElectron::SethadEt03(float s) {
188     hadEt03 = s;
189     }
190    
191     void TCElectron::SetCharge(int c) {
192     charge = c;
193     }
194    
195     void TCElectron::SetCutLevel(int cut, int lvl){
196     if(lvl==95){
197     Cut95 = cut;
198     }else if(lvl==90) {
199     Cut90 = cut;
200     }else if(lvl==85) {
201     Cut85 = cut;
202     }else if(lvl==80) {
203     Cut80 = cut;
204     }else if(lvl==70) {
205     Cut70 = cut;
206     }else if(lvl==60) {
207     Cut60 = cut;
208     }
209     }
210    
211     void TCElectron::SetnumberOfValidPixelHits(int n) {
212     numberOfValidPixelHits_ = n;
213     }
214    
215     void TCElectron::SetnumberOfValidTrackerHits(int n) {
216     numberOfValidTrackerHits_ = n;
217     }
218    
219     void TCElectron::SetnumberOfMissingPixelHits(int n) {
220     numberOfMissingPixelHits_ = n;
221     }
222    
223     void TCElectron::SetnumberOfMissingTrackerHits(int n) {
224     numberOfMissingTrackerHits_ = n;
225     }
226    
227     void TCElectron::SetPFSumPt(float coneSize, float f) {
228     if(fabs(coneSize - 0.3) < 0.01) PFiso_Pt03 = f;
229     if(fabs(coneSize - 0.4) < 0.01) PFiso_Pt04 = f;
230     if(fabs(coneSize - 0.5) < 0.01) PFiso_Pt05 = f;
231     }
232    
233     void TCElectron::SetPFEGamma(float coneSize, float f) {
234     if(fabs(coneSize - 0.3) < 0.01) PFiso_Gamma03 = f;
235     if(fabs(coneSize - 0.4) < 0.01) PFiso_Gamma04 = f;
236     if(fabs(coneSize - 0.5) < 0.01) PFiso_Gamma05 = f;
237     }
238    
239     void TCElectron::SetPFENeutral(float coneSize, float f) {
240     if(fabs(coneSize - 0.3) < 0.01) PFiso_Neutral03 = f;
241     if(fabs(coneSize - 0.4) < 0.01) PFiso_Neutral04 = f;
242     if(fabs(coneSize - 0.5) < 0.01) PFiso_Neutral05 = f;
243     }
244    
245     void TCElectron::SetisEB(bool b) {
246     isEB_ = b;
247     }
248    
249     void TCElectron::SetisEE(bool b) {
250     isEE_ = b;
251     }
252    
253     void TCElectron::SetisInGap(bool b) {
254     isInGap_ = b;
255     }