def __fill_single_dir(self,dir_name,directory,mother_name="",depth=0): #print "MOTHER NAME = +%s+" %mother_name #print "About to study %s (in dir %s)" %(dir_name,getcwd()) # see if in black_list this_dir=DirID(dir_name,depth) #print this_dir if this_dir in self.black_list: #print "Directory %s skipped because black-listed" %dir_name return 0 depth+=1 self.cd(dir_name) #print self.ls() #print "Test %s with thre %s" %(self.stat_test.name, self.stat_test.threshold) contents=self.ls() if depth==1: n_top_contents=len(contents) #print contents cont_counter=1 comparisons=[] for name,obj_type in contents.items(): if obj_type=="TDirectoryFile": #We have a dir, launch recursion! #Some feedback on the progress if depth==1: print "Studying directory %s, %s/%s" %(name,cont_counter,n_top_contents) cont_counter+=1 #print "Studying directory",name # ok recursion on! subdir=Directory(name) subdir.draw_success=directory.draw_success subdir.do_pngs=directory.do_pngs self.__fill_single_dir(name,subdir,join(mother_name,dir_name),depth) if not subdir.is_empty(): if depth==1: print " ->Appending %s..." %name, directory.subdirs.append(subdir) if depth==1: print "Appended." else: # We have probably an histo. Let's make the plot and the png. if obj_type[:2]!="TH" and obj_type[:3]!="TPr" : continue h1,h2=self.getObjs(name) #print "COMPARISON : +%s+%s+" %(mother_name,dir_name) path = join(mother_name,dir_name,name) if path in self.black_list_histos: print " Skipping %s" %(path) directory.comparisons.append(Comparison(name, join(mother_name,dir_name), h1,h2, deepcopy(self.stat_test), draw_success=directory.draw_success, do_pngs=directory.do_pngs, skip=True)) else: directory.comparisons.append(Comparison(name, join(mother_name,dir_name), h1,h2, deepcopy(self.stat_test), draw_success=directory.draw_success, do_pngs=directory.do_pngs, skip=False)) directory.filename1 = self.filename1 directory.filename2 = self.filename2 directory.different_histograms['file1'] = self.different_histograms['file1'] directory.different_histograms['file2'] = self.different_histograms['file2'] self.cd("..")
def __fill_single_dir(self, dir_name, directory, mother_name="", depth=0): #print "MOTHER NAME = +%s+" %mother_name #print "About to study %s (in dir %s)" %(dir_name,getcwd()) # see if in black_list this_dir = DirID(dir_name, depth) #print this_dir if this_dir in self.black_list: #print "Directory %s skipped because black-listed" %dir_name return 0 depth += 1 self.cd(dir_name) #print self.ls() #print "Test %s with thre %s" %(self.stat_test.name, self.stat_test.threshold) contents = self.ls() if depth == 1: n_top_contents = len(contents) #print contents cont_counter = 1 comparisons = [] for name, obj_type in contents.items(): if obj_type == "TDirectoryFile": #We have a dir, launch recursion! #Some feedback on the progress if depth == 1: print "Studying directory %s, %s/%s" % (name, cont_counter, n_top_contents) cont_counter += 1 #print "Studying directory",name # ok recursion on! subdir = Directory(name) subdir.draw_success = directory.draw_success subdir.do_pngs = directory.do_pngs self.__fill_single_dir(name, subdir, join(mother_name, dir_name), depth) if not subdir.is_empty(): if depth == 1: print " ->Appending %s..." % name, directory.subdirs.append(subdir) if depth == 1: print "Appended." else: # We have probably an histo. Let's make the plot and the png. if obj_type[:2] != "TH" and obj_type[:3] != "TPr": continue h1, h2 = self.getObjs(name) #print "COMPARISON : +%s+%s+" %(mother_name,dir_name) path = join(mother_name, dir_name, name) if path in self.black_list_histos: print " Skipping %s" % (path) directory.comparisons.append( Comparison(name, join(mother_name, dir_name), h1, h2, deepcopy(self.stat_test), draw_success=directory.draw_success, do_pngs=directory.do_pngs, skip=True)) else: directory.comparisons.append( Comparison(name, join(mother_name, dir_name), h1, h2, deepcopy(self.stat_test), draw_success=directory.draw_success, do_pngs=directory.do_pngs, skip=False)) self.cd("..")