def getOverlay(self, nbevts): """ Create an overlay step """ pathToFiles = None from ILCDIRAC.Interfaces.API.NewInterface.Applications import OverlayInput overlay = OverlayInput() if self.energy == 350: if self.detectorModel == "ILD_o1_v05": pathToFiles = "/ilc/user/s/sailer/testFiles/overlay/ild_350/" if pathToFiles: overlay.setPathToFiles(pathToFiles) else: self.log.warn( "better define pathToFiles for this overlay: %s, %s, %s" % (self.energy, self.machine, self.backgroundType)) overlay.setMachine(self.machine) overlay.setEnergy(self.energy) overlay.setDetectorModel(self.detectorModel) overlay.setBkgEvtType(self.backgroundType) overlay.setBXOverlay(60) overlay.setGGToHadInt(0.3) overlay.setNumberOfSignalEventsPerJob(nbevts) return overlay
def getJob(jobid, jobpara): iser=jobid+1 outdst = "toto-ovl-%5.5i.dst.slcio"%iser outrec = "toto-ovl-%5.5i.rec.slcio"%iser ###In case one wants a loop: comment the folowing. #for i in range(2): j = UserJob() j.setJobGroup("Tutorial") j.setName("MarlinOverlayParametric%i"%iser) j.setInputSandbox(jobpara["setting_file"]) ## Define the overlay ov = OverlayInput() ov.setMachine("ilc_dbd") ov.setEnergy(energy) ov.setNumberOfSignalEventsPerJob(int(jobpara["n_events_per_job"])) ov.setBXOverlay(int(jobpara["BXOverlay"])) ov.setGGToHadInt(float(jobpara["GGToHadInt500"])) ov.setBkgEvtType("aa_lowpt") # ov.setBackgroundType("aa_lowpt") ov.setDetectorModel("ILD_o1_v05") res = j.append(ov) if not res['OK']: print res['Message'] exit(1) ## Define Marlin job ma = Marlin() ma.setDebug() ma.setVersion("ILCSoft-01-17-09") ma.setSteeringFile("marlin_ovl_stdreco.xml") ma.setGearFile("GearOutput.xml") # ma.setInputFile(simfile) ma.setInputFile(simlists[jobid]) ma.setOutputDstFile(outdst) ma.setOutputRecFile(outrec) res = j.append(ma) if not res['OK']: print res['Message'] exit(1) j.setOutputData([outdst,outrec],"myprod2/test","PNNL-SRM") j.setOutputSandbox(["*.log","*.xml","*.sh","TaggingEfficiency.root","PfoAnalysis.root"]) j.setCPUTime(10000) j.dontPromptMe() return j
def getOverlay(self, nbevts): """ Create an overlay step """ pathToFiles = None from ILCDIRAC.Interfaces.API.NewInterface.Applications import OverlayInput overlay = OverlayInput() if self.energy==350: if self.detectorModel=="ILD_o1_v05": pathToFiles="/ilc/user/s/sailer/testFiles/overlay/ild_350/" if pathToFiles: overlay.setPathToFiles(pathToFiles) else: self.log.warn("better define pathToFiles for this overlay: %s, %s, %s" % (self.energy, self.machine, self.backgroundType) ) overlay.setMachine(self.machine) overlay.setEnergy(self.energy) overlay.setDetectorModel(self.detectorModel) overlay.setBkgEvtType(self.backgroundType) overlay.setBXOverlay(60) overlay.setGGToHadInt(0.3) overlay.setNumberOfSignalEventsPerJob(nbevts) return overlay
def getJob(dirac, jobid, jobpara): iser=jobid+100 outdir = "/ilc/user/a/amiyamoto/myprod2/test/" outdst = "toto-ovl-%5.5i.dst.slcio"%iser outrec = "toto-ovl-%5.5i.rec.slcio"%iser dstlfn = outdir+"dst/"+outdst reclfn = outdir+"rec/"+outrec outsrm = "CERN-SRM" ###In case one wants a loop: comment the folowing. #for i in range(2): j = UserJob() j.setJobGroup("Tutorial") j.setName("MarlinOverlayParametric%i"%iser) j.setInputSandbox(jobpara["setting_file"]) ## Define the overlay ov = OverlayInput() ov.setMachine("ilc_dbd") ov.setEnergy(energy) ov.setNumberOfSignalEventsPerJob(int(jobpara["n_events_per_job"])) ov.setBXOverlay(int(jobpara["BXOverlay"])) ov.setGGToHadInt(float(jobpara["GGToHadInt500"])) ov.setBkgEvtType("aa_lowpt") # ov.setBackgroundType("aa_lowpt") ov.setDetectorModel("ILD_o1_v05") res = j.append(ov) if not res['OK']: print res['Message'] exit(1) ## Define Marlin job ma = Marlin() ma.setDebug() ma.setVersion("ILCSoft-01-17-09") ma.setSteeringFile("marlin_stdreco.xml") ma.setGearFile("GearOutput.xml") # ma.setInputFile(simfile) ma.setInputFile(simlists[jobid]) ma.setOutputDstFile(outdst) ma.setOutputRecFile(outrec) res = j.append(ma) if not res['OK']: print res['Message'] exit(1) # Upload files to different directories upload_script="upload%i.sh"%iser upload = GenericApplication() # Create a script to upload files. shfile = open(upload_script,"w") shfile.write("#!/bin/bash\n") shfile.write("/bin/ls -l \n") shfile.write("dirac-dms-add-file -ddd "+dstlfn+" "+outdst+" "+outsrm+" \n") shfile.write("dirac-dms-add-file -ddd "+reclfn+" "+outrec+" "+outsrm+" \n") shfile.close() os.chmod(upload_script,0755) upload.setScript(upload_script) res = j.append(upload) if not res['OK'] : print res['Message'] exit(1) # j.setOutputData([outdst,outrec],"myprod2/test","PNNL-SRM") j.setInputSandbox([ setting_file, upload_script ] ) j.setOutputSandbox(["*.log","*.xml","*.sh","TaggingEfficiency.root","PfoAnalysis.root"]) j.setCPUTime(10000) j.dontPromptMe() res = j.submit(dirac) if not res["OK"] : print "Failed submit job, jobid=%s" %jobid print res os.remove(upload_script) return j
def subOverlay(): # Decide parameters for a job outputSE = "KEK-SRM" isLocal = _clip.isLocal nbevts = 50 if _clip.numberOfEvents == 0 else _clip.numberOfEvents nbevts = 0 # To analize all input events outputFilePrefix = "overlay_example" if _clip.outputFilePrefix == "" else _clip.outputFilePrefix outputDir = _clip.outputDir inputFile = _clip.inputFile if inputFile == "": gLogger.error("Input file for ddsim does not given.") exit(-1) recfile = outputFilePrefix + ".rec.slcio" dstfile = outputFilePrefix + ".dst.slcio" detector_model = "ILD_l5_o1_v02" key = detector_model.split('_') sim_detectorModel = "_".join([key[0], key[1], key[3]]) # Create DIRAC objects for job submission dIlc = DiracILC() job = UserJob() job.setJobGroup("myoverlayjob") job.setName("myoverlay") job.setOutputSandbox(['*.log', '*.sh', '*.py', '*.xml']) job.setILDConfig("v02-00-02") # job.setInputSandbox(["a6-parameters.sin", "P2f_qqbar.sin"]) # job.setDestination(["LCG.KEK.jp", "LCG.DESY-HH.de"]) # job submission destination # job.setBannedSites([]) # a list of sites not to submit job # job.setCPUTime( cputime_limit_in_seconds_by_dirac_units ) # Create Overlay application ovldata = [{ "ProcessorName": "BgOverlayWW", "evttype": "aa_lowpt_WW", "ProdID": 10237, "expBG": 0.211, "subdir": "000" }, { "ProcessorName": "BgOverlayWB", "evttype": "aa_lowpt_WB", "ProdID": 10241, "expBG": 0.24605, "subdir": "000" }, { "ProcessorName": "BgOverlayBW", "evttype": "aa_lowpt_BW", "ProdID": 10239, "expBG": 0.243873, "subdir": "000" }, { "ProcessorName": "BgOverlayBB", "evttype": "aa_lowpt_BB", "ProdID": 10235, "expBG": 0.35063, "subdir": "000" }, { "ProcessorName": "PairBgOverlay", "evttype": "seeablepairs", "ProdID": 10233, "expBG": 1.0, "subdir": "100" }] BXOverlay = 1 NbSigEvtsPerJob = 100 numberOfSignalEvents = NbSigEvtsPerJob basebkgpath = "/ilc/prod/ilc/mc-opt-3/ild/sim/500-TDR_ws" energy = "500" for ovl in ovldata: print "### OverlayInput ... " + ovl["ProcessorName"] ovlapp = OverlayInput() ovlpath = "%s/%s/%s/v02-00-01/%8.8d/%s" % \ ( basebkgpath, ovl["evttype"], sim_detectorModel, ovl["ProdID"] , ovl["subdir"] ) print " OverlayPath ... " + ovlpath ovlapp.setMachine("ilc_dbd") # ovlapp.setEnergy(energy) # ovlapp.setDetectorModel(sim_detectorModel) ovlapp.setProcessorName(ovl["ProcessorName"]) ovlapp.setBkgEvtType(ovl["evttype"]) ovlapp.setPathToFiles(ovlpath) ovlapp.setGGToHadInt(ovl["expBG"]) ovlapp.setBXOverlay(BXOverlay) ovlapp.setNbSigEvtsPerJob(NbSigEvtsPerJob) ovlapp.setNumberOfSignalEventsPerJob(numberOfSignalEvents) res = job.append(ovlapp) if not res['OK']: print res['Message'] exit(1) # Create Marlin application marlin = Marlin() marlin.setVersion("ILCSoft-02-00-02_gcc49") marlin.setDetectorModel(detector_model) marlin.setSteeringFile("MarlinStdReco.xml") marlin.setInputFile(inputFile) marlin.setNumberOfEvents(nbevts) marlin.setOutputDstFile(dstfile) marlin.setOutputRecFile(recfile) extraCLIArguments = " --constant.DetectorModel=%s " % detector_model extraCLIArguments += " --constant.RunOverlay=true --constant.CMSEnergy=%s " % str( energy) extraCLIArguments += " --global.Verbosity=MESSAGE " marlin.setExtraCLIArguments(extraCLIArguments) job.append(marlin) if outputDir != "": job.setOutputData([dstfile, recfile], OutputPath=outputDir, OutputSE=outputSE) if isLocal: job.submit(dIlc, mode="local") else: job.submit(dIlc)
outrec = "toto-ovl.rec.slcio" #% i d= DiracILC(True,"repo.rep") ###In case one wants a loop: comment the folowing. #for i in range(2): j = UserJob() j.setJobGroup("Tutorial") j.setName("MarlinOverlayExample")#%i) j.setInputSandbox([setting_file]) ## Define the overlay ov = OverlayInput() ov.setMachine("ilc_dbd") ov.setEnergy(energy) ov.setNumberOfSignalEventsPerJob(n_events_per_job) ov.setBXOverlay(BXOverlay) ov.setGGToHadInt(GGToHadInt500) ov.setBkgEvtType("aa_lowpt") # ov.setBackgroundType("aa_lowpt") ov.setDetectorModel("ILD_o1_v05") res = j.append(ov) if not res['OK']: print res['Message'] exit(1) ## Define Marlin job ma = Marlin() ma.setDebug() ma.setVersion("ILCSoft-01-17-09") ma.setSteeringFile("marlin_ovl_stdreco.xml")