#!/usr/bin/env python2 # # Author: Nick Hastings # from os import path from ProcessDataDaemon import ProcessDateDirDataDaemon, MakeDirs class DataQualityD(ProcessDateDirDataDaemon): """ Daemon to submit jobs to analyse the beam and cosmic trigger events """ ProcessDateDirDataDaemon.conffile = path.expanduser('~/run/config/dq-bcd.cfg' ) def mkCommand( self, infile ): fgd_rootfile = self.mkOutNameDateDir( infile, 'fgd', 'dq-fgd-bc' ) tpc_rootfile = self.mkOutNameDateDir( infile, 'tpc', 'dq-tpc-bc' ) #ecal_rootfile = self.mkOutNameDateDir( infile, 'ecal', 'dq-ecal-c' ) #ecal_mip_rootfile = self.mkOutNameDateDir( infile, 'ecal', 'dq-ecal-mip' ) # Safely create output directries if needed for f in [ fgd_rootfile, tpc_rootfile ]: MakeDirs( path.dirname(f) ) c = 'source %s\n' % self.opt.get(self.name,'setupfile') c+= 'env\n' c+= 'CalibOffline_bcdataquality.exe -r' c+= ' -O fgd-bc-root-file=' + fgd_rootfile c+= ' -O tpc-bc-root-file=' + tpc_rootfile # c+= ' -O ecal-bc-root-file=' + ecal_rootfile # c+= ' -O ecal-mip-root-file=' + ecal_mip_rootfile c+= ' ' + infile self.command = c # Check if the infile is really ready and not still being generated def checkFile( self, infile ): infile_donefile = path.splitext(infile)[0] + '.done' return path.exists( infile_donefile ) if __name__ == '__main__': d = DataQualityD()