ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/GeneratorMod.cc
Revision: 1.67
Committed: Wed Jul 6 21:11:33 2011 UTC (13 years, 10 months ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024
Changes since 1.66: +3 -3 lines
Log Message:
fix for ww filters

File Contents

# User Rev Content
1 ceballos 1.67 // $Id: GeneratorMod.cc,v 1.66 2011/07/04 20:36:22 sixie Exp $
2 loizides 1.1
3     #include "MitPhysics/Mods/interface/GeneratorMod.h"
4     #include "MitCommon/MathTools/interface/MathUtils.h"
5 loizides 1.45 #include "MitAna/DataTree/interface/MetCol.h"
6     #include "MitAna/DataTree/interface/MCParticleCol.h"
7 loizides 1.8 #include "MitPhysics/Init/interface/ModNames.h"
8 loizides 1.1 #include <TH1D.h>
9     #include <TH2D.h>
10 ceballos 1.62 #include <TParameter.h>
11 loizides 1.1
12     using namespace mithep;
13    
14     ClassImp(mithep::GeneratorMod)
15    
16     //--------------------------------------------------------------------------------------------------
17 loizides 1.8 GeneratorMod::GeneratorMod(const char *name, const char *title) :
18 loizides 1.1 BaseMod(name,title),
19 ceballos 1.57 fIsData(kFALSE),
20 ceballos 1.32 fPrintDebug(kFALSE),
21 loizides 1.53 fCopyArrays(kFALSE),
22 loizides 1.1 fMCPartName(Names::gkMCPartBrn),
23 ceballos 1.30 fMCMETName(ModNames::gkMCMETName),
24 loizides 1.8 fMCLeptonsName(ModNames::gkMCLeptonsName),
25     fMCAllLeptonsName(ModNames::gkMCAllLeptonsName),
26     fMCTausName(ModNames::gkMCTausName),
27     fMCNeutrinosName(ModNames::gkMCNeutrinosName),
28     fMCQuarksName(ModNames::gkMCQuarksName),
29     fMCqqHsName(ModNames::gkMCqqHsName),
30     fMCBosonsName(ModNames::gkMCBosonsName),
31 ceballos 1.10 fMCPhotonsName(ModNames::gkMCPhotonsName),
32 ceballos 1.32 fMCRadPhotonsName(ModNames::gkMCRadPhotonsName),
33     fMCISRPhotonsName(ModNames::gkMCISRPhotonsName),
34 ceballos 1.14 fPtLeptonMin(0.0),
35     fEtaLeptonMax(5.0),
36     fPtPhotonMin(0.0),
37 loizides 1.15 fEtaPhotonMax(5.0),
38 ceballos 1.32 fPtRadPhotonMin(0.0),
39     fEtaRadPhotonMax(5.0),
40 loizides 1.27 fPdgIdCut(0),
41     fMassMinCut(-FLT_MAX),
42     fMassMaxCut(FLT_MAX),
43 ceballos 1.34 fApplyISRFilter(kFALSE),
44 sixie 1.66 fApplyVVFilter(kFALSE),
45     fAllowWWEvents(kTRUE),
46 ceballos 1.67 fAllowWZEvents(kFALSE),
47     fAllowZZEvents(kFALSE),
48 loizides 1.15 fParticles(0)
49 loizides 1.1 {
50 ceballos 1.42 // Constructor
51 sixie 1.48 fGenLeptons = new MCParticleArr();
52 loizides 1.53 fGenLeptons->SetName(TString("Pub") + ModNames::gkMCLeptonsName);
53 sixie 1.48 fGenAllLeptons = new MCParticleArr();
54 loizides 1.53 fGenAllLeptons->SetName(TString("Pub") + ModNames::gkMCAllLeptonsName);
55 sixie 1.48 fGenTaus = new MCParticleArr();
56 loizides 1.53 fGenTaus->SetName(TString("Pub") + ModNames::gkMCTausName);
57 sixie 1.48 fGenNeutrinos = new MCParticleArr();
58 loizides 1.53 fGenNeutrinos->SetName(TString("Pub") + ModNames::gkMCNeutrinosName);
59 sixie 1.48 fGenQuarks = new MCParticleArr();
60 loizides 1.53 fGenQuarks->SetName(TString("Pub") + ModNames::gkMCQuarksName);
61 sixie 1.48 fGenqqHs = new MCParticleArr();
62 loizides 1.53 fGenqqHs->SetName(TString("Pub") + ModNames::gkMCqqHsName);
63 sixie 1.48 fGenBosons = new MCParticleArr();
64 loizides 1.53 fGenBosons->SetName(TString("Pub") + ModNames::gkMCBosonsName);
65 sixie 1.48 fGenPhotons = new MCParticleArr();
66 loizides 1.53 fGenPhotons->SetName(TString("Pub") + ModNames::gkMCPhotonsName);
67 sixie 1.48 fGenRadPhotons = new MCParticleArr();
68 loizides 1.53 fGenRadPhotons->SetName(TString("Pub") + ModNames::gkMCRadPhotonsName);
69 sixie 1.48 fGenISRPhotons = new MCParticleArr();
70 loizides 1.53 fGenISRPhotons->SetName(TString("Pub") + ModNames::gkMCISRPhotonsName);
71 loizides 1.1 }
72    
73 sixie 1.48
74     //--------------------------------------------------------------------------------------------------
75     GeneratorMod::~GeneratorMod()
76     {
77     // Destructor.
78    
79     delete fGenLeptons;
80     delete fGenAllLeptons;
81     delete fGenTaus;
82     delete fGenNeutrinos;
83     delete fGenQuarks;
84     delete fGenqqHs;
85     delete fGenBosons;
86     delete fGenPhotons;
87     delete fGenRadPhotons;
88     delete fGenISRPhotons;
89     }
90    
91 loizides 1.1 //--------------------------------------------------------------------------------------------------
92     void GeneratorMod::Process()
93     {
94 loizides 1.5 // Process entries of the tree.
95 loizides 1.1
96 loizides 1.5 // these arrays will be filled in the loop of particles
97 ceballos 1.30 MetOArr *GenMet = new MetOArr;
98     GenMet->SetName(fMCMETName);
99     GenMet->SetOwner(kTRUE);
100 loizides 1.9 MCParticleOArr *GenLeptons = new MCParticleOArr;
101 loizides 1.13 GenLeptons->SetName(fMCLeptonsName);
102 loizides 1.9 MCParticleOArr *GenAllLeptons = new MCParticleOArr;
103 loizides 1.13 GenAllLeptons->SetName(fMCAllLeptonsName);
104 loizides 1.9 MCParticleOArr *GenTaus = new MCParticleOArr;
105 loizides 1.13 GenTaus->SetName(fMCTausName);
106     GenTaus->SetOwner(kTRUE);
107 loizides 1.9 MCParticleOArr *GenNeutrinos = new MCParticleOArr;
108 loizides 1.13 GenNeutrinos->SetName(fMCNeutrinosName);
109 loizides 1.9 MCParticleOArr *GenQuarks = new MCParticleOArr;
110 loizides 1.13 GenQuarks->SetName(fMCQuarksName);
111 loizides 1.9 MCParticleOArr *GenqqHs = new MCParticleOArr;
112 loizides 1.13 GenqqHs->SetName(fMCqqHsName);
113 loizides 1.9 MCParticleOArr *GenBosons = new MCParticleOArr;
114 loizides 1.13 GenBosons->SetName(fMCBosonsName);
115 ceballos 1.10 MCParticleOArr *GenPhotons = new MCParticleOArr;
116 loizides 1.13 GenPhotons->SetName(fMCPhotonsName);
117 ceballos 1.32 MCParticleOArr *GenRadPhotons = new MCParticleOArr;
118     GenRadPhotons->SetName(fMCRadPhotonsName);
119     MCParticleOArr *GenISRPhotons = new MCParticleOArr;
120     GenISRPhotons->SetName(fMCISRPhotonsName);
121    
122 ceballos 1.42 MCParticleOArr *GenTempMG0 = new MCParticleOArr;
123    
124     Bool_t isOld = kFALSE;
125     Int_t sumV[2] = {0, 0}; // W, Z
126     Int_t sumVVFlavor[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
127 ceballos 1.30 Double_t totalMET[3] = {0.0, 0.0, 0.0};
128 loizides 1.6 Bool_t isqqH = kFALSE;
129 ceballos 1.58 Double_t ptMin = 999999.;
130 ceballos 1.57 if(fIsData == kFALSE){
131     if (fPrintDebug)
132     printf("\n************ Next Event ************\n\n");
133    
134     // load MCParticle branch
135     LoadEventObject(fMCPartName, fParticles);
136 ceballos 1.32
137 ceballos 1.57 for (UInt_t i=0; i<fParticles->GetEntries(); ++i) {
138     const MCParticle *p = fParticles->At(i);
139 ceballos 1.32
140 ceballos 1.57 if(fPrintDebug)
141     p->Print("l");
142 ceballos 1.32
143 ceballos 1.57 // rad photons, includes gamma from WWGamma vertex.
144     if( p->Is(MCParticle::kGamma) && p->Status() == 1 &&
145     p->Pt() > fPtRadPhotonMin && p->AbsEta() < fEtaRadPhotonMax &&
146     p->DistinctMother() && p->DistinctMother()->Status() == 3 &&
147     (p->DistinctMother()->Is(MCParticle::kEl) || p->DistinctMother()->Is(MCParticle::kMu) ||
148     p->DistinctMother()->Is(MCParticle::kTau) || p->DistinctMother()->Is(MCParticle::kW))
149     ) {
150     CompositeParticle *object = new CompositeParticle();
151     object->AddDaughter(p);
152     object->AddDaughter(p->DistinctMother());
153     if(object->Mass() > 1.0 || p->DistinctMother()->Is(MCParticle::kW)) GenRadPhotons->Add(p);
154     delete object;
155     }
156    
157     // ISR photons
158     if( p->Is(MCParticle::kGamma) && p->Status() == 1 &&
159     p->Pt() > fPtRadPhotonMin && p->AbsEta() < fEtaRadPhotonMax &&
160     p->DistinctMother() && p->DistinctMother()->IsParton()
161     ) {
162     GenISRPhotons->Add(p);
163     }
164    
165     // MET computation at generation level
166     if (p->Status() == 1 && !p->IsNeutrino()) {
167     totalMET[0] = totalMET[0] + p->Px();
168     totalMET[1] = totalMET[1] + p->Py();
169     totalMET[2] = totalMET[2] + p->Pz();
170     }
171    
172     if (!p->IsGenerated()) continue;
173    
174 ceballos 1.58 if ((((p->Is(MCParticle::kEl) || p->Is(MCParticle::kMu)) &&
175     !p->HasMother(MCParticle::kTau, kFALSE)) || p->Is(MCParticle::kTau)) &&
176     p->Status() == 3 &&
177     (p->HasMother(MCParticle::kW, kFALSE) || p->HasMother(MCParticle::kZ, kFALSE))) {
178     if(p->Pt() < ptMin) ptMin = p->Pt();
179     }
180    
181 ceballos 1.57 // all muons/electrons
182     if ((p->Is(MCParticle::kEl) || p->Is(MCParticle::kMu)) && p->Status() == 1) {
183     if (p->Pt() > fPtLeptonMin && p->AbsEta() < fEtaLeptonMax) {
184     GenAllLeptons->Add(p);
185     }
186     Bool_t isGoodLepton = kFALSE;
187     const MCParticle *pm = p;
188     while (pm->HasMother() && isGoodLepton == kFALSE) {
189     if (pm->PdgId() == 92) // string reached, terminate loop
190     break;
191     if (pm->Mother()->Is(MCParticle::kZ) || pm->Mother()->Is(MCParticle::kW) ||
192     pm->Mother()->Is(MCParticle::kZp) || pm->Mother()->Is(MCParticle::kWp) ||
193 ceballos 1.59 pm->Mother()->Is(MCParticle::kH) || pm->Mother()->Is(MCParticle::kH0) ||
194     pm->Mother()->Is(MCParticle::kA0) || pm->Mother()->Is(MCParticle::kHp)) {
195 ceballos 1.57 GenLeptons->Add(p);
196     isGoodLepton = kTRUE;
197     break;
198     } else if (pm->Mother()->Is(MCParticle::kPi0) || pm->Mother()->Is(MCParticle::kEta)) {
199     // this is fake, but it is a trick to get rid of these cases and abort the loop
200     break;
201     }
202     pm = pm->Mother();
203     }
204     }
205    
206     // hadronic taus
207     else if (p->Is(MCParticle::kTau) && p->Status() == 2) {
208     if (!p->HasDaughter(MCParticle::kEl) && !p->HasDaughter(MCParticle::kMu)) {
209     const MCParticle *tv = p->FindDaughter(MCParticle::kTauNu);
210     if (tv) {
211     MCParticle *pm_f = new MCParticle(*p);
212     pm_f->SetMom(p->Px()-tv->Px(), p->Py()-tv->Py(),
213     p->Pz()-tv->Pz(), p->E()-tv->E());
214     GenTaus->AddOwned(pm_f);
215     } else {
216 ceballos 1.58 //SendError(kWarning, "Process", "Could not find a tau neutrino!");
217 ceballos 1.57 }
218     }
219 loizides 1.1 }
220 loizides 1.5
221 ceballos 1.57 // neutrinos
222     else if (p->Status() == 1 && p->IsNeutrino()) {
223     GenNeutrinos->Add(p);
224     }
225    
226     // quarks from W/Z decays or top particles
227     else if (p->IsQuark() && p->HasMother()) {
228     if (p->Mother()->Is(MCParticle::kZ) || p->Mother()->Is(MCParticle::kW) ||
229     p->Is(MCParticle::kTop) || p->Mother()->Is(MCParticle::kTop)) {
230     GenQuarks->Add(p);
231     }
232 loizides 1.1 }
233 ceballos 1.10
234 ceballos 1.57 // qqH, information about the forward jets
235     else if (isqqH == kFALSE && p->Is(MCParticle::kH)) {
236     isqqH = kTRUE;
237     const MCParticle *pq1 = fParticles->At(i-1);
238     const MCParticle *pq2 = fParticles->At(i-2);
239     if (!pq1 || !pq2) {
240     SendError(kWarning, "Process", "Could not find quark pair!");
241     } else if (pq1->IsQuark() && pq2->IsQuark() &&
242     pq1->HasMother() && pq2->HasMother() &&
243     pq1->Mother() == pq2->Mother()) {
244     GenqqHs->Add(pq1);
245     GenqqHs->Add(pq2);
246     }
247    
248     if (p->Status() == 3)
249     GenBosons->Add(p); // take higgs boson in account here rather in next else if
250     }
251    
252     // information about bosons: W, Z, h, Z', W', H0, A0, H+
253     else if ((p->Status() == 3 &&
254     (p->Is(MCParticle::kZ) || p->Is(MCParticle::kW) || p->Is(MCParticle::kH) ||
255     p->Is(MCParticle::kZp) || p->Is(MCParticle::kZpp) ||
256     p->Is(MCParticle::kH0) || p->Is(MCParticle::kA0) || p->Is(MCParticle::kHp))) ||
257     (p->Status() == 2 &&
258     (p->Is(MCParticle::kJPsi) || p->Is(MCParticle::kUpsilon)))) {
259     GenBosons->Add(p);
260     if (p->Is(MCParticle::kW)) sumV[0]++;
261     else if(p->Is(MCParticle::kZ)) sumV[1]++;
262     if (p->Is(MCParticle::kW) && p->HasDaughter(MCParticle::kMu) &&
263     p->HasDaughter(MCParticle::kMuNu))
264 ceballos 1.42 sumVVFlavor[0]++;
265 ceballos 1.57 else if(p->Is(MCParticle::kW) && p->HasDaughter(MCParticle::kEl) &&
266     p->HasDaughter(MCParticle::kElNu))
267 ceballos 1.42 sumVVFlavor[1]++;
268 ceballos 1.57 else if(p->Is(MCParticle::kW) && p->HasDaughter(MCParticle::kTau) &&
269     p->HasDaughter(MCParticle::kTauNu))
270 ceballos 1.42 sumVVFlavor[2]++;
271 ceballos 1.57 else if(p->Is(MCParticle::kZ) && p->HasDaughter(MCParticle::kMu,kTRUE) &&
272     p->HasDaughter(-1*MCParticle::kMu,kTRUE))
273 ceballos 1.42 sumVVFlavor[3]++;
274 ceballos 1.57 else if(p->Is(MCParticle::kZ) && p->HasDaughter(MCParticle::kEl,kTRUE) &&
275     p->HasDaughter(-1*MCParticle::kEl,kTRUE))
276 ceballos 1.42 sumVVFlavor[4]++;
277 ceballos 1.57 else if(p->Is(MCParticle::kZ) && p->HasDaughter(MCParticle::kTau,kTRUE) &&
278     p->HasDaughter(-1*MCParticle::kTau,kTRUE))
279 ceballos 1.42 sumVVFlavor[5]++;
280 ceballos 1.57 else if(p->Is(MCParticle::kZ) && p->HasDaughter(MCParticle::kMuNu,kTRUE) &&
281     p->HasDaughter(-1*MCParticle::kMuNu,kTRUE))
282 ceballos 1.42 sumVVFlavor[6]++;
283 ceballos 1.57 else if(p->Is(MCParticle::kZ) && p->HasDaughter(MCParticle::kElNu,kTRUE) &&
284     p->HasDaughter(-1*MCParticle::kElNu,kTRUE))
285 ceballos 1.42 sumVVFlavor[7]++;
286 ceballos 1.57 else if(p->Is(MCParticle::kZ) && p->HasDaughter(MCParticle::kTauNu,kTRUE) &&
287     p->HasDaughter(-1*MCParticle::kTauNu,kTRUE))
288 ceballos 1.42 sumVVFlavor[8]++;
289 ceballos 1.16 }
290    
291 ceballos 1.57 // photons
292     else if (p->Status() == 1 && p->Is(MCParticle::kGamma) &&
293     p->Pt() > fPtPhotonMin && p->AbsEta() < fEtaPhotonMax) {
294     GenPhotons->Add(p);
295 ceballos 1.16 }
296 ceballos 1.44
297 ceballos 1.57 // W/Z -> lnu for Madgraph
298 ceballos 1.44 if (p->IsParton() && p->NDaughters() >= 2) {
299     CompositeParticle *diBoson = new CompositeParticle();
300     if (p->HasDaughter(MCParticle::kMu) && p->HasDaughter(MCParticle::kMuNu)) {
301     isOld = kFALSE;
302 ceballos 1.57 for(UInt_t nl = 0; nl < GenTempMG0->GetEntries(); nl++){
303     if(p->FindDaughter(MCParticle::kMu) == GenTempMG0->At(nl)) {
304 ceballos 1.44 isOld = kTRUE;
305     break;
306     }
307     }
308     if(isOld == kFALSE){
309 ceballos 1.57 GenTempMG0->Add(p->FindDaughter(MCParticle::kMu));
310 ceballos 1.44 diBoson->AddDaughter(p->FindDaughter(MCParticle::kMu));
311     diBoson->AddDaughter(p->FindDaughter(MCParticle::kMuNu));
312 ceballos 1.57 sumV[0]++;
313     sumVVFlavor[0]++;
314     if (GetFillHist())
315     hDVMass[0]->Fill(TMath::Min(diBoson->Mass(),199.999));
316     const MCParticle *tmp_mu = p->FindDaughter(MCParticle::kMu);
317     while (tmp_mu->HasDaughter(MCParticle::kMu) &&
318     tmp_mu->FindDaughter(MCParticle::kMu)->IsGenerated())
319     tmp_mu = tmp_mu->FindDaughter(MCParticle::kMu);
320    
321     GenLeptons->Add(tmp_mu);
322 ceballos 1.44 }
323     }
324     if (p->HasDaughter(MCParticle::kEl) && p->HasDaughter(MCParticle::kElNu)) {
325     isOld = kFALSE;
326 ceballos 1.57 for(UInt_t nl = 0; nl < GenTempMG0->GetEntries(); nl++){
327     if(p->FindDaughter(MCParticle::kEl) == GenTempMG0->At(nl)) {
328 ceballos 1.44 isOld = kTRUE;
329     break;
330     }
331     }
332     if(isOld == kFALSE){
333 ceballos 1.57 GenTempMG0->Add(p->FindDaughter(MCParticle::kEl));
334 ceballos 1.44 diBoson->AddDaughter(p->FindDaughter(MCParticle::kEl));
335     diBoson->AddDaughter(p->FindDaughter(MCParticle::kElNu));
336 ceballos 1.57 sumV[0]++;
337     sumVVFlavor[1]++;
338     if (GetFillHist())
339     hDVMass[1]->Fill(TMath::Min(diBoson->Mass(),199.999));
340     const MCParticle *tmp_e = p->FindDaughter(MCParticle::kEl);
341     while (tmp_e->HasDaughter(MCParticle::kEl) &&
342     tmp_e->FindDaughter(MCParticle::kEl)->IsGenerated())
343     tmp_e = tmp_e->FindDaughter(MCParticle::kEl);
344     GenLeptons->Add(tmp_e);
345 ceballos 1.44 }
346     }
347     if (p->HasDaughter(MCParticle::kTau) && p->HasDaughter(MCParticle::kTauNu)) {
348     isOld = kFALSE;
349 ceballos 1.57 for(UInt_t nl = 0; nl < GenTempMG0->GetEntries(); nl++){
350     if(p->FindDaughter(MCParticle::kTau) == GenTempMG0->At(nl)) {
351 ceballos 1.44 isOld = kTRUE;
352     break;
353     }
354     }
355     if(isOld == kFALSE){
356 ceballos 1.57 GenTempMG0->Add(p->FindDaughter(MCParticle::kTau));
357 ceballos 1.44 diBoson->AddDaughter(p->FindDaughter(MCParticle::kTau));
358     diBoson->AddDaughter(p->FindDaughter(MCParticle::kTauNu));
359 ceballos 1.57 sumV[0]++;
360     sumVVFlavor[2]++;
361     if (GetFillHist())
362     hDVMass[2]->Fill(TMath::Min(diBoson->Mass(),199.999));
363     const MCParticle *tau = p->FindDaughter(MCParticle::kTau);
364     if (tau->HasDaughter(MCParticle::kMu))
365     GenLeptons->Add(tau->FindDaughter(MCParticle::kMu));
366     if (tau->HasDaughter(MCParticle::kEl))
367     GenLeptons->Add(tau->FindDaughter(MCParticle::kEl));
368     if (tau->HasDaughter(MCParticle::kTau)) {
369     const MCParticle *tau_second = tau->FindDaughter(MCParticle::kTau);
370     if (tau_second->HasDaughter(MCParticle::kMu))
371     GenLeptons->Add(tau_second->FindDaughter(MCParticle::kMu));
372     if (tau_second->HasDaughter(MCParticle::kEl))
373     GenLeptons->Add(tau_second->FindDaughter(MCParticle::kEl));
374     }
375 ceballos 1.44 }
376     }
377     if (p->HasDaughter(MCParticle::kMu,kTRUE) && p->HasDaughter(-1*MCParticle::kMu,kTRUE)) {
378     isOld = kFALSE;
379 ceballos 1.57 for(UInt_t nl = 0; nl < GenTempMG0->GetEntries(); nl++){
380     if(p->FindDaughter(MCParticle::kMu,kTRUE) == GenTempMG0->At(nl)) {
381 ceballos 1.44 isOld = kTRUE;
382     break;
383     }
384     }
385     if(isOld == kFALSE){
386 ceballos 1.57 GenTempMG0->Add(p->FindDaughter(MCParticle::kMu,kTRUE));
387 ceballos 1.44 diBoson->AddDaughter(p->FindDaughter(MCParticle::kMu,kTRUE));
388     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kMu,kTRUE));
389 ceballos 1.57 sumV[1]++;
390     sumVVFlavor[3]++;
391     if (GetFillHist())
392     hDVMass[3]->Fill(TMath::Min(diBoson->Mass(),199.999));
393     const MCParticle *tmp_mu0 = p->FindDaughter(MCParticle::kMu,kTRUE);
394     while (tmp_mu0->HasDaughter(MCParticle::kMu) &&
395     tmp_mu0->FindDaughter(MCParticle::kMu)->IsGenerated())
396     tmp_mu0 = tmp_mu0->FindDaughter(MCParticle::kMu);
397     const MCParticle *tmp_mu1 = p->FindDaughter(-1*MCParticle::kMu,kTRUE);
398     while (tmp_mu1->HasDaughter(MCParticle::kMu) &&
399     tmp_mu1->FindDaughter(MCParticle::kMu)->IsGenerated())
400     tmp_mu1 = tmp_mu1->FindDaughter(MCParticle::kMu);
401     GenLeptons->Add(tmp_mu0);
402     GenLeptons->Add(tmp_mu1);
403 ceballos 1.44 }
404     }
405     if (p->HasDaughter(MCParticle::kEl,kTRUE) && p->HasDaughter(-1*MCParticle::kEl,kTRUE)) {
406     isOld = kFALSE;
407 ceballos 1.57 for(UInt_t nl = 0; nl < GenTempMG0->GetEntries(); nl++){
408     if(p->FindDaughter(MCParticle::kEl,kTRUE) == GenTempMG0->At(nl)) {
409 ceballos 1.44 isOld = kTRUE;
410     break;
411     }
412     }
413     if(isOld == kFALSE){
414 ceballos 1.57 GenTempMG0->Add(p->FindDaughter(MCParticle::kEl,kTRUE));
415 ceballos 1.44 diBoson->AddDaughter(p->FindDaughter(MCParticle::kEl,kTRUE));
416     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kEl,kTRUE));
417 ceballos 1.57 sumV[1]++;
418     sumVVFlavor[4]++;
419     if (GetFillHist())
420     hDVMass[4]->Fill(TMath::Min(diBoson->Mass(),199.999));
421     const MCParticle *tmp_e0 = p->Daughter(0);
422     while (tmp_e0->HasDaughter(MCParticle::kEl) &&
423     tmp_e0->FindDaughter(MCParticle::kEl)->IsGenerated())
424     tmp_e0 = tmp_e0->FindDaughter(MCParticle::kEl);
425     const MCParticle *tmp_e1 = p->Daughter(1);
426     while (tmp_e1->HasDaughter(MCParticle::kEl) &&
427     tmp_e1->FindDaughter(MCParticle::kEl)->IsGenerated())
428     tmp_e1 = tmp_e1->FindDaughter(MCParticle::kEl);
429     GenLeptons->Add(tmp_e0);
430     GenLeptons->Add(tmp_e1);
431 ceballos 1.44 }
432     }
433     if (p->HasDaughter(MCParticle::kTau,kTRUE) && p->HasDaughter(-1*MCParticle::kTau,kTRUE)) {
434     isOld = kFALSE;
435 ceballos 1.57 for(UInt_t nl = 0; nl < GenTempMG0->GetEntries(); nl++){
436     if(p->FindDaughter(MCParticle::kTau,kTRUE) == GenTempMG0->At(nl)) {
437 ceballos 1.44 isOld = kTRUE;
438     break;
439     }
440     }
441     if(isOld == kFALSE){
442 ceballos 1.57 GenTempMG0->Add(p->FindDaughter(MCParticle::kTau,kTRUE));
443 ceballos 1.44 diBoson->AddDaughter(p->FindDaughter(MCParticle::kTau,kTRUE));
444     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kTau,kTRUE));
445 ceballos 1.57 sumV[1]++;
446     sumVVFlavor[5]++;
447     if (GetFillHist())
448     hDVMass[5]->Fill(TMath::Min(diBoson->Mass(),199.999));
449     const MCParticle *tau0 = p->Daughter(0);
450     if (tau0->HasDaughter(MCParticle::kMu))
451     GenLeptons->Add(tau0->FindDaughter(MCParticle::kMu));
452     if (tau0->HasDaughter(MCParticle::kEl))
453     GenLeptons->Add(tau0->FindDaughter(MCParticle::kEl));
454     const MCParticle *tau1 = p->Daughter(1);
455     if (tau1->HasDaughter(MCParticle::kMu))
456     GenLeptons->Add(tau1->FindDaughter(MCParticle::kMu));
457     if (tau1->HasDaughter(MCParticle::kEl))
458     GenLeptons->Add(tau1->FindDaughter(MCParticle::kEl));
459     if (tau0->HasDaughter(MCParticle::kTau)) {
460     const MCParticle *tau0_second = tau0->FindDaughter(MCParticle::kTau);
461     if (tau0_second->HasDaughter(MCParticle::kMu))
462     GenLeptons->Add(tau0_second->FindDaughter(MCParticle::kMu));
463     if (tau0_second->HasDaughter(MCParticle::kEl))
464     GenLeptons->Add(tau0_second->FindDaughter(MCParticle::kEl));
465     }
466     if (tau1->HasDaughter(MCParticle::kTau)) {
467     const MCParticle *tau1_second = tau1->FindDaughter(MCParticle::kTau);
468     if (tau1_second->HasDaughter(MCParticle::kMu))
469     GenLeptons->Add(tau1_second->FindDaughter(MCParticle::kMu));
470     if (tau1_second->HasDaughter(MCParticle::kEl))
471     GenLeptons->Add(tau1_second->FindDaughter(MCParticle::kEl));
472     }
473 ceballos 1.44 }
474     }
475     if (p->HasDaughter(MCParticle::kMuNu,kTRUE) && p->HasDaughter(-1*MCParticle::kMuNu,kTRUE)) {
476     isOld = kFALSE;
477 ceballos 1.57 for(UInt_t nl = 0; nl < GenTempMG0->GetEntries(); nl++){
478     if(p->FindDaughter(MCParticle::kMuNu,kTRUE) == GenTempMG0->At(nl)) {
479 ceballos 1.44 isOld = kTRUE;
480     break;
481     }
482     }
483     if(isOld == kFALSE){
484 ceballos 1.57 GenTempMG0->Add(p->FindDaughter(MCParticle::kMuNu,kTRUE));
485 ceballos 1.44 diBoson->AddDaughter(p->FindDaughter(MCParticle::kMuNu,kTRUE));
486     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kMuNu,kTRUE));
487 ceballos 1.57 sumV[1]++;
488     sumVVFlavor[6]++;
489     if (GetFillHist())
490     hDVMass[6]->Fill(TMath::Min(diBoson->Mass(),199.999));
491 ceballos 1.44 }
492     }
493     if (p->HasDaughter(MCParticle::kElNu,kTRUE) && p->HasDaughter(-1*MCParticle::kElNu,kTRUE)) {
494     isOld = kFALSE;
495 ceballos 1.57 for(UInt_t nl = 0; nl < GenTempMG0->GetEntries(); nl++){
496     if(p->FindDaughter(MCParticle::kElNu,kTRUE) == GenTempMG0->At(nl)) {
497 ceballos 1.44 isOld = kTRUE;
498     break;
499     }
500     }
501     if(isOld == kFALSE){
502 ceballos 1.57 GenTempMG0->Add(p->FindDaughter(MCParticle::kElNu,kTRUE));
503 ceballos 1.44 diBoson->AddDaughter(p->FindDaughter(MCParticle::kElNu,kTRUE));
504     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kElNu,kTRUE));
505 ceballos 1.57 sumV[1]++;
506     sumVVFlavor[7]++;
507     if (GetFillHist())
508     hDVMass[7]->Fill(TMath::Min(diBoson->Mass(),199.999));
509 ceballos 1.44 }
510     }
511 ceballos 1.57 if (p->HasDaughter(MCParticle::kTauNu,kTRUE) && p->HasDaughter(-1*MCParticle::kTauNu,kTRUE)) {
512 ceballos 1.44 isOld = kFALSE;
513 ceballos 1.57 for(UInt_t nl = 0; nl < GenTempMG0->GetEntries(); nl++){
514     if(p->FindDaughter(MCParticle::kTauNu,kTRUE) == GenTempMG0->At(nl)) {
515 ceballos 1.44 isOld = kTRUE;
516     break;
517     }
518     }
519     if(isOld == kFALSE){
520 ceballos 1.57 GenTempMG0->Add(p->FindDaughter(MCParticle::kTauNu,kTRUE));
521 ceballos 1.44 diBoson->AddDaughter(p->FindDaughter(MCParticle::kTauNu,kTRUE));
522     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kTauNu,kTRUE));
523 ceballos 1.57 sumV[1]++;
524     sumVVFlavor[8]++;
525     if (GetFillHist())
526     hDVMass[8]->Fill(TMath::Min(diBoson->Mass(),199.999));
527 ceballos 1.44 }
528     }
529     delete diBoson;
530     }
531 ceballos 1.57
532     // t -> lnu for Madgraph
533     if (p->Is(MCParticle::kTop)) {
534     CompositeParticle *diBoson = new CompositeParticle();
535     if (p->HasDaughter(MCParticle::kMu) && p->HasDaughter(MCParticle::kMuNu)) {
536     diBoson->AddDaughter(p->FindDaughter(MCParticle::kMu));
537     diBoson->AddDaughter(p->FindDaughter(MCParticle::kMuNu));
538     if (GetFillHist())
539     hDVMass[9]->Fill(TMath::Min(diBoson->Mass(),199.999));
540     GenLeptons->Add(p->FindDaughter(MCParticle::kMu));
541     }
542     else if (p->HasDaughter(MCParticle::kEl) && p->HasDaughter(MCParticle::kElNu)) {
543     diBoson->AddDaughter(p->FindDaughter(MCParticle::kEl));
544     diBoson->AddDaughter(p->FindDaughter(MCParticle::kElNu));
545     if (GetFillHist())
546     hDVMass[10]->Fill(TMath::Min(diBoson->Mass(),199.999));
547     GenLeptons->Add(p->FindDaughter(MCParticle::kEl));
548     }
549     else if (p->HasDaughter(MCParticle::kTau) && p->HasDaughter(MCParticle::kTauNu)) {
550     diBoson->AddDaughter(p->FindDaughter(MCParticle::kTau));
551     diBoson->AddDaughter(p->FindDaughter(MCParticle::kTauNu));
552     if (GetFillHist())
553     hDVMass[11]->Fill(TMath::Min(diBoson->Mass(),199.999));
554     const MCParticle *tau = p->FindDaughter(MCParticle::kTau);
555     if (tau->HasDaughter(MCParticle::kMu))
556     GenLeptons->Add(tau->FindDaughter(MCParticle::kMu));
557     if (tau->HasDaughter(MCParticle::kEl))
558     GenLeptons->Add(tau->FindDaughter(MCParticle::kEl));
559     }
560     else if (!p->HasDaughter(MCParticle::kW)) {
561     for(UInt_t nd=0; nd<p->NDaughters(); ++nd)
562     if (p->Daughter(nd)->IsNot(MCParticle::kBottom) &&
563     p->Daughter(nd)->IsNot(MCParticle::kGamma))
564     diBoson->AddDaughter(p->Daughter(nd));
565     if (GetFillHist())
566     hDVMass[12]->Fill(TMath::Min(diBoson->Mass(),199.999));
567 ceballos 1.44 }
568 ceballos 1.57 delete diBoson;
569 ceballos 1.44 }
570 ceballos 1.57
571     // mass cut for given pid
572     if(fPdgIdCut && p->Is(fPdgIdCut) &&
573     (p->Mass() < fMassMinCut || p->Mass() > fMassMaxCut)) {
574     SkipEvent();
575     return;
576     }
577 ceballos 1.44 } // end loop of particles
578    
579 ceballos 1.57 delete GenTempMG0;
580    
581     // --------------------------------
582     // Begin special study about VVjets
583     // --------------------------------
584     if(sumV[0] + 4*sumV[1] == 2 || sumV[0] + 4*sumV[1] == 5 || sumV[0] + 4*sumV[1] == 8){
585     MCParticleOArr *GenTempMG1 = new MCParticleOArr;
586     Double_t diBosonMass[2] = {0., 0.};
587     for (UInt_t i=0; i<fParticles->GetEntries(); ++i) {
588     const MCParticle *p = fParticles->At(i);
589    
590     if (p->IsParton() && p->NDaughters() >= 2) {
591     CompositeParticle *diBoson = new CompositeParticle();
592     if (p->HasDaughter(MCParticle::kMu) && p->HasDaughter(MCParticle::kMuNu)) {
593     isOld = kFALSE;
594     for(UInt_t nl = 0; nl < GenTempMG1->GetEntries(); nl++){
595     if(p->FindDaughter(MCParticle::kMu) == GenTempMG1->At(nl)) {
596     isOld = kTRUE;
597     break;
598     }
599     }
600     if(isOld == kFALSE){
601     GenTempMG1->Add(p->FindDaughter(MCParticle::kMu));
602     diBoson->AddDaughter(p->FindDaughter(MCParticle::kMu));
603     diBoson->AddDaughter(p->FindDaughter(MCParticle::kMuNu));
604     if (GetFillHist() && sumV[0] + 4*sumV[1] == 2)
605     hDVVMass[0]->Fill(TMath::Min(diBoson->Mass(),199.999));
606     if (GetFillHist() && sumV[0] + 4*sumV[1] == 5)
607     hDVVMass[1]->Fill(TMath::Min(diBoson->Mass(),199.999));
608     }
609     }
610     if (p->HasDaughter(MCParticle::kEl) && p->HasDaughter(MCParticle::kElNu)) {
611     isOld = kFALSE;
612     for(UInt_t nl = 0; nl < GenTempMG1->GetEntries(); nl++){
613     if(p->FindDaughter(MCParticle::kEl) == GenTempMG1->At(nl)) {
614     isOld = kTRUE;
615     break;
616     }
617     }
618     if(isOld == kFALSE){
619     GenTempMG1->Add(p->FindDaughter(MCParticle::kEl));
620     diBoson->AddDaughter(p->FindDaughter(MCParticle::kEl));
621     diBoson->AddDaughter(p->FindDaughter(MCParticle::kElNu));
622     if (GetFillHist() && sumV[0] + 4*sumV[1] == 2)
623     hDVVMass[2]->Fill(TMath::Min(diBoson->Mass(),199.999));
624     if (GetFillHist() && sumV[0] + 4*sumV[1] == 5)
625     hDVVMass[3]->Fill(TMath::Min(diBoson->Mass(),199.999));
626     }
627     }
628     if (p->HasDaughter(MCParticle::kTau) && p->HasDaughter(MCParticle::kTauNu)) {
629     isOld = kFALSE;
630     for(UInt_t nl = 0; nl < GenTempMG1->GetEntries(); nl++){
631     if(p->FindDaughter(MCParticle::kTau) == GenTempMG1->At(nl)) {
632     isOld = kTRUE;
633     break;
634     }
635     }
636     if(isOld == kFALSE){
637     GenTempMG1->Add(p->FindDaughter(MCParticle::kTau));
638     diBoson->AddDaughter(p->FindDaughter(MCParticle::kTau));
639     diBoson->AddDaughter(p->FindDaughter(MCParticle::kTauNu));
640     if (GetFillHist() && sumV[0] + 4*sumV[1] == 2)
641     hDVVMass[4]->Fill(TMath::Min(diBoson->Mass(),199.999));
642     if (GetFillHist() && sumV[0] + 4*sumV[1] == 5)
643     hDVVMass[5]->Fill(TMath::Min(diBoson->Mass(),199.999));
644     }
645     }
646     if (p->HasDaughter(MCParticle::kMu,kTRUE) && p->HasDaughter(-1*MCParticle::kMu,kTRUE)) {
647     isOld = kFALSE;
648     for(UInt_t nl = 0; nl < GenTempMG1->GetEntries(); nl++){
649     if(p->FindDaughter(MCParticle::kMu,kTRUE) == GenTempMG1->At(nl)) {
650     isOld = kTRUE;
651     break;
652     }
653     }
654     if(isOld == kFALSE){
655     GenTempMG1->Add(p->FindDaughter(MCParticle::kMu,kTRUE));
656     diBoson->AddDaughter(p->FindDaughter(MCParticle::kMu,kTRUE));
657     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kMu,kTRUE));
658     if (GetFillHist() && sumV[0] + 4*sumV[1] == 5)
659     hDVVMass[6]->Fill(TMath::Min(diBoson->Mass(),199.999));
660     if (GetFillHist() && sumV[0] + 4*sumV[1] == 8)
661     hDVVMass[7]->Fill(TMath::Min(diBoson->Mass(),199.999));
662     }
663     }
664     if (p->HasDaughter(MCParticle::kEl,kTRUE) && p->HasDaughter(-1*MCParticle::kEl,kTRUE)) {
665     isOld = kFALSE;
666     for(UInt_t nl = 0; nl < GenTempMG1->GetEntries(); nl++){
667     if(p->FindDaughter(MCParticle::kEl,kTRUE) == GenTempMG1->At(nl)) {
668     isOld = kTRUE;
669     break;
670     }
671     }
672     if(isOld == kFALSE){
673     GenTempMG1->Add(p->FindDaughter(MCParticle::kEl,kTRUE));
674     diBoson->AddDaughter(p->FindDaughter(MCParticle::kEl,kTRUE));
675     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kEl,kTRUE));
676     if (GetFillHist() && sumV[0] + 4*sumV[1] == 5)
677     hDVVMass[8]->Fill(TMath::Min(diBoson->Mass(),199.999));
678     if (GetFillHist() && sumV[0] + 4*sumV[1] == 8)
679     hDVVMass[9]->Fill(TMath::Min(diBoson->Mass(),199.999));
680     }
681     }
682     if (p->HasDaughter(MCParticle::kTau,kTRUE) && p->HasDaughter(-1*MCParticle::kTau,kTRUE)) {
683     isOld = kFALSE;
684     for(UInt_t nl = 0; nl < GenTempMG1->GetEntries(); nl++){
685     if(p->FindDaughter(MCParticle::kTau,kTRUE) == GenTempMG1->At(nl)) {
686     isOld = kTRUE;
687     break;
688     }
689     }
690     if(isOld == kFALSE){
691     GenTempMG1->Add(p->FindDaughter(MCParticle::kTau,kTRUE));
692     diBoson->AddDaughter(p->FindDaughter(MCParticle::kTau,kTRUE));
693     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kTau,kTRUE));
694     if (GetFillHist() && sumV[0] + 4*sumV[1] == 5)
695     hDVVMass[10]->Fill(TMath::Min(diBoson->Mass(),199.999));
696     if (GetFillHist() && sumV[0] + 4*sumV[1] == 8)
697     hDVVMass[11]->Fill(TMath::Min(diBoson->Mass(),199.999));
698     }
699     }
700     if (p->HasDaughter(MCParticle::kMuNu,kTRUE) && p->HasDaughter(-1*MCParticle::kMuNu,kTRUE)) {
701     isOld = kFALSE;
702     for(UInt_t nl = 0; nl < GenTempMG1->GetEntries(); nl++){
703     if(p->FindDaughter(MCParticle::kMuNu,kTRUE) == GenTempMG1->At(nl)) {
704     isOld = kTRUE;
705     break;
706     }
707     }
708     if(isOld == kFALSE){
709     GenTempMG1->Add(p->FindDaughter(MCParticle::kMuNu,kTRUE));
710     diBoson->AddDaughter(p->FindDaughter(MCParticle::kMuNu,kTRUE));
711     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kMuNu,kTRUE));
712     if (GetFillHist() && sumV[0] + 4*sumV[1] == 5)
713     hDVVMass[12]->Fill(TMath::Min(diBoson->Mass(),199.999));
714     if (GetFillHist() && sumV[0] + 4*sumV[1] == 8)
715     hDVVMass[13]->Fill(TMath::Min(diBoson->Mass(),199.999));
716     }
717     }
718     if (p->HasDaughter(MCParticle::kElNu,kTRUE) && p->HasDaughter(-1*MCParticle::kElNu,kTRUE)) {
719     isOld = kFALSE;
720     for(UInt_t nl = 0; nl < GenTempMG1->GetEntries(); nl++){
721     if(p->FindDaughter(MCParticle::kElNu,kTRUE) == GenTempMG1->At(nl)) {
722     isOld = kTRUE;
723     break;
724     }
725     }
726     if(isOld == kFALSE){
727     GenTempMG1->Add(p->FindDaughter(MCParticle::kElNu,kTRUE));
728     diBoson->AddDaughter(p->FindDaughter(MCParticle::kElNu,kTRUE));
729     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kElNu,kTRUE));
730     if (GetFillHist() && sumV[0] + 4*sumV[1] == 5)
731     hDVVMass[14]->Fill(TMath::Min(diBoson->Mass(),199.999));
732     if (GetFillHist() && sumV[0] + 4*sumV[1] == 8)
733     hDVVMass[15]->Fill(TMath::Min(diBoson->Mass(),199.999));
734     }
735     }
736     if (p->HasDaughter(MCParticle::kTauNu,kTRUE) &&
737     p->HasDaughter(-1*MCParticle::kTauNu,kTRUE)) {
738     isOld = kFALSE;
739     for(UInt_t nl = 0; nl < GenTempMG1->GetEntries(); nl++){
740     if(p->FindDaughter(MCParticle::kTauNu,kTRUE) == GenTempMG1->At(nl)) {
741     isOld = kTRUE;
742     break;
743     }
744     }
745     if(isOld == kFALSE){
746     GenTempMG1->Add(p->FindDaughter(MCParticle::kTauNu,kTRUE));
747     diBoson->AddDaughter(p->FindDaughter(MCParticle::kTauNu,kTRUE));
748     diBoson->AddDaughter(p->FindDaughter(-1*MCParticle::kTauNu,kTRUE));
749     if (GetFillHist() && sumV[0] + 4*sumV[1] == 5)
750     hDVVMass[16]->Fill(TMath::Min(diBoson->Mass(),199.999));
751     if (GetFillHist() && sumV[0] + 4*sumV[1] == 8)
752     hDVVMass[17]->Fill(TMath::Min(diBoson->Mass(),199.999));
753     }
754     }
755     if (diBoson && diBosonMass[0] <= 0) diBosonMass[0] = diBoson->Mass();
756     else if(diBoson && diBosonMass[1] <= 0) diBosonMass[1] = diBoson->Mass();
757     delete diBoson;
758     }
759     else if (p->Status() == 3 && (p->Is(MCParticle::kZ) || p->Is(MCParticle::kW))) {
760     if (diBosonMass[0] <= 0) diBosonMass[0] = p->Mass();
761     else if(diBosonMass[1] <= 0) diBosonMass[1] = p->Mass();
762     if (GetFillHist()) {
763     if (sumV[0] + 4*sumV[1] == 2 && p->Is(MCParticle::kW) &&
764     p->HasDaughter(MCParticle::kMu) &&
765     p->HasDaughter(MCParticle::kMuNu))
766     hDVVMass[0]->Fill(TMath::Min(p->Mass(),199.999));
767     else if(sumV[0] + 4*sumV[1] == 2 && p->Is(MCParticle::kW) &&
768     p->HasDaughter(MCParticle::kEl) &&
769     p->HasDaughter(MCParticle::kElNu))
770     hDVVMass[2]->Fill(TMath::Min(p->Mass(),199.999));
771     else if(sumV[0] + 4*sumV[1] == 2 && p->Is(MCParticle::kW) &&
772     p->HasDaughter(MCParticle::kTau) &&
773     p->HasDaughter(MCParticle::kTauNu))
774     hDVVMass[4]->Fill(TMath::Min(p->Mass(),199.999));
775     else if(sumV[0] + 4*sumV[1] == 5 && p->Is(MCParticle::kW) &&
776     p->HasDaughter(MCParticle::kMu) &&
777     p->HasDaughter(MCParticle::kMuNu))
778     hDVVMass[1]->Fill(TMath::Min(p->Mass(),199.999));
779     else if(sumV[0] + 4*sumV[1] == 5 && p->Is(MCParticle::kW) &&
780     p->HasDaughter(MCParticle::kEl) &&
781     p->HasDaughter(MCParticle::kElNu))
782     hDVVMass[3]->Fill(TMath::Min(p->Mass(),199.999));
783     else if(sumV[0] + 4*sumV[1] == 5 && p->Is(MCParticle::kW) &&
784     p->HasDaughter(MCParticle::kTau) &&
785     p->HasDaughter(MCParticle::kTauNu))
786     hDVVMass[5]->Fill(TMath::Min(p->Mass(),199.999));
787     else if(sumV[0] + 4*sumV[1] == 5 && p->Is(MCParticle::kZ) &&
788     p->HasDaughter(MCParticle::kMu,kTRUE) &&
789     p->HasDaughter(-1*MCParticle::kMu,kTRUE))
790     hDVVMass[6]->Fill(TMath::Min(p->Mass(),199.999));
791     else if(sumV[0] + 4*sumV[1] == 5 && p->Is(MCParticle::kZ) &&
792     p->HasDaughter(MCParticle::kEl,kTRUE) &&
793     p->HasDaughter(-1*MCParticle::kEl,kTRUE))
794     hDVVMass[8]->Fill(TMath::Min(p->Mass(),199.999));
795     else if(sumV[0] + 4*sumV[1] == 5 && p->Is(MCParticle::kZ) &&
796     p->HasDaughter(MCParticle::kTau,kTRUE) &&
797     p->HasDaughter(-1*MCParticle::kTau,kTRUE))
798     hDVVMass[10]->Fill(TMath::Min(p->Mass(),199.999));
799     else if(sumV[0] + 4*sumV[1] == 5 && p->Is(MCParticle::kZ) &&
800     p->HasDaughter(MCParticle::kMuNu,kTRUE) &&
801     p->HasDaughter(-1*MCParticle::kMuNu,kTRUE))
802     hDVVMass[12]->Fill(TMath::Min(p->Mass(),199.999));
803     else if(sumV[0] + 4*sumV[1] == 5 && p->Is(MCParticle::kZ) &&
804     p->HasDaughter(MCParticle::kElNu,kTRUE) &&
805     p->HasDaughter(-1*MCParticle::kElNu,kTRUE))
806     hDVVMass[14]->Fill(TMath::Min(p->Mass(),199.999));
807     else if(sumV[0] + 4*sumV[1] == 5 && p->Is(MCParticle::kZ) &&
808     p->HasDaughter(MCParticle::kTauNu,kTRUE) &&
809     p->HasDaughter(-1*MCParticle::kTauNu,kTRUE))
810     hDVVMass[16]->Fill(TMath::Min(p->Mass(),199.999));
811     else if(sumV[0] + 4*sumV[1] == 8 && p->Is(MCParticle::kZ) &&
812     p->HasDaughter(MCParticle::kMu,kTRUE) &&
813     p->HasDaughter(-1*MCParticle::kMu,kTRUE))
814     hDVVMass[7]->Fill(TMath::Min(p->Mass(),199.999));
815     else if(sumV[0] + 4*sumV[1] == 8 && p->Is(MCParticle::kZ) &&
816     p->HasDaughter(MCParticle::kEl,kTRUE) &&
817     p->HasDaughter(-1*MCParticle::kEl,kTRUE))
818     hDVVMass[9]->Fill(TMath::Min(p->Mass(),199.999));
819     else if(sumV[0] + 4*sumV[1] == 8 && p->Is(MCParticle::kZ) &&
820     p->HasDaughter(MCParticle::kTau,kTRUE) &&
821     p->HasDaughter(-1*MCParticle::kTau,kTRUE))
822     hDVVMass[11]->Fill(TMath::Min(p->Mass(),199.999));
823     else if(sumV[0] + 4*sumV[1] == 8 && p->Is(MCParticle::kZ) &&
824     p->HasDaughter(MCParticle::kMuNu,kTRUE) &&
825     p->HasDaughter(-1*MCParticle::kMuNu,kTRUE))
826     hDVVMass[13]->Fill(TMath::Min(p->Mass(),199.999));
827     else if(sumV[0] + 4*sumV[1] == 8 && p->Is(MCParticle::kZ) &&
828     p->HasDaughter(MCParticle::kElNu,kTRUE) &&
829     p->HasDaughter(-1*MCParticle::kElNu,kTRUE))
830     hDVVMass[15]->Fill(TMath::Min(p->Mass(),199.999));
831     else if(sumV[0] + 4*sumV[1] == 8 && p->Is(MCParticle::kZ) &&
832     p->HasDaughter(MCParticle::kTauNu,kTRUE) &&
833     p->HasDaughter(-1*MCParticle::kTauNu,kTRUE))
834     hDVVMass[17]->Fill(TMath::Min(p->Mass(),199.999));
835     }
836     }
837     } // end loop of particles
838     if (GetFillHist()) {
839     if(diBosonMass[0] > 70 && diBosonMass[0] < 110 &&
840     diBosonMass[1] > 70 && diBosonMass[1] < 110){
841     if(sumV[0] + 4*sumV[1] == 2){
842 ceballos 1.58 if (sumVVFlavor[0] == 2) hDVVMass[18]->Fill(0.);
843     else if(sumVVFlavor[1] == 2) hDVVMass[18]->Fill(1.);
844 ceballos 1.57 else if(sumVVFlavor[2] == 2) hDVVMass[18]->Fill(2.);
845     else if(sumVVFlavor[0] == 1 && sumVVFlavor[1] == 1) hDVVMass[18]->Fill(3.);
846     else if(sumVVFlavor[0] == 1 && sumVVFlavor[2] == 1) hDVVMass[18]->Fill(4.);
847     else if(sumVVFlavor[1] == 1 && sumVVFlavor[2] == 1) hDVVMass[18]->Fill(5.);
848     else hDVVMass[18]->Fill(6.);
849     }
850     if(sumV[0] + 4*sumV[1] == 5){
851     if (sumVVFlavor[3] == 1 && sumVVFlavor[0] == 1) hDVVMass[19]->Fill(0.);
852     else if(sumVVFlavor[3] == 1 && sumVVFlavor[1] == 1) hDVVMass[19]->Fill(1.);
853     else if(sumVVFlavor[3] == 1 && sumVVFlavor[2] == 1) hDVVMass[19]->Fill(2.);
854     else if(sumVVFlavor[4] == 1 && sumVVFlavor[0] == 1) hDVVMass[19]->Fill(3.);
855     else if(sumVVFlavor[4] == 1 && sumVVFlavor[1] == 1) hDVVMass[19]->Fill(4.);
856     else if(sumVVFlavor[4] == 1 && sumVVFlavor[2] == 1) hDVVMass[19]->Fill(5.);
857     else if(sumVVFlavor[5] == 1 && sumVVFlavor[0] == 1) hDVVMass[19]->Fill(6.);
858     else if(sumVVFlavor[5] == 1 && sumVVFlavor[1] == 1) hDVVMass[19]->Fill(7.);
859     else if(sumVVFlavor[5] == 1 && sumVVFlavor[2] == 1) hDVVMass[19]->Fill(8.);
860 ceballos 1.58 else { hDVVMass[19]->Fill(9.);
861     /*for(int i=0; i<9; i++) cout << sumVVFlavor[i] << " " ;cout << endl;*/}
862 ceballos 1.57 }
863     if(sumV[0] + 4*sumV[1] == 8 &&
864 ceballos 1.58 sumVVFlavor[3] + sumVVFlavor[4] + sumVVFlavor[5] == 2){
865     if (sumVVFlavor[3] == 2) hDVVMass[20]->Fill(0.);
866     else if(sumVVFlavor[4] == 2) hDVVMass[20]->Fill(1.);
867     else if(sumVVFlavor[5] == 2) hDVVMass[20]->Fill(2.);
868 ceballos 1.57 else if(sumVVFlavor[3] == 1 && sumVVFlavor[4] == 1) hDVVMass[20]->Fill(3.);
869     else if(sumVVFlavor[3] == 1 && sumVVFlavor[5] == 1) hDVVMass[20]->Fill(4.);
870     else if(sumVVFlavor[4] == 1 && sumVVFlavor[5] == 1) hDVVMass[20]->Fill(5.);
871     else hDVVMass[20]->Fill(6.);
872     }
873     else if(sumV[0] + 4*sumV[1] == 8){
874 ceballos 1.58 if (sumVVFlavor[6] == 2) hDVVMass[21]->Fill(0.);
875     else if(sumVVFlavor[7] == 2) hDVVMass[21]->Fill(1.);
876     else if(sumVVFlavor[8] == 2) hDVVMass[21]->Fill(2.);
877 ceballos 1.57 else if(sumVVFlavor[3] == 1 && sumVVFlavor[6] == 1) hDVVMass[21]->Fill(3.);
878     else if(sumVVFlavor[3] == 1 && sumVVFlavor[7] == 1) hDVVMass[21]->Fill(4.);
879     else if(sumVVFlavor[3] == 1 && sumVVFlavor[8] == 1) hDVVMass[21]->Fill(5.);
880     else if(sumVVFlavor[4] == 1 && sumVVFlavor[6] == 1) hDVVMass[21]->Fill(6.);
881     else if(sumVVFlavor[4] == 1 && sumVVFlavor[7] == 1) hDVVMass[21]->Fill(7.);
882     else if(sumVVFlavor[4] == 1 && sumVVFlavor[8] == 1) hDVVMass[21]->Fill(8.);
883     else if(sumVVFlavor[5] == 1 && sumVVFlavor[6] == 1) hDVVMass[21]->Fill(9.);
884     else if(sumVVFlavor[5] == 1 && sumVVFlavor[7] == 1) hDVVMass[21]->Fill(10.);
885     else if(sumVVFlavor[5] == 1 && sumVVFlavor[8] == 1) hDVVMass[21]->Fill(11.);
886     else if(sumVVFlavor[6] == 1 && sumVVFlavor[7] == 1) hDVVMass[21]->Fill(12.);
887     else if(sumVVFlavor[6] == 1 && sumVVFlavor[8] == 1) hDVVMass[21]->Fill(13.);
888     else if(sumVVFlavor[7] == 1 && sumVVFlavor[8] == 1) hDVVMass[21]->Fill(14.);
889     else hDVVMass[21]->Fill(15.);
890     }
891     } // 60<mV1/2<120
892     if(sumV[0] + 4*sumV[1] == 2)
893     hDVVMass[22]->Fill(TMath::Min(TMath::Min(diBosonMass[0],diBosonMass[1]),199.999));
894     if(sumV[0] + 4*sumV[1] == 2)
895     hDVVMass[23]->Fill(TMath::Min(TMath::Max(diBosonMass[0],diBosonMass[1]),199.999));
896     if(sumV[0] + 4*sumV[1] == 5)
897     hDVVMass[24]->Fill(TMath::Min(TMath::Min(diBosonMass[0],diBosonMass[1]),199.999));
898     if(sumV[0] + 4*sumV[1] == 5)
899     hDVVMass[25]->Fill(TMath::Min(TMath::Max(diBosonMass[0],diBosonMass[1]),199.999));
900     if(sumV[0] + 4*sumV[1] == 8)
901     hDVVMass[26]->Fill(TMath::Min(TMath::Min(diBosonMass[0],diBosonMass[1]),199.999));
902     if(sumV[0] + 4*sumV[1] == 8)
903     hDVVMass[27]->Fill(TMath::Min(TMath::Max(diBosonMass[0],diBosonMass[1]),199.999));
904     }
905     delete GenTempMG1;
906     } // WW, WZ or ZZ
907     // --------------------------------
908     // End special study about VVjets
909     // --------------------------------
910    
911 ceballos 1.60 Met *theMET = new Met(-totalMET[0], -totalMET[1]);
912     theMET->SetElongitudinal(-totalMET[2]);
913 ceballos 1.57 GenMet->AddOwned(theMET);
914    
915     // sort according to pt
916     GenLeptons->Sort();
917     GenAllLeptons->Sort();
918     GenTaus->Sort();
919     GenNeutrinos->Sort();
920     GenQuarks->Sort();
921     GenqqHs->Sort();
922     GenBosons->Sort();
923     GenPhotons->Sort();
924     GenRadPhotons->Sort();
925     GenISRPhotons->Sort();
926     } // Only for Monte Carlo
927 loizides 1.19
928 loizides 1.8 // add objects to this event for other modules to use
929 ceballos 1.30 AddObjThisEvt(GenMet);
930 loizides 1.13 AddObjThisEvt(GenLeptons);
931     AddObjThisEvt(GenAllLeptons);
932     AddObjThisEvt(GenTaus);
933     AddObjThisEvt(GenNeutrinos);
934     AddObjThisEvt(GenQuarks);
935     AddObjThisEvt(GenqqHs);
936     AddObjThisEvt(GenBosons);
937     AddObjThisEvt(GenPhotons);
938 ceballos 1.32 AddObjThisEvt(GenRadPhotons);
939     AddObjThisEvt(GenISRPhotons);
940    
941 ceballos 1.54 // --------------------------------
942     // Copy these Collections into the Arrays for Publication for Output Module
943     // --------------------------------
944     fGenLeptons->Delete();
945     fGenAllLeptons->Delete();
946     fGenTaus->Delete();
947     fGenNeutrinos->Delete();
948     fGenQuarks->Delete();
949     fGenqqHs->Delete();
950     fGenBosons->Delete();
951     fGenPhotons->Delete();
952     fGenRadPhotons->Delete();
953     fGenISRPhotons->Delete();
954    
955     for (UInt_t i=0; i < GenLeptons->GetEntries(); ++i) {
956     mithep::MCParticle *genParticle = fGenLeptons->Allocate();
957     new (genParticle) mithep::MCParticle(GenLeptons->At(i)->Px(),GenLeptons->At(i)->Py(),
958     GenLeptons->At(i)->Pz(),GenLeptons->At(i)->E(),
959     GenLeptons->At(i)->PdgId(),GenLeptons->At(i)->Status());
960     }
961     for (UInt_t i=0; i < GenAllLeptons->GetEntries(); ++i) {
962     mithep::MCParticle *genParticle = fGenAllLeptons->Allocate();
963     new (genParticle) mithep::MCParticle(GenAllLeptons->At(i)->Px(),GenAllLeptons->At(i)->Py(),
964     GenAllLeptons->At(i)->Pz(),GenAllLeptons->At(i)->E(),
965     GenAllLeptons->At(i)->PdgId(),GenAllLeptons->At(i)->Status());
966     }
967     for (UInt_t i=0; i < GenTaus->GetEntries(); ++i) {
968     mithep::MCParticle *genParticle = fGenTaus->Allocate();
969     new (genParticle) mithep::MCParticle(GenTaus->At(i)->Px(),GenTaus->At(i)->Py(),
970     GenTaus->At(i)->Pz(),GenTaus->At(i)->E(),
971     GenTaus->At(i)->PdgId(),GenTaus->At(i)->Status());
972     }
973     for (UInt_t i=0; i < GenNeutrinos->GetEntries(); ++i) {
974     mithep::MCParticle *genParticle = fGenNeutrinos->Allocate();
975     new (genParticle) mithep::MCParticle(GenNeutrinos->At(i)->Px(),GenNeutrinos->At(i)->Py(),
976     GenNeutrinos->At(i)->Pz(),GenNeutrinos->At(i)->E(),
977     GenNeutrinos->At(i)->PdgId(),GenNeutrinos->At(i)->Status());
978     }
979     for (UInt_t i=0; i < GenQuarks->GetEntries(); ++i) {
980     mithep::MCParticle *genParticle = fGenQuarks->Allocate();
981     new (genParticle) mithep::MCParticle(GenQuarks->At(i)->Px(),GenQuarks->At(i)->Py(),
982     GenQuarks->At(i)->Pz(),GenQuarks->At(i)->E(),
983     GenQuarks->At(i)->PdgId(),GenQuarks->At(i)->Status());
984     }
985     for (UInt_t i=0; i < GenqqHs->GetEntries(); ++i) {
986     mithep::MCParticle *genParticle = fGenqqHs->Allocate();
987     new (genParticle) mithep::MCParticle(GenqqHs->At(i)->Px(),GenqqHs->At(i)->Py(),
988     GenqqHs->At(i)->Pz(),GenqqHs->At(i)->E(),
989     GenqqHs->At(i)->PdgId(),GenqqHs->At(i)->Status());
990 loizides 1.55 }
991 ceballos 1.54
992 loizides 1.53 if (fCopyArrays) {
993     // --------------------------------
994     // Copy these Collections into the Arrays for Publication for Output Module
995     // --------------------------------
996     fGenLeptons->Delete();
997     fGenAllLeptons->Delete();
998     fGenTaus->Delete();
999     fGenNeutrinos->Delete();
1000     fGenQuarks->Delete();
1001     fGenqqHs->Delete();
1002     fGenBosons->Delete();
1003     fGenPhotons->Delete();
1004     fGenRadPhotons->Delete();
1005     fGenISRPhotons->Delete();
1006    
1007     for (UInt_t i=0; i < GenLeptons->GetEntries(); ++i) {
1008     mithep::MCParticle *genParticle = fGenLeptons->Allocate();
1009     new (genParticle) mithep::MCParticle(GenLeptons->At(i)->Px(),GenLeptons->At(i)->Py(),
1010     GenLeptons->At(i)->Pz(),GenLeptons->At(i)->E(),
1011     GenLeptons->At(i)->PdgId(),GenLeptons->At(i)->Status());
1012     }
1013     for (UInt_t i=0; i < GenAllLeptons->GetEntries(); ++i) {
1014     mithep::MCParticle *genParticle = fGenAllLeptons->Allocate();
1015     new (genParticle) mithep::MCParticle(GenAllLeptons->At(i)->Px(),GenAllLeptons->At(i)->Py(),
1016     GenAllLeptons->At(i)->Pz(),GenAllLeptons->At(i)->E(),
1017     GenAllLeptons->At(i)->PdgId(),
1018     GenAllLeptons->At(i)->Status());
1019     }
1020     for (UInt_t i=0; i < GenTaus->GetEntries(); ++i) {
1021     mithep::MCParticle *genParticle = fGenTaus->Allocate();
1022     new (genParticle) mithep::MCParticle(GenTaus->At(i)->Px(),GenTaus->At(i)->Py(),
1023     GenTaus->At(i)->Pz(),GenTaus->At(i)->E(),
1024     GenTaus->At(i)->PdgId(),
1025     GenTaus->At(i)->Status());
1026     }
1027     for (UInt_t i=0; i < GenNeutrinos->GetEntries(); ++i) {
1028     mithep::MCParticle *genParticle = fGenNeutrinos->Allocate();
1029     new (genParticle) mithep::MCParticle(GenNeutrinos->At(i)->Px(),GenNeutrinos->At(i)->Py(),
1030     GenNeutrinos->At(i)->Pz(),GenNeutrinos->At(i)->E(),
1031     GenNeutrinos->At(i)->PdgId(),
1032     GenNeutrinos->At(i)->Status());
1033     }
1034     for (UInt_t i=0; i < GenQuarks->GetEntries(); ++i) {
1035     mithep::MCParticle *genParticle = fGenQuarks->Allocate();
1036     new (genParticle) mithep::MCParticle(GenQuarks->At(i)->Px(),GenQuarks->At(i)->Py(),
1037     GenQuarks->At(i)->Pz(),GenQuarks->At(i)->E(),
1038     GenQuarks->At(i)->PdgId(),
1039     GenQuarks->At(i)->Status());
1040     }
1041     for (UInt_t i=0; i < GenqqHs->GetEntries(); ++i) {
1042     mithep::MCParticle *genParticle = fGenqqHs->Allocate();
1043     new (genParticle) mithep::MCParticle(GenqqHs->At(i)->Px(),GenqqHs->At(i)->Py(),
1044     GenqqHs->At(i)->Pz(),GenqqHs->At(i)->E(),
1045     GenqqHs->At(i)->PdgId(),
1046     GenqqHs->At(i)->Status());
1047     }
1048     for (UInt_t i=0; i < GenBosons->GetEntries(); ++i) {
1049     mithep::MCParticle *genParticle = fGenBosons->Allocate();
1050     new (genParticle) mithep::MCParticle(GenBosons->At(i)->Px(),GenBosons->At(i)->Py(),
1051     GenBosons->At(i)->Pz(),GenBosons->At(i)->E(),
1052     GenBosons->At(i)->PdgId(),
1053     GenBosons->At(i)->Status());
1054     }
1055     for (UInt_t i=0; i < GenPhotons->GetEntries(); ++i) {
1056     mithep::MCParticle *genParticle = fGenPhotons->Allocate();
1057     new (genParticle) mithep::MCParticle(GenPhotons->At(i)->Px(),GenPhotons->At(i)->Py(),
1058     GenPhotons->At(i)->Pz(),GenPhotons->At(i)->E(),
1059     GenPhotons->At(i)->PdgId(),
1060     GenPhotons->At(i)->Status());
1061     }
1062     for (UInt_t i=0; i < GenRadPhotons->GetEntries(); ++i) {
1063     mithep::MCParticle *genParticle = fGenRadPhotons->Allocate();
1064     new (genParticle) mithep::MCParticle(GenRadPhotons->At(i)->Px(),GenRadPhotons->At(i)->Py(),
1065     GenRadPhotons->At(i)->Pz(),GenRadPhotons->At(i)->E(),
1066     GenRadPhotons->At(i)->PdgId(),
1067     GenRadPhotons->At(i)->Status());
1068     }
1069     for (UInt_t i=0; i < GenISRPhotons->GetEntries(); ++i) {
1070     mithep::MCParticle *genParticle = fGenISRPhotons->Allocate();
1071     new (genParticle) mithep::MCParticle(GenISRPhotons->At(i)->Px(),GenISRPhotons->At(i)->Py(),
1072     GenISRPhotons->At(i)->Pz(),GenISRPhotons->At(i)->E(),
1073     GenISRPhotons->At(i)->PdgId(),
1074     GenISRPhotons->At(i)->Status());
1075     }
1076 sixie 1.48 }
1077    
1078 ceballos 1.54 for (UInt_t i=0; i < GenBosons->GetEntries(); ++i) {
1079     mithep::MCParticle *genParticle = fGenBosons->Allocate();
1080     new (genParticle) mithep::MCParticle(GenBosons->At(i)->Px(),GenBosons->At(i)->Py(),
1081     GenBosons->At(i)->Pz(),GenBosons->At(i)->E(),
1082     GenBosons->At(i)->PdgId(),GenBosons->At(i)->Status());
1083     }
1084     for (UInt_t i=0; i < GenPhotons->GetEntries(); ++i) {
1085     mithep::MCParticle *genParticle = fGenPhotons->Allocate();
1086     new (genParticle) mithep::MCParticle(GenPhotons->At(i)->Px(),GenPhotons->At(i)->Py(),
1087     GenPhotons->At(i)->Pz(),GenPhotons->At(i)->E(),
1088     GenPhotons->At(i)->PdgId(),GenPhotons->At(i)->Status());
1089     }
1090     for (UInt_t i=0; i < GenRadPhotons->GetEntries(); ++i) {
1091     mithep::MCParticle *genParticle = fGenRadPhotons->Allocate();
1092     new (genParticle) mithep::MCParticle(GenRadPhotons->At(i)->Px(),GenRadPhotons->At(i)->Py(),
1093     GenRadPhotons->At(i)->Pz(),GenRadPhotons->At(i)->E(),
1094     GenRadPhotons->At(i)->PdgId(),GenRadPhotons->At(i)->Status());
1095     }
1096     for (UInt_t i=0; i < GenISRPhotons->GetEntries(); ++i) {
1097     mithep::MCParticle *genParticle = fGenISRPhotons->Allocate();
1098     new (genParticle) mithep::MCParticle(GenISRPhotons->At(i)->Px(),GenISRPhotons->At(i)->Py(),
1099     GenISRPhotons->At(i)->Pz(),GenISRPhotons->At(i)->E(),
1100     GenISRPhotons->At(i)->PdgId(),GenISRPhotons->At(i)->Status());
1101     }
1102    
1103 ceballos 1.63 // Apply WW filter (without filling all histograms)
1104 phedex 1.65 Bool_t passVVFilter = kFALSE;
1105 sixie 1.66 if ( (fAllowWWEvents == kTRUE && sumV[0] + 4*sumV[1] == 2 )
1106 phedex 1.65 ||
1107 sixie 1.66 (fAllowWZEvents == kTRUE && sumV[0] + 4*sumV[1] == 6 )
1108 phedex 1.65 ||
1109 sixie 1.66 (fAllowZZEvents == kTRUE && sumV[0] + 4*sumV[1] == 8 )
1110 phedex 1.65 ) passVVFilter = kTRUE;
1111 sixie 1.66 if (fApplyVVFilter && !passVVFilter) {
1112 ceballos 1.63 SkipEvent();
1113     return;
1114     }
1115 ceballos 1.58
1116 loizides 1.5 // fill histograms if requested
1117 loizides 1.20 if (GetFillHist()) {
1118 ceballos 1.30 // MET
1119     hDGenMet[0]->Fill(GenMet->At(0)->Pt());
1120     hDGenMet[1]->Fill(GenMet->At(0)->Px());
1121     hDGenMet[2]->Fill(GenMet->At(0)->Py());
1122     hDGenMet[3]->Fill(GenMet->At(0)->Elongitudinal());
1123    
1124 ceballos 1.58 // pt min for leptons from W/Z
1125     hDGenPtMin->Fill(TMath::Min(ptMin, 199.999));
1126     //if(ptMin < 10){
1127     // SkipEvent();
1128     // return;
1129     //}
1130    
1131 loizides 1.6 // leptons
1132 loizides 1.1 hDGenLeptons[0]->Fill(GenLeptons->GetEntries());
1133 loizides 1.5 for(UInt_t i=0; i<GenLeptons->GetEntries(); i++) {
1134 loizides 1.1 hDGenLeptons[1]->Fill(GenLeptons->At(i)->Pt());
1135 loizides 1.5 hDGenLeptons[2]->Fill(TMath::Abs(GenLeptons->At(i)->Eta()));
1136     hDGenLeptons[3]->Fill(GenLeptons->At(i)->PhiDeg());
1137     for(UInt_t j=i+1; j<GenLeptons->GetEntries(); j++) {
1138 loizides 1.1 CompositeParticle *dilepton = new CompositeParticle();
1139     dilepton->AddDaughter(GenLeptons->At(i));
1140     dilepton->AddDaughter(GenLeptons->At(j));
1141     hDGenLeptons[4]->Fill(dilepton->Mass());
1142     delete dilepton;
1143     }
1144 ceballos 1.22 }
1145     // looking at events with two leptons
1146     if (GenLeptons->GetEntries() == 2) {
1147     hDGenLeptons[5]->Fill(TMath::Min(TMath::Max(TMath::Abs(GenLeptons->At(0)->Eta()),
1148     TMath::Abs(GenLeptons->At(1)->Eta())),
1149 loizides 1.5 4.999));
1150 ceballos 1.22 hDGenLeptons[6]->Fill(TMath::Min(TMath::Min(TMath::Abs(GenLeptons->At(0)->Eta()),
1151     TMath::Abs(GenLeptons->At(1)->Eta())),
1152 loizides 1.5 4.999));
1153 ceballos 1.22 if (TMath::Abs(GenLeptons->At(0)->Eta()) < 2.5 &&
1154     TMath::Abs(GenLeptons->At(1)->Eta()) < 2.5) {
1155     hDGenLeptons[7]->Fill(TMath::Min(GenLeptons->At(0)->Pt(),199.999));
1156     if (GenLeptons->At(0)->Pt() > 20.0) {
1157     hDGenLeptons[8]->Fill(TMath::Min(GenLeptons->At(1)->Pt(),199.999));
1158     if (GenLeptons->At(1)->Pt() > 10.0) {
1159 loizides 1.1 CompositeParticle *dilepton = new CompositeParticle();
1160 ceballos 1.22 dilepton->AddDaughter(GenLeptons->At(0));
1161     dilepton->AddDaughter(GenLeptons->At(1));
1162 loizides 1.1 hDGenLeptons[9]->Fill(TMath::Min(dilepton->Mass(),999.999));
1163 ceballos 1.64 hDGenLeptons[10]->Fill(MathUtils::DeltaPhi(GenLeptons->At(0)->Phi(),
1164     GenLeptons->At(1)->Phi())
1165     * 180./ TMath::Pi());
1166     hDGenLeptons[11]->Fill(MathUtils::DeltaR(*GenLeptons->At(0),
1167     *GenLeptons->At(1)));
1168 ceballos 1.22 if(dilepton->Mass() > 12.0){
1169 ceballos 1.64 hDGenLeptons[12]->Fill(MathUtils::DeltaPhi(GenLeptons->At(0)->Phi(),
1170 ceballos 1.22 GenLeptons->At(1)->Phi())
1171     * 180./ TMath::Pi());
1172 ceballos 1.64 hDGenLeptons[13]->Fill(MathUtils::DeltaR(*GenLeptons->At(0),
1173 loizides 1.40 *GenLeptons->At(1)));
1174 ceballos 1.22 }
1175 loizides 1.1 delete dilepton;
1176     }
1177     }
1178     }
1179     }
1180 ceballos 1.22 // looking at events with three leptons
1181     if (GenLeptons->GetEntries() == 3) {
1182     if (TMath::Abs(GenLeptons->At(0)->Eta()) < 2.5 &&
1183     TMath::Abs(GenLeptons->At(1)->Eta()) < 2.5 &&
1184     TMath::Abs(GenLeptons->At(2)->Eta()) < 2.5) {
1185 ceballos 1.64 hDGenLeptons[14]->Fill(TMath::Min(GenLeptons->At(0)->Pt(),199.999));
1186 ceballos 1.22 if (GenLeptons->At(0)->Pt() > 20.0) {
1187 ceballos 1.64 hDGenLeptons[15]->Fill(TMath::Min(GenLeptons->At(1)->Pt(),199.999));
1188     hDGenLeptons[16]->Fill(TMath::Min(GenLeptons->At(2)->Pt(),199.999));
1189 ceballos 1.22 if (GenLeptons->At(1)->Pt() > 10.0 && GenLeptons->At(2)->Pt() > 10.0) {
1190     CompositeParticle *dilepton01 = new CompositeParticle();
1191     dilepton01->AddDaughter(GenLeptons->At(0));
1192     dilepton01->AddDaughter(GenLeptons->At(1));
1193     CompositeParticle *dilepton02 = new CompositeParticle();
1194     dilepton02->AddDaughter(GenLeptons->At(0));
1195     dilepton02->AddDaughter(GenLeptons->At(2));
1196     CompositeParticle *dilepton12 = new CompositeParticle();
1197     dilepton12->AddDaughter(GenLeptons->At(1));
1198     dilepton12->AddDaughter(GenLeptons->At(2));
1199 ceballos 1.64 hDGenLeptons[17]->Fill(TMath::Min(dilepton01->Mass(),999.999));
1200     hDGenLeptons[17]->Fill(TMath::Min(dilepton02->Mass(),999.999));
1201     hDGenLeptons[17]->Fill(TMath::Min(dilepton12->Mass(),999.999));
1202 ceballos 1.22 CompositeParticle *trilepton = new CompositeParticle();
1203     trilepton->AddDaughter(GenLeptons->At(0));
1204     trilepton->AddDaughter(GenLeptons->At(1));
1205     trilepton->AddDaughter(GenLeptons->At(2));
1206 ceballos 1.64 hDGenLeptons[18]->Fill(TMath::Min(trilepton->Mass(),999.999));
1207 loizides 1.40 Double_t deltaR[3] = {MathUtils::DeltaR(*GenLeptons->At(0),
1208     *GenLeptons->At(1)),
1209     MathUtils::DeltaR(*GenLeptons->At(0),
1210     *GenLeptons->At(2)),
1211     MathUtils::DeltaR(*GenLeptons->At(1),
1212     *GenLeptons->At(2))};
1213 loizides 1.27 Double_t deltaRMin = deltaR[0];
1214 loizides 1.40 for(Int_t i=1; i<3; i++)
1215     if(deltaRMin > deltaR[i])
1216     deltaRMin = deltaR[i];
1217 ceballos 1.64 hDGenLeptons[19]->Fill(deltaRMin);
1218 ceballos 1.22
1219     delete dilepton01;
1220     delete dilepton02;
1221     delete dilepton12;
1222     delete trilepton;
1223     }
1224     }
1225     }
1226     }
1227     // looking at events with four leptons
1228     if (GenLeptons->GetEntries() == 4) {
1229     if (TMath::Abs(GenLeptons->At(0)->Eta()) < 2.5 &&
1230     TMath::Abs(GenLeptons->At(1)->Eta()) < 2.5 &&
1231     TMath::Abs(GenLeptons->At(2)->Eta()) < 2.5 &&
1232     TMath::Abs(GenLeptons->At(3)->Eta()) < 2.5) {
1233 ceballos 1.64 hDGenLeptons[20]->Fill(TMath::Min(GenLeptons->At(0)->Pt(),199.999));
1234 ceballos 1.22 if (GenLeptons->At(0)->Pt() > 20.0) {
1235 ceballos 1.64 hDGenLeptons[21]->Fill(TMath::Min(GenLeptons->At(1)->Pt(),199.999));
1236     hDGenLeptons[22]->Fill(TMath::Min(GenLeptons->At(2)->Pt(),199.999));
1237     hDGenLeptons[23]->Fill(TMath::Min(GenLeptons->At(3)->Pt(),199.999));
1238 ceballos 1.22 if (GenLeptons->At(1)->Pt() > 10.0 && GenLeptons->At(2)->Pt() > 10.0 &&
1239     GenLeptons->At(3)->Pt() > 10.0) {
1240     CompositeParticle *dilepton01 = new CompositeParticle();
1241     dilepton01->AddDaughter(GenLeptons->At(0));
1242     dilepton01->AddDaughter(GenLeptons->At(1));
1243     CompositeParticle *dilepton02 = new CompositeParticle();
1244     dilepton02->AddDaughter(GenLeptons->At(0));
1245     dilepton02->AddDaughter(GenLeptons->At(2));
1246     CompositeParticle *dilepton03 = new CompositeParticle();
1247     dilepton03->AddDaughter(GenLeptons->At(0));
1248     dilepton03->AddDaughter(GenLeptons->At(3));
1249     CompositeParticle *dilepton12 = new CompositeParticle();
1250     dilepton12->AddDaughter(GenLeptons->At(1));
1251     dilepton12->AddDaughter(GenLeptons->At(2));
1252     CompositeParticle *dilepton13 = new CompositeParticle();
1253     dilepton13->AddDaughter(GenLeptons->At(1));
1254     dilepton13->AddDaughter(GenLeptons->At(3));
1255     CompositeParticle *dilepton23 = new CompositeParticle();
1256     dilepton23->AddDaughter(GenLeptons->At(2));
1257     dilepton23->AddDaughter(GenLeptons->At(3));
1258 ceballos 1.64 hDGenLeptons[24]->Fill(TMath::Min(dilepton01->Mass(),999.999));
1259     hDGenLeptons[24]->Fill(TMath::Min(dilepton02->Mass(),999.999));
1260     hDGenLeptons[24]->Fill(TMath::Min(dilepton03->Mass(),999.999));
1261     hDGenLeptons[24]->Fill(TMath::Min(dilepton12->Mass(),999.999));
1262     hDGenLeptons[24]->Fill(TMath::Min(dilepton13->Mass(),999.999));
1263     hDGenLeptons[24]->Fill(TMath::Min(dilepton23->Mass(),999.999));
1264 ceballos 1.22 CompositeParticle *fourlepton = new CompositeParticle();
1265     fourlepton->AddDaughter(GenLeptons->At(0));
1266     fourlepton->AddDaughter(GenLeptons->At(1));
1267     fourlepton->AddDaughter(GenLeptons->At(2));
1268     fourlepton->AddDaughter(GenLeptons->At(3));
1269 ceballos 1.64 hDGenLeptons[25]->Fill(TMath::Min(fourlepton->Mass(),999.999));
1270 loizides 1.40 Double_t deltaR[6] = {MathUtils::DeltaR(*GenLeptons->At(0),
1271     *GenLeptons->At(1)),
1272     MathUtils::DeltaR(*GenLeptons->At(0),
1273     *GenLeptons->At(2)),
1274     MathUtils::DeltaR(*GenLeptons->At(0),
1275     *GenLeptons->At(3)),
1276     MathUtils::DeltaR(*GenLeptons->At(1),
1277     *GenLeptons->At(2)),
1278     MathUtils::DeltaR(*GenLeptons->At(1),
1279     *GenLeptons->At(3)),
1280     MathUtils::DeltaR(*GenLeptons->At(2),
1281     *GenLeptons->At(3))};
1282 loizides 1.27 Double_t deltaRMin = deltaR[0];
1283 loizides 1.40 for(Int_t i=1; i<6; i++)
1284     if(deltaRMin > deltaR[i])
1285     deltaRMin = deltaR[i];
1286 ceballos 1.64 hDGenLeptons[26]->Fill(deltaRMin);
1287 ceballos 1.22
1288     delete dilepton01;
1289     delete dilepton02;
1290     delete dilepton03;
1291     delete dilepton12;
1292     delete dilepton13;
1293     delete dilepton23;
1294     delete fourlepton;
1295     }
1296     }
1297     }
1298     }
1299 loizides 1.1
1300 loizides 1.6 // all leptons
1301 ceballos 1.3 hDGenAllLeptons[0]->Fill(GenAllLeptons->GetEntries());
1302 loizides 1.5 for(UInt_t i=0; i<GenAllLeptons->GetEntries(); i++) {
1303 ceballos 1.3 hDGenAllLeptons[1]->Fill(GenAllLeptons->At(i)->Pt());
1304 ceballos 1.49 hDGenAllLeptons[2]->Fill(GenAllLeptons->At(i)->AbsEta());
1305 loizides 1.5 hDGenAllLeptons[3]->Fill(GenAllLeptons->At(i)->PhiDeg());
1306 ceballos 1.3 }
1307 ceballos 1.49 if(GenAllLeptons->GetEntries() >= 2) hDGenAllLeptons[4]->Fill(GenAllLeptons->At(1)->Pt());
1308 ceballos 1.3
1309 loizides 1.6 // taus
1310 loizides 1.1 hDGenTaus[0]->Fill(GenTaus->GetEntries());
1311 loizides 1.5 for(UInt_t i=0; i<GenTaus->GetEntries(); i++) {
1312 loizides 1.1 hDGenTaus[1]->Fill(GenTaus->At(i)->Pt());
1313 ceballos 1.49 hDGenTaus[2]->Fill(GenTaus->At(i)->AbsEta());
1314 loizides 1.5 hDGenTaus[3]->Fill(GenTaus->At(i)->PhiDeg());
1315 loizides 1.1 }
1316    
1317 loizides 1.6 // neutrinos
1318 loizides 1.1 hDGenNeutrinos[0]->Fill(GenNeutrinos->GetEntries());
1319     CompositeParticle *neutrinoTotal = new CompositeParticle();
1320 loizides 1.5 for(UInt_t i=0; i<GenNeutrinos->GetEntries(); i++) {
1321     if (GenNeutrinos->At(i)->HasMother())
1322 loizides 1.1 neutrinoTotal->AddDaughter(GenNeutrinos->At(i));
1323     }
1324 loizides 1.5 if (GenNeutrinos->GetEntries() > 0) {
1325 loizides 1.1 hDGenNeutrinos[1]->Fill(neutrinoTotal->Pt());
1326 ceballos 1.49 hDGenNeutrinos[2]->Fill(neutrinoTotal->AbsEta());
1327 loizides 1.5 hDGenNeutrinos[3]->Fill(neutrinoTotal->PhiDeg());
1328 loizides 1.1 }
1329     delete neutrinoTotal;
1330    
1331 loizides 1.6 // quarks
1332 loizides 1.1 hDGenQuarks[0]->Fill(GenQuarks->GetEntries());
1333 loizides 1.5 for(UInt_t i=0; i<GenQuarks->GetEntries(); i++) {
1334     for(UInt_t j=i+1; j<GenQuarks->GetEntries(); j++) {
1335 loizides 1.1 CompositeParticle *dijet = new CompositeParticle();
1336     dijet->AddDaughter(GenQuarks->At(i));
1337     dijet->AddDaughter(GenQuarks->At(j));
1338     hDGenQuarks[1]->Fill(dijet->Pt());
1339     hDGenQuarks[2]->Fill(dijet->Mass());
1340 loizides 1.5 if (TMath::Abs(GenQuarks->At(i)->Eta()) < 2.5 &&
1341     TMath::Abs(GenQuarks->At(j)->Eta()) < 2.5) {
1342 loizides 1.1 hDGenQuarks[3]->Fill(dijet->Pt());
1343     hDGenQuarks[4]->Fill(dijet->Mass());
1344     }
1345     delete dijet;
1346     }
1347 ceballos 1.2 // b quark info
1348 loizides 1.5 if (GenQuarks->At(i)->AbsPdgId() == 5) {
1349 ceballos 1.2 hDGenQuarks[5]->Fill(GenQuarks->At(i)->Pt());
1350     hDGenQuarks[6]->Fill(GenQuarks->At(i)->Eta());
1351     hDGenQuarks[7]->Fill(GenQuarks->At(i)->Phi());
1352 ceballos 1.22 if (GenLeptons->GetEntries() >= 2 &&
1353     GenLeptons->At(0)->Pt() > 20 &&
1354     GenLeptons->At(1)->Pt() > 15) {
1355     if (TMath::Abs(GenLeptons->At(0)->Eta()) < 2.5 &&
1356     TMath::Abs(GenLeptons->At(1)->Eta()) < 2.5) {
1357 ceballos 1.2 hDGenQuarks[8]->Fill(GenQuarks->At(i)->Pt());
1358     hDGenQuarks[9]->Fill(GenQuarks->At(i)->Eta());
1359     hDGenQuarks[10]->Fill(GenQuarks->At(i)->Phi());
1360     }
1361     }
1362     }
1363     // t quark info
1364 loizides 1.5 else if (GenQuarks->At(i)->AbsPdgId() == 6) {
1365 ceballos 1.2 hDGenQuarks[11]->Fill(GenQuarks->At(i)->Pt());
1366     hDGenQuarks[12]->Fill(GenQuarks->At(i)->Eta());
1367     hDGenQuarks[13]->Fill(GenQuarks->At(i)->Phi());
1368     }
1369     // light quark info
1370     else {
1371     hDGenQuarks[14]->Fill(GenQuarks->At(i)->Pt());
1372     hDGenQuarks[15]->Fill(GenQuarks->At(i)->Eta());
1373     hDGenQuarks[16]->Fill(GenQuarks->At(i)->Phi());
1374     }
1375 loizides 1.1 }
1376    
1377 loizides 1.6 // wbf
1378 loizides 1.5 if (GenqqHs->GetEntries() == 2) {
1379 loizides 1.1 hDGenWBF[0]->Fill(MathUtils::DeltaPhi(GenqqHs->At(0)->Phi(),
1380     GenqqHs->At(1)->Phi()) * 180./ TMath::Pi());
1381 loizides 1.5 hDGenWBF[1]->Fill(TMath::Abs(GenqqHs->At(0)->Eta()-GenqqHs->At(1)->Eta()));
1382 loizides 1.1 hDGenWBF[2]->Fill(TMath::Max(GenqqHs->At(0)->Pt(),GenqqHs->At(1)->Pt()));
1383     hDGenWBF[3]->Fill(TMath::Min(GenqqHs->At(0)->Pt(),GenqqHs->At(1)->Pt()));
1384     CompositeParticle *diqq = new CompositeParticle();
1385     diqq->AddDaughter(GenqqHs->At(0));
1386     diqq->AddDaughter(GenqqHs->At(1));
1387     hDGenWBF[4]->Fill(diqq->Mass());
1388     delete diqq;
1389     }
1390    
1391 loizides 1.6 // bosons
1392 loizides 1.1 hDGenBosons[0]->Fill(GenBosons->GetEntries());
1393 loizides 1.5 for(UInt_t i=0; i<GenBosons->GetEntries(); i++) {
1394 loizides 1.1 hDGenBosons[1]->Fill(GenBosons->At(i)->Pt());
1395     hDGenBosons[2]->Fill(GenBosons->At(i)->Eta());
1396 ceballos 1.42 hDGenBosons[3]->Fill(TMath::Min(GenBosons->At(i)->Mass(),1999.999));
1397     hDGenBosons[4]->Fill(TMath::Min(GenBosons->At(i)->Mass(),199.999));
1398     if(GenBosons->At(i)->Is(MCParticle::kW))
1399     hDGenBosons[5]->Fill(TMath::Min(GenBosons->At(i)->Mass(),199.999));
1400     if(GenBosons->At(i)->Is(MCParticle::kZ))
1401     hDGenBosons[6]->Fill(TMath::Min(GenBosons->At(i)->Mass(),199.999));
1402 ceballos 1.61 hDGenBosons[7]->Fill(GenBosons->At(i)->Rapidity());
1403 ceballos 1.62 if(GenBosons->At(i)->Mass() > 60 && GenBosons->At(i)->Mass() < 120){
1404     hDGenBosons[8] ->Fill(GenBosons->At(i)->Pt());
1405     hDGenBosons[9] ->Fill(GenBosons->At(i)->Eta());
1406     hDGenBosons[10]->Fill(GenBosons->At(i)->Rapidity());
1407     }
1408 ceballos 1.42 }
1409 ceballos 1.62 hDGenBosons[11]->Fill(TMath::Min((double)(sumV[0] + 4*sumV[1]),12.4999));
1410 ceballos 1.10
1411     // photons
1412     hDGenPhotons[0]->Fill(GenPhotons->GetEntries());
1413     for(UInt_t i=0; i<GenPhotons->GetEntries(); i++) {
1414     hDGenPhotons[1]->Fill(GenPhotons->At(i)->Pt());
1415     hDGenPhotons[2]->Fill(GenPhotons->At(i)->Eta());
1416     }
1417 ceballos 1.32
1418     // Rad photons
1419     hDGenRadPhotons[0]->Fill(GenRadPhotons->GetEntries());
1420     for(UInt_t i=0; i<GenRadPhotons->GetEntries(); i++) {
1421     hDGenRadPhotons[1]->Fill(TMath::Min(GenRadPhotons->At(i)->Pt(),199.999));
1422     hDGenRadPhotons[2]->Fill(TMath::Min(GenRadPhotons->At(i)->AbsEta(),4.999));
1423 ceballos 1.51 hDGenRadPhotons[3]->Fill(TMath::Min((double)GenRadPhotons->At(i)->DistinctMother()->Status(),
1424 loizides 1.46 19.499));
1425 loizides 1.40 hDGenRadPhotons[4]->Fill(GenRadPhotons->At(i)->IsGenerated() +
1426     2*GenRadPhotons->At(i)->IsSimulated());
1427 ceballos 1.49 if(GenRadPhotons->At(i)->DistinctMother()){
1428     hDGenRadPhotons[5]->Fill(TMath::Min(
1429 loizides 1.40 MathUtils::DeltaR(*GenRadPhotons->At(i),
1430 ceballos 1.49 *GenRadPhotons->At(i)->DistinctMother()),
1431 loizides 1.40 4.999));
1432 ceballos 1.51 CompositeParticle *object = new CompositeParticle();
1433     object->AddDaughter(GenRadPhotons->At(i));
1434     object->AddDaughter(GenRadPhotons->At(i)->DistinctMother());
1435     hDGenRadPhotons[6]->Fill(TMath::Min(object->Mass(),99.999));
1436     delete object;
1437 ceballos 1.49 }
1438 ceballos 1.32 Int_t Mother = 0;
1439 ceballos 1.49 if(GenRadPhotons->At(i)->DistinctMother() &&
1440     GenRadPhotons->At(i)->DistinctMother()->Is(MCParticle::kMu)) Mother = 1;
1441 ceballos 1.51 hDGenRadPhotons[7]->Fill(Mother);
1442 ceballos 1.32 }
1443    
1444     // ISR photons
1445     hDGenISRPhotons[0]->Fill(GenISRPhotons->GetEntries());
1446     for(UInt_t i=0; i<GenISRPhotons->GetEntries(); i++) {
1447     hDGenISRPhotons[1]->Fill(TMath::Min(GenISRPhotons->At(i)->Pt(),199.999));
1448     hDGenISRPhotons[2]->Fill(TMath::Min(GenISRPhotons->At(i)->AbsEta(),4.999));
1449 ceballos 1.51 hDGenISRPhotons[3]->Fill(TMath::Min((Double_t)GenISRPhotons->At(i)->DistinctMother()->Status(),
1450 loizides 1.40 19.499));
1451     hDGenISRPhotons[4]->Fill(GenISRPhotons->At(i)->IsGenerated() +
1452     2*GenISRPhotons->At(i)->IsSimulated());
1453 ceballos 1.51 if(GenISRPhotons->At(i)->DistinctMother()){
1454     hDGenISRPhotons[5]->Fill(TMath::Min(
1455     MathUtils::DeltaR(*GenISRPhotons->At(i),
1456     *GenISRPhotons->At(i)->DistinctMother()),4.999));
1457     CompositeParticle *object = new CompositeParticle();
1458     object->AddDaughter(GenISRPhotons->At(i));
1459     object->AddDaughter(GenISRPhotons->At(i)->DistinctMother());
1460     hDGenISRPhotons[6]->Fill(TMath::Min(object->Mass(),99.999));
1461     delete object;
1462     }
1463 ceballos 1.32 }
1464 ceballos 1.57 } // Fill histograms
1465 ceballos 1.34
1466 ceballos 1.49 // Apply ISR+Rad filter (but filling all histograms)
1467 loizides 1.55 if (fApplyISRFilter == kTRUE &&
1468     (GenISRPhotons->GetEntries() > 0 || GenRadPhotons->GetEntries() > 0)) {
1469 ceballos 1.34 SkipEvent();
1470     }
1471 ceballos 1.63
1472 loizides 1.1 }
1473    
1474     //--------------------------------------------------------------------------------------------------
1475     void GeneratorMod::SlaveBegin()
1476     {
1477 loizides 1.5 // Book branch and histograms if wanted.
1478    
1479 ceballos 1.57 if(fIsData == kFALSE){
1480     ReqEventObject(fMCPartName, fParticles, kTRUE);
1481     }
1482 sixie 1.48
1483     // Publish Arrays For the Output Module
1484     PublishObj(fGenLeptons);
1485     PublishObj(fGenAllLeptons);
1486     PublishObj(fGenTaus);
1487     PublishObj(fGenNeutrinos);
1488     PublishObj(fGenQuarks);
1489     PublishObj(fGenqqHs);
1490     PublishObj(fGenBosons);
1491     PublishObj(fGenPhotons);
1492     PublishObj(fGenRadPhotons);
1493     PublishObj(fGenISRPhotons);
1494    
1495 loizides 1.5 // fill histograms
1496 loizides 1.20 if (GetFillHist()) {
1497 ceballos 1.30 // MET
1498 loizides 1.46 AddTH1(hDGenMet[0],"hDGenMet_0","Gen MET Pt;p_{t} [GeV];#",200,0,200);
1499     AddTH1(hDGenMet[1],"hDGenMet_1","Gen MET Px;p_{x} [GeV];#",400,-200,200);
1500     AddTH1(hDGenMet[2],"hDGenMet_2","Gen MET Py;p_{y} [GeV];#",400,-200,200);
1501     AddTH1(hDGenMet[3],"hDGenMet_3","Gen MET Pz;p_{z} [GeV];#",400,-1000,1000);
1502 ceballos 1.30
1503 ceballos 1.58 // pt min for leptons from W/Z
1504     AddTH1(hDGenPtMin, "hDGenPtMin","Pt min leptons from W/Z;p_{t} [GeV];#",200,0.0,200.0);
1505    
1506 loizides 1.6 // leptons from W
1507 loizides 1.46 AddTH1(hDGenLeptons[0], "hDGenLeptons_0",
1508     "Number of leptons from W/Z;N_{leptons};#",10,-0.5,9.5);
1509     AddTH1(hDGenLeptons[1], "hDGenLeptons_1","Pt leptons from W/Z;p_{t} [GeV];#",100,0.0,200.0);
1510     AddTH1(hDGenLeptons[2], "hDGenLeptons_2","Eta leptons from W/Z;#eta;#",50,0.0,5.0);
1511     AddTH1(hDGenLeptons[3], "hDGenLeptons_3","Phi leptons from W/Z;#phi;#",90,0.0,180.0);
1512     AddTH1(hDGenLeptons[4], "hDGenLeptons_4","Dilepton mass from W/Z;m_{ll};#",1000,0.0,1000.0);
1513     AddTH1(hDGenLeptons[5], "hDGenLeptons_5","Eta Max for 2 lepton case;#eta;#",50,0.0,5.0);
1514     AddTH1(hDGenLeptons[6], "hDGenLeptons_6","Eta Min for 2 lepton case;#eta;#",50,0.0,5.0);
1515     AddTH1(hDGenLeptons[7], "hDGenLeptons_7",
1516     "Pt Max for 2 lepton case;p_{t} [GeV];#",100,0.0,200.0);
1517     AddTH1(hDGenLeptons[8], "hDGenLeptons_8",
1518     "Pt Min for 2 lepton case;p_{t} [GeV];#",100,0.0,200.0);
1519     AddTH1(hDGenLeptons[9], "hDGenLeptons_9",
1520     "DiLepton mass for 2 lepton case;p_{t} [GeV];#",1000,0.0,1000.0);
1521     AddTH1(hDGenLeptons[10],"hDGenLeptons_10",
1522     "Delta Phi ll for 2 lepton case;#Delta#phi_{ll};#",90,0.0,180.0);
1523 ceballos 1.44 AddTH1(hDGenLeptons[11],"hDGenLeptons_11","Delta R ll;#Delta R_{ll};#",100,0.0,5.0);
1524 loizides 1.46 AddTH1(hDGenLeptons[12],"hDGenLeptons_12",
1525 ceballos 1.64 "Delta Phi ll for 2 lepton case;#Delta#phi_{ll};#",90,0.0,180.0);
1526     AddTH1(hDGenLeptons[13],"hDGenLeptons_13","Delta R ll;#Delta R_{ll};#",100,0.0,5.0);
1527     AddTH1(hDGenLeptons[14],"hDGenLeptons_14",
1528 loizides 1.46 "Pt Max for 3 lepton case;p_{t} [GeV];#",100,0.0,200.0);
1529 ceballos 1.64 AddTH1(hDGenLeptons[15],"hDGenLeptons_15",
1530 loizides 1.46 "Pt 2nd for 3 lepton case;p_{t} [GeV];#",100,0.0,200.0);
1531 ceballos 1.64 AddTH1(hDGenLeptons[16],"hDGenLeptons_16",
1532 loizides 1.46 "Pt Min for 3 lepton case;p_{t} [GeV];#",100,0.0,200.0);
1533 ceballos 1.64 AddTH1(hDGenLeptons[17],"hDGenLeptons_17",
1534 loizides 1.46 "Dilepton mass for 3 lepton case;m_{ll};#",1000,0.0,1000.0);
1535 ceballos 1.64 AddTH1(hDGenLeptons[18],"hDGenLeptons_18",
1536 loizides 1.46 "Trilepton mass for 3 lepton case;m_{lll};#",1000,0.0,1000.0);
1537 ceballos 1.64 AddTH1(hDGenLeptons[19],"hDGenLeptons_19",
1538 loizides 1.46 "Delta R Minimum between leptons for 3 lepton case;#Delta R_{ll};#",100,0.0,5.0);
1539 ceballos 1.64 AddTH1(hDGenLeptons[20],"hDGenLeptons_20",
1540 loizides 1.46 "Pt Max for 4 lepton case;p_{t} [GeV];#",100,0.0,200.0);
1541 ceballos 1.64 AddTH1(hDGenLeptons[21],"hDGenLeptons_21",
1542 loizides 1.46 "Pt 2nd for 4 lepton case;p_{t} [GeV];#",100,0.0,200.0);
1543 ceballos 1.64 AddTH1(hDGenLeptons[22],"hDGenLeptons_22",
1544 loizides 1.46 "Pt 3rd for 4 lepton case;p_{t} [GeV];#",100,0.0,200.0);
1545 ceballos 1.64 AddTH1(hDGenLeptons[23],"hDGenLeptons_23",
1546 loizides 1.46 "Pt 4th for 4 lepton case;#",100,0.0,200.0);
1547 ceballos 1.64 AddTH1(hDGenLeptons[24],"hDGenLeptons_24",
1548 loizides 1.46 "Dilepton mass for 4 lepton case;m_{ll};#",1000,0.0,1000.0);
1549 ceballos 1.64 AddTH1(hDGenLeptons[25],"hDGenLeptons_25",
1550 loizides 1.46 "Fourlepton mass for 3 lepton case;m_{llll};#",1000,0.0,1000.0);
1551 ceballos 1.64 AddTH1(hDGenLeptons[26],"hDGenLeptons_26",
1552 loizides 1.46 "Delta R Minimum between leptons for 4 lepton case;#Delta R_{ll};#",100,0.0,5.0);
1553 loizides 1.1
1554 loizides 1.6 // all leptons
1555 loizides 1.46 AddTH1(hDGenAllLeptons[0], "hDGenAllLeptons_0",
1556     "Number of all leptons;N_{leptons};#",10,-0.5,9.5);
1557 ceballos 1.49 AddTH1(hDGenAllLeptons[1], "hDGenAllLeptons_1","Pt all leptons;p_{t} [GeV];#",400,0.0,200.0);
1558 loizides 1.46 AddTH1(hDGenAllLeptons[2], "hDGenAllLeptons_2","Eta all leptons;#eta;#",50,0.0,5.0);
1559     AddTH1(hDGenAllLeptons[3], "hDGenAllLeptons_3","Phi all leptons;#phi;#",90,0.0,180.0);
1560 ceballos 1.49 AddTH1(hDGenAllLeptons[4], "hDGenAllLeptons_4","Pt second lepton;p_{t} [GeV];#",400,0.0,200.0);
1561 ceballos 1.3
1562 loizides 1.6 // taus
1563 loizides 1.46 AddTH1(hDGenTaus[0], "hDGenTaus_0","Number of taus;N_{tau};#",10,-0.5,9.5);
1564     AddTH1(hDGenTaus[1], "hDGenTaus_1","Pt taus;p_{t} [GeV];#",100,0.0,200.0);
1565     AddTH1(hDGenTaus[2], "hDGenTaus_2","Eta taus;#eta;#",50,0.0,5.0);
1566     AddTH1(hDGenTaus[3], "hDGenTaus_3","Phi taus;#phi;#",90,0.0,180.0);
1567 loizides 1.1
1568 loizides 1.6 // neutrinos
1569 loizides 1.46 AddTH1(hDGenNeutrinos[0], "hDGenNeutrinos_0","Number of neutrinos;N_{#nu};#",10,-0.5,9.5);
1570     AddTH1(hDGenNeutrinos[1], "hDGenNeutrinos_1","Pt neutrinos;p_{t} [GeV];#",100,0.0,200.0);
1571 ceballos 1.49 AddTH1(hDGenNeutrinos[2], "hDGenNeutrinos_2","Eta neutrinos;#eta;#",50,0.0,5.0);
1572 loizides 1.46 AddTH1(hDGenNeutrinos[3], "hDGenNeutrinos_3","Phi neutrinos;#phi;#",90,0.0,180.0);
1573 loizides 1.1
1574 loizides 1.6 // quarks
1575 loizides 1.46 AddTH1(hDGenQuarks[0], "hDGenQuarks_0", "Number of quarks;N_{quarks};#",10,-0.5,9.5);
1576     AddTH1(hDGenQuarks[1], "hDGenQuarks_1", "dijet pt for quarks;p_{t} [GeV];#",200,0.0,400.);
1577     AddTH1(hDGenQuarks[2], "hDGenQuarks_2", "dijet mass for quarks;m_{jj};#",2000,0.0,2000.);
1578     AddTH1(hDGenQuarks[3], "hDGenQuarks_3",
1579     "dijet pt for quarks with |eta|<2.5;p_{t} [GeV];#",200,0.0,400.);
1580     AddTH1(hDGenQuarks[4], "hDGenQuarks_4",
1581     "dijet mass for quarks with |eta|<2.5;m_{jj};#",2000,0.0,2000.);
1582     AddTH1(hDGenQuarks[5], "hDGenQuarks_5", "Pt for b quarks;p_{t} [GeV];#",200,0.0,400.);
1583     AddTH1(hDGenQuarks[6], "hDGenQuarks_6", "Eta for b quarks;#eta;#",200,-10.0,10.);
1584     AddTH1(hDGenQuarks[7], "hDGenQuarks_7",
1585     "Phi for b quarks;#phi;#",200,-TMath::Pi(),TMath::Pi());
1586     AddTH1(hDGenQuarks[8], "hDGenQuarks_8",
1587     "Pt for b quarks with |eta|<2.5;p_{t} [GeV];#",200,0.0,400.);
1588     AddTH1(hDGenQuarks[9], "hDGenQuarks_9",
1589     "Eta for b quarks with |eta|<2.5;#eta;#",200,-10.0,10.);
1590     AddTH1(hDGenQuarks[10],"hDGenQuarks_10",
1591     "Phi for b quarks with |eta|<2.5;#phi;#",200,-TMath::Pi(),TMath::Pi());
1592     AddTH1(hDGenQuarks[11],"hDGenQuarks_11","Pt for t quarks;p_{t} [GeV];#",200,0.0,400.);
1593 ceballos 1.44 AddTH1(hDGenQuarks[12],"hDGenQuarks_12","Eta for t quarks;#eta;#",200,-10.0,10.);
1594 loizides 1.46 AddTH1(hDGenQuarks[13],"hDGenQuarks_13",
1595     "Phi for t quarks;#phi;#",200,-TMath::Pi(),TMath::Pi());
1596     AddTH1(hDGenQuarks[14],"hDGenQuarks_14","Pt for light quarks;p_{t} [GeV];#",200,0.0,400.);
1597 ceballos 1.44 AddTH1(hDGenQuarks[15],"hDGenQuarks_15","Eta for light quarks;#eta;#",200,-10.0,10.);
1598 loizides 1.46 AddTH1(hDGenQuarks[16],"hDGenQuarks_16",
1599     "Phi for light quarks;#phi;#",200,-TMath::Pi(),TMath::Pi());
1600 loizides 1.1
1601     // qqH
1602 loizides 1.46 AddTH1(hDGenWBF[0], "hDGenWBF_0",
1603     "Delta Phi jj for WBF quarks;#Delta Phi_{jj};#",90,0.0,180.);
1604     AddTH1(hDGenWBF[1], "hDGenWBF_1",
1605     "Delta Eta jj for WBF quarks;#Delta #eta_{jj};#",100,0.0,10.);
1606     AddTH1(hDGenWBF[2], "hDGenWBF_2",
1607     "Pt max for WBF quarks;p_{t} [GeV];#",200,0.0,400.);
1608     AddTH1(hDGenWBF[3], "hDGenWBF_3",
1609     "Pt min for WBF quarks;p_{t} [GeV];#",200,0.0,400.);
1610     AddTH1(hDGenWBF[4], "hDGenWBF_4",
1611     "dijet mass for WBF quarks;m_{jj};#",200,0.0,4000.);
1612 loizides 1.1
1613 loizides 1.6 // bosons
1614 loizides 1.46 AddTH1(hDGenBosons[0], "hDGenBosons_0", "Number of bosons;N_{bosons};#",10,-0.5,9.5);
1615     AddTH1(hDGenBosons[1], "hDGenBosons_1", "Pt of bosons;p_{t} [GeV];#",200,0.0,400.0);
1616 ceballos 1.62 AddTH1(hDGenBosons[2], "hDGenBosons_2", "Eta of bosons;#eta;#",100,-10.0,10.0);
1617 ceballos 1.49 AddTH1(hDGenBosons[3], "hDGenBosons_3", "Mass of bosons;Mass;#",2000,0.0,2000.0);
1618 loizides 1.46 AddTH1(hDGenBosons[4], "hDGenBosons_4", "Mass of bosons;m_{V};#",200,0.0,200.0);
1619     AddTH1(hDGenBosons[5], "hDGenBosons_5", "Mass of W bosons;m_{W};#",200,0.0,200.0);
1620     AddTH1(hDGenBosons[6], "hDGenBosons_6", "Mass of Z bosons;m_{Z};#",200,0.0,200.0);
1621 ceballos 1.62 AddTH1(hDGenBosons[7], "hDGenBosons_7", "Rapidity of bosons;rapidity;#",100,-10.0,10.0);
1622     AddTH1(hDGenBosons[8], "hDGenBosons_8", "Pt of bosons;p_{t} [GeV];#",200,0.0,400.0);
1623     AddTH1(hDGenBosons[9], "hDGenBosons_9", "Eta of bosons;#eta;#",100,-10.0,10.0);
1624     AddTH1(hDGenBosons[10],"hDGenBosons_10","Rapidity of bosons;rapidity;#",100,-10.0,10.0);
1625     AddTH1(hDGenBosons[11],"hDGenBosons_11","Number of W bosons + 4 * Z bosons;Number;#",13,-0.5,12.5);
1626 ceballos 1.10
1627     // photons
1628 loizides 1.46 AddTH1(hDGenPhotons[0], "hDGenPhotons_0", "Number of photons;N_{photons};#",10,-0.5,9.5);
1629     AddTH1(hDGenPhotons[1], "hDGenPhotons_1", "Pt of photons;p_{t} [GeV];#",200,0.0,400.0);
1630     AddTH1(hDGenPhotons[2], "hDGenPhotons_2", "Eta of photons;#eta;#",100,-5.0,5.0);
1631 ceballos 1.16
1632 loizides 1.40 // rad photons
1633 loizides 1.46 AddTH1(hDGenRadPhotons[0], "hDGenRadPhotons_0",
1634     "Number of radiative photons;N_{photons};#",10,-0.5,9.5);
1635     AddTH1(hDGenRadPhotons[1], "hDGenRadPhotons_1",
1636     "Pt of radiative photons;p_{t} [GeV];#",400,0.0,200.0);
1637     AddTH1(hDGenRadPhotons[2], "hDGenRadPhotons_2",
1638     "Eta of radiative photons;#eta;#",100,0.0,5.0);
1639     AddTH1(hDGenRadPhotons[3], "hDGenRadPhotons_3",
1640 ceballos 1.49 "Status of mother of radiative photons;Status;#",20,-0.5,19.5);
1641 loizides 1.46 AddTH1(hDGenRadPhotons[4], "hDGenRadPhotons_4",
1642     "IsGenerated+2*IsSimulated of radiative photons;IsGenerated+2*IsSimulated;#",
1643     4,-0.5,3.5);
1644     AddTH1(hDGenRadPhotons[5], "hDGenRadPhotons_5",
1645     "Delta R between photon and mother of radiative photons;#Delta R;#",500,0.0,5.0);
1646     AddTH1(hDGenRadPhotons[6], "hDGenRadPhotons_6",
1647 ceballos 1.51 "Mass photon-photon mother;Mass;#",500,0.0,100.0);
1648     AddTH1(hDGenRadPhotons[7], "hDGenRadPhotons_7",
1649 loizides 1.46 "Number of radiative photon with muon as a mother;Status;#",2,-0.5,1.5);
1650 ceballos 1.32
1651     // ISR photons
1652 loizides 1.46 AddTH1(hDGenISRPhotons[0], "hDGenISRPhotons_0",
1653     "Number of ISR photons;N_{photons};#",10,-0.5,9.5);
1654     AddTH1(hDGenISRPhotons[1], "hDGenISRPhotons_1",
1655     "Pt of ISR photons;p_{t} [GeV];#",400,0.0,200.0);
1656     AddTH1(hDGenISRPhotons[2], "hDGenISRPhotons_2",
1657     "Eta of ISR photons;#eta;#",100,0.0,5.0);
1658     AddTH1(hDGenISRPhotons[3], "hDGenISRPhotons_3",
1659     "Status of mother of radiative photons;#eta;#",20,-0.5,19.5);
1660     AddTH1(hDGenISRPhotons[4], "hDGenISRPhotons_4",
1661     "IsGenerated+2*IsSimulated of radiative photons;IsGenerated+2*IsSimulated;#",
1662     4,-0.5,3.5);
1663     AddTH1(hDGenISRPhotons[5], "hDGenISRPhotons_5",
1664     "Delta R between photon and mother of ISR photons;#Delta R;#",500,0.0,5.0);
1665 ceballos 1.51 AddTH1(hDGenISRPhotons[6], "hDGenISRPhotons_6",
1666     "Mass photon-photon mother;Mass;#",500,0.0,100.0);
1667 ceballos 1.32
1668 ceballos 1.42 // auxiliar for MG studies
1669 loizides 1.46 AddTH1(hDVMass[0], "hDVMass_0", "Mass of munu candidates ;Mass [GeV];#",200,0.,200.);
1670     AddTH1(hDVMass[1], "hDVMass_1", "Mass of elnu candidates ;Mass [GeV];#",200,0.,200.);
1671     AddTH1(hDVMass[2], "hDVMass_2", "Mass of taunu candidates ;Mass [GeV];#",200,0.,200.);
1672     AddTH1(hDVMass[3], "hDVMass_3", "Mass of mumu candidates ;Mass [GeV];#",200,0.,200.);
1673     AddTH1(hDVMass[4], "hDVMass_4", "Mass of ee candidates ;Mass [GeV];#",200,0.,200.);
1674     AddTH1(hDVMass[5], "hDVMass_5", "Mass of tautau candidates;Mass [GeV];#",200,0.,200.);
1675     AddTH1(hDVMass[6], "hDVMass_6", "Mass of numunumu candidates;Mass [GeV];#",200,0.,200.);
1676     AddTH1(hDVMass[7], "hDVMass_7", "Mass of nuenue candidates;Mass [GeV];#",200,0.,200.);
1677     AddTH1(hDVMass[8], "hDVMass_8", "Mass of nutaunutau candidates;Mass [GeV];#",200,0.,200.);
1678     AddTH1(hDVMass[9], "hDVMass_9",
1679     "Mass of munu candidates for t events ;Mass [GeV];#",200,0.,200.);
1680     AddTH1(hDVMass[10],"hDVMass_10",
1681     "Mass of elnu candidates for t events ;Mass [GeV];#",200,0.,200.);
1682     AddTH1(hDVMass[11],"hDVMass_11",
1683     "Mass of taunu candidates for t events;Mass [GeV];#",200,0.,200.);
1684     AddTH1(hDVMass[12],"hDVMass_12",
1685     "Mass of qq candidates for t events;Mass [GeV];#",200,0.,200.);
1686 ceballos 1.44
1687     // Special study about VVjets
1688 loizides 1.46 AddTH1(hDVVMass[0], "hDVVMass_0", "Mass of munu for WW events;Mass [GeV];#",200,0.,200.);
1689     AddTH1(hDVVMass[1], "hDVVMass_1", "Mass of munu WZ events;Mass [GeV];#",200,0.,200.);
1690     AddTH1(hDVVMass[2], "hDVVMass_2", "Mass of elnu WW events;Mass [GeV];#",200,0.,200.);
1691     AddTH1(hDVVMass[3], "hDVVMass_3", "Mass of elnu WZ events;Mass [GeV];#",200,0.,200.);
1692     AddTH1(hDVVMass[4], "hDVVMass_4", "Mass of taunu WW events;Mass [GeV];#",200,0.,200.);
1693     AddTH1(hDVVMass[5], "hDVVMass_5", "Mass of taunu WZ events;Mass [GeV];#",200,0.,200.);
1694     AddTH1(hDVVMass[6], "hDVVMass_6", "Mass of mumu WZ events;Mass [GeV];#",200,0.,200.);
1695     AddTH1(hDVVMass[7], "hDVVMass_7", "Mass of mumu ZZ events;Mass [GeV];#",200,0.,200.);
1696     AddTH1(hDVVMass[8], "hDVVMass_8", "Mass of ee WZ events;Mass [GeV];#",200,0.,200.);
1697     AddTH1(hDVVMass[9], "hDVVMass_9", "Mass of ee ZZ events;Mass [GeV];#",200,0.,200.);
1698     AddTH1(hDVVMass[10],"hDVVMass_10","Mass of tautau WZ events;Mass [GeV];#",200,0.,200.);
1699     AddTH1(hDVVMass[11],"hDVVMass_11","Mass of tautau ZZ events;Mass [GeV];#",200,0.,200.);
1700     AddTH1(hDVVMass[12],"hDVVMass_12","Mass of numunumu WZ events;Mass [GeV];#",200,0.,200.);
1701     AddTH1(hDVVMass[13],"hDVVMass_13","Mass of numunumu ZZ events;Mass [GeV];#",200,0.,200.);
1702     AddTH1(hDVVMass[14],"hDVVMass_14","Mass of nuenue WZ events;Mass [GeV];#",200,0.,200.);
1703     AddTH1(hDVVMass[15],"hDVVMass_15","Mass of nuenue ZZ events;Mass [GeV];#",200,0.,200.);
1704     AddTH1(hDVVMass[16],"hDVVMass_16","Mass of nutaunutau WZ events;Mass [GeV];#",200,0.,200.);
1705     AddTH1(hDVVMass[17],"hDVVMass_17","Mass of nutaunutau ZZ events;Mass [GeV];#",200,0.,200.);
1706 ceballos 1.44 AddTH1(hDVVMass[18],"hDVVMass_18","Ratios for WW events;Type;#",7,-0.5,6.5);
1707     AddTH1(hDVVMass[19],"hDVVMass_19","Ratios for WZ events;Type;#",10,-0.5,9.5);
1708     AddTH1(hDVVMass[20],"hDVVMass_20","Ratios for ZZ2l events;Type;#",7,-0.5,6.5);
1709     AddTH1(hDVVMass[21],"hDVVMass_21","Ratios for ZZ4l events;Type;#",16,-0.5,15.5);
1710 loizides 1.46 AddTH1(hDVVMass[22],"hDVVMass_22","Maximum mass for WW events;Mass [GeV];#",200,0.,200.);
1711     AddTH1(hDVVMass[23],"hDVVMass_23","Minimum mass for WW events;Mass [GeV];#",200,0.,200.);
1712     AddTH1(hDVVMass[24],"hDVVMass_24","Maximum mass for WZ events;Mass [GeV];#",200,0.,200.);
1713     AddTH1(hDVVMass[25],"hDVVMass_25","Minimum mass for WZ events;Mass [GeV];#",200,0.,200.);
1714     AddTH1(hDVVMass[26],"hDVVMass_26","Maximum mass for ZZ events;Mass [GeV];#",200,0.,200.);
1715     AddTH1(hDVVMass[27],"hDVVMass_27","Minimum mass for ZZ events;Mass [GeV];#",200,0.,200.);
1716 loizides 1.1 }
1717     }