1 |
bpollack |
1.1 |
#include "TCElectron.h"
|
2 |
|
|
#include <iostream>
|
3 |
|
|
#include <map>
|
4 |
|
|
#include <utility>
|
5 |
|
|
#include <string>
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
TCElectron::TCElectron() {
|
9 |
|
|
}
|
10 |
|
|
|
11 |
|
|
TCElectron::~TCElectron() {
|
12 |
|
|
}
|
13 |
|
|
|
14 |
|
|
using namespace std;
|
15 |
|
|
|
16 |
|
|
// "get" methods -------------------------------------
|
17 |
|
|
|
18 |
|
|
map<string, float> TCElectron::ElectronMap() {
|
19 |
|
|
return _ElectronTrueMap;
|
20 |
|
|
}
|
21 |
|
|
|
22 |
|
|
TVector2 TCElectron::P2() const {
|
23 |
|
|
TVector2 v2(this->Px(), this->Py());
|
24 |
|
|
return v2;
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
TVector3 TCElectron::Vtx() const {
|
28 |
|
|
return _vtx;
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
float TCElectron::PtError() const {
|
32 |
|
|
return _ptError;
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
int TCElectron::Charge() const {
|
36 |
|
|
return _charge;
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
bool TCElectron::IsEB() const {
|
41 |
|
|
return _isEB;
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
bool TCElectron::IsEE() const {
|
45 |
|
|
return _isEE;
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
bool TCElectron::IsInGap() const {
|
49 |
|
|
return _isInGap;
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
int TCElectron::CutLevel(int lvl) const{
|
54 |
|
|
if(lvl==95){
|
55 |
|
|
return _cut95;
|
56 |
|
|
}else if(lvl==90) {
|
57 |
|
|
return _cut90;
|
58 |
|
|
}else if(lvl==85) {
|
59 |
|
|
return _cut85;
|
60 |
|
|
}else if(lvl==80) {
|
61 |
|
|
return _cut80;
|
62 |
|
|
}else if(lvl==70) {
|
63 |
|
|
return _cut70;
|
64 |
|
|
}else if(lvl==60) {
|
65 |
|
|
return _cut60;
|
66 |
|
|
}else{
|
67 |
|
|
return -99;
|
68 |
|
|
}
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
bool TCElectron::PassID(int lvl) const {
|
72 |
|
|
unsigned c = CutLevel(lvl);
|
73 |
|
|
if (c & 0x01) return true;
|
74 |
|
|
else return false;
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
bool TCElectron::PassIsolation(int lvl) const {
|
78 |
|
|
unsigned c = CutLevel(lvl);
|
79 |
|
|
if (c & 0x02) return true;
|
80 |
|
|
else return false;
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
bool TCElectron::PassConversion(int lvl) const {
|
84 |
|
|
unsigned c = CutLevel(lvl);
|
85 |
|
|
if (c & 0x04) return true;
|
86 |
|
|
else return false;
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
float TCElectron::Dxy(TVector3 *primVtx) const {
|
91 |
|
|
//Calculating track dxy parameter wrt primary vertex
|
92 |
|
|
//d0 = - dxy
|
93 |
|
|
float vx = _vtx.X(), vy = _vtx.Y();
|
94 |
|
|
float px = this->Px(), py = this->Py(), pt = this->Pt();
|
95 |
|
|
float pvx = primVtx->X(), pvy = primVtx->Y();
|
96 |
|
|
float ret = (-(vx-pvx)*py + (vy-pvy)*px)/pt;
|
97 |
|
|
return ret;
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
float TCElectron::Dz(TVector3 *primVtx) const {
|
101 |
|
|
//Calculating track dz parameter wrt primary vertex
|
102 |
|
|
float vx = _vtx.X(), vy = _vtx.Y(), vz = _vtx.Z();
|
103 |
|
|
float px = this->Px(), py = this->Py();
|
104 |
|
|
float pz = this->Pz(), pt = this->Pt();
|
105 |
|
|
float pvx = primVtx->X(), pvy = primVtx->Y(), pvz = primVtx->Z();
|
106 |
|
|
float ret = (vz-pvz)-((vx-pvx)*px +(vy-pvy)*py)/pt*(pz/pt);
|
107 |
|
|
return ret;
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
//------------------------------------------------
|
111 |
|
|
// "set" methods ---------------------------------------------
|
112 |
|
|
//------------------------------------------------------------------------
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
void TCElectron::LoadMap(vector<string> svec){
|
116 |
|
|
//Strings take a lot of memory, so call this to load the cut names into the muon class
|
117 |
|
|
//when you start running your analyzer, otherwise MuonMap will return an empty map
|
118 |
|
|
for (unsigned int i=0; i<_ElectronIndexMap.size(); i++)
|
119 |
|
|
{
|
120 |
|
|
_ElectronTrueMap[svec[i]] = _ElectronIndexMap[i];
|
121 |
|
|
}
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
void TCElectron::SetMap(string s, float v, vector<string>* svec){
|
125 |
|
|
//set the index map internally and the name map externally, for memory saving
|
126 |
|
|
for (unsigned int i = 0; i<svec->size(); i++){
|
127 |
|
|
if (s.compare(svec->at(i)) ==0){
|
128 |
|
|
_ElectronIndexMap[i] = v;
|
129 |
|
|
return;
|
130 |
|
|
}
|
131 |
|
|
}
|
132 |
|
|
svec->push_back(s);
|
133 |
|
|
_ElectronIndexMap[svec->size()-1] = v;
|
134 |
|
|
}
|
135 |
|
|
|
136 |
|
|
void TCElectron::SetVtx(float vx, float vy, float vz) {
|
137 |
|
|
TVector3 v3(vx, vy, vz);
|
138 |
|
|
_vtx = v3;
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
void TCElectron::SetCharge(int c){
|
143 |
|
|
_charge = c;
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
void TCElectron::SetIsEB(bool b) {
|
148 |
|
|
_isEB = b;
|
149 |
|
|
}
|
150 |
|
|
|
151 |
|
|
void TCElectron::SetIsEE(bool b) {
|
152 |
|
|
_isEE = b;
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
void TCElectron::SetIsInGap(bool b) {
|
156 |
|
|
_isInGap = b;
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
void TCElectron::SetCutLevel(int cut, int lvl){
|
160 |
|
|
if(lvl==95){
|
161 |
|
|
_cut95 = cut;
|
162 |
|
|
}else if(lvl==90) {
|
163 |
|
|
_cut90 = cut;
|
164 |
|
|
}else if(lvl==85) {
|
165 |
|
|
_cut85 = cut;
|
166 |
|
|
}else if(lvl==80) {
|
167 |
|
|
_cut80 = cut;
|
168 |
|
|
}else if(lvl==70) {
|
169 |
|
|
_cut70 = cut;
|
170 |
|
|
}else if(lvl==60) {
|
171 |
|
|
_cut60 = cut;
|
172 |
|
|
}
|
173 |
|
|
}
|