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