CMS 3D CMS Logo

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