-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectionFunctions.cc
More file actions
123 lines (112 loc) · 3.96 KB
/
SelectionFunctions.cc
File metadata and controls
123 lines (112 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include "SelectionFunctions.h"
Bool_t isGoodEvent(Int_t nVertex, std::vector<Double_t> Vertex_Ndof, std::vector<Double_t> Vertex_X, std::vector<Double_t> Vertex_Y, std::vector<Double_t> Vertex_Z, Double_t beamspot_x, Double_t beamspot_y, Bool_t *goodVerticies) {
if (nVertex>0) {
if (nVertex>50) {
//cout<<"nVertex "<<nVertex<<endl;
nVertex=50;
}
for (Int_t i=0; i<nVertex; i++) {
if ( Vertex_Ndof[i]>4 && fabs(Vertex_Z[i])<=24 && fabs(sqrt(pow(Vertex_X[i],2)+pow(Vertex_Y[i],2))-sqrt(pow(beamspot_x,2)+pow(beamspot_y,2)))<=2 ) {
goodVerticies[i] = true;
return true;
}
else {
goodVerticies[i] = false;
}
}
return false;
}
else
return false;
}
Bool_t isGoodEvent(Int_t nVertex, std::vector<Bool_t> Vertex_Fake, std::vector<Double_t> Vertex_Ndof, std::vector<Double_t> Vertex_X, std::vector<Double_t> Vertex_Y, std::vector<Double_t> Vertex_Z, Bool_t *goodVerticies) {
if (nVertex>0) {
for (Int_t i=0; i<nVertex; i++) {
if ( Vertex_Ndof[i]>4 && fabs(Vertex_Z[i])<=24 && sqrt(pow(Vertex_X[i],2)+pow(Vertex_Y[i],2))<=2 && !Vertex_Fake[i] ) {
goodVerticies[i] = true;
return true;
}
else {
goodVerticies[i] = false;
}
}
return false;
}
else
return false;
}
Bool_t Zselection(std::vector<Lepton>& leptonColl, Double_t MET) {
Double_t mass=0;
Double_t temp_mass=0;
if (leptonColl.size()==2) {
for (UInt_t i=0; i<leptonColl.size()-1; i++)
for(UInt_t j=i+1; j<leptonColl.size(); j++) {
if ( leptonColl[i].charge() != leptonColl[j].charge() ) {
temp_mass = (leptonColl[i].lorentzVec() + leptonColl[j].lorentzVec()).M();
if ( fabs(temp_mass-Mass_Z) < fabs(mass-Mass_Z) )
mass=temp_mass;
}
}
if ( MET < 20 && mass > (Mass_Z-20) && mass < (Mass_Z+20) )
return true;
else
return false;
}
else
return false;
}
Bool_t ZandWveto(std::vector<Lepton>& leptonColl, Double_t MET, Double_t METPhi) {
Double_t mass=0;
Double_t temp_mass=0;
Double_t temp_MT=0;
Double_t MT=0;
for(UInt_t w=0; w<leptonColl.size(); w++) {
temp_MT = sqrt(2.*leptonColl[w].lorentzVec().Et()*MET* (1 - cos(leptonColl[w].lorentzVec().Phi()-METPhi)) );
if ( temp_MT > MT)
MT = temp_MT;
}
if (leptonColl.size()>=2) {
for (UInt_t i=0; i<leptonColl.size()-1; i++)
for(UInt_t j=i+1; j<leptonColl.size(); j++) {
if ( leptonColl[i].charge() != leptonColl[j].charge() && leptonColl[i].lorentzVec().Pt()>20 && leptonColl[j].lorentzVec().Pt()>20) {
temp_mass = (leptonColl[i].lorentzVec() + leptonColl[j].lorentzVec()).M();
if ( fabs(temp_mass-Mass_Z) < fabs(mass-Mass_Z) )
mass=temp_mass;
}
}
}
if ( MET < 25 && MT < 25 && (mass < (Mass_Z-20) || mass > (Mass_Z+20) ) )
return false;
else
return true;
}
Bool_t TriggerSelector (std::vector<TString> triggernames, std::vector<string> inputtriggers, std::vector<Bool_t> triggerdecision, std::vector<Int_t> HLTPrescales, Int_t &prescaler) {
for (std::vector<TString>::reverse_iterator it (triggernames.end());
it != std::vector<TString>::reverse_iterator (triggernames.begin());
++it) {
for (UInt_t i=0; i<inputtriggers.size(); i++) {
TString tmpHLT = inputtriggers[i];
if ( tmpHLT.BeginsWith(*it) && triggerdecision[i] ) {
//cout<< inputtriggers[i] << " has fired"<<endl;
//cout<< "is prescaled by "<<HLTPrescales[i]<<endl<<endl;
//prescaler=HLTPrescales[i];
return true;
}
}
}
/*
for (UInt_t i=0; i<inputtriggers.size(); i++) {
cout<<"inputtriggers "<<inputtriggers[i]<<endl;
if ( triggerdecision[i] ) {
TString tmpHLT = inputtriggers[i];
cout<<"passed inputtriggers OK "<<inputtriggers[i]<<endl;
for (std::vector<TString>::iterator it=triggernames.begin(); it != triggernames.end(); ++it)
if ( tmpHLT.BeginsWith(*it) ) {
cout<<"SELEZIONATO OK"<<endl<<endl<<endl;
return true;
}
}
}
*/
return false;
}