def submit(self,dirname,history): # Initializing the JobWriter jobber = JobWriter(self.main,dirname,self.resubmit) # Writing process if not self.resubmit: logging.info(" Creating folder '"+dirname.split('/')[-1] \ +"'...") else: logging.info(" Checking the structure of the folder '"+\ dirname.split('/')[-1]+"'...") if not jobber.Open(): logging.error("job submission aborted.") return False if not self.resubmit: logging.info(" Copying 'SampleAnalyzer' source files...") if not jobber.CopyLHEAnalysis(): logging.error(" job submission aborted.") return False if not jobber.CreateBldDir(): logging.error(" job submission aborted.") return False if self.main.shower.enable: mode=self.main.shower.type if self.main.shower.type=='auto': mode = commands.getstatusoutput('less ' + self.main.datasets[0].filenames[0] + ' | grep parton_shower ') if mode[0]!=0: logging.error('Cannot retrieve the showering information from the LHE files') return False mode = (mode[1].split())[0] if not jobber.CreateShowerDir(mode): logging.error(" job submission aborted.") return False logging.info(" Inserting your selection into 'SampleAnalyzer'...") if not jobber.WriteSelectionHeader(self.main): logging.error("job submission aborted.") return False if not jobber.WriteSelectionSource(self.main): logging.error("job submission aborted.") return False logging.info(" Writing the list of datasets...") for item in self.main.datasets: jobber.WriteDatasetList(item) logging.info(" Writing the command line history...") jobber.WriteHistory(history,self.main.firstdir) layouter = LayoutWriter(self.main, dirname) layouter.WriteLayoutConfig() if not self.resubmit: logging.info(" Creating Makefiles...") if not jobber.WriteMakefiles(): logging.error("job submission aborted.") return False #edit the delphes cards if self.main.fastsim.package in ["delphes","delfes"]: self.editDelphesCard(dirname) if self.resubmit: logging.info(" Cleaning 'SampleAnalyzer'...") if not jobber.MrproperJob(): logging.error("job submission aborted.") return False logging.info(" Compiling 'SampleAnalyzer'...") if not jobber.CompileJob(): logging.error("job submission aborted.") return False logging.info(" Linking 'SampleAnalyzer'...") if not jobber.LinkJob(): logging.error("job submission aborted.") return False for item in self.main.datasets: logging.info(" Running 'SampleAnalyzer' over dataset '" +item.name+"'...") logging.info(" *******************************************************") if not jobber.RunJob(item): logging.error("run over '"+item.name+"' aborted.") logging.info(" *******************************************************") return True
def Copy(self): # Initializing the JobWriter jobber = JobWriter(self.main, self.path, False) # Writing process logging.info(" Creating folder '" + self.path + "'...") if not jobber.Open(): logging.error("job submission aborted.") return False # Copying SampleAnalyzer logging.info(" Copying required 'SampleAnalyzer' source files...") if not jobber.CopyLHEAnalysis(): logging.error(" job submission aborted.") return False # Writing an empty analysis logging.info("Please enter a name for your analysis") title = raw_input("Answer: ") if title == "": title = "user" title = title.replace(' ', '_') title = title.replace('-', '_') logging.info(" Writing an empty analysis...") os.system("cd " + self.path + "/Build/SampleAnalyzer; python newAnalyzer.py " + title + " 1") # Extracting analysis name file = open(self.path + "/Build/SampleAnalyzer/Analyzer/analysisList.h") title = "" for line in file: if "Add" not in line: continue words = line.split('"') if len(words) >= 3: title = words[1] break file.close() # Writing a Makefile logging.info(" Writing a 'Makefile'...") if not jobber.WriteMakefiles(): logging.error("job submission aborted.") return False # Writing Main if not jobber.CreateBldDir(analysisName=title, outputName="user.saf"): logging.error(" job submission aborted.") return False if self.main.shower.enable: mode = self.main.shower.type if self.main.shower.type == 'auto': mode = commands.getstatusoutput( 'less ' + self.main.datasets[0].filenames[0] + ' | grep parton_shower ') if mode[0] != 0: logging.error( 'Cannot retrieve the showering information from the LHE files' ) return False mode = (mode[1].split())[0] if not jobber.CreateShowerDir(mode): logging.error(" job submission aborted.") return False return True