ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/GeneratorMod.cc
Revision: 1.60
Committed: Thu Jul 22 08:03:04 2010 UTC (14 years, 9 months ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_014e, Mit_014d
Changes since 1.59: +3 -3 lines
Log Message:
bug in gen met

File Contents

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