コード例 #1
0
        print "="*20, "Printing Closest Matches", "with BX mismatch"*(not options.detaildump), "="*20
        for mu_out in out_mu_non_zero:
            rel_in = in_matches[mu_out][0]
            rel_imd = imd_matches[mu_out][0]
            mu_in = in_matches[mu_out][1]
            mu_imd = imd_matches[mu_out][1]

            # check if the match was not perfect
            mismatch = rel_in < Relation.max_relation or rel_imd < Relation.max_relation
            # check if BX is the same... as a few bits were usually not fitting
            mismatch_bx = mu_in == None or mu_imd == None or mu_in.bx != mu_out.bx or mu_imd.bx != mu_out.bx

            # first dump the matches with some additional info:
            if (mismatch_bx or (mismatch and options.verbose) or options.detaildump):
                print "+"*30, "BX", mu_out.bx, "+"*30
                print "out: ", print_out_word(mu_out.bitword), "in BX", mu_out.bx, "( frame:", mu_out.frame, " link:", mu_out.link, ")"
                if mu_imd != None:
                    print "imd: ", print_out_word(mu_imd.bitword), "in BX", mu_imd.bx, "( frame:", mu_imd.frame, " link:", mu_imd.link, \
                        " match: {match:.2%} )".format(match=rel_imd/float(Relation.max_relation))
                else: 
                    print "imd: NO MATCH"
                if mu_in != None:
                    print "in : ", print_in_word(mu_in.bitword), "in BX", mu_in.bx, "( frame:", mu_in.frame, " link:", mu_in.link, \
                        " match: {match:.2%} )".format(match=rel_in/float(Relation.max_relation))
                else:
                    print "in : NO MATCH"

            # Now, dump details about the BXs that were connected above (if options.verbose --> option -v)
            if options.verbose and mismatch and mu_in != None and mu_imd != None:
                bxs = [mu_out.bx]
                if not mu_in.bx in bxs: bxs.append(mu_in.bx)
コード例 #2
0
            rel_in = in_matches[mu_out][0]
            rel_imd = imd_matches[mu_out][0]
            mu_in = in_matches[mu_out][1]
            mu_imd = imd_matches[mu_out][1]

            # check if the match was not perfect
            mismatch = rel_in < Relation.max_relation or rel_imd < Relation.max_relation
            # check if BX is the same... as a few bits were usually not fitting
            mismatch_bx = mu_in == None or mu_imd == None or mu_in.bx != mu_out.bx or mu_imd.bx != mu_out.bx

            # first dump the matches with some additional info:
            if (mismatch_bx or (mismatch and options.verbose)
                    or options.detaildump):
                print "+" * 30, "BX", mu_out.bx, "+" * 30
                print "out: ", print_out_word(
                    mu_out.bitword
                ), "in BX", mu_out.bx, "( frame:", mu_out.frame, " link:", mu_out.link, ")"
                if mu_imd != None:
                    print "imd: ", print_out_word(mu_imd.bitword), "in BX", mu_imd.bx, "( frame:", mu_imd.frame, " link:", mu_imd.link, \
                        " match: {match:.2%} )".format(match=rel_imd/float(Relation.max_relation))
                else:
                    print "imd: NO MATCH"
                if mu_in != None:
                    print "in : ", print_in_word(mu_in.bitword), "in BX", mu_in.bx, "( frame:", mu_in.frame, " link:", mu_in.link, \
                        " match: {match:.2%} )".format(match=rel_in/float(Relation.max_relation))
                else:
                    print "in : NO MATCH"

            # Now, dump details about the BXs that were connected above (if options.verbose --> option -v)
            if options.verbose and mismatch and mu_in != None and mu_imd != None:
                bxs = [mu_out.bx]
コード例 #3
0
        if out_muons_emu != None:
            mu_to_print = {}
            imd_to_print = zip(imd_muons, imd_muons_emu)
            print imd_to_print
            if options.verbose:
                mu_to_print = zip(out_muons, out_muons_emu)
            else:
                mu_to_print = zip(non_zero, non_zero_emu)

            last_bx = 0
            for mu, mu_emu in mu_to_print:
                if mu.bx != last_bx:
                    print "*"*50, "intermediates", "*"*50
                    for i in range(last_bx*24, last_bx*24 + 24):
                        print "hw", print_out_word(imd_to_print[i][0].bitword), "emu", print_out_word(imd_to_print[i][1].bitword)
                    print "*"*50, "current bx:", mu.bx, "*"*50
                    last_bx = mu.bx
                if options.verbose or (mu.bitword != mu_emu.bitword):
                    print "hw", print_out_word(mu.bitword), "emu", print_out_word(mu_emu.bitword)
        else:
            mu_to_print = []
            if options.verbose:
                mu_to_print = out_muons
            else:
                mu_to_print = non_zero

            last_bx = 0
            for mu in non_zero:
                if mu.bx != last_bx:
                    print "*"*50, "current bx:", mu.bx, "*"*50
コード例 #4
0
                min(len(intermediate_muons), len(emu_imd_list)))
            mucnt = -1

            # non_zero_ranks = [rank for rank in ranks if rank != 0]
            # non_zero_emu = [emu for emu in emu_imd_list if emu.bitword != 0]
            # for mu, rank in zip(non_zero_emu, non_zero_ranks):
            #     if mu.rank != rank: print mu.rank, rank

            for emu_mu, hw_mu, hw_rank in zip(emu_imd_list, intermediate_muons,
                                              ranks):
                mucnt += 1
                if emu_mu.bitword == hw_mu.bitword:
                    continue
                if options.verbose:
                    print "mismatch in BX", hw_mu.bx, "rank hw:", hw_rank, "rank emu:", emu_mu.rank
                    print print_out_word(hw_mu.bitword)
                    print print_out_word(emu_mu.bitword)
                    print "-" * 80
                for x in xrange(64):
                    hw = bithlp.single_bit(hw_mu.bitword, x)
                    emu = bithlp.single_bit(emu_mu.bitword, x)
                    if hw != emu:
                        hist_inter_1.Fill(x, mucnt % 24 + 1)

            hist_inter_1.Draw("TEXT COLZ")
            hist_inter_1.SetMaximum(1)
            hist_inter_1.SetMinimum(-1)
            hist_inter_1.SetContour(5)
            hist_inter_1.SetStats(0)
            hist_inter_1.GetXaxis().SetTitle("Bits")
            for n in xrange(64):
コード例 #5
0
        if not options.nodebug:
            hist_inter_1 = ROOT.TH2D("{f}_comparison_inter_1".format(f=pattern), "comparison of intermediates: all bits [{f}]".format(f=pattern), 64, 0, 64, 24, 0, min(len(intermediate_muons), len(emu_imd_list)))
            mucnt = -1

            # non_zero_ranks = [rank for rank in ranks if rank != 0]
            # non_zero_emu = [emu for emu in emu_imd_list if emu.bitword != 0]
            # for mu, rank in zip(non_zero_emu, non_zero_ranks):
            #     if mu.rank != rank: print mu.rank, rank

            for emu_mu, hw_mu, hw_rank in zip(emu_imd_list, intermediate_muons, ranks):
                mucnt += 1
                if emu_mu.bitword == hw_mu.bitword: 
                    continue
                if options.verbose:
                    print "mismatch in BX", hw_mu.bx, "rank hw:", hw_rank, "rank emu:", emu_mu.rank
                    print print_out_word(hw_mu.bitword)
                    print print_out_word(emu_mu.bitword)
                    print "-"*80
                for x in xrange(64):
                    hw = bithlp.single_bit(hw_mu.bitword, x)
                    emu = bithlp.single_bit(emu_mu.bitword, x)
                    if hw != emu:
                        hist_inter_1.Fill(x, mucnt%24+1)


            hist_inter_1.Draw("TEXT COLZ")
            hist_inter_1.SetMaximum(1)
            hist_inter_1.SetMinimum(-1)
            hist_inter_1.SetContour(5)
            hist_inter_1.SetStats(0)
            hist_inter_1.GetXaxis().SetTitle("Bits")