1
#pylint: disable = C0103
3
basic test of KLDigitizer to see if digits come out on real spills
4
and if errors come out on empty
9
import maus_cpp.converter
12
from Configuration import Configuration
14
class MapCppKLMCDigitizer(unittest.TestCase): #pylint: disable = R0904
15
""" basic MapCppKLMCDigitizer test to check
16
if we get digits on good evts and errors on bad
19
def setUpClass(cls): # pylint: disable-msg=C0103
20
""" Class Initializer.
21
The set up is called before each test function
24
cls.mapper = MAUS.MapCppKLMCDigitizer()
25
conf_json = json.loads(Configuration().getConfigJSON())
26
conf_json["simulation_geometry_filename"] = "Stage6.dat"
27
# Test whether the configuration files were loaded correctly at birth
28
cls.mapper.birth(json.dumps(conf_json))
32
""" Test to make sure death occurs """
35
def test_process(self):
36
""" Test of the process function """
37
root_dir = os.environ.get("MAUS_ROOT_DIR")
38
assert root_dir != None
39
assert os.path.isdir(root_dir)
41
'%s/src/map/MapCppKLMCDigitizer/mc_test.dat' % root_dir
42
assert os.path.isfile(_filename)
43
_file = open(_filename, 'r')
45
# Spill 1 is corrupted.
47
output = self.mapper.process(spill)
48
self.assertTrue("errors" in maus_cpp.converter.json_repr(output))
50
spill = _file.readline().rstrip()
51
output = self.mapper.process(spill)
52
doc = maus_cpp.converter.json_repr(output)
53
self.assertTrue("kl_digits" in \
54
doc["recon_events"][0]["kl_event"])
58
def tear_down_class(cls):
63
if __name__ == '__main__':