import sys,os,math,time #pandapath=os.environ.get('PANDAPATH') pandapath='/home/walbrecht/fopiroot/fopiroot_dev2/' sys.path.append(pandapath+'/macro/tpc/FOPI/python/argparse-1.2.1') import argparse pandapath='/home/walbrecht/fopiroot/fopiroot_dev/' #pandapath='/home/walbrecht/fopiroot/fopiroot_dev2/' sys.path.append(pandapath+'/macro/tpc/FOPI/python/argparse-1.2.1') import argparse parser=argparse.ArgumentParser(description='Read distortion files from a folder ') parser.add_argument('path',help='path to distortion',type=str) parser.add_argument('--pathMC',help='pathMC',type=str) parser.add_argument('--nEvents',help='How many Events',type=int,default=50000) parser.add_argument('--nEv',help='how many Events per batch',type=int,default=50000) parser.add_argument('--noreclust',help='no reclust',action='store_true') parser.add_argument('--noclcorr',help='no cluster correction',action='store_true') parser.add_argument('--inter',help='use interactive session instead of batch farm',action='store_true') parser.add_argument('--mc',help='prod mc file',action='store_true') parser.add_argument('--digi',help='prod digi file',action='store_true') parser.add_argument('--reco',help='prod reco file',action='store_true') args=parser.parse_args() nEvents=args.nEvents if nEvents == args.nEv: os.environ['moreEv']="false" else: os.environ['moreEv']="true" os.environ['nEvents']=str(nEvents) dirList = os.listdir(args.path) dirList.sort() print dirList for dist in dirList: name=dist[:-11] print name start=0 partNr=0 while start < nEvents: print nEvents namebatch=name namebatch+="part_" namebatch+=str(partNr) stop=start+args.nEv distFile=args.path + dist print start, stop os.environ['distFile']=str(distFile) os.environ['name']=str(name) os.environ['namebatch']=str(namebatch) os.environ['pathMC']=str(args.pathMC) os.environ['dist']=str(dist) os.environ['start']=str(start) os.environ['stop']=str(stop) if args.noreclust: os.environ['reclust']="false" savename="Cosmics_FopiMC_86ar85_1_"+str(stop)+".reco.root" else: os.environ['reclust']="true" savename="Cosmics_FopiMC_86ar85_1_"+str(stop)+"_recl.reco.root" if args.noclcorr: os.environ['clcorr']="false" savename="Cosmics_FopiMC_86ar85_1_"+str(stop)+"_recl.reco.root" else: os.environ['clcorr']="true" savename="Cosmics_FopiMC_86ar85_1_"+str(stop)+"_recl_clcorr.reco.root" os.environ['savename']=str(savename) if args.mc: if args.inter: os.system('. macro/tpc/FOPI/vwalbre/Batch/dosime12_mc.sh') else: os.system('qsub -N '+name+' -v "nEvents","distFile","name","pathMC","dist","start","stop","reclust","clcorr","moreEv","savename" -o ~/sgeout/ -j oe macro/tpc/FOPI/vwalbre/Batch/dosime12_mc.sh') if args.digi: os.system('. macro/tpc/FOPI/vwalbre/Batch/dosime12_digi.sh') if args.reco: if args.inter: os.system('. macro/tpc/FOPI/vwalbre/Batch/dosime12_reco.sh') else: os.system('qsub -N '+name+' -v "nEvents","distFile","name","pathMC","dist","start","stop","reclust","clcorr","moreEv","savename" -o ~/sgeout/ -j oe macro/tpc/FOPI/vwalbre/Batch/dosime12_reco.sh') start=stop partNr+=1