Package iceprod :: Package modules :: Module i3filter
[hide private]
[frames] | no frames]

Source Code for Module iceprod.modules.i3filter

 1   
 2  #!/bin/env python 
 3  # 
 4  """ 
 5   Interface for configuring and running python filtering scripts  
 6   
 7   copyright  (c) 2005 the icecube collaboration 
 8   
 9   @version: $Revision: $ 
10   @date: $Date: $ 
11   @author: Juan Carlos Diaz Velez <juancarlos@icecube.wisc.edu> 
12  """ 
13   
14  import os 
15  import re 
16  import sys 
17  import string 
18  import os.path 
19  from ipmodule import IPBaseClass 
20  from iceprod.core import functions 
21  import logging 
22   
23 -class I3MCFilter(IPBaseClass):
24 """ 25 This class provides an interface for preprocessing files in iceprod 26 """ 27
28 - def __init__(self):
29 IPBaseClass.__init__(self) 30 self.AddParameter('URL','SVN URL of python script', 31 'http://code.icecube.wisc.edu/svn/meta-projects/std-processing/releases/V03-03-04/scripts/IC40/level1_sim_IC40.py') 32 self.AddParameter('Revision','SVN revision of python script',0) 33 self.AddParameter('GCDFILE','Input GCD file','') 34 self.AddParameter('INFILE','Input simulation file','') 35 self.AddParameter('OUTFILE','write output to this file','') 36 self.AddParameter('NUMEVENTS','Number of events to process',0) 37 self.AddParameter('MC','Configure prescales for normal MC data',0) 38 self.AddParameter('IT','Configure prescales for IceTop MC data',0) 39 self.AddParameter('PhotoRecDriverFile','DriverFile for PhotoRec tables','') 40 self.AddParameter('TableDir','directory where the photonics tables are located','') 41 self.AddParameter('SummaryFile','XML Summary file','') 42 self.logger = logging.getLogger('iceprod::I3MCFilter')
43 44
45 - def Execute(self,stats):
46 if not IPBaseClass.Execute(self,stats): return 0 47 url = self.GetParameter('URL') 48 gcdfile = self.GetParameter('GCDFILE') 49 infile = self.GetParameter('INFILE') 50 outfile = self.GetParameter('OUTFILE') 51 numevents = self.GetParameter('NUMEVENTS') 52 mc = self.GetParameter('MC') 53 it = self.GetParameter('IT') 54 driverfile = self.GetParameter('PhotoRecDriverFile') 55 tabledir = self.GetParameter('TableDir') 56 summaryfile = self.GetParameter('SummaryFile') 57 filt = os.path.basename(url) 58 59 if functions.wget(url): 60 raise Exception, "Failed to retrieve i3filter from '%s'" % url 61 62 cmd = "python %s -g%s -i%s -o%s" % (filt,gcdfile,infile,outfile) 63 if numevents: 64 cmd += " -n%d " % numevents 65 if mc: 66 cmd += " -m " 67 if it: 68 cmd += " -y " 69 if tabledir: 70 cmd += " -t%s" % tabledir 71 if driverfile: 72 cmd += " -d%s" % driverfile 73 if summaryfile: 74 cmd += " -x%s" % summaryfile 75 self.logger.info(cmd) 76 retval = os.system(cmd) 77 if retval == 0: 78 return retval 79 else: 80 self.logger.error("Failed to execute command '%s'" % cmd) 81 raise Exception, "Failed to execute command '%s'" % cmd
82