1531def diff_branch (k, kb, v1, v2):
1532 head = '%s branch %s:' % (k, kb)
1533 ev1 = v1.keys()
1534 ev2 = v2.keys()
1535 ev1.sort()
1536 ev2.sort()
1537 if ev1 != ev2:
1538 if ignore_event_differences:
1540 ev1.sort()
1541 else:
1542 print (head, 'Different set of events; new file: ',
1543 ev1, 'reference file', ev2)
1544 return
1545
1546 ithresh = None
1547 eltcmp = None
1548
1549 thresh = 1e-6
1550 for (pat, th) in branch_thresh:
1551 if pat.match (kb):
1552 if isinstance(th, tuple):
1553 thresh = th[0]
1554 ithresh = th[1]
1555 else:
1556 thresh = th
1557 break
1558
1559
1560 if kb.startswith ('el_gsf_'): thresh = 1e-4
1561 if kb == 'el_gsf_deltaeta2': thresh = 3e-3
1562 if kb == 'el_gsf_deltaphi2': thresh = 2e-1
1563 if kb == 'el_gsf_deltaphiRescaled': thresh = 2e-2
1564 if kb == 'el_gsf_deltaeta1': thresh = 3e-3
1565 if kb == 'el_gsf_trackz0pv': thresh = 1e-1
1566 if kb == 'el_gsf_covqoverp': thresh = 5e-2
1567 if kb == 'el_gsf_L2_dr': thresh = 3e-2
1568 if kb == 'el_gsf_EF_dr': thresh = 7e-2
1569 if kb == 'el_gsf_covd0theta': thresh = 3e-4
1570 if kb == 'el_gsf_electronweight': thresh = 2e-2
1571 if kb == 'el_gsf_electronbgweight': thresh = 3e-1
1572 if kb == 'el_gsf_adaboost': thresh = 7e-2
1573 if kb == 'el_gsf_neuralnet': thresh = 2e-1
1574 if kb == 'el_gsf_isolationlikelihoodhqelectrons': thresh = 4e-2
1575 if kb == 'el_gsf_jet_dr': thresh = 2e-2
1576 if kb == 'el_gsf_Et': thresh = 3e-3
1577 if kb == 'el_gsf_E': thresh = 4e-3
1578 if kb == 'sc_yCells': thresh = 2e-6
1579 if kb.startswith ('el_gsf_p'): thresh = 3e-3
1580 if kb.startswith ('el_gsf_refittedTrack_cov'): thresh = 3e-1
1581 if kb.startswith ('el_gsf_trackcov'): thresh = 5e-1
1582 if kb.startswith ('el_gsf_tracksig'): thresh = 4e-2
1583 if kb.startswith ('el_gsf_trackd0'): thresh = 6e-2
1584 if kb.startswith ('el_gsf_trackz0'): thresh = 3e-2
1585 if kb.startswith ('el_gsf_trackfitchi2'): thresh = 7e-3
1586 if kb.startswith ('el_gsf_trackqoverp'): thresh = 2e-2
1587 if kb.startswith ('el_gsf_trackpt'): thresh = 2e-2
1588 if kb.startswith ('el_gsf_refittedTrack_d0'): thresh = 3e-3
1589 if kb.startswith ('el_gsf_refittedTrack_LMqoverp'): thresh = 3e-3
1590 if kb.startswith ('el_gsf_refittedTrack_qoverp'): thresh = 2e-2
1591 if kb.startswith ('el_gsf_refittedTrack_covphitheta'): thresh = 5e-1
1592 if kb.startswith ('el_gsf_mvaptcone'): ithresh = 1e-10
1593 if kb == 'el_gsf_m':
1594 thresh = 2e-2
1595 ithresh = 0.01
1596
1597 if kb.find('jet_')>=0 and kb.endswith ('_m'): ithresh = 0.1
1598 if kb.find('jetcone_')>=0 and kb.endswith ('_m'): ithresh = 1e-3
1599 if kb.find('muonTruth_')>=0 and kb.endswith ('_m'): ithresh = 0.5
1600 if kb == 'mc_m':
1601 ithresh = 0.1
1602 thresh = 2e-5
1603 if kb.endswith ('_effTopoInvMass'): thresh = 1e-2
1604 if kb.endswith ('_topoInvMass'): thresh = 1e-2
1605 if (kb.endswith ('_topoMeanDeltaR') or
1606 kb.endswith ('_effTopoMeanDeltaR')):
1607 ithresh = 1e-6
1608 if kb.find ('_rawcl_etas') >= 0: thresh = 2e-4
1609 if kb.endswith ('_convIP'): thresh = 4e-4
1610 if kb.endswith ('_convIPRev'): thresh = 6e-5
1611 if kb.endswith ('_emscale_E'): thresh = 9e-5
1612 if kb.endswith ('_emscale_eta'): thresh = 9e-5
1613 if kb.endswith ('_emscale_m'): ithresh = 0.1
1614 if kb.endswith ('_constscale_E'): thresh = 9e-5
1615 if kb.endswith ('_constscale_eta'): thresh = 9e-5
1616 if kb == 'mc_eta': thresh = mc_eta_thresh
1617 if kb.endswith ('_seg_locX'): ithresh = 2e-12
1618 if kb.endswith ('_seg_locY'): ithresh = 2e-12
1619 if kb == 'MET_Goodness_DeltaEt_JetAlgs_Jet': ithresh = 3e-11
1620 if kb == 'MET_Goodness_EEM_Jet': thresh = 2e-5
1621 if kb == 'MET_Goodness_HECf_Jet': thresh = 3e-6
1622 if kb.find ('_blayerPrediction') >= 0: thresh = 1e-2
1623 if kb.endswith ('_hecf'): thresh = 4e-6
1624 if kb.endswith ('_SpaceTime_t'): thresh = 4e-6
1625 if kb.endswith ('_SpaceTime_weight'): thresh = 2e-5
1626 if kb.endswith ('_SpaceTime_tError'): thresh = 8e-6
1627 if kb.endswith ('_calcVars_ChPiEMEOverCaloEME'): thresh = 1e-5
1628 if kb.endswith ('_vx_m'): ithresh = 1e-2
1629 if kb.endswith ('MET_Goodness_DeltaEt_JetAlgs_Jet'): ithresh = 1e-10
1630
1631
1632 if kb == 'mc_perigee_theta': thresh = 1
1633 if kb == 'mc_perigee_d0': thresh = 1
1634 if kb == 'mc_perigee_phi': thresh = 1
1635 if kb == 'mc_perigee_z0': thresh = 1
1636 if kb == 'tau_likelihood': thresh = 1e-5
1637 if kb == 'tau_SafeLikelihood': thresh = 1e-5
1638 if kb == 'el_gsf_softeweight': thresh = 1e-1
1639 if kb == 'el_gsf_softebgweight': thresh = 2e-2
1640
1641 if kb.endswith ('_mvaptcone20'): ithresh = 1e-10
1642 if kb.endswith ('_mvaptcone30'): ithresh = 1e-10
1643 if kb.endswith ('_mvaptcone40'): ithresh = 1e-10
1644
1645
1646 if kb == 'tau_SafeLikelihood': thresh = 0.4
1647 if kb == 'tau_likelihood': thresh = 0.4
1648 if kb == 'tau_BDTJetScore': thresh = 1.0
1649 if kb == 'tau_calcVars_corrFTrk': thresh = 0.02
1650 if kb == 'tau_calcVars_corrCentFrac': thresh = 0.4
1651 if kb == 'tau_JetBDTSigLoose': thresh = 1.0
1652 if kb == 'tau_JetBDTSigMedium': thresh = 1.0
1653 if kb == 'tau_JetBDTSigTight': thresh = 1.0
1654 if kb == 'tau_tauLlhMedium': thresh = 1.0
1655 if kb == 'tau_pi0_cl1_pt': thresh = 1e-5
1656
1657 if kb.endswith ('_neighbourSig'): thresh = 1e-4
1658 if kb.endswith ('_curvatureSig'): thresh = 1e-4
1659
1660 if kb == 'pixClus_detElementId': eltcmp = compare_detElementId
1661 if kb == 'pixClus_id': eltcmp = compare_pixid
1662 if kb == 'trig_EF_emcl_pt': eltcmp = compare_abs
1663
1664 for e in ev1:
1665 head = '%s branch %s event %d:' % (k, kb, e)
1666 b1 = v1[e]
1667 b2 = v2[e]
1668
1669
1670 if type(b1)
in inttypes
and isinstance(b2, float):
1671 b1 = float(b1)
1672 elif type(b2)
in inttypes
and isinstance(b1, float):
1673 b2 = float(b2)
1674
1676 print (head,
'Type differs; new file: ',
type(b1).__name__,
1677 'reference file:',
type(b2).__name__)
1678 elif not compare (b1, b2, thresh = thresh, ithresh = ithresh,
1679 eltcmp = eltcmp):
1680 print (head, 'Branch mismatch')
1681 print (' new file:', b1)
1682 print (' ref file:', b2)
1683
1684 return
1685
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)