ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/GeneratorMod.cc
Revision: 1.65
Committed: Fri Jul 1 22:06:28 2011 UTC (13 years, 10 months ago) by phedex
Content type: text/plain
Branch: MAIN
Changes since 1.64: +11 -2 lines
Log Message:
add wz and zz filter

File Contents

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