StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBET4pMakerImpBuilderTest.C
1 // Copyright (C) 2007 Tai Sakuma <sakuma@mit.edu>
2 
3 #include <StBET4pMakerImpBuilder.h>
4 #include <StBET4pMakerImp.h>
5 
6 #include <StjTPCMuDst.h>
7 #include <StjBEMCMuDst.h>
8 #include <StjEEMCMuDst.h>
9 #include <StjTPCNull.h>
10 #include <StjBEMCNull.h>
11 #include <StjEEMCNull.h>
12 #include <StjTPCTree.h>
13 #include <StjBEMCTree.h>
14 
15 #include <StjTrackListCut.h>
16 
17 #include <StjTrackCutDca.h>
18 #include <StjTrackCutDcaPtDependent.h>
19 #include <StjTrackCutEta.h>
20 #include <StjTrackCutPossibleHitRatio.h>
21 
22 #include <StjTowerEnergyListCut.h>
23 
24 #include <StjTowerEnergyCut2003BemcTower.h>
25 #include <StjTowerEnergyCutBemcWestOnly.h>
26 #include <StjTowerEnergyCutEnergy.h>
27 #include <StjTowerEnergyCutBemcStatus.h>
28 #include <StjTowerEnergyCutAdc.h>
29 
30 #include "StBET4pMakerImpBuilderTest.hh"
31 
32 
33 using namespace std;
34 
35 // Registers the fixture into the 'registry'
36 CPPUNIT_TEST_SUITE_REGISTRATION( StBET4pMakerImpBuilderTest );
37 
38 void StBET4pMakerImpBuilderTest::setUp()
39 {
40 
41 }
42 
43 void StBET4pMakerImpBuilderTest::tearDown()
44 {
45 
46 }
47 
48 void StBET4pMakerImpBuilderTest::test2003()
49 {
50  StMuDstMaker* uDstMaker(0);
51  bool doTowerSwapFix = true;
52  bool useTPC = true;
53  bool useBEMC = true;
54  bool useEEMC = false;
55  bool use2003Cuts = true;
56  bool use2005Cuts = false;
57  bool use2006Cuts = false;
58 
59  StBET4pMakerImpBuilder builder;
60  StBET4pMakerImp* imp = builder.build(useTPC, useBEMC, useEEMC, use2003Cuts, use2005Cuts, use2006Cuts, uDstMaker, doTowerSwapFix);
61 
62  imp->Init();
63 
64  CPPUNIT_ASSERT( dynamic_cast<StjTPCMuDst*>(imp->TPC()) );
65  CPPUNIT_ASSERT( dynamic_cast<StjBEMCMuDst*>(imp->BEMC()) );
66  CPPUNIT_ASSERT( dynamic_cast<StjEEMCNull*>(imp->EEMC()) );
67 
68  StjTowerEnergyListCut* bemcCut = imp->getBEMCEnergyCut();
69  StjTowerEnergyListCut::CutList bemcCutList = bemcCut->getCutList();
70  CPPUNIT_ASSERT_EQUAL( (size_t)4, bemcCutList.size() );
71  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCut2003BemcTower*>(bemcCutList[0]) );
72  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutEnergy*>(bemcCutList[1]) );
73  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutBemcStatus*>(bemcCutList[2]) );
74  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutAdc*>(bemcCutList[3]) );
75 
76 
77  StjTrackListCut* tpcCut = imp->getTPCTrackCut();
78  StjTrackListCut::CutList tpcCutList = tpcCut->getCutList();
79  CPPUNIT_ASSERT_EQUAL( (size_t)3, tpcCutList.size() );
80  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutDca*>(tpcCutList[0]) );
81  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutEta*>(tpcCutList[1]) );
82  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutPossibleHitRatio*>(tpcCutList[2]) );
83 
84  delete imp;
85 }
86 
87  void StBET4pMakerImpBuilderTest::test2005()
88  {
89  StMuDstMaker* uDstMaker(0);
90  bool doTowerSwapFix = true;
91  bool useTPC = true;
92  bool useBEMC = true;
93  bool useEEMC = false;
94  bool use2003Cuts = false;
95  bool use2005Cuts = true;
96  bool use2006Cuts = false;
97 
98  StBET4pMakerImpBuilder builder;
99  StBET4pMakerImp* imp = builder.build(useTPC, useBEMC, useEEMC, use2003Cuts, use2005Cuts, use2006Cuts, uDstMaker, doTowerSwapFix);
100 
101  imp->Init();
102 
103 
104  CPPUNIT_ASSERT( dynamic_cast<StjTPCMuDst*>(imp->TPC()) );
105  CPPUNIT_ASSERT( dynamic_cast<StjBEMCMuDst*>(imp->BEMC()) );
106  CPPUNIT_ASSERT( dynamic_cast<StjEEMCNull*>(imp->EEMC()) );
107 
108  StjTowerEnergyListCut* bemcCut = imp->getBEMCEnergyCut();
109  StjTowerEnergyListCut::CutList bemcCutList = bemcCut->getCutList();
110  CPPUNIT_ASSERT_EQUAL( (size_t)4, bemcCutList.size() );
111  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutBemcWestOnly*>(bemcCutList[0]) );
112  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutEnergy*>(bemcCutList[1]) );
113  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutBemcStatus*>(bemcCutList[2]) );
114  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutAdc*>(bemcCutList[3]) );
115 
116  StjTrackListCut* tpcCut = imp->getTPCTrackCut();
117  StjTrackListCut::CutList tpcCutList = tpcCut->getCutList();
118  CPPUNIT_ASSERT_EQUAL( (size_t)3, tpcCutList.size() );
119  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutDca*>(tpcCutList[0]) );
120  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutEta*>(tpcCutList[1]) );
121  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutPossibleHitRatio*>(tpcCutList[2]) );
122 
123  delete imp;
124  }
125 
126  void StBET4pMakerImpBuilderTest::test2006()
127  {
128  StMuDstMaker* uDstMaker(0);
129  bool doTowerSwapFix = true;
130  bool useTPC = true;
131  bool useBEMC = true;
132  bool useEEMC = true;
133  bool use2003Cuts = false;
134  bool use2005Cuts = false;
135  bool use2006Cuts = true;
136 
137  StBET4pMakerImpBuilder builder;
138  StBET4pMakerImp* imp = builder.build(useTPC, useBEMC, useEEMC, use2003Cuts, use2005Cuts, use2006Cuts, uDstMaker, doTowerSwapFix);
139 
140  imp->Init();
141 
142 
143  CPPUNIT_ASSERT( dynamic_cast<StjTPCMuDst*>(imp->TPC()) );
144  CPPUNIT_ASSERT( dynamic_cast<StjBEMCMuDst*>(imp->BEMC()) );
145  CPPUNIT_ASSERT( dynamic_cast<StjEEMCMuDst*>(imp->EEMC()) );
146 
147  StjTowerEnergyListCut* bemcCut = imp->getBEMCEnergyCut();
148  StjTowerEnergyListCut::CutList bemcCutList = bemcCut->getCutList();
149  CPPUNIT_ASSERT_EQUAL( (size_t)3, bemcCutList.size() );
150  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutEnergy*>(bemcCutList[0]) );
151  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutBemcStatus*>(bemcCutList[1]) );
152  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutAdc*>(bemcCutList[2]) );
153 
154 
155  StjTrackListCut* tpcCut = imp->getTPCTrackCut();
156  StjTrackListCut::CutList tpcCutList = tpcCut->getCutList();
157  CPPUNIT_ASSERT_EQUAL( (size_t)4, tpcCutList.size() );
158  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutDca*>(tpcCutList[0]) );
159  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutDcaPtDependent*>(tpcCutList[1]) );
160  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutEta*>(tpcCutList[2]) );
161  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutPossibleHitRatio*>(tpcCutList[3]) );
162 
163  delete imp;
164  }
165 
166  void StBET4pMakerImpBuilderTest::testBEMCout()
167  {
168  StMuDstMaker* uDstMaker(0);
169  bool doTowerSwapFix = true;
170  bool useTPC = true;
171  bool useBEMC = false;
172  bool useEEMC = true;
173  bool use2003Cuts = false;
174  bool use2005Cuts = false;
175  bool use2006Cuts = true;
176 
177  StBET4pMakerImpBuilder builder;
178  StBET4pMakerImp* imp = builder.build(useTPC, useBEMC, useEEMC, use2003Cuts, use2005Cuts, use2006Cuts, uDstMaker, doTowerSwapFix);
179 
180  imp->Init();
181 
182 
183  CPPUNIT_ASSERT( dynamic_cast<StjTPCMuDst*>(imp->TPC()) );
184  CPPUNIT_ASSERT( dynamic_cast<StjBEMCNull*>(imp->BEMC()) );
185  CPPUNIT_ASSERT( dynamic_cast<StjEEMCMuDst*>(imp->EEMC()) );
186 
187  StjTowerEnergyListCut* bemcCut = imp->getBEMCEnergyCut();
188  StjTowerEnergyListCut::CutList bemcCutList = bemcCut->getCutList();
189  CPPUNIT_ASSERT_EQUAL( (size_t)0, bemcCutList.size() );
190 
191  StjTrackListCut* tpcCut = imp->getTPCTrackCut();
192  StjTrackListCut::CutList tpcCutList = tpcCut->getCutList();
193  CPPUNIT_ASSERT_EQUAL( (size_t)4, tpcCutList.size() );
194  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutDca*>(tpcCutList[0]) );
195  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutDcaPtDependent*>(tpcCutList[1]) );
196  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutEta*>(tpcCutList[2]) );
197  CPPUNIT_ASSERT( dynamic_cast<StjTrackCutPossibleHitRatio*>(tpcCutList[3]) );
198 
199  delete imp;
200  }
201 
202  void StBET4pMakerImpBuilderTest::testTPCout()
203  {
204  StMuDstMaker* uDstMaker(0);
205  bool doTowerSwapFix = true;
206  bool useTPC = false;
207  bool useBEMC = true;
208  bool useEEMC = true;
209  bool use2003Cuts = false;
210  bool use2005Cuts = false;
211  bool use2006Cuts = true;
212 
213  StBET4pMakerImpBuilder builder;
214  StBET4pMakerImp* imp = builder.build(useTPC, useBEMC, useEEMC, use2003Cuts, use2005Cuts, use2006Cuts, uDstMaker, doTowerSwapFix);
215 
216  imp->Init();
217 
218 
219  CPPUNIT_ASSERT( dynamic_cast<StjTPCNull*>(imp->TPC()) );
220  CPPUNIT_ASSERT( dynamic_cast<StjBEMCMuDst*>(imp->BEMC()) );
221  CPPUNIT_ASSERT( dynamic_cast<StjEEMCMuDst*>(imp->EEMC()) );
222 
223  StjTowerEnergyListCut* bemcCut = imp->getBEMCEnergyCut();
224  StjTowerEnergyListCut::CutList bemcCutList = bemcCut->getCutList();
225  CPPUNIT_ASSERT_EQUAL( (size_t)3, bemcCutList.size() );
226  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutEnergy*>(bemcCutList[0]) );
227  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutBemcStatus*>(bemcCutList[1]) );
228  CPPUNIT_ASSERT( dynamic_cast<StjTowerEnergyCutAdc*>(bemcCutList[2]) );
229 
230 
231  StjTrackListCut* tpcCut = imp->getTPCTrackCut();
232  StjTrackListCut::CutList tpcCutList = tpcCut->getCutList();
233  CPPUNIT_ASSERT_EQUAL( (size_t)0, tpcCutList.size() );
234 
235  delete imp;
236  }
237