/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Mdc/DedxCalibAlg/DedxCalibAlg-00-01-15/share/sub/sub_special.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import os
00004 import sys
00005 
00006 if(len(sys.argv)<2):
00007     print("example: sub_special.py path [ID] [template] [tag]")
00008     sys.exit()
00009 else:
00010     rawpath = str(sys.argv[1])
00011 
00012 if(len(sys.argv)>=3):
00013     ID = str(sys.argv[2])
00014 else:
00015     ID = "ID"
00016 
00017 if(len(sys.argv)>=4):
00018     template = str(sys.argv[3])
00019 else:
00020     template = "jobOptions_rec.txt"
00021 tempname = template.split(".txt")[0]
00022 
00023 if(len(sys.argv)>=5):
00024     tagname = str(sys.argv[4])
00025 else:
00026     tagname = ".rtraw"
00027 
00028 dirList=os.listdir(rawpath)
00029 for fname in dirList:
00030     if(fname.find(tagname)>-1):
00031         fname = fname.split(tagname)[0]
00032         fsave = open(tempname + fname + ".txt", "w")
00033         ftemp = open(template, "r")
00034         for ltemp in ftemp:
00035             if(ltemp.find("EventCnvSvc.digiRootInputFile")>-1):
00036                 ltemp = ltemp.replace(ID + ".rtraw", rawpath  + fname + tagname)
00037             if(ltemp.find("EventCnvSvc.digiRootOutputFile")>-1):
00038                 ltemp = ltemp.replace(ID + ".rec", fname + ".rec")
00039             if(ltemp.find("FILE103")>-1):
00040                 ltemp = ltemp.replace(ID + ".root", fname + ".root")
00041             fsave.write(ltemp)
00042         fsave.close()
00043 
00044 

Generated on Tue Nov 29 23:12:45 2016 for BOSS_7.0.2 by  doxygen 1.4.7