1 |
bpollack |
1.1 |
#include "TCMuon.h"
|
2 |
|
|
|
3 |
|
|
TCMuon::TCMuon() {
|
4 |
|
|
}
|
5 |
|
|
TCMuon::~TCMuon() {
|
6 |
|
|
}
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
// "get" methods -------------------------------------
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
map<string, float> TCMuon::MuonMap() {
|
13 |
|
|
return _MuonTrueMap;
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
TVector2 TCMuon::P2() const {
|
17 |
|
|
TVector2 v2(this->Px(), this->Py());
|
18 |
|
|
return v2;
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
float TCMuon::PtError() const {
|
22 |
|
|
return _ptError;
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
TVector3 TCMuon::Vtx() const {
|
26 |
|
|
return _vtx;
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
int TCMuon::Charge() const {
|
30 |
|
|
return _charge;
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
float TCMuon::CaloComp() const {
|
34 |
|
|
return _caloComp;
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
float TCMuon::SegComp() const {
|
38 |
|
|
return _segComp;
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
float TCMuon::Dxy(TVector3 *primVtx) const {
|
42 |
|
|
//Calculating track dxy parameter wrt primary vertex
|
43 |
|
|
//d0 = - dxy
|
44 |
|
|
float vx = _vtx.X(), vy = _vtx.Y();
|
45 |
|
|
float px = this->Px(), py = this->Py(), pt = this->Pt();
|
46 |
|
|
float pvx = primVtx->X(), pvy = primVtx->Y();
|
47 |
|
|
float ret = (-(vx-pvx)*py + (vy-pvy)*px)/pt;
|
48 |
|
|
return ret;
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
float TCMuon::Dz(TVector3 *primVtx) const {
|
52 |
|
|
//Calculating track dz parameter wrt primary vertex
|
53 |
|
|
float vx = _vtx.X(), vy = _vtx.Y(), vz = _vtx.Z();
|
54 |
|
|
float px = this->Px(), py = this->Py();
|
55 |
|
|
float pz = this->Pz(), pt = this->Pt();
|
56 |
|
|
float pvx = primVtx->X(), pvy = primVtx->Y(), pvz = primVtx->Z();
|
57 |
|
|
float ret = (vz-pvz)-((vx-pvx)*px +(vy-pvy)*py)/pt*(pz/pt);
|
58 |
|
|
return ret;
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
// "set" methods ---------------------------------------------
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
void TCMuon::LoadMap(vector<string> svec){
|
65 |
|
|
//Strings take a lot of memory, so call this to load the cut names into the muon class
|
66 |
|
|
//when you start running your analyzer, otherwise MuonMap will return an empty map
|
67 |
|
|
for (unsigned int i=0; i<_MuonIndexMap.size(); i++)
|
68 |
|
|
{
|
69 |
|
|
_MuonTrueMap[svec[i]] = _MuonIndexMap[i];
|
70 |
|
|
}
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
void TCMuon::SetMap(string s, float v, vector<string>* svec){
|
74 |
|
|
//set the index map internally and the name map externally, for memory saving
|
75 |
|
|
for (unsigned int i = 0; i<svec->size(); i++){
|
76 |
|
|
if (s.compare(svec->at(i)) ==0){
|
77 |
|
|
_MuonIndexMap[i] = v;
|
78 |
|
|
return;
|
79 |
|
|
}
|
80 |
|
|
}
|
81 |
|
|
svec->push_back(s);
|
82 |
|
|
_MuonIndexMap[svec->size()-1] = v;
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
void TCMuon::SetVtx(float vx, float vy, float vz) {
|
86 |
|
|
TVector3 v3(vx, vy, vz);
|
87 |
|
|
_vtx = v3;
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
void TCMuon::SetPtError(float er){
|
91 |
|
|
_ptError = er;
|
92 |
|
|
}
|
93 |
|
|
void TCMuon::SetCharge(int c){
|
94 |
|
|
_charge = c;
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
void TCMuon::SetCaloComp(float c){
|
98 |
|
|
_caloComp = c;
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
void TCMuon::SetSegComp(float s){
|
102 |
|
|
_segComp = s;
|
103 |
|
|
}
|