ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MPIAnalyzer/src/TCJet.cc
Revision: 1.4
Committed: Mon Feb 14 11:38:47 2011 UTC (14 years, 2 months ago) by naodell
Content type: text/plain
Branch: MAIN
Changes since 1.3: +26 -1 lines
Log Message:
Keep fresh

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 naodell 1.4 float TCJet::VtxSumPtFrac() const {
120     return _vtxSumPtFrac;
121     }
122    
123 naodell 1.3 float TCJet::VtxSumPt() const {
124     return _vtxSumPt;
125 naodell 1.4 }
126    
127     float TCJet::VtxTrackFrac() const {
128     return _vtxTrackFrac;
129     }
130    
131     int TCJet::VtxNTracks() const {
132     return _vtxNTracks;
133     }
134    
135 naodell 1.3
136     unsigned int TCJet::VtxIndex() const {
137     return _vtxIndex;
138     }
139    
140 naodell 1.1 //TVector3 TCJet::AssocVtx() {
141     // return _assocPV;
142     //}
143    
144     bool TCJet::JetCorrIsSet(unsigned int lvl) const {
145     return _jetCorrIsSet[lvl];
146     }
147    
148     float TCJet::JetCorr(unsigned int lvl) const {
149     return _jetCorr[lvl];
150     }
151    
152     float TCJet::TotalJetCorr(unsigned int lvl) const {
153     float corr = 1.0;
154     for (unsigned int i = 1; i <= lvl; ++i) {
155 anastass 1.2 if (JetCorrIsSet(lvl)) corr *= JetCorr(i);
156 naodell 1.1 }
157     return corr;
158     }
159    
160     // b tagging discriminators
161     //Track counting tag with N = 3: trackCountingHighPurBJetTags
162    
163     float TCJet::BDiscrTrkCountHiPure() const {
164     return _bDiscrTrkCountHiPure;
165     }
166    
167     //Track counting tag with N = 2: trackCountingHighEffBJetTags
168    
169     float TCJet::BDiscrTrkCountHiEff() const {
170     return _bDiscrTrkCountHiEff;
171     }
172    
173     //Simple secondary vertex b tag: simpleSecondaryVertexBJetTags
174    
175     float TCJet::BDiscrSecVtxSimple() const {
176     return _bDiscrSecVtxSimple;
177     }
178    
179     //Combined SV b tag using likelihood ratios: combinedSVBJetTags
180    
181     float TCJet::BDiscrSecVtxL() const {
182     return _bDiscrSecVtxL;
183     }
184    
185     //Combined SV b tag using MVA: combinedSVMVABJetTags
186    
187     float TCJet::BDiscrSecVtxMVA() const {
188     return _bDiscrSecVtxMVA;
189     }
190    
191    
192     // "set" methods ---------------------------------------------
193    
194     void TCJet::SetP4(TLorentzVector p4) {
195     _p4 = p4;
196     }
197    
198     void TCJet::SetP4(float px, float py, float pz, float e) {
199     TLorentzVector p4(px, py, pz, e);
200     _p4 = p4;
201     }
202    
203     void TCJet::SetVtx(float vx, float vy, float vz) {
204     TVector3 v3(vx, vy, vz);
205     _vtx = v3;
206     }
207    
208 naodell 1.4 void TCJet::SetVtxSumPtFrac(float vtxSumPtFrac){
209     _vtxSumPtFrac = vtxSumPtFrac;
210     }
211    
212 naodell 1.3 void TCJet::SetVtxSumPt(float vtxSumPt){
213     _vtxSumPt = vtxSumPt;
214     }
215    
216 naodell 1.4 void TCJet::SetVtxTrackFrac(float vtxTrackFrac){
217     _vtxTrackFrac = vtxTrackFrac;
218     }
219    
220     void TCJet::SetVtxNTracks(int vtxNTracks){
221     _vtxNTracks = vtxNTracks;
222     }
223    
224 naodell 1.3 void TCJet::SetVtxIndex(unsigned int vtxIndex){
225     _vtxIndex = vtxIndex;
226     }
227 naodell 1.1 //void TCJet::SetAssocVtx(float vx, float vy, float vz) {
228     // TVector3 v3(vx, vy, vz);
229     // _assocPV = v3;
230     //}
231    
232     void TCJet::SetChHadFrac(float c) {
233     _chHadFrac = c;
234     }
235    
236     void TCJet::SetNeuHadFrac(float n) {
237     _neuHadFrac = n;
238     }
239    
240     void TCJet::SetChEmFrac(float c) {
241     _chEmFrac = c;
242     }
243    
244     void TCJet::SetNeuEmFrac(float n) {
245     _neuEmFrac = n;
246     }
247    
248     void TCJet::SetNumConstit(unsigned int n) {
249     _numConstit = n;
250     }
251    
252     void TCJet::SetNumChPart(unsigned int n) {
253     _numChPart = n;
254     }
255    
256     void TCJet::SetJetCorr(unsigned int lvl, float corr) {
257    
258     if (lvl >= 0 && lvl <= 7) {
259     _jetCorr[lvl] = corr;
260     _jetCorrIsSet[lvl] = true;
261    
262     } else {
263     std::cout << "\nJet correction lvl = " << lvl << " is not valid!\n";
264     std::cout << "No correction will be applied!\n\n";
265     }
266    
267     }
268     // b tagging discriminators
269    
270     void TCJet::SetBDiscrTrkCountHiPure(float d) {
271     _bDiscrTrkCountHiPure = d;
272     }
273    
274     void TCJet::SetBDiscrTrkCountHiEff(float d) {
275     _bDiscrTrkCountHiEff = d;
276     }
277    
278     void TCJet::SetBDiscrSecVtxSimple(float d) {
279     _bDiscrSecVtxSimple = d;
280     }
281    
282     void TCJet::SetBDiscrSecVtxL(float d) {
283     _bDiscrSecVtxL = d;
284     }
285    
286     void TCJet::SetBDiscrSecVtxMVA(float d) {
287     _bDiscrSecVtxMVA = d;
288     }