ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/dhidas/OSUAnalysis/Tools/test/TestMuon.h
Revision: 1.1.1.1 (vendor branch)
Committed: Thu Dec 1 16:28:47 2011 UTC (13 years, 5 months ago) by dhidas
Content type: text/plain
Branch: dhidas, MAIN
CVS Tags: START, HEAD
Changes since 1.1: +0 -0 lines
Error occurred while calculating annotation data.
Log Message:
osu copy modified

File Contents

# Content
1 #include "cute/cute.h"
2 #include "cute/cute_suite.h"
3
4 #include "../interface/RecoObjects/Muon.h"
5 #include "TestObjectFactory.h"
6
7 using namespace BAT;
8
9 struct TestMuon {
10 private:
11
12 MuonPointer goodNonIsolatedMuon;
13 MuonPointer goodIsolatedMuon;
14 MuonPointer nonGlobalMuon;
15 MuonPointer badMuonLowPt;
16 MuonPointer badEtaMuon;
17
18 public:
19 TestMuon() :
20 goodNonIsolatedMuon(TestObjectFactory::goodNonIsolatedMuon()),
21 goodIsolatedMuon(TestObjectFactory::goodIsolatedMuon()),
22 nonGlobalMuon(TestObjectFactory::badNonGlobalMuon()),
23 badMuonLowPt(TestObjectFactory::badPtMuon()),
24 badEtaMuon(TestObjectFactory::badEtaMuon()) {
25 }
26
27 void testGlobalMuon() {
28 ASSERT_EQUAL(true, goodNonIsolatedMuon->isGlobal());
29 goodNonIsolatedMuon->makeGlobal(false);
30 ASSERT_EQUAL(false, goodNonIsolatedMuon->isGlobal());
31 }
32
33 void testEcalIsolation() {
34 goodNonIsolatedMuon->setEcalIsolation(1234.);
35 ASSERT_EQUAL(1234., goodNonIsolatedMuon->ecalIsolation());
36 }
37
38 void testHcalIsolation() {
39 goodNonIsolatedMuon->setHcalIsolation(1234.);
40 ASSERT_EQUAL(1234., goodNonIsolatedMuon->hcalIsolation());
41 }
42
43 void testTrackerIsolation() {
44 goodNonIsolatedMuon->setTrackerIsolation(1234.);
45 ASSERT_EQUAL(1234., goodNonIsolatedMuon->trackerIsolation());
46 }
47
48 void testRelativeIsolation() {
49 float relativeIsolation = (goodNonIsolatedMuon->ecalIsolation() + goodNonIsolatedMuon->hcalIsolation()
50 + goodNonIsolatedMuon->trackerIsolation()) / goodNonIsolatedMuon->pt();
51 ASSERT_EQUAL(relativeIsolation, goodNonIsolatedMuon->relativeIsolation());
52 }
53
54 void testIsIsolated() {
55 ASSERT_EQUAL(true, goodIsolatedMuon->isIsolated());
56 }
57
58 void testIsNotIsolated() {
59 ASSERT_EQUAL(false, goodNonIsolatedMuon->isIsolated());
60 }
61
62 void testIsGoodMuon() {
63 ASSERT_EQUAL(true, goodNonIsolatedMuon->isGood());
64 ASSERT_EQUAL(true, goodIsolatedMuon->isGood());
65 }
66
67 void testNonGlobalMuonIsGood() {
68 ASSERT_EQUAL(false, nonGlobalMuon->isGood());
69 }
70
71 void testBadMuonLowPtIsGood() {
72 ASSERT_EQUAL(false, badMuonLowPt->isGood());
73 }
74
75 void testBadEtaMuonIsGood() {
76 ASSERT_EQUAL(false, badEtaMuon->isGood());
77 }
78 };
79
80 extern cute::suite make_suite_TestMuon() {
81 cute::suite s;
82
83 s.push_back(CUTE_SMEMFUN(TestMuon, testGlobalMuon));
84 s.push_back(CUTE_SMEMFUN(TestMuon, testEcalIsolation));
85 s.push_back(CUTE_SMEMFUN(TestMuon, testHcalIsolation));
86 s.push_back(CUTE_SMEMFUN(TestMuon, testTrackerIsolation));
87 s.push_back(CUTE_SMEMFUN(TestMuon, testRelativeIsolation));
88
89 s.push_back(CUTE_SMEMFUN(TestMuon, testIsIsolated));
90 s.push_back(CUTE_SMEMFUN(TestMuon, testIsNotIsolated));
91 s.push_back(CUTE_SMEMFUN(TestMuon, testIsGoodMuon));
92 s.push_back(CUTE_SMEMFUN(TestMuon, testNonGlobalMuonIsGood));
93 s.push_back(CUTE_SMEMFUN(TestMuon, testBadMuonLowPtIsGood));
94 s.push_back(CUTE_SMEMFUN(TestMuon, testBadEtaMuonIsGood));
95
96 return s;
97 }