Skip to content

Commit

Permalink
spare checked-out the remaining differences from bachtis/KMTF_V2.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
panoskatsoulis committed Oct 12, 2018
1 parent 05f5933 commit 13f5b18
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 32 deletions.
29 changes: 14 additions & 15 deletions L1Trigger/L1TMuonBarrel/test/kalmanTools/kmtfAnalysis.py
@@ -1,4 +1,3 @@
from __future__ import print_function
import ROOT,itertools,math #
from array import array #
from DataFormats.FWLite import Events, Handle
Expand Down Expand Up @@ -75,7 +74,7 @@ def fetchTP(event,etaMax=0.83):
return []
trigger=tH.product()
# for f in range(0,trigger.sizeFilters()):
# print(f,trigger.filterLabel(f))
# print f,trigger.filterLabel(f)
# import pdb;pdb.set_trace()
obj = trigger.getObjects()
index = trigger.filterIndex(ROOT.edm.InputTag("hltL3fL1sMu22Or25L1f0L2f10QL3Filtered27Q::HLT"))
Expand Down Expand Up @@ -308,8 +307,8 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf):
print 'wheel={w} sector={sc} station={st} high/low={ts} phi={phi} phiB={phiB} qual={qual} BX={BX} eta1={eta1} eta2={eta2}'.format(w=stub.whNum(),sc=stub.scNum(),st=stub.stNum(),ts=stub.tag(),phi=stub.phi(),phiB=stub.phiB(),qual=stub.quality(),BX=stub.bxNum(),eta1=stub.eta1(),eta2=stub.eta2())
print 'Gen muons:'
for g in gen:
print("Generated muon charge={q} pt={pt} eta={eta} phi={phi}".format(q=g.charge(),pt=g.pt(),eta=g.eta(),phi=g.phi()))
print('BMTF:')
print "Generated muon charge={q} pt={pt} eta={eta} phi={phi}".format(q=g.charge(),pt=g.pt(),eta=g.eta(),phi=g.phi())
print 'BMTF:'
for g in bmtf :
print "BMTF sector={sector} charge={q} pt={pt} eta={eta} phi={phi} qual={qual} dxy={dxy} pt2={pt2} hasFineEta={HF} rawPhi={hwPHI}".format(sector=g.processor(),q=g.charge(),pt=g.pt(),eta=g.eta(),phi=g.phi(),qual=g.quality(),dxy=g.dxy(),pt2=g.ptUnconstrained(),HF=g.hasFineEta(),hwPHI=g.phiINT())
print 'KMTF:'
Expand All @@ -322,9 +321,9 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf):



print("-----------------------------")
print("-----------------------------")
print("c + enter to continue")
print "-----------------------------"
print "-----------------------------"
print "c + enter to continue"
import pdb;pdb.set_trace()

#########Histograms#############
Expand Down Expand Up @@ -469,9 +468,9 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf):
# if counter==1000:
# break;

# print('OLD stubs')
# print 'OLD stubs'
# for s in stubsOLD:
# print(s.bxNum(),s.whNum(),s.scNum(),s.stNum(),s.phi(),s.phiB(),s.code())
# print s.bxNum(),s.whNum(),s.scNum(),s.stNum(),s.phi(),s.phiB(),s.code()


# reco=fetchRECO(event,2.4)
Expand Down Expand Up @@ -499,10 +498,10 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf):


# for g in gen:
# print('GEN', g.pt(),g.eta(),g.phi())
# print 'GEN', g.pt(),g.eta(),g.phi()

# for k in kmtf:
# print('L1', k.pt(),k.eta(),k.phi())
# print 'L1', k.pt(),k.eta(),k.phi()

# log(counter,stubs,gen,kmtfFull,kmtf,bmtf)

Expand Down Expand Up @@ -665,18 +664,18 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf):


# if bestKMTF!=None and bestBMTF!=None and abs(bestKMTF.eta()-g.eta())>abs(bestBMTF.eta()-g.eta()):
# print('Input Theta stubs')
# print 'Input Theta stubs'
# for s in stubsOLDTheta:
# if s.bxNum()!=0:
# continue
# a=[]
# for i in range(0,7):
# a.append(s.position(i))
# print(s.whNum(),s.scNum(),s.stNum(),':',a)
# print('Combined stubs')
# print s.whNum(),s.scNum(),s.stNum(),':',a
# print 'Combined stubs'
#
# for s in stubs:
# print(s.whNum(),s.scNum(),s.stNum(),s.eta1(),s.eta2(),s.qeta1(),s.qeta2())
# print s.whNum(),s.scNum(),s.stNum(),s.eta1(),s.eta2(),s.qeta1(),s.qeta2()
# import pdb;pdb.set_trace()

if len(matchedKMTFFull)>0:
Expand Down
19 changes: 9 additions & 10 deletions L1Trigger/L1TMuonBarrel/test/kalmanTools/makeEtaLuts.py
@@ -1,4 +1,3 @@
from __future__ import print_function
etaLUT0=[8.946,7.508,6.279,6.399]
etaLUT1=[-0.159,-0.116,-0.088,-0.128]

Expand Down Expand Up @@ -26,11 +25,11 @@
p=int(round(etaLUT0[station-1]*p+etaLUT1[station-1]*p*p*p/abs(p)))
lut.append(str(p))
if wheel>0:
print('etaLUT_plus_{wheel}_{station} = cms.vint32('.format(wheel=wheel,station=station)+','.join(lut)+')\n')
print 'etaLUT_plus_{wheel}_{station} = cms.vint32('.format(wheel=wheel,station=station)+','.join(lut)+')\n'
if wheel<0:
print('etaLUT_minus_{wheel}_{station} = cms.vint32('.format(wheel=abs(wheel),station=station)+','.join(lut)+')\n')
print 'etaLUT_minus_{wheel}_{station} = cms.vint32('.format(wheel=abs(wheel),station=station)+','.join(lut)+')\n'
if wheel==0:
print('etaLUT_0_{station} = cms.vint32('.format(station=station)+','.join(lut)+')\n')
print 'etaLUT_0_{station} = cms.vint32('.format(station=station)+','.join(lut)+')\n'

#wite HLS LUT
HLSINFO={}
Expand Down Expand Up @@ -67,9 +66,9 @@
else:
etaTag='0'

print('const ap_int<8> etaLUT0_'+etaTag+"_"+str(station)+'[128]={'+','.join(d1)+'};\n')
print('const ap_int<8> etaLUT1_'+etaTag+"_"+str(station)+'[128]={'+','.join(d2)+'};\n')
print('const ap_int<8> etaLUTQ_'+etaTag+"_"+str(station)+'[128]={'+','.join(d3)+'};\n')
print 'const ap_int<8> etaLUT0_'+etaTag+"_"+str(station)+'[128]={'+','.join(d1)+'};\n'
print 'const ap_int<8> etaLUT1_'+etaTag+"_"+str(station)+'[128]={'+','.join(d2)+'};\n'
print 'const ap_uint<1> etaLUTQ_'+etaTag+"_"+str(station)+'[128]={'+','.join(d3)+'};\n'



Expand All @@ -88,8 +87,8 @@


if wheel>0:
print('etaCoarseLUT_plus_{wheel}= cms.vint32('.format(wheel=wheel)+','.join(lut)+')\n')
print 'etaCoarseLUT_plus_{wheel}= cms.vint32('.format(wheel=wheel)+','.join(lut)+')\n'
if wheel<0:
print('etaCoarseLUT_minus_{wheel} = cms.vint32('.format(wheel=abs(wheel))+','.join(lut)+')\n')
print 'etaCoarseLUT_minus_{wheel} = cms.vint32('.format(wheel=abs(wheel))+','.join(lut)+')\n'
if wheel==0:
print('etaCoarseLUT_0 = cms.vint32('+','.join(lut)+')\n')
print 'etaCoarseLUT_0 = cms.vint32('+','.join(lut)+')\n'
6 changes: 3 additions & 3 deletions L1Trigger/L1TMuonBarrel/test/kalmanTools/makeInitialState.py
@@ -1,6 +1,6 @@
from __future__ import print_function
import FWCore.ParameterSet.Config as cms


from L1Trigger.L1TMuonBarrel.simKBmtfDigis_cfi import bmtfKalmanTrackingSettings as settings

initialK = settings.initialK
Expand Down Expand Up @@ -56,12 +56,12 @@ def compliment(value):
K=-8191
arr[address]=str(K)
# import pdb;pdb.set_trace()
print('\n\n\n')
print '\n\n\n'
if i in [0,1]:
lut = 'ap_int<14> initialK_'+str(i+1)+'[1024] = {'+','.join(arr)+'};'
if i in [2,3]:
lut = 'ap_int<14> initialK_'+str(i+1)+'[1024] = {'+','.join(arr)+'};'
print(lut)
print lut



Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1TMuonBarrel/test/kalmanTools/makePTPhiLUTs.py
@@ -1,7 +1,7 @@
from math import pi,floor


print(int(((-330+1024)*pi/(6.0*2048.0))/(0.625*pi/180.0)))
print int(((-330+1024)*pi/(6.0*2048.0))/(0.625*pi/180.0))



Expand Down
@@ -1,4 +1,4 @@
from __future__ import print_function

import FWCore.ParameterSet.Config as cms


Expand All @@ -25,8 +25,8 @@



print('ap_ufixed<12,12> eLossVertex[2048] = {'+','.join(deltaK)+'};')
print('ap_ufixed<12,12> dxyVertex[2048] = {'+','.join(dxy)+'};')
print 'ap_ufixed<12,12> eLossVertex[2048] = {'+','.join(deltaK)+'};'
print 'ap_ufixed<12,12> dxyVertex[2048] = {'+','.join(dxy)+'};'



0 comments on commit 13f5b18

Please sign in to comment.