Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:37

0001 from pathlib import Path
0002 import sys
0003 import subprocess
0004 def submit(path, run):
0005     cfg=""
0006     with open("DiamondCalibrationHarvester_cfg.py","r") as f:
0007         cfg=f.readlines()
0008         cfg[0]="run = "+str(run)+'\n'
0009         cfg[1]="input_file="+str(path_list)+'\n'
0010         
0011     with open("DiamondCalibrationHarvester_cfg.py","w") as f:
0012         f.writelines(cfg)
0013             
0014         
0015     subprocess.run(["cmsRun", "DiamondCalibrationHarvester_cfg.py"])
0016     
0017     
0018 path_list=[]
0019 last_run=0;
0020 run=0
0021 for path in Path(sys.argv[1]).rglob(sys.argv[2]):
0022     path=str(path)
0023     start=path.rfind(sys.argv[3])
0024     if(start==-1):
0025         continue
0026     start=start+len(sys.argv[3])
0027     end=path.find("/",start)
0028 
0029     run=sys.argv[4]+path[start:end]
0030     print(str(path), run)
0031     if(last_run==0 or run==last_run): 
0032         path_list.append("file:"+str(path))
0033     else:
0034         submit(path_list,last_run) 
0035         path_list=[]
0036         path_list.append("file:"+str(path))
0037     last_run=run
0038 
0039 if len(path_list)!=0:
0040     submit(path_list,last_run) 
0041