8 if sys.argv[1]==
"--trial":
11 dirFile =
"dirsToHadd.txt" 12 l_Dirs = [line.rstrip(
'\n')
for line
in open(dirFile)]
13 s_Persistent=
"/pnfs/nova/persistent/users/aboot" 16 s_ExampleFile = subprocess.check_output(
"ls " + d +
" | grep root | tail -n1", shell=
True);
17 nFiles = subprocess.check_output(
"ls " + s_Dir +
" | grep root | wc -l", shell=
True);
18 for sub
in nFiles.split():
24 print(s_Dir +
" IS EMPTY!");
27 s_ExpectedFiles = re.search(
"_of_(.*).root", s_ExampleFile);
28 print(
"IN THIS DIR THERE ARE " + nFiles +
" of " + s_ExpectedFiles.group(1) +
" ROOT FILES");
29 return (
"of_"+
str(nFiles))
in s_ExampleFile;
32 s_FirstDir = l_Dirs[0]
33 s_Persistent += s_FirstDir.split(
"abooth",1)[1]
34 s_Persistent = s_Persistent.rsplit(
"/", 1)[0]
37 if not os.path.exists(s_Persistent):
38 print(
"MAKING PERSISTENT DIR!")
40 os.makedirs(s_Persistent)
43 print(
"\n\nLOOKING AT DIRECTORY: " + d)
44 s_ExampleFile = subprocess.check_output(
"ls " + d +
" | grep root | tail -n1", shell=
True);
45 s_FileStub = s_ExampleFile.split(
".")[0]
46 s_DestFile = s_Persistent + s_FileStub +
".root" 47 if os.path.exists(s_DestFile):
48 print(
"*****HADDED FILE EXISTS IN OUTDIR, PLEASE DELETE AND RERUN IF YOU WANT REGENERATION***")
52 cmd =
"hadd_cafana " + s_DestFile
53 cmd += d +
"/" + s_FileStub +
".*_of*.root" 55 print(
"DIRECTORY COMPLETE, HADDING!!!\n")
57 print(
"TRIAL RUN, JUST PRINTING THE COMMAND:")
62 print(
"ALL FILES NOT YET COMPLETE, MOVING ON\n")
64 print(
"\n\nALL DONE!")
def checkFileCount(s_Dir)
procfile open("FD_BRL_v0.txt")