1 |
loizides |
1.19 |
// $Id: GeneratorMod.cc,v 1.18 2008/12/08 15:48:31 loizides Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/GeneratorMod.h"
|
4 |
|
|
#include "MitCommon/MathTools/interface/MathUtils.h"
|
5 |
loizides |
1.8 |
#include "MitPhysics/Init/interface/ModNames.h"
|
6 |
loizides |
1.1 |
#include <TH1D.h>
|
7 |
|
|
#include <TH2D.h>
|
8 |
|
|
|
9 |
|
|
using namespace mithep;
|
10 |
|
|
|
11 |
|
|
ClassImp(mithep::GeneratorMod)
|
12 |
|
|
|
13 |
|
|
//--------------------------------------------------------------------------------------------------
|
14 |
loizides |
1.8 |
GeneratorMod::GeneratorMod(const char *name, const char *title) :
|
15 |
loizides |
1.1 |
BaseMod(name,title),
|
16 |
loizides |
1.5 |
fFillHist(kFALSE),
|
17 |
loizides |
1.1 |
fMCPartName(Names::gkMCPartBrn),
|
18 |
loizides |
1.8 |
fMCLeptonsName(ModNames::gkMCLeptonsName),
|
19 |
|
|
fMCAllLeptonsName(ModNames::gkMCAllLeptonsName),
|
20 |
|
|
fMCTausName(ModNames::gkMCTausName),
|
21 |
|
|
fMCNeutrinosName(ModNames::gkMCNeutrinosName),
|
22 |
|
|
fMCQuarksName(ModNames::gkMCQuarksName),
|
23 |
|
|
fMCqqHsName(ModNames::gkMCqqHsName),
|
24 |
|
|
fMCBosonsName(ModNames::gkMCBosonsName),
|
25 |
ceballos |
1.10 |
fMCPhotonsName(ModNames::gkMCPhotonsName),
|
26 |
ceballos |
1.14 |
fPtLeptonMin(0.0),
|
27 |
|
|
fEtaLeptonMax(5.0),
|
28 |
|
|
fPtPhotonMin(0.0),
|
29 |
loizides |
1.15 |
fEtaPhotonMax(5.0),
|
30 |
|
|
fParticles(0)
|
31 |
loizides |
1.1 |
{
|
32 |
|
|
// Constructor.
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
//--------------------------------------------------------------------------------------------------
|
36 |
|
|
void GeneratorMod::Process()
|
37 |
|
|
{
|
38 |
loizides |
1.5 |
// Process entries of the tree.
|
39 |
loizides |
1.1 |
|
40 |
loizides |
1.5 |
// these arrays will be filled in the loop of particles
|
41 |
loizides |
1.9 |
MCParticleOArr *GenLeptons = new MCParticleOArr;
|
42 |
loizides |
1.13 |
GenLeptons->SetName(fMCLeptonsName);
|
43 |
loizides |
1.9 |
MCParticleOArr *GenAllLeptons = new MCParticleOArr;
|
44 |
loizides |
1.13 |
GenAllLeptons->SetName(fMCAllLeptonsName);
|
45 |
loizides |
1.9 |
MCParticleOArr *GenTaus = new MCParticleOArr;
|
46 |
loizides |
1.13 |
GenTaus->SetName(fMCTausName);
|
47 |
|
|
GenTaus->SetOwner(kTRUE);
|
48 |
loizides |
1.9 |
MCParticleOArr *GenNeutrinos = new MCParticleOArr;
|
49 |
loizides |
1.13 |
GenNeutrinos->SetName(fMCNeutrinosName);
|
50 |
loizides |
1.9 |
MCParticleOArr *GenQuarks = new MCParticleOArr;
|
51 |
loizides |
1.13 |
GenQuarks->SetName(fMCQuarksName);
|
52 |
loizides |
1.9 |
MCParticleOArr *GenqqHs = new MCParticleOArr;
|
53 |
loizides |
1.13 |
GenqqHs->SetName(fMCqqHsName);
|
54 |
loizides |
1.9 |
MCParticleOArr *GenBosons = new MCParticleOArr;
|
55 |
loizides |
1.13 |
GenBosons->SetName(fMCBosonsName);
|
56 |
ceballos |
1.10 |
MCParticleOArr *GenPhotons = new MCParticleOArr;
|
57 |
loizides |
1.13 |
GenPhotons->SetName(fMCPhotonsName);
|
58 |
loizides |
1.1 |
|
59 |
loizides |
1.5 |
// load MCParticle branch
|
60 |
|
|
LoadBranch(fMCPartName);
|
61 |
|
|
|
62 |
loizides |
1.6 |
Bool_t isqqH = kFALSE;
|
63 |
loizides |
1.5 |
for (UInt_t i=0; i<fParticles->GetEntries(); ++i) {
|
64 |
loizides |
1.7 |
const MCParticle *p = fParticles->At(i);
|
65 |
loizides |
1.5 |
|
66 |
|
|
if (!p->IsGenerated()) continue;
|
67 |
|
|
|
68 |
|
|
// muons/electrons from W/Z decays
|
69 |
loizides |
1.7 |
if ((p->Is(MCParticle::kEl) || p->Is(MCParticle::kMu)) && p->Status() == 1) {
|
70 |
ceballos |
1.14 |
if (p->Pt() > fPtLeptonMin && p->AbsEta() < fEtaLeptonMax) {
|
71 |
loizides |
1.5 |
GenAllLeptons->Add(p);
|
72 |
|
|
}
|
73 |
loizides |
1.6 |
Bool_t isGoodLepton = kFALSE;
|
74 |
loizides |
1.7 |
const MCParticle *pm = p;
|
75 |
loizides |
1.5 |
while (pm->HasMother() && isGoodLepton == kFALSE) {
|
76 |
loizides |
1.7 |
if (pm->Mother()->Is(MCParticle::kZ) || pm->Mother()->Is(MCParticle::kW)) {
|
77 |
loizides |
1.5 |
GenLeptons->Add(p);
|
78 |
|
|
isGoodLepton = kTRUE;
|
79 |
loizides |
1.7 |
break;
|
80 |
loizides |
1.8 |
} else if (pm->Mother()->Is(MCParticle::kPi0) || pm->Mother()->Is(MCParticle::kEta)) {
|
81 |
loizides |
1.7 |
// this is fake, but it is a trick to get rid of these cases and abort the loop
|
82 |
loizides |
1.5 |
isGoodLepton = kTRUE;
|
83 |
loizides |
1.7 |
break;
|
84 |
|
|
}
|
85 |
|
|
pm = pm->Mother();
|
86 |
loizides |
1.1 |
}
|
87 |
loizides |
1.5 |
}
|
88 |
|
|
|
89 |
loizides |
1.7 |
// hadronic taus
|
90 |
|
|
else if (p->Is(MCParticle::kTau) && p->Status() == 2) {
|
91 |
|
|
if (!p->HasDaughter(MCParticle::kEl) && !p->HasDaughter(MCParticle::kMu)) {
|
92 |
|
|
const MCParticle *tv = p->FindDaughter(MCParticle::kTauNu);
|
93 |
|
|
if (tv) {
|
94 |
|
|
MCParticle *pm_f = new MCParticle(*p);
|
95 |
|
|
pm_f->SetMom(p->Px()-tv->Px(), p->Py()-tv->Py(),
|
96 |
|
|
p->Pz()-tv->Pz(), p->E()-tv->E());
|
97 |
|
|
GenTaus->AddOwned(pm_f);
|
98 |
|
|
} else {
|
99 |
loizides |
1.18 |
SendError(kWarning, "Process", "Could not find a tau neutrino!");
|
100 |
loizides |
1.5 |
}
|
101 |
loizides |
1.1 |
}
|
102 |
loizides |
1.5 |
}
|
103 |
loizides |
1.1 |
|
104 |
loizides |
1.5 |
// neutrinos
|
105 |
loizides |
1.7 |
else if (p->Status() == 1 && p->IsNeutrino()) {
|
106 |
loizides |
1.5 |
GenNeutrinos->Add(p);
|
107 |
|
|
}
|
108 |
loizides |
1.1 |
|
109 |
loizides |
1.5 |
// quarks from W/Z decays or top particles
|
110 |
loizides |
1.7 |
else if (p->IsQuark() && p->HasMother()) {
|
111 |
|
|
if (p->Mother()->Is(MCParticle::kZ) || p->Mother()->Is(MCParticle::kW) ||
|
112 |
|
|
p->Is(MCParticle::kTop) || p->Mother()->Is(MCParticle::kTop)) {
|
113 |
loizides |
1.5 |
GenQuarks->Add(p);
|
114 |
loizides |
1.1 |
}
|
115 |
loizides |
1.5 |
}
|
116 |
loizides |
1.1 |
|
117 |
loizides |
1.5 |
// qqH, information about the forward jets
|
118 |
loizides |
1.8 |
else if (isqqH == kFALSE && p->Is(MCParticle::kH)) {
|
119 |
loizides |
1.5 |
isqqH = kTRUE;
|
120 |
loizides |
1.17 |
const MCParticle *pq1 = fParticles->At(i-1);
|
121 |
|
|
const MCParticle *pq2 = fParticles->At(i-2);
|
122 |
loizides |
1.7 |
if (!pq1 || !pq2) {
|
123 |
|
|
SendError(kWarning, "Process", "Could not find quark pair!");
|
124 |
loizides |
1.8 |
} else if (pq1->IsQuark() && pq2->IsQuark() &&
|
125 |
|
|
pq1->HasMother() && pq2->HasMother() &&
|
126 |
|
|
pq1->Mother()->PdgId() == p->Mother()->PdgId() &&
|
127 |
|
|
pq2->Mother()->PdgId() == p->Mother()->PdgId()) {
|
128 |
loizides |
1.5 |
GenqqHs->Add(pq1);
|
129 |
|
|
GenqqHs->Add(pq2);
|
130 |
loizides |
1.1 |
}
|
131 |
loizides |
1.7 |
if (p->Status() == 3)
|
132 |
|
|
GenBosons->Add(p); // take higgs boson in account here rather in next else if
|
133 |
loizides |
1.5 |
}
|
134 |
loizides |
1.1 |
|
135 |
loizides |
1.5 |
// information about bosons: W, Z, h, Z', W', H0, A0, H+
|
136 |
loizides |
1.7 |
else if (p->Status() == 3 &&
|
137 |
|
|
(p->Is(MCParticle::kZ) || p->Is(MCParticle::kW) || p->Is(MCParticle::kH) ||
|
138 |
|
|
p->Is(MCParticle::kZp) || p->Is(MCParticle::kZpp) ||
|
139 |
|
|
p->Is(MCParticle::kH0) || p->Is(MCParticle::kA0) || p->Is(MCParticle::kHp))) {
|
140 |
loizides |
1.5 |
GenBosons->Add(p);
|
141 |
loizides |
1.1 |
}
|
142 |
ceballos |
1.10 |
|
143 |
ceballos |
1.14 |
// photons
|
144 |
ceballos |
1.10 |
else if (p->Status() == 1 && p->Is(MCParticle::kGamma) &&
|
145 |
ceballos |
1.14 |
p->Pt() > fPtPhotonMin && p->AbsEta() < fEtaPhotonMax) {
|
146 |
ceballos |
1.10 |
GenPhotons->Add(p);
|
147 |
|
|
}
|
148 |
|
|
|
149 |
loizides |
1.18 |
// W/Z -> lnu for Madgraph
|
150 |
|
|
if (p->IsParton() && p->NDaughters() == 2) {
|
151 |
ceballos |
1.16 |
CompositeParticle *diBoson = new CompositeParticle();
|
152 |
|
|
diBoson->AddDaughter(p->Daughter(0));
|
153 |
|
|
diBoson->AddDaughter(p->Daughter(1));
|
154 |
loizides |
1.18 |
if (p->HasDaughter(MCParticle::kMu) && p->HasDaughter(MCParticle::kMuNu)) {
|
155 |
|
|
if (fFillHist)
|
156 |
|
|
hDVMass[0]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
157 |
ceballos |
1.16 |
GenLeptons->Add(p->FindDaughter(MCParticle::kMu));
|
158 |
|
|
}
|
159 |
loizides |
1.18 |
else if (p->HasDaughter(MCParticle::kEl) && p->HasDaughter(MCParticle::kElNu)) {
|
160 |
|
|
if (fFillHist)
|
161 |
|
|
hDVMass[1]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
162 |
ceballos |
1.16 |
GenLeptons->Add(p->FindDaughter(MCParticle::kEl));
|
163 |
|
|
}
|
164 |
loizides |
1.18 |
else if (p->HasDaughter(MCParticle::kTau) && p->HasDaughter(MCParticle::kTauNu)) {
|
165 |
|
|
if (fFillHist)
|
166 |
|
|
hDVMass[2]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
167 |
|
|
const MCParticle *tau = p->FindDaughter(MCParticle::kTau);
|
168 |
|
|
if (tau->HasDaughter(MCParticle::kMu))
|
169 |
|
|
GenLeptons->Add(tau->FindDaughter(MCParticle::kMu));
|
170 |
|
|
if (tau->HasDaughter(MCParticle::kEl))
|
171 |
|
|
GenLeptons->Add(tau->FindDaughter(MCParticle::kEl));
|
172 |
|
|
}
|
173 |
|
|
else if (p->Daughter(0)->Is(MCParticle::kMu) && p->Daughter(1)->Is(MCParticle::kMu)) {
|
174 |
|
|
if (fFillHist)
|
175 |
|
|
hDVMass[3]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
176 |
ceballos |
1.16 |
GenLeptons->Add(p->Daughter(0));
|
177 |
|
|
GenLeptons->Add(p->Daughter(1));
|
178 |
|
|
}
|
179 |
loizides |
1.18 |
else if (p->Daughter(0)->Is(MCParticle::kEl) && p->Daughter(1)->Is(MCParticle::kEl)) {
|
180 |
|
|
if (fFillHist)
|
181 |
|
|
hDVMass[4]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
182 |
ceballos |
1.16 |
GenLeptons->Add(p->Daughter(0));
|
183 |
|
|
GenLeptons->Add(p->Daughter(1));
|
184 |
|
|
}
|
185 |
loizides |
1.18 |
else if (p->Daughter(0)->Is(MCParticle::kTau) && p->Daughter(1)->Is(MCParticle::kTau)) {
|
186 |
|
|
if (fFillHist)
|
187 |
|
|
hDVMass[5]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
188 |
|
|
const MCParticle *tau0 = p->Daughter(0);
|
189 |
|
|
if (tau0->HasDaughter(MCParticle::kMu))
|
190 |
|
|
GenLeptons->Add(tau0->FindDaughter(MCParticle::kMu));
|
191 |
|
|
if (tau0->HasDaughter(MCParticle::kEl))
|
192 |
|
|
GenLeptons->Add(tau0->FindDaughter(MCParticle::kEl));
|
193 |
|
|
const MCParticle *tau1 = p->Daughter(1);
|
194 |
|
|
if (tau1->HasDaughter(MCParticle::kMu))
|
195 |
|
|
GenLeptons->Add(tau1->FindDaughter(MCParticle::kMu));
|
196 |
|
|
if (tau1->HasDaughter(MCParticle::kEl))
|
197 |
|
|
GenLeptons->Add(tau1->FindDaughter(MCParticle::kEl));
|
198 |
ceballos |
1.16 |
}
|
199 |
|
|
delete diBoson;
|
200 |
|
|
}
|
201 |
|
|
|
202 |
loizides |
1.18 |
// t -> lnu for Madgraph
|
203 |
|
|
if (p->Is(MCParticle::kTop)) {
|
204 |
ceballos |
1.16 |
CompositeParticle *diBoson = new CompositeParticle();
|
205 |
loizides |
1.18 |
if (p->HasDaughter(MCParticle::kMu) && p->HasDaughter(MCParticle::kMuNu)) {
|
206 |
ceballos |
1.16 |
diBoson->AddDaughter(p->FindDaughter(MCParticle::kMu));
|
207 |
|
|
diBoson->AddDaughter(p->FindDaughter(MCParticle::kMuNu));
|
208 |
loizides |
1.18 |
if (fFillHist)
|
209 |
|
|
hDVMass[6]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
210 |
ceballos |
1.16 |
GenLeptons->Add(p->FindDaughter(MCParticle::kMu));
|
211 |
|
|
}
|
212 |
loizides |
1.18 |
else if (p->HasDaughter(MCParticle::kEl) && p->HasDaughter(MCParticle::kElNu)) {
|
213 |
ceballos |
1.16 |
diBoson->AddDaughter(p->FindDaughter(MCParticle::kEl));
|
214 |
|
|
diBoson->AddDaughter(p->FindDaughter(MCParticle::kElNu));
|
215 |
loizides |
1.18 |
if (fFillHist)
|
216 |
|
|
hDVMass[7]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
217 |
ceballos |
1.16 |
GenLeptons->Add(p->FindDaughter(MCParticle::kEl));
|
218 |
|
|
}
|
219 |
loizides |
1.18 |
else if (p->HasDaughter(MCParticle::kTau) && p->HasDaughter(MCParticle::kTauNu)) {
|
220 |
ceballos |
1.16 |
diBoson->AddDaughter(p->FindDaughter(MCParticle::kTau));
|
221 |
|
|
diBoson->AddDaughter(p->FindDaughter(MCParticle::kTauNu));
|
222 |
loizides |
1.18 |
if (fFillHist)
|
223 |
|
|
hDVMass[8]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
224 |
|
|
const MCParticle *tau = p->FindDaughter(MCParticle::kTau);
|
225 |
|
|
if (tau->HasDaughter(MCParticle::kMu))
|
226 |
|
|
GenLeptons->Add(tau->FindDaughter(MCParticle::kMu));
|
227 |
|
|
if (tau->HasDaughter(MCParticle::kEl))
|
228 |
|
|
GenLeptons->Add(tau->FindDaughter(MCParticle::kEl));
|
229 |
|
|
}
|
230 |
|
|
else if (!p->HasDaughter(MCParticle::kW)) {
|
231 |
|
|
for(UInt_t nd=0; nd<p->NDaughters(); ++nd)
|
232 |
|
|
if (p->Daughter(nd)->IsNot(MCParticle::kBottom) &&
|
233 |
|
|
p->Daughter(nd)->IsNot(MCParticle::kGamma))
|
234 |
|
|
diBoson->AddDaughter(p->Daughter(nd));
|
235 |
|
|
if (fFillHist)
|
236 |
|
|
hDVMass[9]->Fill(TMath::Min(diBoson->Mass(),199.999));
|
237 |
ceballos |
1.16 |
}
|
238 |
|
|
delete diBoson;
|
239 |
|
|
}
|
240 |
loizides |
1.5 |
}
|
241 |
loizides |
1.1 |
|
242 |
loizides |
1.19 |
// sort according to pt
|
243 |
|
|
GenLeptons->Sort();
|
244 |
|
|
GenAllLeptons->Sort();
|
245 |
|
|
GenTaus->Sort();
|
246 |
|
|
GenNeutrinos->Sort();
|
247 |
|
|
GenQuarks->Sort();
|
248 |
|
|
GenqqHs->Sort();
|
249 |
|
|
GenBosons->Sort();
|
250 |
|
|
GenPhotons->Sort();
|
251 |
|
|
|
252 |
loizides |
1.8 |
// add objects to this event for other modules to use
|
253 |
loizides |
1.13 |
AddObjThisEvt(GenLeptons);
|
254 |
|
|
AddObjThisEvt(GenAllLeptons);
|
255 |
|
|
AddObjThisEvt(GenTaus);
|
256 |
|
|
AddObjThisEvt(GenNeutrinos);
|
257 |
|
|
AddObjThisEvt(GenQuarks);
|
258 |
|
|
AddObjThisEvt(GenqqHs);
|
259 |
|
|
AddObjThisEvt(GenBosons);
|
260 |
|
|
AddObjThisEvt(GenPhotons);
|
261 |
ceballos |
1.16 |
|
262 |
loizides |
1.5 |
// fill histograms if requested
|
263 |
|
|
if (fFillHist) {
|
264 |
|
|
|
265 |
loizides |
1.6 |
// leptons
|
266 |
loizides |
1.1 |
hDGenLeptons[0]->Fill(GenLeptons->GetEntries());
|
267 |
loizides |
1.5 |
Int_t idxMaxLep[2] = {-1, -1};
|
268 |
|
|
Double_t ptMaxLep[2] = {-1, -1};
|
269 |
|
|
for(UInt_t i=0; i<GenLeptons->GetEntries(); i++) {
|
270 |
loizides |
1.1 |
hDGenLeptons[1]->Fill(GenLeptons->At(i)->Pt());
|
271 |
loizides |
1.5 |
hDGenLeptons[2]->Fill(TMath::Abs(GenLeptons->At(i)->Eta()));
|
272 |
|
|
hDGenLeptons[3]->Fill(GenLeptons->At(i)->PhiDeg());
|
273 |
|
|
for(UInt_t j=i+1; j<GenLeptons->GetEntries(); j++) {
|
274 |
loizides |
1.1 |
CompositeParticle *dilepton = new CompositeParticle();
|
275 |
|
|
dilepton->AddDaughter(GenLeptons->At(i));
|
276 |
|
|
dilepton->AddDaughter(GenLeptons->At(j));
|
277 |
|
|
hDGenLeptons[4]->Fill(dilepton->Mass());
|
278 |
|
|
delete dilepton;
|
279 |
|
|
}
|
280 |
loizides |
1.6 |
// selecting the two highest pt leptons
|
281 |
loizides |
1.5 |
if (GenLeptons->At(i)->Pt() > ptMaxLep[0]) {
|
282 |
loizides |
1.1 |
ptMaxLep[1] = ptMaxLep[0];
|
283 |
|
|
idxMaxLep[1] = idxMaxLep[0];
|
284 |
|
|
ptMaxLep[0] = GenLeptons->At(i)->Pt();
|
285 |
|
|
idxMaxLep[0] = i;
|
286 |
|
|
}
|
287 |
loizides |
1.5 |
else if (GenLeptons->At(i)->Pt() > ptMaxLep[1]) {
|
288 |
loizides |
1.1 |
ptMaxLep[1] = GenLeptons->At(i)->Pt();
|
289 |
|
|
idxMaxLep[1] = i;
|
290 |
|
|
}
|
291 |
|
|
}
|
292 |
loizides |
1.6 |
// looking at events with at least two leptons
|
293 |
loizides |
1.5 |
if (ptMaxLep[0] > 0 && ptMaxLep[1] > 0) {
|
294 |
|
|
hDGenLeptons[5]->Fill(TMath::Min(TMath::Max(TMath::Abs(GenLeptons->At(idxMaxLep[0])->Eta()),
|
295 |
|
|
TMath::Abs(GenLeptons->At(idxMaxLep[1])->Eta())),
|
296 |
|
|
4.999));
|
297 |
|
|
hDGenLeptons[6]->Fill(TMath::Min(TMath::Min(TMath::Abs(GenLeptons->At(idxMaxLep[0])->Eta()),
|
298 |
|
|
TMath::Abs(GenLeptons->At(idxMaxLep[1])->Eta())),
|
299 |
|
|
4.999));
|
300 |
|
|
if (TMath::Abs(GenLeptons->At(idxMaxLep[0])->Eta()) < 2.5 &&
|
301 |
|
|
TMath::Abs(GenLeptons->At(idxMaxLep[1])->Eta()) < 2.5) {
|
302 |
loizides |
1.1 |
hDGenLeptons[7]->Fill(TMath::Min(GenLeptons->At(idxMaxLep[0])->Pt(),199.999));
|
303 |
loizides |
1.5 |
if (GenLeptons->At(idxMaxLep[0])->Pt() > 20.0) {
|
304 |
loizides |
1.1 |
hDGenLeptons[8]->Fill(TMath::Min(GenLeptons->At(idxMaxLep[1])->Pt(),199.999));
|
305 |
loizides |
1.5 |
if (GenLeptons->At(idxMaxLep[1])->Pt() > 10.0) {
|
306 |
loizides |
1.1 |
CompositeParticle *dilepton = new CompositeParticle();
|
307 |
|
|
dilepton->AddDaughter(GenLeptons->At(idxMaxLep[0]));
|
308 |
|
|
dilepton->AddDaughter(GenLeptons->At(idxMaxLep[1]));
|
309 |
|
|
hDGenLeptons[9]->Fill(TMath::Min(dilepton->Mass(),999.999));
|
310 |
|
|
hDGenLeptons[10]->Fill(MathUtils::DeltaPhi(GenLeptons->At(idxMaxLep[0])->Phi(),
|
311 |
|
|
GenLeptons->At(idxMaxLep[1])->Phi())
|
312 |
|
|
* 180./ TMath::Pi());
|
313 |
|
|
delete dilepton;
|
314 |
|
|
}
|
315 |
|
|
}
|
316 |
|
|
}
|
317 |
|
|
}
|
318 |
|
|
|
319 |
loizides |
1.6 |
// all leptons
|
320 |
ceballos |
1.3 |
hDGenAllLeptons[0]->Fill(GenAllLeptons->GetEntries());
|
321 |
loizides |
1.5 |
for(UInt_t i=0; i<GenAllLeptons->GetEntries(); i++) {
|
322 |
ceballos |
1.3 |
hDGenAllLeptons[1]->Fill(GenAllLeptons->At(i)->Pt());
|
323 |
|
|
hDGenAllLeptons[2]->Fill(GenAllLeptons->At(i)->Eta());
|
324 |
loizides |
1.5 |
hDGenAllLeptons[3]->Fill(GenAllLeptons->At(i)->PhiDeg());
|
325 |
ceballos |
1.3 |
}
|
326 |
|
|
|
327 |
loizides |
1.6 |
// taus
|
328 |
loizides |
1.1 |
hDGenTaus[0]->Fill(GenTaus->GetEntries());
|
329 |
loizides |
1.5 |
for(UInt_t i=0; i<GenTaus->GetEntries(); i++) {
|
330 |
loizides |
1.1 |
hDGenTaus[1]->Fill(GenTaus->At(i)->Pt());
|
331 |
|
|
hDGenTaus[2]->Fill(GenTaus->At(i)->Eta());
|
332 |
loizides |
1.5 |
hDGenTaus[3]->Fill(GenTaus->At(i)->PhiDeg());
|
333 |
loizides |
1.1 |
}
|
334 |
|
|
|
335 |
loizides |
1.6 |
// neutrinos
|
336 |
loizides |
1.1 |
hDGenNeutrinos[0]->Fill(GenNeutrinos->GetEntries());
|
337 |
|
|
CompositeParticle *neutrinoTotal = new CompositeParticle();
|
338 |
loizides |
1.5 |
for(UInt_t i=0; i<GenNeutrinos->GetEntries(); i++) {
|
339 |
|
|
if (GenNeutrinos->At(i)->HasMother())
|
340 |
loizides |
1.1 |
neutrinoTotal->AddDaughter(GenNeutrinos->At(i));
|
341 |
|
|
}
|
342 |
loizides |
1.5 |
if (GenNeutrinos->GetEntries() > 0) {
|
343 |
loizides |
1.1 |
hDGenNeutrinos[1]->Fill(neutrinoTotal->Pt());
|
344 |
|
|
hDGenNeutrinos[2]->Fill(neutrinoTotal->Eta());
|
345 |
loizides |
1.5 |
hDGenNeutrinos[3]->Fill(neutrinoTotal->PhiDeg());
|
346 |
loizides |
1.1 |
}
|
347 |
|
|
delete neutrinoTotal;
|
348 |
|
|
|
349 |
loizides |
1.6 |
// quarks
|
350 |
loizides |
1.1 |
hDGenQuarks[0]->Fill(GenQuarks->GetEntries());
|
351 |
loizides |
1.5 |
for(UInt_t i=0; i<GenQuarks->GetEntries(); i++) {
|
352 |
|
|
for(UInt_t j=i+1; j<GenQuarks->GetEntries(); j++) {
|
353 |
loizides |
1.1 |
CompositeParticle *dijet = new CompositeParticle();
|
354 |
|
|
dijet->AddDaughter(GenQuarks->At(i));
|
355 |
|
|
dijet->AddDaughter(GenQuarks->At(j));
|
356 |
|
|
hDGenQuarks[1]->Fill(dijet->Pt());
|
357 |
|
|
hDGenQuarks[2]->Fill(dijet->Mass());
|
358 |
loizides |
1.5 |
if (TMath::Abs(GenQuarks->At(i)->Eta()) < 2.5 &&
|
359 |
|
|
TMath::Abs(GenQuarks->At(j)->Eta()) < 2.5) {
|
360 |
loizides |
1.1 |
hDGenQuarks[3]->Fill(dijet->Pt());
|
361 |
|
|
hDGenQuarks[4]->Fill(dijet->Mass());
|
362 |
|
|
}
|
363 |
|
|
delete dijet;
|
364 |
|
|
}
|
365 |
ceballos |
1.2 |
// b quark info
|
366 |
loizides |
1.5 |
if (GenQuarks->At(i)->AbsPdgId() == 5) {
|
367 |
ceballos |
1.2 |
hDGenQuarks[5]->Fill(GenQuarks->At(i)->Pt());
|
368 |
|
|
hDGenQuarks[6]->Fill(GenQuarks->At(i)->Eta());
|
369 |
|
|
hDGenQuarks[7]->Fill(GenQuarks->At(i)->Phi());
|
370 |
loizides |
1.5 |
if (ptMaxLep[0] > 20 && ptMaxLep[1] > 15) {
|
371 |
|
|
if (TMath::Abs(GenLeptons->At(idxMaxLep[0])->Eta()) < 2.5 &&
|
372 |
|
|
TMath::Abs(GenLeptons->At(idxMaxLep[1])->Eta()) < 2.5) {
|
373 |
ceballos |
1.2 |
hDGenQuarks[8]->Fill(GenQuarks->At(i)->Pt());
|
374 |
|
|
hDGenQuarks[9]->Fill(GenQuarks->At(i)->Eta());
|
375 |
|
|
hDGenQuarks[10]->Fill(GenQuarks->At(i)->Phi());
|
376 |
|
|
}
|
377 |
|
|
}
|
378 |
|
|
}
|
379 |
|
|
// t quark info
|
380 |
loizides |
1.5 |
else if (GenQuarks->At(i)->AbsPdgId() == 6) {
|
381 |
ceballos |
1.2 |
hDGenQuarks[11]->Fill(GenQuarks->At(i)->Pt());
|
382 |
|
|
hDGenQuarks[12]->Fill(GenQuarks->At(i)->Eta());
|
383 |
|
|
hDGenQuarks[13]->Fill(GenQuarks->At(i)->Phi());
|
384 |
|
|
}
|
385 |
|
|
// light quark info
|
386 |
|
|
else {
|
387 |
|
|
hDGenQuarks[14]->Fill(GenQuarks->At(i)->Pt());
|
388 |
|
|
hDGenQuarks[15]->Fill(GenQuarks->At(i)->Eta());
|
389 |
|
|
hDGenQuarks[16]->Fill(GenQuarks->At(i)->Phi());
|
390 |
|
|
}
|
391 |
loizides |
1.1 |
}
|
392 |
|
|
|
393 |
loizides |
1.6 |
// wbf
|
394 |
loizides |
1.5 |
if (GenqqHs->GetEntries() == 2) {
|
395 |
loizides |
1.1 |
hDGenWBF[0]->Fill(MathUtils::DeltaPhi(GenqqHs->At(0)->Phi(),
|
396 |
|
|
GenqqHs->At(1)->Phi()) * 180./ TMath::Pi());
|
397 |
loizides |
1.5 |
hDGenWBF[1]->Fill(TMath::Abs(GenqqHs->At(0)->Eta()-GenqqHs->At(1)->Eta()));
|
398 |
loizides |
1.1 |
hDGenWBF[2]->Fill(TMath::Max(GenqqHs->At(0)->Pt(),GenqqHs->At(1)->Pt()));
|
399 |
|
|
hDGenWBF[3]->Fill(TMath::Min(GenqqHs->At(0)->Pt(),GenqqHs->At(1)->Pt()));
|
400 |
|
|
CompositeParticle *diqq = new CompositeParticle();
|
401 |
|
|
diqq->AddDaughter(GenqqHs->At(0));
|
402 |
|
|
diqq->AddDaughter(GenqqHs->At(1));
|
403 |
|
|
hDGenWBF[4]->Fill(diqq->Mass());
|
404 |
|
|
delete diqq;
|
405 |
|
|
}
|
406 |
|
|
|
407 |
loizides |
1.6 |
// bosons
|
408 |
loizides |
1.1 |
hDGenBosons[0]->Fill(GenBosons->GetEntries());
|
409 |
loizides |
1.5 |
for(UInt_t i=0; i<GenBosons->GetEntries(); i++) {
|
410 |
loizides |
1.1 |
hDGenBosons[1]->Fill(GenBosons->At(i)->Pt());
|
411 |
|
|
hDGenBosons[2]->Fill(GenBosons->At(i)->Eta());
|
412 |
|
|
hDGenBosons[3]->Fill(GenBosons->At(i)->Mass());
|
413 |
|
|
}
|
414 |
ceballos |
1.10 |
|
415 |
|
|
// photons
|
416 |
|
|
hDGenPhotons[0]->Fill(GenPhotons->GetEntries());
|
417 |
|
|
for(UInt_t i=0; i<GenPhotons->GetEntries(); i++) {
|
418 |
|
|
hDGenPhotons[1]->Fill(GenPhotons->At(i)->Pt());
|
419 |
|
|
hDGenPhotons[2]->Fill(GenPhotons->At(i)->Eta());
|
420 |
|
|
}
|
421 |
loizides |
1.1 |
}
|
422 |
|
|
}
|
423 |
|
|
|
424 |
|
|
//--------------------------------------------------------------------------------------------------
|
425 |
|
|
void GeneratorMod::SlaveBegin()
|
426 |
|
|
{
|
427 |
loizides |
1.5 |
// Book branch and histograms if wanted.
|
428 |
|
|
|
429 |
loizides |
1.1 |
ReqBranch(fMCPartName, fParticles);
|
430 |
|
|
|
431 |
loizides |
1.5 |
// fill histograms
|
432 |
|
|
if (fFillHist == kTRUE) {
|
433 |
|
|
char sb[1024];
|
434 |
|
|
|
435 |
loizides |
1.6 |
// leptons from W
|
436 |
loizides |
1.1 |
sprintf(sb,"hDGenLeptons_%d", 0); hDGenLeptons[0] = new TH1D(sb,sb,10,-0.5,9.5);
|
437 |
|
|
sprintf(sb,"hDGenLeptons_%d", 1); hDGenLeptons[1] = new TH1D(sb,sb,100,0.0,200.0);
|
438 |
|
|
sprintf(sb,"hDGenLeptons_%d", 2); hDGenLeptons[2] = new TH1D(sb,sb,50,0.0,5.0);
|
439 |
|
|
sprintf(sb,"hDGenLeptons_%d", 3); hDGenLeptons[3] = new TH1D(sb,sb,90,0.0,180.0);
|
440 |
|
|
sprintf(sb,"hDGenLeptons_%d", 4); hDGenLeptons[4] = new TH1D(sb,sb,1000,0.0,1000.0);
|
441 |
|
|
sprintf(sb,"hDGenLeptons_%d", 5); hDGenLeptons[5] = new TH1D(sb,sb,50,0.0,5.0);
|
442 |
|
|
sprintf(sb,"hDGenLeptons_%d", 6); hDGenLeptons[6] = new TH1D(sb,sb,50,0.0,5.0);
|
443 |
|
|
sprintf(sb,"hDGenLeptons_%d", 7); hDGenLeptons[7] = new TH1D(sb,sb,100,0.0,200.0);
|
444 |
|
|
sprintf(sb,"hDGenLeptons_%d", 8); hDGenLeptons[8] = new TH1D(sb,sb,100,0.0,200.0);
|
445 |
|
|
sprintf(sb,"hDGenLeptons_%d", 9); hDGenLeptons[9] = new TH1D(sb,sb,1000,0.0,1000.0);
|
446 |
|
|
sprintf(sb,"hDGenLeptons_%d",10); hDGenLeptons[10] = new TH1D(sb,sb,90,0.0,180.0);
|
447 |
loizides |
1.5 |
for(Int_t i=0; i<11; i++) AddOutput(hDGenLeptons[i]);
|
448 |
loizides |
1.1 |
|
449 |
loizides |
1.6 |
// all leptons
|
450 |
ceballos |
1.3 |
sprintf(sb,"hDGenAllLeptons_%d", 0); hDGenAllLeptons[0] = new TH1D(sb,sb,10,-0.5,9.5);
|
451 |
|
|
sprintf(sb,"hDGenAllLeptons_%d", 1); hDGenAllLeptons[1] = new TH1D(sb,sb,100,0.0,200.0);
|
452 |
ceballos |
1.14 |
sprintf(sb,"hDGenAllLeptons_%d", 2); hDGenAllLeptons[2] = new TH1D(sb,sb,100,-5.0,5.0);
|
453 |
ceballos |
1.3 |
sprintf(sb,"hDGenAllLeptons_%d", 3); hDGenAllLeptons[3] = new TH1D(sb,sb,90,0.0,180.0);
|
454 |
loizides |
1.5 |
for(Int_t i=0; i<4; i++) AddOutput(hDGenAllLeptons[i]);
|
455 |
ceballos |
1.3 |
|
456 |
loizides |
1.6 |
// taus
|
457 |
loizides |
1.1 |
sprintf(sb,"hDGenTaus_%d", 0); hDGenTaus[0] = new TH1D(sb,sb,10,-0.5,9.5);
|
458 |
|
|
sprintf(sb,"hDGenTaus_%d", 1); hDGenTaus[1] = new TH1D(sb,sb,100,0.0,200.0);
|
459 |
|
|
sprintf(sb,"hDGenTaus_%d", 2); hDGenTaus[2] = new TH1D(sb,sb,100,-5.0,5.0);
|
460 |
|
|
sprintf(sb,"hDGenTaus_%d", 3); hDGenTaus[3] = new TH1D(sb,sb,90,0.0,180.0);
|
461 |
loizides |
1.5 |
for(Int_t i=0; i<4; i++) AddOutput(hDGenTaus[i]);
|
462 |
loizides |
1.1 |
|
463 |
loizides |
1.6 |
// neutrinos
|
464 |
loizides |
1.1 |
sprintf(sb,"hDGenNeutrinos_%d", 0); hDGenNeutrinos[0] = new TH1D(sb,sb,10,-0.5,9.5);
|
465 |
|
|
sprintf(sb,"hDGenNeutrinos_%d", 1); hDGenNeutrinos[1] = new TH1D(sb,sb,100,0.0,200.0);
|
466 |
|
|
sprintf(sb,"hDGenNeutrinos_%d", 2); hDGenNeutrinos[2] = new TH1D(sb,sb,100,-5.0,5.0);
|
467 |
|
|
sprintf(sb,"hDGenNeutrinos_%d", 3); hDGenNeutrinos[3] = new TH1D(sb,sb,90,0.0,180.0);
|
468 |
loizides |
1.5 |
for(Int_t i=0; i<4; i++) AddOutput(hDGenNeutrinos[i]);
|
469 |
loizides |
1.1 |
|
470 |
loizides |
1.6 |
// quarks
|
471 |
loizides |
1.1 |
sprintf(sb,"hDGenQuarks_%d", 0); hDGenQuarks[0] = new TH1D(sb,sb,10,-0.5,9.5);
|
472 |
|
|
sprintf(sb,"hDGenQuarks_%d", 1); hDGenQuarks[1] = new TH1D(sb,sb,200,0.0,400.);
|
473 |
|
|
sprintf(sb,"hDGenQuarks_%d", 2); hDGenQuarks[2] = new TH1D(sb,sb,2000,0.0,2000.);
|
474 |
|
|
sprintf(sb,"hDGenQuarks_%d", 3); hDGenQuarks[3] = new TH1D(sb,sb,200,0.0,400.);
|
475 |
|
|
sprintf(sb,"hDGenQuarks_%d", 4); hDGenQuarks[4] = new TH1D(sb,sb,2000,0.0,2000.);
|
476 |
ceballos |
1.2 |
sprintf(sb,"hDGenQuarks_%d", 5); hDGenQuarks[5] = new TH1D(sb,sb,200,0.0,400.);
|
477 |
|
|
sprintf(sb,"hDGenQuarks_%d", 6); hDGenQuarks[6] = new TH1D(sb,sb,200,-10.0,10.);
|
478 |
loizides |
1.5 |
sprintf(sb,"hDGenQuarks_%d", 7); hDGenQuarks[7] = new TH1D(sb,sb,200,-TMath::Pi(),
|
479 |
|
|
TMath::Pi());
|
480 |
ceballos |
1.2 |
sprintf(sb,"hDGenQuarks_%d", 8); hDGenQuarks[8] = new TH1D(sb,sb,200,0.0,400.);
|
481 |
|
|
sprintf(sb,"hDGenQuarks_%d", 9); hDGenQuarks[9] = new TH1D(sb,sb,200,-10.0,10.);
|
482 |
loizides |
1.5 |
sprintf(sb,"hDGenQuarks_%d",10); hDGenQuarks[10] = new TH1D(sb,sb,200,-TMath::Pi(),
|
483 |
|
|
TMath::Pi());
|
484 |
ceballos |
1.2 |
sprintf(sb,"hDGenQuarks_%d",11); hDGenQuarks[11] = new TH1D(sb,sb,200,0.0,400.);
|
485 |
|
|
sprintf(sb,"hDGenQuarks_%d",12); hDGenQuarks[12] = new TH1D(sb,sb,200,-10.0,10.);
|
486 |
loizides |
1.5 |
sprintf(sb,"hDGenQuarks_%d",13); hDGenQuarks[13] = new TH1D(sb,sb,200,-TMath::Pi(),
|
487 |
|
|
TMath::Pi());
|
488 |
ceballos |
1.2 |
sprintf(sb,"hDGenQuarks_%d",14); hDGenQuarks[14] = new TH1D(sb,sb,200,0.0,400.);
|
489 |
|
|
sprintf(sb,"hDGenQuarks_%d",15); hDGenQuarks[15] = new TH1D(sb,sb,200,-10.0,10.);
|
490 |
loizides |
1.5 |
sprintf(sb,"hDGenQuarks_%d",16); hDGenQuarks[16] = new TH1D(sb,sb,200,-TMath::Pi(),
|
491 |
|
|
TMath::Pi());
|
492 |
|
|
for(Int_t i=0; i<17; i++) AddOutput(hDGenQuarks[i]);
|
493 |
loizides |
1.1 |
|
494 |
|
|
// qqH
|
495 |
|
|
sprintf(sb,"hDGenWBF_%d", 0); hDGenWBF[0] = new TH1D(sb,sb,90,0.0,180.);
|
496 |
|
|
sprintf(sb,"hDGenWBF_%d", 1); hDGenWBF[1] = new TH1D(sb,sb,100,0.0,10.);
|
497 |
|
|
sprintf(sb,"hDGenWBF_%d", 2); hDGenWBF[2] = new TH1D(sb,sb,200,0.0,400.);
|
498 |
|
|
sprintf(sb,"hDGenWBF_%d", 3); hDGenWBF[3] = new TH1D(sb,sb,200,0.0,400.);
|
499 |
|
|
sprintf(sb,"hDGenWBF_%d", 4); hDGenWBF[4] = new TH1D(sb,sb,200,0.0,4000.);
|
500 |
loizides |
1.5 |
for(Int_t i=0; i<5; i++) AddOutput(hDGenWBF[i]);
|
501 |
loizides |
1.1 |
|
502 |
loizides |
1.6 |
// bosons
|
503 |
loizides |
1.1 |
sprintf(sb,"hDGenBosons_%d", 0); hDGenBosons[0] = new TH1D(sb,sb,10,-0.5,9.5);
|
504 |
|
|
sprintf(sb,"hDGenBosons_%d", 1); hDGenBosons[1] = new TH1D(sb,sb,200,0.0,400.0);
|
505 |
|
|
sprintf(sb,"hDGenBosons_%d", 2); hDGenBosons[2] = new TH1D(sb,sb,100,-5.0,5.0);
|
506 |
|
|
sprintf(sb,"hDGenBosons_%d", 3); hDGenBosons[3] = new TH1D(sb,sb,2000,0.0,2000.0);
|
507 |
loizides |
1.5 |
for(Int_t i=0; i<4; i++) AddOutput(hDGenBosons[i]);
|
508 |
ceballos |
1.10 |
|
509 |
|
|
// photons
|
510 |
|
|
sprintf(sb,"hDGenPhotons_%d", 0); hDGenPhotons[0] = new TH1D(sb,sb,10,-0.5,9.5);
|
511 |
|
|
sprintf(sb,"hDGenPhotons_%d", 1); hDGenPhotons[1] = new TH1D(sb,sb,200,0.0,400.0);
|
512 |
ceballos |
1.14 |
sprintf(sb,"hDGenPhotons_%d", 2); hDGenPhotons[2] = new TH1D(sb,sb,100,-5.0,5.0);
|
513 |
ceballos |
1.10 |
for(Int_t i=0; i<3; i++) AddOutput(hDGenPhotons[i]);
|
514 |
ceballos |
1.16 |
|
515 |
|
|
// auxiliar
|
516 |
|
|
sprintf(sb,"hDVMass_%d", 0); hDVMass[0] = new TH1D(sb,sb,200,0.,200.);
|
517 |
|
|
sprintf(sb,"hDVMass_%d", 1); hDVMass[1] = new TH1D(sb,sb,200,0.,200.);
|
518 |
|
|
sprintf(sb,"hDVMass_%d", 2); hDVMass[2] = new TH1D(sb,sb,200,0.,200.);
|
519 |
|
|
sprintf(sb,"hDVMass_%d", 3); hDVMass[3] = new TH1D(sb,sb,200,0.,200.);
|
520 |
|
|
sprintf(sb,"hDVMass_%d", 4); hDVMass[4] = new TH1D(sb,sb,200,0.,200.);
|
521 |
|
|
sprintf(sb,"hDVMass_%d", 5); hDVMass[5] = new TH1D(sb,sb,200,0.,200.);
|
522 |
|
|
sprintf(sb,"hDVMass_%d", 6); hDVMass[6] = new TH1D(sb,sb,200,0.,200.);
|
523 |
|
|
sprintf(sb,"hDVMass_%d", 7); hDVMass[7] = new TH1D(sb,sb,200,0.,200.);
|
524 |
|
|
sprintf(sb,"hDVMass_%d", 8); hDVMass[8] = new TH1D(sb,sb,200,0.,200.);
|
525 |
|
|
sprintf(sb,"hDVMass_%d", 9); hDVMass[9] = new TH1D(sb,sb,200,0.,200.);
|
526 |
|
|
for(Int_t i=0; i<10; i++) AddOutput(hDVMass[i]);
|
527 |
loizides |
1.1 |
}
|
528 |
|
|
}
|