1 |
ceballos |
1.1 |
// $Id $
|
2 |
|
|
|
3 |
|
|
#include "MitPhysics/SelMods/interface/WBFExampleAnalysisMod.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 |
|
|
#include "MitAna/DataTree/interface/ParticleCol.h"
|
13 |
|
|
#include "TFile.h"
|
14 |
|
|
#include "TTree.h"
|
15 |
|
|
|
16 |
|
|
using namespace mithep;
|
17 |
|
|
ClassImp(mithep::WBFExampleAnalysisMod)
|
18 |
|
|
|
19 |
|
|
//--------------------------------------------------------------------------------------------------
|
20 |
|
|
WBFExampleAnalysisMod::WBFExampleAnalysisMod(const char *name, const char *title) :
|
21 |
|
|
BaseMod(name,title),
|
22 |
|
|
fMetName("NoDefaultNameSet"),
|
23 |
|
|
fCleanJetsName("NoDefaultNameSet"),
|
24 |
|
|
fVertexName(ModNames::gkGoodVertexesName),
|
25 |
|
|
fMet(0),
|
26 |
|
|
fVertices(0),
|
27 |
|
|
fJetPtMax(30),
|
28 |
|
|
fJetPtMin(30),
|
29 |
|
|
fDeltaEtaMin(4),
|
30 |
|
|
fDiJetMassMin(600)
|
31 |
|
|
{
|
32 |
|
|
// Constructor.
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
//--------------------------------------------------------------------------------------------------
|
36 |
|
|
void WBFExampleAnalysisMod::Begin()
|
37 |
|
|
{
|
38 |
|
|
// Run startup code on the client machine. For this module, we dont do
|
39 |
|
|
// anything here.
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
//--------------------------------------------------------------------------------------------------
|
43 |
|
|
void WBFExampleAnalysisMod::SlaveBegin()
|
44 |
|
|
{
|
45 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
46 |
|
|
// we typically initialize histograms and other analysis objects and request
|
47 |
|
|
// branches. For this module, we request a branch of the MitTree.
|
48 |
|
|
|
49 |
|
|
//Create your histograms here
|
50 |
|
|
|
51 |
|
|
//*************************************************************************************************
|
52 |
|
|
// Selection Histograms
|
53 |
|
|
//*************************************************************************************************
|
54 |
|
|
AddTH1(fWBFSelection,"fWBFSelection", ";Cut Number;Number of Events", 6, -1.5, 4.5);
|
55 |
|
|
|
56 |
|
|
//***********************************************************************************************
|
57 |
|
|
// N-1 Histograms
|
58 |
|
|
//***********************************************************************************************
|
59 |
|
|
//All events
|
60 |
|
|
AddTH1(fWBFPtJetMax_NMinusOne, "fWBFPtJetMax_NMinusOne", ";Pt Jet Max;Number of Events",400,0.,400.);
|
61 |
|
|
AddTH1(fWBFPtJetMin_NMinusOne, "fWBFPtJetMin_NMinusOne", ";Pt Jet Min;Number of Events",400,0.,400.);
|
62 |
|
|
AddTH1(fWBFdeltaEta_NMinusOne, "fWBFdeltaEta_NMinusOne", ";Delta Eta;Number of Events",100,0.,10.);
|
63 |
|
|
AddTH1(fWBFdijetMass_NMinusOne,"fWBFdijetMass_NMinusOne",";DiJet Mass;Number of Events",400,0.,4000.);
|
64 |
|
|
|
65 |
|
|
//***********************************************************************************************
|
66 |
|
|
// After all cuts Histograms
|
67 |
|
|
//***********************************************************************************************
|
68 |
|
|
AddTH1(fWBFSSMass_afterCuts,"fWBFSSMass_afterCuts",";SS dilepton Mass;Number of Events",200,0.,400);
|
69 |
|
|
AddTH1(fWBFSSDeltaPhi_afterCuts,"fWBFOSDeltaPhi_afterCuts",";SS DeltaPhi 2l;Number of Events",90,0.,180);
|
70 |
|
|
AddTH1(fWBFOSMass_afterCuts,"fWBFSSMass_afterCuts",";OS dilepton Mass;Number of Events",200,0.,400);
|
71 |
|
|
AddTH1(fWBFSSDeltaPhi_afterCuts,"fWBFOSDeltaPhi_afterCuts",";OS DeltaPhi 2l;Number of Events",90,0.,180);
|
72 |
|
|
AddTH1(fWBFDiPhotonMass_afterCuts,"fWBFDiPhotonMass_afterCuts",";DiPhoton Mass;Number of Events",400,0.,400);
|
73 |
|
|
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
//--------------------------------------------------------------------------------------------------
|
77 |
|
|
void WBFExampleAnalysisMod::Process()
|
78 |
|
|
{
|
79 |
|
|
//Obtain all the good objects from the event cleaning module
|
80 |
|
|
fVertices = GetObjThisEvt<VertexOArr>(fVertexName);
|
81 |
|
|
ParticleOArr *CleanLeptons = dynamic_cast<mithep::ParticleOArr*>
|
82 |
|
|
(FindObjThisEvt(ModNames::gkMergedLeptonsName));
|
83 |
|
|
PhotonOArr *CleanPhotons = GetObjThisEvt<PhotonOArr>(ModNames::gkMCPhotonsName);
|
84 |
|
|
ObjArray<Jet> *CleanJets = dynamic_cast<ObjArray<Jet>* >
|
85 |
|
|
(FindObjThisEvt(fCleanJetsName.Data()));
|
86 |
|
|
TParameter<Double_t> *NNLOWeight = GetObjThisEvt<TParameter<Double_t> >("NNLOWeight");
|
87 |
|
|
|
88 |
|
|
MetCol *met = dynamic_cast<ObjArray<Met>* >(FindObjThisEvt(fMetName));
|
89 |
|
|
const Met *caloMet = 0;
|
90 |
|
|
if (met) {
|
91 |
|
|
caloMet = met->At(0);
|
92 |
|
|
} else {
|
93 |
|
|
cout << "Error: Met Collection " << fMetName << " could not be loaded.\n";
|
94 |
|
|
return;
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
if(CleanJets->GetEntries() < 2) return;
|
98 |
|
|
|
99 |
|
|
//*********************************************************************************************
|
100 |
|
|
//Define Cuts
|
101 |
|
|
//*********************************************************************************************
|
102 |
|
|
const int nCuts = 7;
|
103 |
|
|
bool passCut[nCuts] = {false, false, false, false, false};
|
104 |
|
|
|
105 |
|
|
// ptjet max cut
|
106 |
|
|
if(CleanJets->At(0)->Pt() > fJetPtMax) passCut[0] = true;
|
107 |
|
|
|
108 |
|
|
// ptjet min cut
|
109 |
|
|
if(CleanJets->At(1)->Pt() > fJetPtMin) passCut[1] = true;
|
110 |
|
|
|
111 |
|
|
// this cut is always applied
|
112 |
|
|
if(CleanJets->At(0)->Eta()*CleanJets->At(1)->Eta() < 0) passCut[2] = true;
|
113 |
|
|
|
114 |
|
|
// deltaEta cut
|
115 |
|
|
double deltaEta = TMath::Abs(CleanJets->At(0)->Eta()-CleanJets->At(1)->Eta());
|
116 |
|
|
if(deltaEta > fDeltaEtaMin) passCut[3] = true;
|
117 |
|
|
|
118 |
|
|
// dijet mass cut
|
119 |
|
|
CompositeParticle dijet;
|
120 |
|
|
dijet.AddDaughter(CleanJets->At(0));
|
121 |
|
|
dijet.AddDaughter(CleanJets->At(1));
|
122 |
|
|
if(dijet.Mass() > fDiJetMassMin) passCut[4] = true;
|
123 |
|
|
|
124 |
|
|
//*********************************************************************************************
|
125 |
|
|
//Make Selection Histograms. Number of events passing each level of cut
|
126 |
|
|
//*********************************************************************************************
|
127 |
|
|
bool passAllCuts = true;
|
128 |
|
|
for(int c=0; c<nCuts; c++) passAllCuts = passAllCuts & passCut[c];
|
129 |
|
|
|
130 |
|
|
//Cut Selection Histograms
|
131 |
|
|
fWBFSelection->Fill(-1,NNLOWeight->GetVal());
|
132 |
|
|
for (int k=0;k<nCuts;k++) {
|
133 |
|
|
bool pass = true;
|
134 |
|
|
bool passPreviousCut = true;
|
135 |
|
|
for (int p=0;p<=k;p++) {
|
136 |
|
|
pass = (pass && passCut[p]);
|
137 |
|
|
if (p<k)
|
138 |
|
|
passPreviousCut = (passPreviousCut&& passCut[p]);
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
if (pass) {
|
142 |
|
|
fWBFSelection->Fill(k,NNLOWeight->GetVal());
|
143 |
|
|
}
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
//*********************************************************************************************
|
147 |
|
|
// N-1 Histograms
|
148 |
|
|
//*********************************************************************************************
|
149 |
|
|
// N-1 ptjet max
|
150 |
|
|
bool pass = true;
|
151 |
|
|
for (int k=0;k<nCuts;k++) {
|
152 |
|
|
if (k != 0) {
|
153 |
|
|
pass = (pass && passCut[k]);
|
154 |
|
|
}
|
155 |
|
|
}
|
156 |
|
|
if (pass) {
|
157 |
|
|
fWBFPtJetMax_NMinusOne->Fill(TMath::Min(CleanJets->At(0)->Pt(),399.999),NNLOWeight->GetVal());
|
158 |
|
|
}
|
159 |
|
|
|
160 |
|
|
// N-1 ptjet min
|
161 |
|
|
pass = true;
|
162 |
|
|
for (int k=0;k<nCuts;k++) {
|
163 |
|
|
if (k != 1) {
|
164 |
|
|
pass = (pass && passCut[k]);
|
165 |
|
|
}
|
166 |
|
|
}
|
167 |
|
|
if (pass) {
|
168 |
|
|
fWBFPtJetMin_NMinusOne->Fill(TMath::Min(CleanJets->At(1)->Pt(),399.999),NNLOWeight->GetVal());
|
169 |
|
|
}
|
170 |
|
|
|
171 |
|
|
// N-1 deltaEta
|
172 |
|
|
pass = true;
|
173 |
|
|
for (int k=0;k<nCuts;k++) {
|
174 |
|
|
if (k != 3) {
|
175 |
|
|
pass = (pass && passCut[k]);
|
176 |
|
|
}
|
177 |
|
|
}
|
178 |
|
|
if (pass) {
|
179 |
|
|
fWBFdeltaEta_NMinusOne->Fill(TMath::Min(deltaEta,9.999),NNLOWeight->GetVal());
|
180 |
|
|
}
|
181 |
|
|
|
182 |
|
|
// N-1 dijet mass
|
183 |
|
|
pass = true;
|
184 |
|
|
for (int k=0;k<nCuts;k++) {
|
185 |
|
|
if (k != 4) {
|
186 |
|
|
pass = (pass && passCut[k]);
|
187 |
|
|
}
|
188 |
|
|
}
|
189 |
|
|
if (pass) {
|
190 |
|
|
fWBFdijetMass_NMinusOne->Fill(TMath::Min(dijet.Mass(),3999.999),NNLOWeight->GetVal());
|
191 |
|
|
}
|
192 |
|
|
|
193 |
|
|
//*********************************************************************************************
|
194 |
|
|
//Plots after all Cuts
|
195 |
|
|
//*********************************************************************************************
|
196 |
|
|
if (passAllCuts) {
|
197 |
|
|
// Distributions for dileptons events
|
198 |
|
|
if (CleanLeptons->GetEntries() >= 2 &&
|
199 |
|
|
CleanLeptons->At(0)->Pt() > 20 && CleanLeptons->At(1)->Pt() > 10){
|
200 |
|
|
|
201 |
|
|
CompositeParticle dilepton;
|
202 |
|
|
dilepton.AddDaughter(CleanLeptons->At(0));
|
203 |
|
|
dilepton.AddDaughter(CleanLeptons->At(1));
|
204 |
|
|
double deltaPhiLeptons = MathUtils::DeltaPhi(CleanLeptons->At(0)->Phi(),
|
205 |
|
|
CleanLeptons->At(1)->Phi())* 180.0 / TMath::Pi();
|
206 |
|
|
|
207 |
|
|
if(CleanLeptons->At(0)->Charge() * CleanLeptons->At(1)->Charge() > 0){
|
208 |
|
|
fWBFSSMass_afterCuts->Fill(TMath::Min(dilepton.Mass(),399.999),NNLOWeight->GetVal());
|
209 |
|
|
fWBFSSDeltaPhi_afterCuts->Fill(deltaPhiLeptons,NNLOWeight->GetVal());
|
210 |
|
|
}
|
211 |
|
|
else {
|
212 |
|
|
fWBFOSMass_afterCuts->Fill(TMath::Min(dilepton.Mass(),399.999),NNLOWeight->GetVal());
|
213 |
|
|
fWBFOSDeltaPhi_afterCuts->Fill(deltaPhiLeptons,NNLOWeight->GetVal());
|
214 |
|
|
}
|
215 |
|
|
}
|
216 |
|
|
|
217 |
|
|
// Distributions for diphotons events
|
218 |
|
|
if(CleanPhotons->GetEntries() >= 2 &&
|
219 |
|
|
CleanPhotons->At(0)->Pt() > 30 && CleanPhotons->At(1)->Pt() > 30){
|
220 |
|
|
CompositeParticle diphoton;
|
221 |
|
|
diphoton.AddDaughter(CleanPhotons->At(0));
|
222 |
|
|
diphoton.AddDaughter(CleanPhotons->At(1));
|
223 |
|
|
fWBFDiPhotonMass_afterCuts->Fill(TMath::Min(diphoton.Mass(),399.999),NNLOWeight->GetVal());
|
224 |
|
|
}
|
225 |
|
|
}
|
226 |
|
|
|
227 |
|
|
return;
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
//--------------------------------------------------------------------------------------------------
|
231 |
|
|
void WBFExampleAnalysisMod::SlaveTerminate()
|
232 |
|
|
{
|
233 |
|
|
|
234 |
|
|
// Run finishing code on the computer (slave) that did the analysis. For this
|
235 |
|
|
// module, we dont do anything here.
|
236 |
|
|
|
237 |
|
|
}
|
238 |
|
|
//--------------------------------------------------------------------------------------------------
|
239 |
|
|
void WBFExampleAnalysisMod::Terminate()
|
240 |
|
|
{
|
241 |
|
|
// Run finishing code on the client computer. For this module, we dont do
|
242 |
|
|
// anything here.
|
243 |
|
|
|
244 |
|
|
}
|