ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/dhidas/OSUAnalysis/Tools/test/TestMuonReader.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
Log Message:
osu copy modified

File Contents

# User Rev Content
1 dhidas 1.1 #include "cute/cute.h"
2     #include "cute/cute_suite.h"
3    
4     #include <boost/scoped_ptr.hpp>
5     #include <boost/shared_ptr.hpp>
6    
7     #include "TChain.h"
8     #include "../interface/Readers/MuonReader.h"
9     #include "InputFiles.h"
10    
11     using namespace BAT;
12    
13     struct TestMuonReader {
14     private:
15     boost::shared_ptr<TChain> input;
16     boost::scoped_ptr<MuonReader> reader;
17     MuonCollection muons;
18     MuonPointer leadingMuon;
19    
20     public:
21     TestMuonReader() :
22     input(new TChain(NTupleEventReader::EVENT_CHAIN)),
23     reader(new MuonReader(input)),
24     muons(),
25     leadingMuon() {
26     input->Add(InputFile::ttbar);
27     input->SetBranchStatus("*", 0);
28     reader->initialise();
29     input->GetEntry(1);
30     muons = reader->getMuons();
31     leadingMuon = muons.front();
32     }
33    
34     void testNumberOfMuons() {
35     ASSERT_EQUAL(1, muons.size());
36     }
37    
38     void testLeadingMuonFourVector() {
39     ASSERT_EQUAL_DELTA(79.3238, leadingMuon->energy(), 0.0001);
40     ASSERT_EQUAL_DELTA(-1.85475, leadingMuon->px(), 0.0001);
41     ASSERT_EQUAL_DELTA(-72.8907, leadingMuon->py(), 0.0001);
42     ASSERT_EQUAL_DELTA(-31.2372, leadingMuon->pz(), 0.0001);
43     }
44    
45     void testLeadingMuonRelativeIsolation() {
46     ASSERT_EQUAL_DELTA(0.0144937, leadingMuon->relativeIsolation(), 0.00001);
47     }
48    
49     void testLeadingMuonIsGlobal() {
50     ASSERT_EQUAL(true, leadingMuon->isGlobal());
51     }
52     };
53    
54     extern cute::suite make_suite_TestMuonReader() {
55     cute::suite s;
56    
57     s.push_back(CUTE_SMEMFUN(TestMuonReader,testNumberOfMuons));
58     s.push_back(CUTE_SMEMFUN(TestMuonReader,testLeadingMuonFourVector));
59     s.push_back(CUTE_SMEMFUN(TestMuonReader,testLeadingMuonRelativeIsolation));
60     s.push_back(CUTE_SMEMFUN(TestMuonReader,testLeadingMuonIsGlobal));
61    
62     return s;
63     }