Fork me on GitHub

source: git/python/TtbarEventSelection.py@ d870fc5

ImprovedOutputFile Timing dual_readout llp
Last change on this file since d870fc5 was ae1d49f, checked in by pavel <pavel@…>, 12 years ago

add DelphesAnalysis

  • Property mode set to 100644
File size: 2.1 KB
Line 
1# basic selection for semi-leptonic ttbar events
2
3# requirements:
4# event.muons
5# event.electrons
6# event.jets
7# event.selectedJets
8# event.bJets
9# event.topCandidates_L
10# event.topCandidates_H
11# event.topPairCandidates
12
13# the list of category names
14categoryNames = [ "l4j", "withPtCuts", "withBtag", "LeptonicTopCandidate", "HadronicTopCandidate", "TtbarCandidate" ]
15
16def eventCategory(event):
17 """Check analysis requirements for various steps
18 and return a tuple of data used to decide
19 to what category an event belong """
20 categoryData = [ ]
21 # 0: number of muons
22 categoryData.append(event.muons.GetEntries())
23 # 1: number of electrons
24 categoryData.append(event.electrons.GetEntries())
25 # 2: number of jets
26 categoryData.append(event.jets.GetEntries())
27 # 3: Pt of the leading muon
28 if event.muons.GetEntries():
29 categoryData.append(event.muons[0].PT)
30 else:
31 categoryData.append(0.)
32 # 4: Pt of the leading electron
33 if event.electrons.GetEntries():
34 categoryData.append(event.electrons[0].PT)
35 else:
36 categoryData.append(0.)
37 # 5: number of selected jets
38 categoryData.append(len(event.selectedJets))
39 # 6: number of bjets
40 categoryData.append(len(event.bJets))
41 # 7: leptonic top candidate
42 categoryData.append(len(event.topCandidates_L))
43 # 8: hadronic top candidate
44 categoryData.append(len(event.topCandidates_H))
45 # 9: top pairs
46 categoryData.append(len(event.topPairCandidates))
47 # DONE
48 return categoryData
49
50def isInCategory(category, categoryData):
51 """Check if the event enters category X, given the tuple computed by eventCategory."""
52 if category==0:
53 return (categoryData[0]>0 or categoryData[1]>0) and categoryData[2]>=4
54 elif category==1:
55 return isInCategory(0,categoryData) and (categoryData[3]>15 or categoryData[4]>15) and categoryData[5]>=4
56 elif category==2:
57 return isInCategory(1,categoryData) and categoryData[6]>=2
58 elif category==3:
59 return isInCategory(2,categoryData) and categoryData[7]>0
60 elif category==4:
61 return isInCategory(2,categoryData) and categoryData[8]>0
62 elif category==5:
63 return isInCategory(2,categoryData) and categoryData[9]>0
64 else:
65 return False
66
Note: See TracBrowser for help on using the repository browser.