def testDiMuonBranchExists(self): """Tests that the DiMuon branch exists""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testMuon_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.aliases.has_key('cmgDiMuonSel'),'We are expecting a branch called cmgDiMuonSel')
def testMultiJetBranchExists(self): """Tests that the multi-object branch exists.""" output = self.__class__.cfgsRunOnceCache[TestMultiJet.cfg_file_name] events = TestTools.getObject(output[1], "Events") cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.aliases.has_key("cmgMultiJet"), "We are expecting a branch called cmgMultiJet")
def testDiHemiBranchExists(self): """Tests that the di-hemisphere branch exists.""" output = self.__class__.cfgsRunOnceCache["CMGTools/Common/test/testHemi_cfg.py"] events = TestTools.getObject(output[1], "Events") cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.aliases.has_key("cmgDiHemi"), "We are expecting a branch called cmgDiHemi")
def testTauPt(self): """Very the default pt selection""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testTau_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertEqual(cmg.Draw("cmgTauSel.pt()","cmgTauSel.pt() < 15.0","goff"),0,\ 'All taus should have a 15 GeV default cut')
def testTauID(self): """Verify the tauID is applied""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testTau_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertNotEqual(cmg.Draw("cmgTauSel.tauID(\"decayModeFinding\")","cmgTauSel.tauID(\"decayModeFinding\")==1","goff"),0,\ 'HPS taudID should be filled')
def testBTag(self): """Verify that the Btag is applied""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testJet_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.Draw("cmgPFJetSel.btag()","cmgPFJetSel.getSelection(\"cuts_btag_loose\")","goff") > 0,\ 'The btag should be applied')
def testHasZID(self): """Verify that the Z id is applied""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testMuon_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertEqual(cmg.Draw("cmgDiMuonSel.pt()","!cmgDiMuonSel.hasSelection(\"cuts_zmumu\")","goff"),0,\ 'The Z id should be applied')
def testHasSelection(self): """Verify that hasSelection returns false if there is nothing there""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testMuon_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertEqual(cmg.Draw("cmgDiMuonSel.pt()","cmgDiMuonSel.hasSelection(\"foo_bar_dummy\")","goff"),0,\ 'foo_bar_dummy must not be found')
def testLegOrdering(self): """Verify that the leg ordering is applied""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testMuon_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertEqual(cmg.Draw("cmgDiMuonSel.mass()","cmgDiMuonSel.leg1().pt() < cmgDiMuonSel.leg2().pt()","goff"),0,\ 'The legs should be pt ordered')
def testcmgTriggerObjectFullPt(self): """Verify that cmgTriggerObjectFull has some entries""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.Draw("cmgTriggerObjectFull.pt()", 'cmgTriggerObjectFull.getSelectionRegExp("%s") && cmgTriggerObjectFull.pt() > 0' % self.triggerNameRe,"goff") > 0,\ 'cmgTriggerObjectFull has some pt')
def testcmgTriggerObjectSelLength(self): """Verify that cmgTriggerObjectSel has length 1""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertEquals(cmg.Draw("cmgTriggerObjectSel.pt()", "cmgTriggerObjectSelVec.size() != 1","goff"), 0,\ 'cmgTriggerObjectSel should have exactly one entry')
def testcmgTriggerObjectFullLength(self): """Verify that cmgTriggerObjectFull has some entries""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.Draw("cmgTriggerObjectFull.pt()", 'cmgTriggerObjectFullVec.size() > 0',"goff") > 0,\ 'cmgTriggerObjectFull should have some entries')
def testRazorMRT(self): """Verify that MRT is set""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testMuon_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.Draw("cmgDiMuonSel.mRT()", "(abs(cmgDiMuonSel.mRT() + 9999) > 1e-3) ","goff") > 0,\ 'MRT should be filled for relevant events')
def testcmgTriggerObjectFullLength(self): """Verify that cmgTriggerObjectFull has some entries""" output = self.__class__.cfgsRunOnceCache[ 'CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.Draw("cmgTriggerObjectFull.pt()", 'cmgTriggerObjectFullVec.size() > 0',"goff") > 0,\ 'cmgTriggerObjectFull should have some entries')
def testcmgTriggerObjectFullPt(self): """Verify that cmgTriggerObjectFull has some entries""" output = self.__class__.cfgsRunOnceCache[ 'CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.Draw("cmgTriggerObjectFull.pt()", 'cmgTriggerObjectFull.getSelectionRegExp("%s") && cmgTriggerObjectFull.pt() > 0' % self.triggerNameRe,"goff") > 0,\ 'cmgTriggerObjectFull has some pt')
def testcmgTriggerObjectSelLength(self): """Verify that cmgTriggerObjectSel has length 1""" output = self.__class__.cfgsRunOnceCache[ 'CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertEquals(cmg.Draw("cmgTriggerObjectSel.pt()", "cmgTriggerObjectSelVec.size() != 1","goff"), 0,\ 'cmgTriggerObjectSel should have exactly one entry')
def testcmgTriggerObjectSelTriggerFirseRegExp(self): """Verify that cmgTriggerObjectSel has the selected trigger fires""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.Draw("cmgTriggerObjectSel.pt()", 'cmgTriggerObjectSel.getSelectionRegExp("%s")' % self.triggerNameRe,"goff") > 0,\ 'There must be at least one event where the trigger fired')
def testcmgTriggerObjectSelTriggerFires(self): """Verify that cmgTriggerObjectSel has the selected trigger fires""" output = self.__class__.cfgsRunOnceCache[ 'CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertTrue(cmg.Draw("cmgTriggerObjectSel.pt()", 'cmgTriggerObjectSel.getSelection("%s")' % self.triggerName,"goff") > 0,\ 'There must be at least one event where the trigger fired')
def testMuonIsolation(self): """Verify that the isolation variables are set""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testMuon_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) self.assertEqual(cmg.Draw("abs(cmgMuonSel.absIso() + 3)","abs(cmgMuonSel.absIso() + 3) < 1e-6","goff"),0,\ 'There must be no isolations unset by pat') #9999 is the value of Unset(double) self.assertEqual(cmg.Draw("abs(cmgMuonSel.absIso() + 9999*3)","abs(cmgMuonSel.absIso() + 9999*3) < 1e-6","goff"),0,\ 'There must be no isolations unset by cmgTools')
def testcmgTriggerObjectSelTriggerExists(self): """Verify that cmgTriggerObjectSel has the selected trigger""" output = self.__class__.cfgsRunOnceCache['CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) entries = cmg.tree.GetEntries() self.assertEquals(cmg.Draw("cmgTriggerObjectSel.pt()", 'cmgTriggerObjectSel.hasSelection("%s")' % self.triggerName,"goff"), entries,\ 'Each event has the test trigger present')
def testcmgTriggerObjectSelTriggerExists(self): """Verify that cmgTriggerObjectSel has the selected trigger""" output = self.__class__.cfgsRunOnceCache[ 'CMGTools/Common/test/testTriggerObjects_cfg.py'] events = TestTools.getObject(output[1], 'Events') cmg = cmgTuple.cmgTuple(events) entries = cmg.tree.GetEntries() self.assertEquals(cmg.Draw("cmgTriggerObjectSel.pt()", 'cmgTriggerObjectSel.hasSelection("%s")' % self.triggerName,"goff"), entries,\ 'Each event has the test trigger present')