3 from __future__
import print_function
24 if not os.path.isdir(os.environ[
'LOCALRT'] +
"/src/L1Trigger/L1TCalorimeter/data"):
25 print(os.environ[
'LOCALRT'] +
"/src/L1Trigger/L1TCalorimeter/data/ directory does not exist.\n"
26 "Creating directory now.\n"
27 "Remember to do 'git add " + os.environ[
'LOCALRT'] +
"L1Trigger/L1TCalorimeter/data' when committing the new LUT!")
28 os.makedirs(os.environ[
'LOCALRT'] +
"/src/L1Trigger/L1TCalorimeter/data")
30 print(
"Creating tower Et threshold LUT with filename " + os.environ[
'LOCALRT'] +
"/src/L1Trigger/L1TCalorimeter/data/lut_towEtThresh_2017v4_excl30.txt'")
31 towEtThreshLUTFile = open(os.environ[
'LOCALRT']+
"/src/L1Trigger/L1TCalorimeter/data/lut_towEtThresh_2017v4_excl30.txt",
"w")
35 towEtThreshLUTFile.write(
36 "# address to et sum tower Et threshold LUT\n"
37 "# maps 11 bits to 9 bits\n"
38 "# 11 bits = (compressedPileupEstimate << 6) | abs(ieta)\n"
39 "# compressedPileupEstimate is unsigned 5 bits, abs(ieta) is unsigned 6 bits\n"
40 "# data: tower energy threshold returned has 9 bits \n"
41 "# anything after # is ignored with the exception of the header\n"
42 "# the header is first valid line starting with #<header> versionStr nrBitsAddress nrBitsData </header>\n"
43 "#<header> v1 11 9 </header>\n"
50 towerAreas = [0.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,
51 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,
52 1.03,1.15,1.3,1.48,1.72,2.05,1.72,4.02,
53 3.29,2.01,2.02,2.01,2.02,2.0,2.03,1.99,2.02,2.04,2.00,3.47];
55 etaRange = xrange(0,41)
56 compNTT4Range = xrange(0,32)
60 for compNTT4
in compNTT4Range:
62 towEtThresh = int(round(float(towerAreas[ieta])*(1/(1+math.exp(-0.2*(ieta-5))))*(float(compNTT4)/10)))
67 if ieta < 13
or towEtThresh < 0:
72 printBins =
" # nTT4 = " +
str(5*compNTT4) +
"-" +
str((5*compNTT4)+5) +
" ieta = " +
str(ieta)
75 towEtThreshLUTFile.write(
84 while extraCount < 23:
85 towEtThreshLUTFile.write(
94 for addr
in xrange(addr,2047):
95 towEtThreshLUTFile.write(
str(addr) +
" " +
str(0) +
" # dummy\n")
98 print(
"Done. Closing file...")
100 towEtThreshLUTFile.close()
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)