850 def __init__(self, name, viewMaker=None, isProbe=False, **viewMakerArgs):
851 super( InViewRecoCA, self ).
__init__()
852 self.name = name +
"_probe" if isProbe
else name
853 def updateHandle(baseTool, probeTool, handleName):
854 if hasattr(baseTool, handleName)
and getattr(baseTool, handleName).Path!=
"StoreGateSvc+":
855 setattr(probeTool, handleName, getattr(probeTool, handleName).Path +
"_probe")
857 if len(viewMakerArgs) != 0:
858 assert viewMaker
is None,
"No support for explicitly passed view maker and args for EventViewCreatorAlgorithm"
861 assert len(viewMakerArgs) == 0,
"No support for explicitly passed view maker and args for EventViewCreatorAlgorithm"
863 self.viewMakerAlg = viewMaker.__class__(viewMaker.getName()+
'_probe', **viewMaker._properties)
864 self.viewMakerAlg.Views = viewMaker.Views+
'_probe'
865 roiTool = self.viewMakerAlg.RoITool.__class.__(self.viewMakerAlg.RoITool.getName()+
'_probe', **self.viewMakerAlg.RoITool._properties)
866 log.debug(f
"InViewRecoCA: Setting InputCachedViews on {self.viewMaker.getName()} to read decisions from tag leg {viewMaker.getName()}: {viewMaker.InputMakerOutputDecisions}")
867 self.viewMakerAlg.InputCachedViews = viewMaker.InputMakerOutputDecisions
868 updateHandle(viewMakerArgs[
'RoITool'], roiTool,
"RoisWriteHandleKey")
869 if hasattr(viewMakerArgs[
'RoITool'],
"RoiCreator"):
870 updateHandle(viewMakerArgs[
'RoITool'], roiTool,
"ExtraPrefetchRoIsKey")
871 updateHandle(viewMakerArgs[
'RoITool'].RoiCreator, roiTool.RoiCreator,
"RoisWriteHandleKey")
873 self.viewMakerAlg.RoITool = roiTool
875 self.viewMakerAlg = viewMaker
877 assert 'name' not in viewMakerArgs,
"The name of view maker is predefined by the name of sequence"
878 assert 'Views' not in viewMakerArgs,
"The Views is predefined by the name of sequence"
879 assert 'ViewsNodeName' not in viewMakerArgs,
"The ViewsNodeName is predefined by the name of sequence"
880 if 'RoITool' in viewMakerArgs:
881 roiTool = viewMakerArgs[
'RoITool']
883 roiTool = CompFactory.ViewCreatorInitialROITool()
886 args = {
'name': f
'IM_{self.name}',
887 'ViewFallThrough' :
True,
888 'RoIsLink' :
'initialRoI',
890 'InViewRoIs' : f
'{name}RoIs',
891 'Views' : f
'{name}Views'+
'_probe' if isProbe
else f
'{name}Views',
892 'ViewNodeName' : f
'{name}InViews'+
'_probe' if isProbe
else f
'{name}InViews',
893 'RequireParentView' :
False,
894 'mergeUsingFeature' :
False }
895 args.update(**viewMakerArgs)
896 self.viewMakerAlg = CompFactory.EventViewCreatorAlgorithm(**args)
898 updateHandle(args[
'RoITool'], roiTool,
"RoisWriteHandleKey")
899 if hasattr(args[
'RoITool'],
"RoiCreator"):
900 updateHandle(args[
'RoITool'], roiTool,
"ExtraPrefetchRoIsKey")
901 updateHandle(args[
'RoITool'].RoiCreator, roiTool.RoiCreator,
"RoisWriteHandleKey")
902 self.viewsSeq =
parOR( self.viewMakerAlg.ViewNodeName )
903 self.addSequence( self.viewsSeq )