1 |
ceballos |
1.1 |
// $Id $
|
2 |
|
|
|
3 |
|
|
#include "MitPhysics/SelMods/interface/HwwExampleAnalysisMod.h"
|
4 |
|
|
#include <TH1D.h>
|
5 |
|
|
#include <TH2D.h>
|
6 |
|
|
#include <TParameter.h>
|
7 |
|
|
#include "MitAna/DataUtil/interface/Debug.h"
|
8 |
|
|
#include "MitAna/DataTree/interface/Names.h"
|
9 |
|
|
#include "MitPhysics/Init/interface/ModNames.h"
|
10 |
|
|
#include "MitAna/DataCont/interface/ObjArray.h"
|
11 |
|
|
#include "MitCommon/MathTools/interface/MathUtils.h"
|
12 |
ceballos |
1.18 |
#include "MitPhysics/Utils/interface/JetTools.h"
|
13 |
ceballos |
1.14 |
#include "MitPhysics/Utils/interface/MetTools.h"
|
14 |
ceballos |
1.1 |
#include "MitAna/DataTree/interface/ParticleCol.h"
|
15 |
|
|
#include "TFile.h"
|
16 |
|
|
#include "TTree.h"
|
17 |
|
|
|
18 |
|
|
using namespace mithep;
|
19 |
|
|
ClassImp(mithep::HwwExampleAnalysisMod)
|
20 |
|
|
|
21 |
|
|
//--------------------------------------------------------------------------------------------------
|
22 |
|
|
HwwExampleAnalysisMod::HwwExampleAnalysisMod(const char *name, const char *title) :
|
23 |
|
|
BaseMod(name,title),
|
24 |
|
|
fMuonBranchName(Names::gkMuonBrn),
|
25 |
|
|
fMetName("NoDefaultNameSet"),
|
26 |
|
|
fCleanJetsName("NoDefaultNameSet"),
|
27 |
ceballos |
1.6 |
fCleanJetsNoPtCutName("NoDefaultNameSet"),
|
28 |
ceballos |
1.5 |
fVertexName(ModNames::gkGoodVertexesName),
|
29 |
ceballos |
1.14 |
fPFCandidatesName(Names::gkPFCandidatesBrn),
|
30 |
ceballos |
1.1 |
fMuons(0),
|
31 |
|
|
fMet(0),
|
32 |
ceballos |
1.6 |
fVertices(0),
|
33 |
ceballos |
1.14 |
fPFCandidates(0),
|
34 |
ceballos |
1.13 |
fNEventsSelected(0)
|
35 |
ceballos |
1.1 |
{
|
36 |
|
|
// Constructor.
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
//--------------------------------------------------------------------------------------------------
|
40 |
|
|
void HwwExampleAnalysisMod::Begin()
|
41 |
|
|
{
|
42 |
|
|
// Run startup code on the client machine. For this module, we dont do
|
43 |
|
|
// anything here.
|
44 |
|
|
}
|
45 |
|
|
|
46 |
|
|
//--------------------------------------------------------------------------------------------------
|
47 |
|
|
void HwwExampleAnalysisMod::SlaveBegin()
|
48 |
|
|
{
|
49 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
50 |
|
|
// we typically initialize histograms and other analysis objects and request
|
51 |
|
|
// branches. For this module, we request a branch of the MitTree.
|
52 |
|
|
|
53 |
|
|
// Load Branches
|
54 |
ceballos |
1.14 |
ReqBranch(fMuonBranchName, fMuons);
|
55 |
|
|
ReqBranch(fPFCandidatesName, fPFCandidates);
|
56 |
ceballos |
1.1 |
|
57 |
|
|
//Create your histograms here
|
58 |
|
|
|
59 |
|
|
//*************************************************************************************************
|
60 |
|
|
// Selection Histograms
|
61 |
|
|
//*************************************************************************************************
|
62 |
ceballos |
1.18 |
AddTH1(fHWWSelection,"hHWWSelection", ";Cut Number;Number of Events", 16, -1.5, 14.5);
|
63 |
|
|
AddTH1(fHWWToEESelection,"hHWWToEESelection", ";Cut Number;Number of Events", 16, -1.5, 14.5);
|
64 |
|
|
AddTH1(fHWWToMuMuSelection,"hHWWToMuMuSelection", ";Cut Number;Number of Events", 16, -1.5, 14.5);
|
65 |
|
|
AddTH1(fHWWToEMuSelection,"hHWWToEMuSelection", ";Cut Number;Number of Events", 16, -1.5, 14.5);
|
66 |
ceballos |
1.1 |
|
67 |
|
|
//***********************************************************************************************
|
68 |
|
|
// Histograms after preselection
|
69 |
|
|
//***********************************************************************************************
|
70 |
|
|
AddTH1(fLeptonEta ,"hLeptonEta",";LeptonEta;Number of Events",100,-5.,5.0);
|
71 |
|
|
AddTH1(fLeptonPtMax ,"hLeptonPtMax",";Lepton P_t Max;Number of Events",150,0.,150.);
|
72 |
|
|
AddTH1(fLeptonPtMin ,"hLeptonPtMin",";Lepton P_t Min;Number of Events",150,0.,150.);
|
73 |
|
|
AddTH1(fMetPtHist ,"hMetPtHist",";Met;Number of Events",150,0.,300.);
|
74 |
|
|
AddTH1(fMetPhiHist ,"hMetPhiHist",";#phi;Number of Events",28,-3.5,3.5);
|
75 |
|
|
AddTH1(fUncorrMetPtHist ,"hUncorrMetPtHist",";Met;Number of Events",150,0.,300.);
|
76 |
|
|
AddTH1(fUncorrMetPhiHist ,"hUncorrMetPhiHist",";#phi;Number of Events",28,-3.5,3.5);
|
77 |
|
|
AddTH1(fDeltaPhiLeptons ,"hDeltaPhiLeptons",";#Delta#phi_{ll};Number of Events",90,0,180);
|
78 |
ceballos |
1.8 |
AddTH1(fDeltaEtaLeptons ,"hDeltaEtaLeptons",";#Delta#eta_{ll};Number of Events",100,-5.,5.0);
|
79 |
ceballos |
1.1 |
AddTH1(fDileptonMass ,"hDileptonMass",";Mass_{ll};Number of Events",150,0.,300.);
|
80 |
|
|
|
81 |
|
|
//***********************************************************************************************
|
82 |
|
|
// N-1 Histograms
|
83 |
|
|
//***********************************************************************************************
|
84 |
|
|
//All events
|
85 |
|
|
AddTH1(fLeptonPtMax_NMinusOne ,"hLeptonPtMax_NMinusOne",
|
86 |
|
|
";Lepton P_t Max;Number of Events",150,0.,150.);
|
87 |
|
|
AddTH1(fLeptonPtMin_NMinusOne ,"hLeptonPtMin_NMinusOne",
|
88 |
|
|
";Lepton P_t Min;Number of Events",150,0.,150.);
|
89 |
|
|
AddTH1(fMetPtHist_NMinusOne ,"hMetPtHist_NMinusOne",
|
90 |
|
|
";Met;Number of Events",150,0.,300.);
|
91 |
|
|
AddTH1(fMetPhiHist_NMinusOne ,"hMetPhiHist_NMinusOne",
|
92 |
|
|
";#phi;Number of Events",28,-3.5,3.5);
|
93 |
|
|
AddTH1(fMETdeltaPhilEtHist_NMinusOne ,"hMETdeltaPhilEtHist_NMinusOne",
|
94 |
|
|
";METdeltaPhilEtHist;Number of Events",150,0.,300.);
|
95 |
|
|
AddTH1(fNCentralJets_NMinusOne ,"hNCentralJets_NMinusOne",
|
96 |
|
|
";Number of Central Jets;Number of Events",6,-0.5,5.5);
|
97 |
|
|
AddTH1(fNSoftMuonsHist_NMinusOne ,"hNSoftMuonsHist_NMinusOne",
|
98 |
|
|
";Number of Dirty Muons; Number of Events",6,-0.5,5.5);
|
99 |
|
|
AddTH1(fDeltaPhiLeptons_NMinusOne ,"hDeltaPhiLeptons_NMinusOne",
|
100 |
|
|
";#Delta#phi_{ll};Number of Events",90,0,180);
|
101 |
|
|
AddTH1(fDeltaEtaLeptons_NMinusOne ,"hDeltaEtaLeptons_NMinusOne",
|
102 |
|
|
";#Delta#eta_{ll};Number of Events",100,-5.0,5.0);
|
103 |
|
|
AddTH1(fDileptonMass_NMinusOne ,"hDileptonMass_NMinusOne",
|
104 |
|
|
";Mass_{ll};Number of Events",150,0.,300.);
|
105 |
|
|
AddTH1(fMinDeltaPhiLeptonMet_NMinusOne ,"hMinDeltaPhiLeptonMet_NMinusOne",
|
106 |
|
|
";Min #Delta#phi_{l,Met};Number of Events",90,0.,180);
|
107 |
|
|
|
108 |
|
|
//***********************************************************************************************
|
109 |
|
|
// After all cuts Histograms
|
110 |
|
|
//***********************************************************************************************
|
111 |
|
|
AddTH1(fMinDeltaPhiLeptonMet_afterCuts ,"hMinDeltaPhiLeptonMet_afterCuts",
|
112 |
|
|
";Min #Delta#phi_{l,Met};Number of Events",90,0.,180);
|
113 |
|
|
AddTH1(fMtLepton1_afterCuts ,"hMtLepton1_afterCuts",
|
114 |
|
|
";M_t (Lepton1,Met);Number of Events",100,0.,200.);
|
115 |
|
|
AddTH1(fMtLepton2_afterCuts ,"hMtLepton2_afterCuts",
|
116 |
|
|
";M_t (Lepton2,Met);Number of Events",100,0.,200.);
|
117 |
|
|
AddTH1(fMtHiggs_afterCuts ,"hMtHiggs_afterCuts",
|
118 |
|
|
";M_t (l1+l2+Met);Number of Events",150,0.,300.);
|
119 |
|
|
AddTH1(fLeptonPtPlusMet_afterCuts ,"hLeptonPtPlusMet_afterCuts",
|
120 |
|
|
";LeptonPtPlusMet;Number of Events",150,0., 300.);
|
121 |
|
|
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
//--------------------------------------------------------------------------------------------------
|
125 |
|
|
void HwwExampleAnalysisMod::Process()
|
126 |
|
|
{
|
127 |
|
|
// Process entries of the tree. For this module, we just load the branches and
|
128 |
|
|
LoadBranch(fMuonBranchName);
|
129 |
ceballos |
1.14 |
LoadBranch(fPFCandidatesName);
|
130 |
|
|
|
131 |
ceballos |
1.1 |
//Obtain all the good objects from the event cleaning module
|
132 |
ceballos |
1.5 |
fVertices = GetObjThisEvt<VertexOArr>(fVertexName);
|
133 |
ceballos |
1.1 |
ObjArray<Muon> *CleanMuons = dynamic_cast<ObjArray<Muon>* >(FindObjThisEvt(ModNames::gkCleanMuonsName));
|
134 |
ceballos |
1.6 |
ObjArray<Electron> *CleanElectrons = dynamic_cast<ObjArray<Electron>* >(FindObjThisEvt(ModNames::gkCleanElectronsName));
|
135 |
ceballos |
1.1 |
ParticleOArr *CleanLeptons = dynamic_cast<mithep::ParticleOArr*>
|
136 |
|
|
(FindObjThisEvt(ModNames::gkMergedLeptonsName));
|
137 |
|
|
ObjArray<Jet> *CleanJets = dynamic_cast<ObjArray<Jet>* >
|
138 |
|
|
(FindObjThisEvt(fCleanJetsName.Data()));
|
139 |
ceballos |
1.6 |
ObjArray<Jet> *CleanJetsNoPtCut = dynamic_cast<ObjArray<Jet>* >
|
140 |
|
|
(FindObjThisEvt(fCleanJetsNoPtCutName.Data()));
|
141 |
ceballos |
1.2 |
TParameter<Double_t> *NNLOWeight = GetObjThisEvt<TParameter<Double_t> >("NNLOWeight");
|
142 |
ceballos |
1.1 |
|
143 |
|
|
MetCol *met = dynamic_cast<ObjArray<Met>* >(FindObjThisEvt(fMetName));
|
144 |
ceballos |
1.14 |
const Met *stdMet = 0;
|
145 |
ceballos |
1.1 |
if (met) {
|
146 |
ceballos |
1.14 |
stdMet = met->At(0);
|
147 |
ceballos |
1.1 |
} else {
|
148 |
|
|
cout << "Error: Met Collection " << fMetName << " could not be loaded.\n";
|
149 |
|
|
return;
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
//***********************************************************************************************
|
153 |
|
|
//Kinematic PreSelection
|
154 |
|
|
//***********************************************************************************************
|
155 |
|
|
// At least two leptons in the event
|
156 |
|
|
if (CleanLeptons->GetEntries() < 2) return;
|
157 |
|
|
// Pt1 > 20 && Pt2 > 10
|
158 |
ceballos |
1.4 |
if(CleanLeptons->At(0)->Pt() <= 20 || CleanLeptons->At(1)->Pt() <= 10) return;
|
159 |
ceballos |
1.1 |
// opposite charge leptons
|
160 |
|
|
if(CleanLeptons->At(0)->Charge() * CleanLeptons->At(1)->Charge() > 0) return;
|
161 |
|
|
|
162 |
|
|
CompositeParticle *dilepton = new CompositeParticle();
|
163 |
|
|
dilepton->AddDaughter(CleanLeptons->At(0));
|
164 |
|
|
dilepton->AddDaughter(CleanLeptons->At(1));
|
165 |
|
|
|
166 |
|
|
//***********************************************************************************************
|
167 |
|
|
//Get Dirty Muons: Non-isolated Muons (exclude the clean muons)
|
168 |
|
|
//***********************************************************************************************
|
169 |
|
|
ObjArray<Muon> *SoftMuons = new ObjArray<Muon>;
|
170 |
|
|
for (UInt_t i=0; i<fMuons->GetEntries(); ++i) {
|
171 |
|
|
const Muon *mu = fMuons->At(i);
|
172 |
ceballos |
1.18 |
if(!MuonTools::PassSoftMuonCut(mu, fVertices, 0.1)) continue;
|
173 |
ceballos |
1.1 |
|
174 |
|
|
bool isCleanMuon = kFALSE;
|
175 |
|
|
for (UInt_t j=0; j<CleanMuons->GetEntries(); j++) {
|
176 |
|
|
if(fMuons->At(i) == CleanMuons->At(j) &&
|
177 |
|
|
CleanMuons->At(j)->Pt() > 10) isCleanMuon = kTRUE;
|
178 |
|
|
}
|
179 |
|
|
if(isCleanMuon == kFALSE) SoftMuons->Add(mu);
|
180 |
|
|
}
|
181 |
|
|
|
182 |
|
|
//***********************************************************************************************
|
183 |
ceballos |
1.6 |
//|Z_vert-Z_l| maximum
|
184 |
|
|
//***********************************************************************************************
|
185 |
ceballos |
1.14 |
std::vector<double> leptonsDz;
|
186 |
ceballos |
1.6 |
double zDiffMax = 0.0;
|
187 |
|
|
if(fVertices->GetEntries() > 0) {
|
188 |
|
|
for (UInt_t j=0; j<CleanMuons->GetEntries(); j++) {
|
189 |
ceballos |
1.14 |
double pDz = CleanMuons->At(j)->BestTrk()->DzCorrected(*fVertices->At(0));
|
190 |
|
|
leptonsDz.push_back(pDz);
|
191 |
ceballos |
1.6 |
}
|
192 |
|
|
for (UInt_t j=0; j<CleanElectrons->GetEntries(); j++) {
|
193 |
ceballos |
1.14 |
double pDz = CleanElectrons->At(j)->GsfTrk()->DzCorrected(*fVertices->At(0));
|
194 |
|
|
leptonsDz.push_back(pDz);
|
195 |
|
|
}
|
196 |
|
|
for(UInt_t t=0; t<leptonsDz.size(); t++) {
|
197 |
|
|
for(UInt_t i=t+1; i<leptonsDz.size(); i++) {
|
198 |
|
|
if(TMath::Abs(leptonsDz[t]-leptonsDz[i]) > zDiffMax) zDiffMax = TMath::Abs(leptonsDz[t]-leptonsDz[i]);
|
199 |
ceballos |
1.7 |
}
|
200 |
ceballos |
1.6 |
}
|
201 |
ceballos |
1.14 |
leptonsDz.clear();
|
202 |
ceballos |
1.6 |
}
|
203 |
|
|
|
204 |
|
|
//***********************************************************************************************
|
205 |
ceballos |
1.1 |
//Define Event Variables
|
206 |
|
|
//***********************************************************************************************
|
207 |
|
|
//delta phi between the 2 leptons in degrees
|
208 |
|
|
double deltaPhiLeptons = MathUtils::DeltaPhi(CleanLeptons->At(0)->Phi(),
|
209 |
|
|
CleanLeptons->At(1)->Phi())* 180.0 / TMath::Pi();
|
210 |
|
|
|
211 |
ceballos |
1.8 |
double deltaEtaLeptons = CleanLeptons->At(0)->Eta() - CleanLeptons->At(1)->Eta();
|
212 |
ceballos |
1.1 |
|
213 |
ceballos |
1.14 |
double deltaPhiDileptonMet = MathUtils::DeltaPhi(stdMet->Phi(),
|
214 |
ceballos |
1.1 |
dilepton->Phi())*180.0 / TMath::Pi();
|
215 |
|
|
|
216 |
ceballos |
1.14 |
double mtHiggs = TMath::Sqrt(2.0*dilepton->Pt() * stdMet->Pt()*
|
217 |
ceballos |
1.1 |
(1.0 - cos(deltaPhiDileptonMet * TMath::Pi() / 180.0)));
|
218 |
|
|
|
219 |
|
|
//angle between MET and closest lepton
|
220 |
ceballos |
1.14 |
double deltaPhiMetLepton[2] = {MathUtils::DeltaPhi(stdMet->Phi(), CleanLeptons->At(0)->Phi()),
|
221 |
|
|
MathUtils::DeltaPhi(stdMet->Phi(), CleanLeptons->At(1)->Phi())};
|
222 |
ceballos |
1.1 |
|
223 |
ceballos |
1.14 |
double mTW[2] = {TMath::Sqrt(2.0*CleanLeptons->At(0)->Pt()*stdMet->Pt()*
|
224 |
ceballos |
1.1 |
(1.0 - cos(deltaPhiMetLepton[0]))),
|
225 |
ceballos |
1.14 |
TMath::Sqrt(2.0*CleanLeptons->At(1)->Pt()*stdMet->Pt()*
|
226 |
ceballos |
1.1 |
(1.0 - cos(deltaPhiMetLepton[1])))};
|
227 |
|
|
|
228 |
|
|
double minDeltaPhiMetLepton = (deltaPhiMetLepton[0] < deltaPhiMetLepton[1])?
|
229 |
|
|
deltaPhiMetLepton[0]:deltaPhiMetLepton[1];
|
230 |
|
|
|
231 |
ceballos |
1.16 |
MetTools metTools(CleanMuons, CleanElectrons, fPFCandidates, fVertices->At(0), 0.1, 8.0, 5.0);
|
232 |
ceballos |
1.14 |
double pMET[2] = {metTools.GetProjectedMet(CleanLeptons,stdMet),
|
233 |
|
|
metTools.GetProjectedTrackMet(CleanLeptons)};
|
234 |
|
|
|
235 |
|
|
double METdeltaPhilEt = TMath::Min(pMET[0],pMET[1]);
|
236 |
ceballos |
1.1 |
|
237 |
ceballos |
1.6 |
//count the number of central Jets for vetoing and b-tagging
|
238 |
|
|
vector<Jet*> sortedJetsAll;
|
239 |
|
|
vector<Jet*> sortedJets;
|
240 |
|
|
vector<Jet*> sortedJetsLowPt;
|
241 |
|
|
for(UInt_t i=0; i<CleanJetsNoPtCut->GetEntries(); i++){
|
242 |
ceballos |
1.17 |
if(CleanJetsNoPtCut->At(i)->RawMom().Pt() <= 7) continue;
|
243 |
ceballos |
1.6 |
Jet* jet_a = new Jet(CleanJetsNoPtCut->At(i)->Px(),
|
244 |
|
|
CleanJetsNoPtCut->At(i)->Py(),
|
245 |
|
|
CleanJetsNoPtCut->At(i)->Pz(),
|
246 |
|
|
CleanJetsNoPtCut->At(i)->E() );
|
247 |
ceballos |
1.14 |
jet_a->SetMatchedMCFlavor(CleanJetsNoPtCut->At(i)->MatchedMCFlavor());
|
248 |
|
|
jet_a->SetCombinedSecondaryVertexBJetTagsDisc(CleanJetsNoPtCut->At(i)->CombinedSecondaryVertexBJetTagsDisc());
|
249 |
|
|
jet_a->SetCombinedSecondaryVertexMVABJetTagsDisc(CleanJetsNoPtCut->At(i)->CombinedSecondaryVertexMVABJetTagsDisc());
|
250 |
|
|
jet_a->SetJetProbabilityBJetTagsDisc(CleanJetsNoPtCut->At(i)->JetProbabilityBJetTagsDisc());
|
251 |
|
|
jet_a->SetJetBProbabilityBJetTagsDisc(CleanJetsNoPtCut->At(i)->JetBProbabilityBJetTagsDisc());
|
252 |
|
|
jet_a->SetTrackCountingHighEffBJetTagsDisc(CleanJetsNoPtCut->At(i)->TrackCountingHighEffBJetTagsDisc());
|
253 |
|
|
jet_a->SetTrackCountingHighPurBJetTagsDisc(CleanJetsNoPtCut->At(i)->TrackCountingHighPurBJetTagsDisc());
|
254 |
|
|
jet_a->SetSimpleSecondaryVertexBJetTagsDisc(CleanJetsNoPtCut->At(i)->SimpleSecondaryVertexBJetTagsDisc());
|
255 |
|
|
jet_a->SetSimpleSecondaryVertexHighEffBJetTagsDisc(CleanJetsNoPtCut->At(i)->SimpleSecondaryVertexHighEffBJetTagsDisc());
|
256 |
|
|
jet_a->SetSimpleSecondaryVertexHighPurBJetTagsDisc(CleanJetsNoPtCut->At(i)->SimpleSecondaryVertexHighPurBJetTagsDisc());
|
257 |
ceballos |
1.6 |
sortedJetsAll.push_back(jet_a);
|
258 |
|
|
}
|
259 |
|
|
|
260 |
ceballos |
1.1 |
for(UInt_t i=0; i<CleanJets->GetEntries(); i++){
|
261 |
ceballos |
1.9 |
if(TMath::Abs(CleanJets->At(i)->Eta()) < 5.0 &&
|
262 |
ceballos |
1.14 |
CleanJets->At(i)->Pt() > 30.0){
|
263 |
ceballos |
1.6 |
Jet* jet_b = new Jet(CleanJets->At(i)->Px(),
|
264 |
|
|
CleanJets->At(i)->Py(),
|
265 |
|
|
CleanJets->At(i)->Pz(),
|
266 |
|
|
CleanJets->At(i)->E() );
|
267 |
|
|
sortedJets.push_back(jet_b);
|
268 |
|
|
}
|
269 |
|
|
}
|
270 |
|
|
|
271 |
|
|
for(UInt_t i=0; i<sortedJetsAll.size(); i++){
|
272 |
|
|
bool overlap = kFALSE;
|
273 |
|
|
for(UInt_t j=0; j<sortedJets.size(); j++){
|
274 |
|
|
if(sortedJetsAll[i]->Pt() == sortedJets[j]->Pt() ||
|
275 |
|
|
(sortedJetsAll[i]->CombinedSecondaryVertexBJetTagsDisc() == sortedJets[j]->CombinedSecondaryVertexBJetTagsDisc() &&
|
276 |
|
|
sortedJetsAll[i]->JetBProbabilityBJetTagsDisc() == sortedJets[j]->JetBProbabilityBJetTagsDisc() &&
|
277 |
|
|
sortedJetsAll[i]->TrackCountingHighPurBJetTagsDisc() == sortedJets[j]->TrackCountingHighPurBJetTagsDisc())
|
278 |
|
|
) {
|
279 |
|
|
sortedJets[j]->SetMatchedMCFlavor(sortedJetsAll[i]->MatchedMCFlavor());
|
280 |
|
|
sortedJets[j]->SetCombinedSecondaryVertexBJetTagsDisc(sortedJetsAll[i]->CombinedSecondaryVertexBJetTagsDisc());
|
281 |
|
|
sortedJets[j]->SetCombinedSecondaryVertexMVABJetTagsDisc(sortedJetsAll[i]->CombinedSecondaryVertexMVABJetTagsDisc());
|
282 |
|
|
sortedJets[j]->SetJetProbabilityBJetTagsDisc(sortedJetsAll[i]->JetProbabilityBJetTagsDisc());
|
283 |
|
|
sortedJets[j]->SetJetBProbabilityBJetTagsDisc(sortedJetsAll[i]->JetBProbabilityBJetTagsDisc());
|
284 |
|
|
sortedJets[j]->SetTrackCountingHighEffBJetTagsDisc(sortedJetsAll[i]->TrackCountingHighEffBJetTagsDisc());
|
285 |
|
|
sortedJets[j]->SetTrackCountingHighPurBJetTagsDisc(sortedJetsAll[i]->TrackCountingHighPurBJetTagsDisc());
|
286 |
|
|
sortedJets[j]->SetSimpleSecondaryVertexBJetTagsDisc(sortedJetsAll[i]->SimpleSecondaryVertexBJetTagsDisc());
|
287 |
|
|
sortedJets[j]->SetSimpleSecondaryVertexHighEffBJetTagsDisc(sortedJetsAll[i]->SimpleSecondaryVertexHighEffBJetTagsDisc());
|
288 |
|
|
sortedJets[j]->SetSimpleSecondaryVertexHighPurBJetTagsDisc(sortedJetsAll[i]->SimpleSecondaryVertexHighPurBJetTagsDisc());
|
289 |
|
|
overlap = kTRUE;
|
290 |
|
|
break;
|
291 |
|
|
}
|
292 |
|
|
}
|
293 |
|
|
if(overlap == kFALSE){
|
294 |
|
|
sortedJetsLowPt.push_back(sortedJetsAll[i]);
|
295 |
|
|
}
|
296 |
|
|
}
|
297 |
|
|
double maxBtag = -99999.;
|
298 |
|
|
double imaxBtag = -1;
|
299 |
|
|
for(UInt_t i=0; i<sortedJetsLowPt.size(); i++){
|
300 |
|
|
if(sortedJetsLowPt[i]->TrackCountingHighEffBJetTagsDisc() > maxBtag){
|
301 |
|
|
maxBtag = sortedJetsLowPt[i]->TrackCountingHighEffBJetTagsDisc();
|
302 |
|
|
imaxBtag = i;
|
303 |
ceballos |
1.1 |
}
|
304 |
|
|
}
|
305 |
|
|
|
306 |
|
|
//Lepton Type
|
307 |
|
|
int finalstateType = -1;
|
308 |
|
|
if (CleanLeptons->At(0)->ObjType() == kMuon && CleanLeptons->At(1)->ObjType() == kMuon ){ // mumu
|
309 |
|
|
finalstateType = 10;
|
310 |
|
|
} else if(CleanLeptons->At(0)->ObjType() == kElectron && CleanLeptons->At(1)->ObjType() == kElectron ){ // ee
|
311 |
|
|
finalstateType = 11;
|
312 |
|
|
} else if((CleanLeptons->At(0)->ObjType() == kElectron && CleanLeptons->At(1)->ObjType() == kMuon) ||
|
313 |
|
|
(CleanLeptons->At(1)->ObjType() == kElectron && CleanLeptons->At(0)->ObjType() == kMuon)) {
|
314 |
|
|
finalstateType = 12;
|
315 |
|
|
} else {
|
316 |
|
|
cerr << "Error: finalstate lepton type not supported\n";
|
317 |
|
|
}
|
318 |
|
|
|
319 |
ceballos |
1.18 |
double deltaPhiLLJet = 0.0;
|
320 |
|
|
if(sortedJetsAll.size() > 0 && sortedJetsAll[0]->Pt() > 15.0 && (finalstateType == 10 || finalstateType == 11)){
|
321 |
|
|
deltaPhiLLJet = MathUtils::DeltaPhi(dilepton->Phi(), sortedJetsAll[0]->Phi())*180.0/TMath::Pi();
|
322 |
|
|
}
|
323 |
|
|
|
324 |
ceballos |
1.1 |
//*********************************************************************************************
|
325 |
|
|
//Define Cuts
|
326 |
|
|
//*********************************************************************************************
|
327 |
ceballos |
1.18 |
const int nCuts = 15;
|
328 |
ceballos |
1.7 |
bool passCut[nCuts] = {false, false, false, false, false,
|
329 |
ceballos |
1.18 |
false, false, false, false, false,
|
330 |
|
|
false, false, false, false, false};
|
331 |
ceballos |
1.1 |
|
332 |
ceballos |
1.14 |
Bool_t PreselPtCut = kTRUE;
|
333 |
|
|
if(CleanLeptons->At(0)->Pt() <= 20) PreselPtCut = kFALSE;
|
334 |
|
|
if(CleanLeptons->At(1)->Pt() <= 10) PreselPtCut = kFALSE;
|
335 |
ceballos |
1.17 |
//if(CleanLeptons->At(1)->ObjType() == kElectron && CleanLeptons->At(1)->Pt() <= 15) PreselPtCut = kFALSE;
|
336 |
ceballos |
1.14 |
if(PreselPtCut == kTRUE) passCut[0] = true;
|
337 |
ceballos |
1.1 |
|
338 |
ceballos |
1.18 |
if(stdMet->Pt() > 20.0) passCut[1] = true;
|
339 |
ceballos |
1.1 |
|
340 |
ceballos |
1.18 |
if(dilepton->Mass() > 12.0) passCut[2] = true;
|
341 |
ceballos |
1.1 |
|
342 |
ceballos |
1.18 |
if(sortedJets.size() < 1) passCut[5] = true;
|
343 |
|
|
|
344 |
|
|
if(deltaPhiLLJet < 165.0) passCut[6] = true;
|
345 |
ceballos |
1.7 |
|
346 |
|
|
if(SoftMuons->GetEntries() == 0) passCut[7] = true;
|
347 |
ceballos |
1.6 |
|
348 |
ceballos |
1.7 |
if(CleanLeptons->GetEntries() == 2) passCut[8] = true;
|
349 |
ceballos |
1.1 |
|
350 |
ceballos |
1.7 |
if(maxBtag < 2.1) passCut[9] = true;
|
351 |
ceballos |
1.1 |
|
352 |
|
|
if (finalstateType == 10 || finalstateType == 11){ // mumu/ee
|
353 |
ceballos |
1.18 |
if(fabs(dilepton->Mass()-91.1876) > 15.0) passCut[3] = true;
|
354 |
|
|
if(METdeltaPhilEt > 40) passCut[4] = true;
|
355 |
ceballos |
1.1 |
}
|
356 |
|
|
else if(finalstateType == 12) { // emu
|
357 |
ceballos |
1.18 |
passCut[3] = true;
|
358 |
|
|
if(METdeltaPhilEt > 20) passCut[4] = true;
|
359 |
ceballos |
1.1 |
}
|
360 |
ceballos |
1.13 |
|
361 |
ceballos |
1.18 |
if(CleanLeptons->At(0)->Pt() > 30) passCut[10] = true;
|
362 |
|
|
|
363 |
|
|
if(CleanLeptons->At(1)->Pt() > 25) passCut[11] = true;
|
364 |
|
|
|
365 |
|
|
if(dilepton->Mass() < 50) passCut[12] = true;
|
366 |
|
|
|
367 |
|
|
if(mtHiggs > 90.0 && mtHiggs < 160.0) passCut[13] = true;
|
368 |
|
|
|
369 |
|
|
if(deltaPhiLeptons < 60.0) passCut[14] = true;
|
370 |
|
|
|
371 |
ceballos |
1.1 |
//*********************************************************************************************
|
372 |
|
|
//Make Selection Histograms. Number of events passing each level of cut
|
373 |
|
|
//*********************************************************************************************
|
374 |
|
|
bool passAllCuts = true;
|
375 |
|
|
for(int c=0; c<nCuts; c++) passAllCuts = passAllCuts & passCut[c];
|
376 |
ceballos |
1.13 |
if(passAllCuts) fNEventsSelected++;
|
377 |
|
|
|
378 |
ceballos |
1.1 |
//Cut Selection Histograms
|
379 |
ceballos |
1.2 |
fHWWSelection->Fill(-1,NNLOWeight->GetVal());
|
380 |
ceballos |
1.1 |
if (finalstateType == 10 )
|
381 |
ceballos |
1.2 |
fHWWToMuMuSelection->Fill(-1,NNLOWeight->GetVal());
|
382 |
ceballos |
1.1 |
else if(finalstateType == 11 )
|
383 |
ceballos |
1.2 |
fHWWToEESelection->Fill(-1,NNLOWeight->GetVal());
|
384 |
ceballos |
1.1 |
else if(finalstateType == 12 )
|
385 |
ceballos |
1.2 |
fHWWToEMuSelection->Fill(-1,NNLOWeight->GetVal());
|
386 |
ceballos |
1.1 |
|
387 |
|
|
for (int k=0;k<nCuts;k++) {
|
388 |
|
|
bool pass = true;
|
389 |
|
|
bool passPreviousCut = true;
|
390 |
|
|
for (int p=0;p<=k;p++) {
|
391 |
|
|
pass = (pass && passCut[p]);
|
392 |
|
|
if (p<k)
|
393 |
|
|
passPreviousCut = (passPreviousCut&& passCut[p]);
|
394 |
|
|
}
|
395 |
|
|
|
396 |
|
|
if (pass) {
|
397 |
ceballos |
1.2 |
fHWWSelection->Fill(k,NNLOWeight->GetVal());
|
398 |
ceballos |
1.1 |
if (finalstateType == 10 )
|
399 |
ceballos |
1.2 |
fHWWToMuMuSelection->Fill(k,NNLOWeight->GetVal());
|
400 |
ceballos |
1.1 |
else if(finalstateType == 11)
|
401 |
ceballos |
1.2 |
fHWWToEESelection->Fill(k,NNLOWeight->GetVal());
|
402 |
ceballos |
1.1 |
else if(finalstateType == 12)
|
403 |
ceballos |
1.2 |
fHWWToEMuSelection->Fill(k,NNLOWeight->GetVal());
|
404 |
ceballos |
1.1 |
}
|
405 |
|
|
}
|
406 |
|
|
|
407 |
|
|
//*****************************************************************************************
|
408 |
|
|
//Make Preselection Histograms
|
409 |
|
|
//*****************************************************************************************
|
410 |
ceballos |
1.2 |
fLeptonEta->Fill(CleanLeptons->At(0)->Eta(),NNLOWeight->GetVal());
|
411 |
|
|
fLeptonEta->Fill(CleanLeptons->At(1)->Eta(),NNLOWeight->GetVal());
|
412 |
|
|
fLeptonPtMax->Fill(CleanLeptons->At(0)->Pt(),NNLOWeight->GetVal());
|
413 |
|
|
fLeptonPtMin->Fill(CleanLeptons->At(1)->Pt(),NNLOWeight->GetVal());
|
414 |
ceballos |
1.14 |
fMetPtHist->Fill(stdMet->Pt(),NNLOWeight->GetVal());
|
415 |
|
|
fMetPhiHist->Fill(stdMet->Phi(),NNLOWeight->GetVal());
|
416 |
ceballos |
1.2 |
fDeltaPhiLeptons->Fill(deltaPhiLeptons,NNLOWeight->GetVal());
|
417 |
|
|
fDeltaEtaLeptons->Fill(deltaEtaLeptons,NNLOWeight->GetVal());
|
418 |
|
|
fDileptonMass->Fill(dilepton->Mass(),NNLOWeight->GetVal());
|
419 |
ceballos |
1.1 |
|
420 |
|
|
//*********************************************************************************************
|
421 |
|
|
// N-1 Histograms
|
422 |
|
|
//*********************************************************************************************
|
423 |
|
|
bool pass;;
|
424 |
|
|
|
425 |
|
|
//N Jet Veto
|
426 |
|
|
pass = true;
|
427 |
|
|
for (int k=0;k<nCuts;k++) {
|
428 |
ceballos |
1.18 |
if (k != 5) pass = (pass && passCut[k]);
|
429 |
ceballos |
1.1 |
}
|
430 |
|
|
if (pass) {
|
431 |
ceballos |
1.6 |
fNCentralJets_NMinusOne->Fill(sortedJets.size(),NNLOWeight->GetVal());
|
432 |
ceballos |
1.1 |
}
|
433 |
|
|
|
434 |
|
|
// Final Met Cut
|
435 |
|
|
pass = true;
|
436 |
|
|
for (int k=0;k<nCuts;k++) {
|
437 |
ceballos |
1.18 |
if (k != 4) pass = (pass && passCut[k]);
|
438 |
ceballos |
1.1 |
}
|
439 |
|
|
if (pass) {
|
440 |
ceballos |
1.14 |
fMetPtHist_NMinusOne->Fill(stdMet->Pt(),NNLOWeight->GetVal());
|
441 |
ceballos |
1.1 |
}
|
442 |
|
|
|
443 |
|
|
// dilepton mass
|
444 |
|
|
pass = true;
|
445 |
|
|
for (int k=0;k<nCuts;k++) {
|
446 |
ceballos |
1.18 |
if (k != 2 && k != 3) pass = (pass && passCut[k]);
|
447 |
ceballos |
1.1 |
}
|
448 |
|
|
if (pass) {
|
449 |
ceballos |
1.2 |
fDileptonMass_NMinusOne->Fill(dilepton->Mass(),NNLOWeight->GetVal());
|
450 |
ceballos |
1.1 |
}
|
451 |
|
|
|
452 |
|
|
// Lepton Pt Max, Lepton Pt Min, DeltaPhiLeptons
|
453 |
|
|
pass = true;
|
454 |
|
|
for (int k=0;k<nCuts;k++) {
|
455 |
ceballos |
1.12 |
if (k != 0)
|
456 |
|
|
pass = (pass && passCut[k]);
|
457 |
ceballos |
1.1 |
}
|
458 |
|
|
if (pass) {
|
459 |
ceballos |
1.2 |
fLeptonPtMax_NMinusOne->Fill(CleanLeptons->At(0)->Pt(),NNLOWeight->GetVal());
|
460 |
|
|
fLeptonPtMin_NMinusOne->Fill(CleanLeptons->At(1)->Pt(),NNLOWeight->GetVal());
|
461 |
|
|
fDeltaPhiLeptons_NMinusOne->Fill(deltaPhiLeptons,NNLOWeight->GetVal());
|
462 |
ceballos |
1.1 |
}
|
463 |
|
|
|
464 |
|
|
// NSoftMuons
|
465 |
|
|
pass = true;
|
466 |
|
|
for (int k=0;k<nCuts;k++) {
|
467 |
ceballos |
1.18 |
if (k != 7) pass = (pass && passCut[k]);
|
468 |
ceballos |
1.1 |
}
|
469 |
|
|
if (pass) {
|
470 |
ceballos |
1.2 |
fNSoftMuonsHist_NMinusOne->Fill(SoftMuons->GetEntries(),NNLOWeight->GetVal());
|
471 |
ceballos |
1.1 |
}
|
472 |
|
|
|
473 |
|
|
//*********************************************************************************************
|
474 |
|
|
//Plots after all Cuts
|
475 |
|
|
//*********************************************************************************************
|
476 |
|
|
if (passAllCuts) {
|
477 |
ceballos |
1.2 |
fMinDeltaPhiLeptonMet_afterCuts->Fill(minDeltaPhiMetLepton,NNLOWeight->GetVal());
|
478 |
|
|
fMtLepton1_afterCuts->Fill(mTW[0],NNLOWeight->GetVal());
|
479 |
|
|
fMtLepton2_afterCuts->Fill(mTW[1],NNLOWeight->GetVal());
|
480 |
|
|
fMtHiggs_afterCuts->Fill(mtHiggs,NNLOWeight->GetVal());
|
481 |
ceballos |
1.14 |
fLeptonPtPlusMet_afterCuts->Fill(CleanLeptons->At(0)->Pt()+CleanLeptons->At(1)->Pt()+stdMet->Pt(),NNLOWeight->GetVal());
|
482 |
ceballos |
1.1 |
}
|
483 |
|
|
|
484 |
|
|
delete dilepton;
|
485 |
|
|
delete SoftMuons;
|
486 |
ceballos |
1.6 |
for(UInt_t i=0; i<sortedJets.size(); i++) delete sortedJets[i];
|
487 |
|
|
for(UInt_t i=0; i<sortedJetsAll.size(); i++) delete sortedJetsAll[i];
|
488 |
ceballos |
1.1 |
return;
|
489 |
|
|
}
|
490 |
|
|
|
491 |
|
|
//--------------------------------------------------------------------------------------------------
|
492 |
|
|
void HwwExampleAnalysisMod::SlaveTerminate()
|
493 |
|
|
{
|
494 |
|
|
|
495 |
|
|
// Run finishing code on the computer (slave) that did the analysis. For this
|
496 |
|
|
// module, we dont do anything here.
|
497 |
ceballos |
1.13 |
cout << "selected events on HwwExampleAnalysisMod: " << fNEventsSelected << endl;
|
498 |
ceballos |
1.1 |
|
499 |
|
|
}
|
500 |
|
|
//--------------------------------------------------------------------------------------------------
|
501 |
|
|
void HwwExampleAnalysisMod::Terminate()
|
502 |
|
|
{
|
503 |
|
|
// Run finishing code on the client computer. For this module, we dont do
|
504 |
|
|
// anything here.
|
505 |
|
|
|
506 |
|
|
}
|