Пример #1
0
    data = totalPdf.generate(fitter.ws.set('obsSet'), RooFit.Name('data_obs'),
                             RooFit.Extended())
    if fitter.pars.binData:
        data = RooDataHist('data_obs', 'data_obs', fitter.ws.set('obsSet'),
                           data)
        data.Print('v')
    getattr(fitter.ws, 'import')(data)
else:
    data = fitter.loadData()

fitter.setMultijetYield()
data.Print()
startpars.IsA().Destructor(startpars)

print 'Time elapsed: %.1f sec' % timer.RealTime()
print 'CPU time used: %.1f sec' % timer.CpuTime()
print 'starting fitting routine'
timer.Continue()
#fitter.ws.var('top_nrm').setConstant()
fr = None
fr = fitter.fit()

plot1 = fitter.stackedPlot(pars.var[0])
leg1 = RooWjj2DFitter.Wjj2DFitter.legend4Plot(plot1)
plot2 = fitter.stackedPlot(pars.var[1])
leg2 = RooWjj2DFitter.Wjj2DFitter.legend4Plot(plot2)

c1 = TCanvas('c1', fitter.ws.var(pars.var[0]).GetTitle() + ' plot')
plot1.addObject(leg1)
plot1.Draw()
Пример #2
0
if stat.st_uid == os.getuid() and stat.st_gid == os.getgid():
    os.chmod("/tmp/mergeOutput.lock", 0666)
fcntl.lockf(f, fcntl.LOCK_EX)
processes = []
for composite_dataset in composite_datasets:
    p = Process(target=mergeCompositeDataset, args=(composite_dataset, sema))
    p.start()
    processes.append(p)
for p in processes:
    p.join()
fcntl.lockf(f, fcntl.LOCK_UN)
f.close()

sw.Stop()
cpu = sw.CpuTime()
real = sw.RealTime()

days = int(cpu / (60.0 * 60.0 * 24.0))
cpu -= days * (60.0 * 60.0 * 24.0)
hours = int(cpu / (60.0 * 60.0))
cpu -= hours * (60.0 * 60.0)
minutes = int(cpu / 60.0)
cpu -= minutes * 60.0

timeInfo = "\n\n\n=============================================\n\n"
timeInfo += "CPU Time:  "
if days > 0:
    timeInfo += str(days) + " days, "
if days > 0 or hours > 0:
    timeInfo += str(hours) + " hours, "
if days > 0 or hours > 0 or minutes > 0:
Пример #3
0
        event.getByLabel(muon_L, muon_H)
        muons = muon_H.product()

        print('muons size = ', muPt.size(), ', good muon size = ', muId.size(),
              'good muon collection size = ', len(muons))

        for imu in range(0, muPt.size()):
            print('muon pt in b2g muon collection =', muPt.at(imu))
        for imu in muons:
            print('muon pt', imu.getP4().Pt())
            #print ('muon charge', imu.getCharge())

        #Lets just get the good muons:
        #goodMuIso

# Done processing the events!
# Stop our timer
timer.Stop()

# Print out our timing information
rtime = timer.RealTime()
# Real time (or "wall time")
ctime = timer.CpuTime()
# CPU time
print("Analyzed events: {0:6d}".format(nEventsAnalyzed))
print("RealTime={0:6.2f} seconds, CpuTime={1:6.2f} seconds".format(
    rtime, ctime))
print("{0:4.2f} events / RealTime second .".format(nEventsAnalyzed / rtime))
print("{0:4.2f} events / CpuTime second .".format(nEventsAnalyzed / ctime))
subprocess.call(["ps aux | grep skhalil | cat > memory.txt", ""], shell=True)
Пример #4
0
    def submitArrayToBatch(self, scripts, arrayscriptpath, jobid=None):
        '''
        submits given scripts as array to batch system
        scripts: scripts to be submitted as array
        arrayscriptpath: path to generated array file
        jobid: newly created array job waits for the jobs given in jobid (as a list of ids) before executing

        returns jobid of array as list
        '''
        submitclock = TStopwatch()
        submitclock.Start()
        arrayscriptpath = os.path.abspath(arrayscriptpath)

        logdir = os.path.dirname(arrayscriptpath) + "/logs"
        print "will save logs in", logdir
        # if os.path.exists(logdir):
        #     print "emptying directory", logdir
        #     shutil.rmtree(logdir)
        # os.makedirs(logdir)
        if not os.path.exists(logdir):
            os.makedirs(logdir)

        # write array script
        nscripts = len(scripts)
        tasknumberstring = '1-' + str(nscripts)

        arrayscriptpath = self.writeArrayCode(scripts=scripts,
                                              arrayPath=arrayscriptpath,
                                              logdir=logdir)

        # prepate submit
        if self.jobmode == "HTC":
            print 'writing code for condor_submit-script'
            hold = True if jobid else False
            submitPath = self.writeSubmitCode(arrayscriptpath,
                                              logdir,
                                              hold=hold,
                                              isArray=True,
                                              nscripts=nscripts)

            print 'submitting', submitPath
            command = self.subname + " -terse " + submitPath
            command = command.split()
        else:
            print 'submitting', arrayscriptpath
            command = self.construct_array_submit()
            if not command:
                print "could not generate array submit command"
                return
            command.append('-t')
            command.append(tasknumberstring)
            if jobid:
                command.append("-hold_jid")
                command.append(str(jobid))
            command.append(arrayscriptpath)

        # submitting
        print "command:", command
        a = subprocess.Popen(command,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT,
                             stdin=subprocess.PIPE)
        output = a.communicate()[0]
        jobidstring = output
        if len(jobidstring) < 2:
            sys.exit("something did not work with submitting the array job")

        # extracting jobid
        try:
            jobidint = int(output.split(".")[0])
        except:
            sys.exit(
                "something went wrong with calling condor_submit command, submission of jobs was not succesfull"
            )
        submittime = submitclock.RealTime()
        print "submitted job", jobidint, " in ", submittime
        if hold:
            self.setupRelease(jobid, jobidint)
        return [jobidint]