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