path = \
    '/tmp/jodafons/news/tunedDiscr.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium.eta.et.dep/' + \
    'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_3_etBin_2/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_3_etBin_1/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_3_etBin_0/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_2_etBin_2/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_2_etBin_1/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_2_etBin_0/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_1_etBin_2/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_1_etBin_1/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_1_etBin_0/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_0_etBin_2/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_0_etBin_1/'
#'tuned.mc14.sgn.offLH.bkg.truth.trig.l1cluscut_20.l2etcut_19.e24_medium_etaBin_0_etBin_0/'

stat = CrossValidStatAnalysis(path, level=LoggingLevel.DEBUG)

################################## For Trigger ##################################

# Define the reference benchmarks
'''
#Crack
#Online: e24_lhmedium_L1EM20VH, all range of eta/et. We will use the global eff
Medium_LH_L2Calo_Pd = ReferenceBenchmark( "Medium_LH_L2Calo_Pd", "Pd", refVal = 0.9809     )
Medium_LH_EFCalo_Pd = ReferenceBenchmark( "Medium_LH_EFCalo_Pd", "Pd", refVal = 0.9506     )
Medium_MaxSP        = ReferenceBenchmark( "Medium_MaxSP", "SP"                             )
Medium_LH_L2Calo_Pf = ReferenceBenchmark( "Medium_LH_L2Calo_Pf", "Pf", refVal = 0.1358     )
Medium_LH_EFCalo_Pf = ReferenceBenchmark( "Medium_LH_EFCalo_Pf", "Pf", refVal = 0.0582     )
outputName = 'crossValStat_indep'
'''
'''
예제 #2
0
                    ["Medium_LH_EFCalo_Pf"]],
                      # Et 2, Eta 0
                    [["Medium_LH_EFCalo_Pf"],
                      # Et 2, Eta 1
                    ["Medium_LH_EFCalo_Pf"],
                      # Et 2, Eta 2
                    ["Medium_LH_EFCalo_Pd"],
                      # Et 2, Eta 3
                    ["Medium_LH_EFCalo_Pd"]],
                      # Et 3, Eta 0
                    [["Medium_LH_EFCalo_Pf"],
                      # Et 3, Eta 1
                    ["Medium_LH_EFCalo_Pf"],
                      # Et 3, Eta 2
                    ["Medium_LH_EFCalo_Pd"],
                      # Et 3, Eta 3
                    ["Medium_LH_EFCalo_Pf"]],
                    ]


chainNames=['e24_lhmedium_EFCalo']

CrossValidStatAnalysis.exportDiscrFiles(crossValGrid,
                                        RingerOperation.L2,
                                        refBenchCol=refBenchmarkList,
                                        configCol=configList,
                                        triggerChains=chainNames
                                        )


예제 #3
0
            13, 11, 11
        ],
        [  # Et 2, Eta 2
            9, 9, 19
        ],
        [  # Et 2, Eta 3
            20, 20, 15
        ]
    ],
    # EFCalo, Et 3, Eta 0
    #  Pd, SP, Pf
    [
        [20, 20, 20],
        [  # Et 3, Eta 1
            11, 7, 7
        ],
        [  # Et 3, Eta 2
            17, 17, 19
        ],
        [  # Et 3, Eta 3
            16, 16, 16
        ]
    ]
]]

from pprint import pprint
pprint(configMap)

from TuningTools.CrossValidStat import CrossValidStatAnalysis
CrossValidStatAnalysis.printTables(configBaseList, crossValGrid, configMap)
예제 #4
0
    'mc14_13TeV.147406.129160.sgn.offCutID.bkg.truth.trig.e24_lhmedium_L1EM20VH_summary.pic.gz',
    'mc14_13TeV.147406.129160.sgn.offCutID.bkg.truth.trig.e24_lhtight_L1EM20VH_summary.pic.gz',
]

lhmediumSummary = load(summaryList[0])
lhtightSummary = load(summaryList[1])

for nEta in [3]:

    for nEt in [0, 1, 2]:

        outputName = (
            'crossValStat_mc14_13TeV.147406.129160.sgn.offCutID.bkg.truth.trig.e24.etaBin_%d_etBin_%d'
        ) % (nEta, nEt)

        stat = CrossValidStatAnalysis(basepath + '/' + fileList[nEta][nEt],
                                      level=LoggingLevel.DEBUG)

        Medium_LH_L2Calo_Pd = ReferenceBenchmark(
            "Medium_LH_L2Calo_Pd",
            "Pd",
            refVal=lhmediumSummary['sgn'][nEt][nEta][0].efficiency() /
            float(100))
        Medium_LH_L2Calo_Pf = ReferenceBenchmark(
            "Medium_LH_L2Calo_Pf",
            "Pf",
            refVal=lhmediumSummary['bkg'][nEt][nEta][0].efficiency() /
            float(100))
        Medium_LH_EFCalo_Pd = ReferenceBenchmark(
            "Medium_LH_EFCalo_Pd",
            "Pd",
            refVal=lhmediumSummary['sgn'][nEt][nEta][2].efficiency() /
예제 #5
0
#!/usr/bin/env python

from RingerCore.Logger import LoggingLevel
from TuningTools.CrossValidStat import CrossValidStatAnalysis, GridJobFilter


basepath = 'files'

stat = CrossValidStatAnalysis( 
    basepath+'/tuned/',
    #binFilters = GridJobFilter,
    level = LoggingLevel.DEBUG,
    )

from TuningTools.CreateData import TuningDataArchieve
TDArchieve = TuningDataArchieve(basepath+'/data.pic.npz')

nEtBins = TDArchieve.nEtBins()
nEtaBins = TDArchieve.nEtaBins()
refBenchmarkList = []

from itertools import product
from TuningTools.TuningJob import ReferenceBenchmark
with TDArchieve as data:
  for etBin, etaBin in product( range( nEtBins if nEtBins is not None else 1 ),
                                range( nEtaBins if nEtaBins is not None else 1 )):
    benchmarks = (data['signal_efficiencies'], data['background_efficiencies'])
    #cross_benchmarks = (TDArchieve['signal_cross_efficiencies'], TDArchieve['background_cross_efficiencies'])
    sigEff = data['signal_efficiencies']['EFCaloAccept'][etBin][etaBin]
    bkgEff = data['background_efficiencies']['EFCaloAccept'][etBin][etaBin]
    try:
예제 #6
0
              'e24_lhmedium_L1EM20VH_L2EFCalo_ringer_pd',
              'e24_lhmedium_L1EM20VH_L2Calo_ringer_pd',
              'e24_lhmedium_L1EM20VH_ringer_sp',
              'e24_lhtight_L1EM20VH_L2EFCalo_ringer_pd',
              'e24_lhtight_L1EM20VH_L2Calo_ringer_pd',
            ]
tc=0

for key in ['Medium_LH_EFCalo_Pd', 'Medium_LH_L2Calo_Pd','Medium_LH_MaxSP','Tight_LH_EFCalo_Pd','Tight_LH_L2Calo_Pd']:

  netBins=dict()
  for nEta in [0,1,2,3]:  
    for nEt in [0,1,2]:

      crossValSummary = load((crossValBasepath+'/'+crossValName)%(nEta,nEt))
      stat = CrossValidStatAnalysis( basepath+'/'+fileList[nEta][nEt], level = LoggingLevel.DEBUG )
      # Add them to a list:
      data  = CrossValidStatAnalysis.exportDiscrFiles(crossValSummary, RingerOperation.L2,
                                                      refBenchmarkNameList=[key],
                                                      configList=[config[key][nEta][nEt]])

      network = data['tunedDiscr']
      network['etaBin']=[etaBins[nEta],etaBins[nEta+1]] 
      network['etBin'] =[etBins[nEt]  ,etBins[nEt+1]  ] 
      netBins[('eta%d_et%d')%(nEta,nEt)]=network

  output.write(('  signatures["%s"]=%s\n')%(triggerList[tc],str(netBins)))
  tc+=1

output.write('  return signatures')
output.close()
예제 #7
0
#!/usr/bin/env python


crossValGrid = [['crossValStat.pic']]

configBaseList =  ['Loose_LH',
                  'Medium_',
                  'Tight_LH']

configMap = [
            [[[   16,  16,  16  ]]],
            [[[   16,  16,  16  ]]],
            [[[   16,  16,  16  ]]],
            [[[   16,  16,  16  ]]],
            [[[   16,  16,  16  ]]],
            ]

from pprint import pprint
pprint(configMap)

from TuningTools.CrossValidStat import CrossValidStatAnalysis
CrossValidStatAnalysis.printTables(configBaseList, 
                                   crossValGrid,
                                   configMap)
예제 #8
0
#!/usr/bin/env python

from RingerCore.Logger import LoggingLevel
from TuningTools.CrossValidStat import CrossValidStatAnalysis, GridJobFilter

stat = CrossValidStatAnalysis(
    '/afs/cern.ch/work/w/wsfreund/public/Online/20.7.3.6_fixET/user.nbullacr.nn.mc14_13TeV.147406.129160.sgn.offLH.bkg.truth.trig.ef.e24_lhmedium_nod0_binned_t0001_tunedDiscrXYZ.tgz',
    #'/afs/cern.ch/work/w/wsfreund/public/Online/20.7.3.6_fixET/test',
    #'/Users/wsfreund/Documents/Doutorado/CERN/Online/data/test',
    binFilters=GridJobFilter,
    level=LoggingLevel.DEBUG,
)

from TuningTools.CreateData import TuningDataArchieve
TDArchieve = TuningDataArchieve(
    '/afs/cern.ch/work/j/jodafons/public/Tuning2016/TuningConfig/mc14_13TeV.147406.129160.sgn.offLikelihood.bkg.truth.trig.e24_lhmedium_nod0_l1etcut20_l2etcut19_efetcut24_binned.pic.npz'
)
#TDArchieve = TuningDataArchieve('/Users/wsfreund/Documents/Doutorado/CERN/Online/data/mc14_13TeV.147406.129160.sgn.offLikelihood.bkg.truth.trig.e24_lhmedium_nod0_l1etcut20_l2etcut19_efetcut24_binned.pic.npz')
nEtBins = TDArchieve.nEtBins()
nEtaBins = TDArchieve.nEtaBins()
refBenchmarkList = []
from itertools import product
from TuningTools.TuningJob import ReferenceBenchmark
with TDArchieve as data:
    for etBin, etaBin in product(
            range(nEtBins if nEtBins is not None else 1),
            range(nEtaBins if nEtaBins is not None else 1)):
        benchmarks = (data['signal_efficiencies'],
                      data['background_efficiencies'])
        #cross_benchmarks = (TDArchieve['signal_cross_efficiencies'], TDArchieve['background_cross_efficiencies'])
        sigEff = data['signal_efficiencies']['EFCaloAccept'][etBin][etaBin]
예제 #9
0
    ],
    # Et 2, Eta 0
    [
        ["Medium_LH_EFCalo_Pf"],
        # Et 2, Eta 1
        ["Medium_LH_EFCalo_Pf"],
        # Et 2, Eta 2
        ["Medium_LH_EFCalo_Pd"],
        # Et 2, Eta 3
        ["Medium_LH_EFCalo_Pd"]
    ],
    # Et 3, Eta 0
    [
        ["Medium_LH_EFCalo_Pf"],
        # Et 3, Eta 1
        ["Medium_LH_EFCalo_Pf"],
        # Et 3, Eta 2
        ["Medium_LH_EFCalo_Pd"],
        # Et 3, Eta 3
        ["Medium_LH_EFCalo_Pf"]
    ],
]

chainNames = ['e24_lhmedium_EFCalo']

CrossValidStatAnalysis.exportDiscrFiles(crossValGrid,
                                        RingerOperation.L2,
                                        refBenchCol=refBenchmarkList,
                                        configCol=configList,
                                        triggerChains=chainNames)