@@ -496,31 +496,6 @@ def finish(self, *args, **kwargs):
496496        self ._waveformsContainers  =  waveformsContainers .containers [
497497            EventType .SKY_PEDESTAL 
498498        ]
499-         # log.info('JPL: waveformsContainers=',waveformsContainers.containers[ 
500-         # EventType.SKY_PEDESTAL].nsamples) 
501- 
502-         # If we want to filter based on charges distribution 
503-         # make sure that the charge distribution container is filled 
504-         if  (
505-             self .filter_method  ==  "ChargeDistributionFilter" 
506-             and  self ._chargesContainers  is  None 
507-         ):
508-             log .debug ("Compute charges from waveforms" )
509-             chargesComponent_kwargs  =  {}
510-             chargesComponent_configurable_traits  =  (
511-                 ComponentUtils .get_configurable_traits (ChargesComponent )
512-             )
513-             for  key  in  kwargs .keys ():
514-                 if  key  in  chargesComponent_configurable_traits .keys ():
515-                     chargesComponent_kwargs [key ] =  kwargs [key ]
516-             self ._chargesContainers  =  ChargesComponent .create_from_waveforms (
517-                 waveformsContainer = self ._waveformsContainers ,
518-                 subarray = self .subarray ,
519-                 config = self .config ,
520-                 parent = self .parent ,
521-                 * args ,
522-                 ** chargesComponent_kwargs ,
523-             )
524499
525500        # Check if waveforms container is empty 
526501        if  self ._waveformsContainers  is  None :
@@ -535,6 +510,29 @@ def finish(self, *args, **kwargs):
535510            # container with no results 
536511            return  None 
537512        else :
513+             # If we want to filter based on charges distribution 
514+             # make sure that the charge distribution container is filled 
515+             if  (
516+                 self .filter_method  ==  "ChargeDistributionFilter" 
517+                 and  self ._chargesContainers  is  None 
518+             ):
519+                 log .debug ("Compute charges from waveforms" )
520+                 chargesComponent_kwargs  =  {}
521+                 chargesComponent_configurable_traits  =  (
522+                     ComponentUtils .get_configurable_traits (ChargesComponent )
523+                 )
524+                 for  key  in  kwargs .keys ():
525+                     if  key  in  chargesComponent_configurable_traits .keys ():
526+                         chargesComponent_kwargs [key ] =  kwargs [key ]
527+                 self ._chargesContainers  =  ChargesComponent .create_from_waveforms (
528+                     waveformsContainer = self ._waveformsContainers ,
529+                     subarray = self .subarray ,
530+                     config = self .config ,
531+                     parent = self .parent ,
532+                     * args ,
533+                     ** chargesComponent_kwargs ,
534+                 )
535+ 
538536            # Build mask to filter the waveforms 
539537            # Mask based on the high gain channel that is most sensitive to signals 
540538            # Initialize empty mask 
0 commit comments