CMS 3D CMS Logo

studyJets.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import os
4 import sys
5 import math
6 
7 
8 ####################################################################################
9 # Python script for studying eta dependence of jet sizes and seed centrality #
10 # Author: Aaron Bundock (aaron.*nospamthankyamaam*bundock@cern.ch) #
11 # Date: 15/01/18 #
12 # #
13 ####################################################################################
14 
15 
16 
17 towerEtaWidths = [0, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, # 0-10
18  0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, 0.087, # 11-20
19  0.090, 0.100, 0.113, 0.129, 0.150, 0.178, 0.150, 0.350, # 21-28
20  0.132, 0.175, 0.176, 0.174, 0.176, 0.174, 0.177, 0.173, 0.175, 0.177, 0.173, 0.302] # 30-41
21 #0.150, 0.180, 0.170, 0.180, 0.170, 0.180, 0.170, 0.180, 0.180, 0.180, 0.180, 0.290]
22 
23 
24 
25 def getJetProperties(jetSeed,etaFwd,etaCen):
26 
27  jetSize = 0
28  etaFwdSize = 0
29  etaCenSize = 0
30 
31  for ring in xrange(jetSeed-etaCen,jetSeed+etaFwd+1):
32 
33  if ring < 1:
34  ring = abs(ring-1)
35 
36  if ring >= len(towerEtaWidths):
37  break
38 
39  if ring < jetSeed:
40  etaFwdSize += towerEtaWidths[ring]
41  if ring > jetSeed:
42  etaCenSize += towerEtaWidths[ring]
43 
44  jetSize = (etaFwdSize + etaCenSize + towerEtaWidths[jetSeed])/0.8
45  seedCent = etaCenSize/etaFwdSize
46 
47  jetProps = [jetSize, seedCent]
48 
49  return jetProps
50 
51 
52 def printJetProperties(etaRange):
53 
54  print "Size \ eta\t",
55  for seedEta in etaRange:
56  if(seedEta<29):
57  print str(seedEta)+"\t\t",
58  else:
59  print str(seedEta+1)+"\t\t",
60  print
61 
62  for size in jetEtaSizes:
63 
64  if size%2:
65  print " 9x"+str(size)+("\t"),
66  for seedEta in etaRange:
67  print("\t"),
68  etaFwdCen = (size-1)/2
69  jetProps = getJetProperties(seedEta,etaFwdCen,etaFwdCen)
70  print("%.2f / %.2f" %(jetProps[0],jetProps[1])),
71  print
72 
73  else:
74  print " 9x"+str(size)+" cen",
75  for seedEta in etaRange:
76  print("\t"),
77  etaFwd = size/2-1
78  etaCen = size/2
79  jetProps = getJetProperties(seedEta, etaFwd, etaCen)
80  print("%.2f / %.2f" %(jetProps[0],jetProps[1])),
81  print
82  print " 9x"+str(size)+" fwd",
83  for seedEta in etaRange:
84  print("\t"),
85  etaFwd = size/2
86  etaCen = size/2-1
87  jetProps = getJetProperties(seedEta, etaFwd, etaCen)
88  print("%.2f / %.2f" %(jetProps[0],jetProps[1])),
89  print
90 
91 
92 
93 print "\n"
94 print "=============================================================================================================================================================================================================================="
95 print "Eta-dependence of jet sizes & seed centrality"
96 print "First number = jet diameter in eta, normalised to 0.8 (offline)"
97 print "Second number = jet size on forward side of jet seed / jet size on central side of jet seed"
98 print "Ideally, best jet choice is where both numbers are closest to unity!"
99 print "9xN cen = larger area on side of jet further from beam pipe"
100 print "9xN fwd = larger area on side of jet closer to beam pipe"
101 print "=============================================================================================================================================================================================================================="
102 
103 
104 beEtaRange = xrange(16,29)
105 hfEtaRange = xrange(29,41)
106 
107 
108 jetEtaSizes = [9,8,7,6,5,4,3]
109 
110 
111 print("\n BE \n")
112 printJetProperties(beEtaRange)
113 
114 print("\n\n HF \n")
115 printJetProperties(hfEtaRange)
116 
117 print("\n")
118 print "=============================================================================================================================================================================================================================="
119 print("\n\n")
def printJetProperties(etaRange)
Definition: studyJets.py:52
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
def getJetProperties(jetSeed, etaFwd, etaCen)
Python script for studying eta dependence of jet sizes and seed centrality # Author: Aaron Bundock (a...
Definition: studyJets.py:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define str(s)