ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MPIAnalyzer/src/TCJet.cc
Revision: 1.1
Committed: Sat May 22 18:17:38 2010 UTC (14 years, 11 months ago) by naodell
Content type: text/plain
Branch: MAIN
Log Message:
Jet class object for ntuples.

File Contents

# User Rev Content
1 naodell 1.1 /*
2     * File: TCJet.cc
3     * Author: Anton A.
4     *
5     * Created on April 30, 2010, 2:49 PM
6     */
7    
8     #include "TCJet.h"
9     #include<iostream>
10    
11     TCJet::TCJet() {
12     for (int i = 0; i < 8; ++i) {
13     _jetCorr[i] = 1.0;
14     _jetCorrIsSet[i] = false;
15     }
16     _jetCorrIsSet[0] = true;
17     }
18    
19     TCJet::TCJet(const TCJet& orig) {
20     }
21    
22     TCJet::~TCJet() {
23     }
24    
25    
26    
27    
28     // "get" methods -------------------------------------
29    
30     TLorentzVector TCJet::P4() const {
31     return _p4;
32     }
33    
34     TVector2 TCJet::P2() const {
35     TVector2 v2(_p4.Px(), _p4.Py());
36     return v2;
37     }
38    
39     float TCJet::Et() const {
40     return _p4.Et();
41     }
42    
43     float TCJet::Pt() const {
44     return _p4.Pt();
45     }
46    
47     // accessors for corrected jets (argument is level of correction)
48    
49     TLorentzVector TCJet::P4(unsigned int lvl) const {
50     if (lvl > 7) {
51     std::cout << "\nJet correction = " << lvl << std::endl;
52     std::cout << "Correction level cannot exceed 7!\n";
53     std::cout << "No correction will be applied!\n";
54     return _p4;
55     }
56     return TotalJetCorr(lvl) * _p4;
57     }
58    
59     TVector2 TCJet::P2(unsigned int lvl) const {
60     TVector2 v2(_p4.Px(), _p4.Py());
61     if (lvl > 7) {
62     std::cout << "\nJet correction = " << lvl << std::endl;
63     std::cout << "Correction level cannot exceed 7!\n";
64     std::cout << "No correction will be applied!\n";
65     return v2;
66     }
67     return TotalJetCorr(lvl) * v2;
68     }
69    
70     float TCJet::Et(unsigned int lvl) const {
71    
72     if (lvl > 7) {
73     std::cout << "\nJet correction = " << lvl << std::endl;
74     std::cout << "Correction level cannot exceed 7!\n";
75     std::cout << "No correction will be applied!\n";
76     return _p4.Et();
77     }
78     return TotalJetCorr(lvl) * _p4.Et();
79     }
80    
81     float TCJet::Pt(unsigned int lvl) const {
82     if (lvl > 7) {
83     std::cout << "\nJet correction = " << lvl << std::endl;
84     std::cout << "Correction level cannot exceed 7!\n";
85     std::cout << "No correction will be applied!\n";
86     return _p4.Pt();
87     }
88     return TotalJetCorr(lvl) * _p4.Pt();
89     }
90    
91     float TCJet::ChHadFrac() const {
92     return _chHadFrac;
93     }
94    
95     float TCJet::NeuHadFrac() const {
96     return _neuHadFrac;
97     }
98    
99     float TCJet::ChEmFrac() const {
100     return _chEmFrac;
101     }
102    
103     float TCJet::NeuEmFrac() const {
104     return _neuEmFrac;
105     }
106    
107     unsigned int TCJet::NumConstit() const {
108     return _numConstit;
109     }
110    
111     unsigned int TCJet::NumChPart() const {
112     return _numChPart;
113     }
114    
115     TVector3 TCJet::Vtx() const {
116     return _vtx;
117     }
118    
119     //TVector3 TCJet::AssocVtx() {
120     // return _assocPV;
121     //}
122    
123     bool TCJet::JetCorrIsSet(unsigned int lvl) const {
124     return _jetCorrIsSet[lvl];
125     }
126    
127     float TCJet::JetCorr(unsigned int lvl) const {
128     return _jetCorr[lvl];
129     }
130    
131     float TCJet::TotalJetCorr(unsigned int lvl) const {
132     float corr = 1.0;
133     for (unsigned int i = 1; i <= lvl; ++i) {
134     if (JetCorrIsSet(lvl)) corr *= JetCorr(lvl);
135     }
136     return corr;
137     }
138    
139     // b tagging discriminators
140     //Track counting tag with N = 3: trackCountingHighPurBJetTags
141    
142     float TCJet::BDiscrTrkCountHiPure() const {
143     return _bDiscrTrkCountHiPure;
144     }
145    
146     //Track counting tag with N = 2: trackCountingHighEffBJetTags
147    
148     float TCJet::BDiscrTrkCountHiEff() const {
149     return _bDiscrTrkCountHiEff;
150     }
151    
152     //Simple secondary vertex b tag: simpleSecondaryVertexBJetTags
153    
154     float TCJet::BDiscrSecVtxSimple() const {
155     return _bDiscrSecVtxSimple;
156     }
157    
158     //Combined SV b tag using likelihood ratios: combinedSVBJetTags
159    
160     float TCJet::BDiscrSecVtxL() const {
161     return _bDiscrSecVtxL;
162     }
163    
164     //Combined SV b tag using MVA: combinedSVMVABJetTags
165    
166     float TCJet::BDiscrSecVtxMVA() const {
167     return _bDiscrSecVtxMVA;
168     }
169    
170    
171     // "set" methods ---------------------------------------------
172    
173     void TCJet::SetP4(TLorentzVector p4) {
174     _p4 = p4;
175     }
176    
177     void TCJet::SetP4(float px, float py, float pz, float e) {
178     TLorentzVector p4(px, py, pz, e);
179     _p4 = p4;
180     }
181    
182     void TCJet::SetVtx(float vx, float vy, float vz) {
183     TVector3 v3(vx, vy, vz);
184     _vtx = v3;
185     }
186    
187     //void TCJet::SetAssocVtx(float vx, float vy, float vz) {
188     // TVector3 v3(vx, vy, vz);
189     // _assocPV = v3;
190     //}
191    
192     void TCJet::SetChHadFrac(float c) {
193     _chHadFrac = c;
194     }
195    
196     void TCJet::SetNeuHadFrac(float n) {
197     _neuHadFrac = n;
198     }
199    
200     void TCJet::SetChEmFrac(float c) {
201     _chEmFrac = c;
202     }
203    
204     void TCJet::SetNeuEmFrac(float n) {
205     _neuEmFrac = n;
206     }
207    
208     void TCJet::SetNumConstit(unsigned int n) {
209     _numConstit = n;
210     }
211    
212     void TCJet::SetNumChPart(unsigned int n) {
213     _numChPart = n;
214     }
215    
216     void TCJet::SetJetCorr(unsigned int lvl, float corr) {
217    
218     if (lvl >= 0 && lvl <= 7) {
219     _jetCorr[lvl] = corr;
220     _jetCorrIsSet[lvl] = true;
221    
222     } else {
223     std::cout << "\nJet correction lvl = " << lvl << " is not valid!\n";
224     std::cout << "No correction will be applied!\n\n";
225     }
226    
227     }
228     // b tagging discriminators
229    
230     void TCJet::SetBDiscrTrkCountHiPure(float d) {
231     _bDiscrTrkCountHiPure = d;
232     }
233    
234     void TCJet::SetBDiscrTrkCountHiEff(float d) {
235     _bDiscrTrkCountHiEff = d;
236     }
237    
238     void TCJet::SetBDiscrSecVtxSimple(float d) {
239     _bDiscrSecVtxSimple = d;
240     }
241    
242     void TCJet::SetBDiscrSecVtxL(float d) {
243     _bDiscrSecVtxL = d;
244     }
245    
246     void TCJet::SetBDiscrSecVtxMVA(float d) {
247     _bDiscrSecVtxMVA = d;
248     }