Exemplo n.º 1
0
 def do_merge(self):
     self.status = STATE_MERGE_WAITING
     if self.alignment.isDesign:
         folderName = '{}/hists/{}/baseline'.format(base, self.name)
     else:
         folderName = '{}/hists/{}/iter{}'.format(base, self.name, self.curIteration)
     
     # (re)move results from previous measurements before creating folder
     if os.path.isdir(folderName):
         if os.path.isdir(folderName+"_old"):
             shutil.rmtree("{}_old".format(folderName))
         os.rename(folderName, folderName+"_old")
     os.makedirs(folderName)
     
     # This is so that the structure of the tree can be retrieved by ApeEstimatorSummary.cc and the tree does not have to be rebuilt
     if self.curIteration > 0 and not self.alignment.isDesign: # don't have to check for isDesign here because it always ends after iteration 0...
         shutil.copyfile('{}/hists/{}/iter{}/allData_iterationApe.root'.format(base, self.name, self.curIteration-1),folderName+"/allData_iterationApe.root")
     fileNames = ['{}/hists/{}/{}{}.root'.format(base, self.name, self.dataset.sampleType, str(i)) for i in range(1, self.dataset.nFiles+1)]
     fileString = " ".join(fileNames)
     
     from autoSubmitterTemplates import mergeTemplate
     merge_result = subprocess.call(mergeTemplate.format(path=folderName, inputFiles=fileString), shell=True) # returns exit code (0 if no error occured)
     for name in fileNames:
         os.remove(name)
         
     if os.path.isfile("{}/allData.root".format(folderName)) and merge_result == 0: # maybe check with ROOT if all neccessary contents are in?
         self.status = STATE_MERGE_DONE
     else:
         self.status = STATE_MERGE_FAILED
         self.finishTime = subprocess.check_output(["date"]).strip()
     self.print_status()
Exemplo n.º 2
0
 def do_merge(self):
     self.status = STATE_MERGE_WAITING
     if self.alignment.isDesign:
         folderName = '{}/hists/{}/baseline'.format(base, self.name)
     else:
         folderName = '{}/hists/{}/iter{}'.format(base, self.name, self.curIteration)
     
     # (re)move results from previous measurements before creating folder
     if os.path.isdir(folderName):
         if os.path.isdir(folderName+"_old"):
             shutil.rmtree("{}_old".format(folderName))
         os.rename(folderName, folderName+"_old")
     os.makedirs(folderName)
     
     # This is so that the structure of the tree can be retrieved by ApeEstimatorSummary.cc and the tree does not have to be rebuilt
     if self.curIteration > 0 and not self.alignment.isDesign: # don't have to check for isDesign here because it always ends after iteration 0...
         shutil.copyfile('{}/hists/{}/iter{}/allData_iterationApe.root'.format(base, self.name, self.curIteration-1),folderName+"/allData_iterationApe.root")
     fileNames = ['{}/hists/{}/{}{}.root'.format(base, self.name, self.dataset.sampleType, str(i)) for i in range(1, self.dataset.nFiles+1)]
     fileString = " ".join(fileNames)
     
     from autoSubmitterTemplates import mergeTemplate
     merge_result = subprocess.call(mergeTemplate.format(path=folderName, inputFiles=fileString), shell=True) # returns exit code (0 if no error occured)
     for name in fileNames:
         os.remove(name)
         
     if os.path.isfile("{}/allData.root".format(folderName)) and merge_result == 0: # maybe check with ROOT if all neccessary contents are in?
         self.status = STATE_MERGE_DONE
     else:
         self.status = STATE_MERGE_FAILED
         self.finishTime = subprocess.check_output(["date"]).strip()
     self.print_status()
Exemplo n.º 3
0
 def do_merge(self):
     self.status = STATE_MERGE_WAITING
     if self.alignment.isDesign:
         folderName = '%s/hists/%s/baseline'%(base, self.name)
     else:
         folderName = '%s/hists/%s/iter%d'%(base, self.name, self.curIteration)
     if os.path.isdir(folderName):
         if os.path.isdir(folderName+"_old"):
             shutil.rmtree("%s_old"%(folderName))
         os.rename(folderName, folderName+"_old")
     os.makedirs(folderName)
     
     if self.curIteration > 0 and not self.alignment.isDesign: # don't have to check for isDesign here because it always ends after iteration 0...
         shutil.copyfile('%s/hists/%s/iter%d/allData_iterationApe.root'%(base, self.name, self.curIteration-1),folderName+"/allData_iterationApe.root")
     fileNames = ['%s/hists/%s/%s%s.root'%(base, self.name, self.dataset.sampleType, str(i)) for i in range(1, self.dataset.nFiles+1)]
     fileString = " ".join(fileNames)
     
     from autoSubmitterTemplates import mergeTemplate
     merge_result = subprocess.call(mergeTemplate.format(path=folderName, inputFiles=fileString), shell=True) # returns exit code (0 if no error occured)
     for name in fileNames:
         os.remove(name)
         
     if os.path.isfile("%s/allData.root"%(folderName)) and merge_result == 0:
         self.status = STATE_MERGE_DONE
     else:
         self.status = STATE_MERGE_FAILED
         self.finishTime = subprocess.check_output(["date"]).strip()
     self.print_status()
Exemplo n.º 4
0
    def do_merge(self):
        self.status = STATE_MERGE_WAITING
        if self.alignment.isDesign:
            folderName = '%s/hists/%s/baseline' % (base, self.name)
        else:
            folderName = '%s/hists/%s/iter%d' % (base, self.name,
                                                 self.curIteration)
        if os.path.isdir(folderName):
            if os.path.isdir(folderName + "_old"):
                shutil.rmtree("%s_old" % (folderName))
            os.rename(folderName, folderName + "_old")
        os.makedirs(folderName)

        if self.curIteration > 0 and not self.alignment.isDesign:  # don't have to check for isDesign here because it always ends after iteration 0...
            shutil.copyfile(
                '%s/hists/%s/iter%d/allData_iterationApe.root' %
                (base, self.name, self.curIteration - 1),
                folderName + "/allData_iterationApe.root")
        fileNames = [
            '%s/hists/%s/%s%s.root' %
            (base, self.name, self.dataset.sampleType, str(i))
            for i in range(1, self.dataset.nFiles + 1)
        ]
        fileString = " ".join(fileNames)

        from autoSubmitterTemplates import mergeTemplate
        merge_result = subprocess.call(
            mergeTemplate.format(path=folderName, inputFiles=fileString),
            shell=True)  # returns exit code (0 if no error occured)
        for name in fileNames:
            os.remove(name)

        if os.path.isfile("%s/allData.root" %
                          (folderName)) and merge_result == 0:
            self.status = STATE_MERGE_DONE
        else:
            self.status = STATE_MERGE_FAILED
            self.finishTime = subprocess.check_output(["date"]).strip()
        self.print_status()