'''
Processor that can read (not write) Katydid ROOT files using the Cicada library
Author: M. Guigue
Date: Mar 30 2018
'''
from morpho.processors.IO import IOProcessor
from morpho.utilities import reader, morphologging
logger = morphologging.getLogger(__name__)
try:
from ROOT import TFile, TTreeReader, TTreeReaderValue
except ImportError:
pass
[docs]class IOCicadaProcessor(IOProcessor):
'''
Processor that can read (not write) Katydid ROOT files using the Cicada library
'''
[docs] def Reader(self):
'''
Reader method
'''
logger.debug("Reading {}".format(self.file_name))
try:
from ReadKTOutputFile import ReadKTOutputFile
except ImportError:
logger.warn("Cannot import ReadKTOutputFile")
self.data = ReadKTOutputFile(self.file_name,self.variables,katydid=self.use_katydid,objectType=self.object_type,name=self.object_name)
return True
[docs] def Writer(self):
'''
End-user analysis should not produce Katydid output objects...
'''
logger.error("End user analysis: cannot write reconstruction algorithm output")
raise