def updateTopDB(type):  # type = pat or toptree

    log.output("********** Adding the information to TopDB **********")

    ## SIM INFO
    global cmssw_sim
    global gt_sim
    global publish_sim
    global GENFASTSIM_CFFPath
    global GENFASTSIM_PublishName
    global GENFASTSIM_nEvents
    global GENFASTSIM_PNFSLocation
    global GENFASTSIM_jobEff
    global GENFASTSIM_LHEFiles

    db = topDBInterface()

    # get current dir

    cmd = "pwd"
    pExe = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
    dir = pExe.stdout.read()

    ## insert GENFASTSIM into topDB
    print GENFASTSIM_jobEff
    if type == "GENFASTSIM":
        print GENFASTSIM_PublishName
        db.insertGENFASTSIM(
            "TopTree Producer",
            GENFASTSIM_PublishName.split("\n")[0],
            GENFASTSIM_PNFSLocation,
            cmssw_sim,
            gt_sim,
            GENFASTSIM_CFFPath,
            GENFASTSIM_LHEFiles,
            GENFASTSIM_jobEff,
            GENFASTSIM_nEvents,
            options.campaign,
        )
        # insert dataset into topDB
        cmssw_dataset = "CMSSW_53X"
        if not cmssw_sim.rfind("CMSSW_5_2") == -1:
            cmssw_dataset = "CMSSW_52X"
        elif not cmssw_sim.rfind("CMSSW_5_3") == -1:
            cmssw_dataset = "CMSSW_53X"
        else:
            log.output(
                "--> WARNING: CMSSW version not recognized in database; dataset will be inserted in TopDB as CMSSW_53X!"
            )

        db.insertDataSet(
            "TopTree Producer",
            GENFASTSIM_PublishName.split("\n")[0],
            "NewPhysics",
            "1",
            cmssw_dataset,
            "AOD",
            "Produced",
        )
Exemple #2
0
def updateTopDB(type):  # type = pat or toptree

    log.output("********** Adding the information to TopDB **********")

    ## SIM INFO
    global cmssw_sim
    global gt_sim
    global publish_sim
    global GENFASTSIM_CFFPath
    global GENFASTSIM_PublishName
    global GENFASTSIM_nEvents
    global GENFASTSIM_PNFSLocation
    global GENFASTSIM_jobEff
    global GENFASTSIM_LHEFiles

    db = topDBInterface()

    # get current dir

    cmd = 'pwd'
    pExe = Popen(cmd,
                 shell=True,
                 stdin=PIPE,
                 stdout=PIPE,
                 stderr=STDOUT,
                 close_fds=True)
    dir = pExe.stdout.read()

    ## insert GENFASTSIM into topDB
    print GENFASTSIM_jobEff
    if type == "GENFASTSIM":
        print GENFASTSIM_PublishName
        db.insertGENFASTSIM("TopTree Producer",
                            GENFASTSIM_PublishName.split("\n")[0],
                            GENFASTSIM_PNFSLocation, cmssw_sim, gt_sim,
                            GENFASTSIM_CFFPath, GENFASTSIM_LHEFiles,
                            GENFASTSIM_jobEff, GENFASTSIM_nEvents,
                            options.campaign)
        #insert dataset into topDB
        cmssw_dataset = "CMSSW_53X"
        if not cmssw_sim.rfind("CMSSW_5_2") == -1:
            cmssw_dataset = "CMSSW_52X"
        elif not cmssw_sim.rfind("CMSSW_5_3") == -1:
            cmssw_dataset = "CMSSW_53X"
        else:
            log.output(
                "--> WARNING: CMSSW version not recognized in database; dataset will be inserted in TopDB as CMSSW_53X!"
            )

        db.insertDataSet("TopTree Producer",
                         GENFASTSIM_PublishName.split("\n")[0], "NewPhysics",
                         "1", cmssw_dataset, "AOD", "Produced")
def updateTopDB(type): # type = pat or toptree

    log.output("********** Adding the information to TopDB **********")

    global options
    global logFileName
    global patPublishName
    global nEventsPAT
    global nEventsTT
    global nEventsDBS
    global doStartFromPAT
    global timestamp
    global workingDir
    global topTreeLocation
    global patLocation
    global ttreeEventContent
    global patEventContent
    global jobEffPat
    global jobEffTT
    
    db = topDBInterface()
        
    #patTAG=""
    #topTAG=""
    patTag = commands.getoutput("cd "+options.cmssw_ver+"/src"+"; git branch | sed -n '/\* /s///p'")
    topTag = commands.getoutput("cd "+options.cmssw_ver+"/src/TopBrussels/TopTreeProducer"+"; git branch | sed -n '/\* /s///p'")

    cmd ='cd '+workingDir+'; eval `scramv1 runtime -sh`'

    if not workingDir.rfind("CMSSW_5_") == -1:
        log.output("updateTopDB:: CMSSW_5_X_Y release detected, setting scram arch to slc5_amd64_gcc462")
        cmd = "export SCRAM_ARCH=\"slc5_amd64_gcc462\";"+cmd
    
    pExe = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
    out = pExe.stdout.read()

    #for line in open(workingDir+"/tags","r"):
    #    if not line.rfind("PatAlgos") == -1:
    #        patTAG=line
    #    if not line.rfind("TopTreeProducer") == -1:
    #        topTAG=line

    #os.remove(workingDir+"/tags")

    # get current dir

    cmd ='pwd'
    pExe = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
    dir = pExe.stdout.read()

    # insert dataset into topDB if not present (obsolete)

    #if skipPAT:
        
    #    db.insertDataSet("TopTree Producer",options.dataset,options.cmssw_ver,"Reco","Produced",0)

    #elif not doStartFromPAT:
    #    db.insertDataSet("TopTree Producer",options.dataset,options.cmssw_ver,"Reco","PATified",1)

    # insert patuple in topDB

    if type == "pat":

        if not doStartFromPAT:

            db.insertPatTuple("TopTree Producer",options.dataset,patPublishName,patTAG,options.cmssw_ver,patLocation,dir+'/'+workingDir+'/'+patCffName,nEventsDBS,nEventsPAT,jobEffPat,patEventContent,CrabJSON,options.RunSelection)
            
    # insert toptree in topdb

    comment = ""

    if not options.flavourHistoryFilterPath == -1:
        comment += "flavorHistoryPath:"+str(options.flavourHistoryFilterPath)+"\n"

    if type == "toptree":

        comment += ""
        
        if doStartFromPAT:
            db.insertTopTree("TopTree Producer",db.searchPATOrigin(options.dataset),options.dataset,options.cmssw_ver,topTAG,topTreeLocation,topTreeLocation,nEventsTT,jobEffTT,dir+'/'+workingDir+'/'+topCffName,comment,ttreeEventContent,CrabJSON,options.RunSelection)
        else:
            db.insertTopTree("TopTree Producer",options.dataset,patPublishName,options.cmssw_ver,topTAG,topTreeLocation,topTreeLocation,nEventsTT,jobEffTT,dir+'/'+workingDir+'/'+topCffName,comment,ttreeEventContent,CrabJSON,options.RunSelection)

    if type == "pat+toptree":

        comment += "\nTopTree Created from PAT in one single run, PAT was not stored!!!!"

        db.insertPatTuple("TopTree Producer",options.dataset,"PaTuple "+timestamp+" Not Published in DBS",patTAG,options.cmssw_ver,"PaTuple not stored on storage",dir+'/'+workingDir+'/'+patCffName,nEventsDBS,nEventsTT,jobEffPat,"PaTuple not stored on storage",CrabJSON,options.RunSelection)
        
        db.insertTopTree("TopTree Producer",options.dataset,"PaTuple "+timestamp+" Not Published in DBS",options.cmssw_ver,topTAG,topTreeLocation,topTreeLocation,nEventsTT,jobEffTT,dir+'/'+workingDir+'/'+topCffName,comment,ttreeEventContent,CrabJSON,options.RunSelection)
def updateTopDB(type):  # type = pat or toptree

    log.output("********** Adding the information to TopDB **********")

    global options
    global logFileName
    global patPublishName
    global nEventsPAT
    global nEventsTT
    global nEventsDBS
    global doStartFromPAT
    global timestamp
    global workingDir
    global topTreeLocation
    global patLocation
    global ttreeEventContent
    global patEventContent
    global jobEffPat
    global jobEffTT

    db = topDBInterface()

    #patTAG=""
    #topTAG=""
    patTag = commands.getoutput("cd " + options.cmssw_ver + "/src" +
                                "; git branch | sed -n '/\* /s///p'")
    topTag = commands.getoutput("cd " + options.cmssw_ver +
                                "/src/TopBrussels/TopTreeProducer" +
                                "; git branch | sed -n '/\* /s///p'")

    cmd = 'cd ' + workingDir + '; eval `scramv1 runtime -sh`'

    if not workingDir.rfind("CMSSW_5_") == -1:
        log.output(
            "updateTopDB:: CMSSW_5_X_Y release detected, setting scram arch to slc5_amd64_gcc462"
        )
        cmd = "export SCRAM_ARCH=\"slc5_amd64_gcc462\";" + cmd

    pExe = Popen(cmd,
                 shell=True,
                 stdin=PIPE,
                 stdout=PIPE,
                 stderr=STDOUT,
                 close_fds=True)
    out = pExe.stdout.read()

    #for line in open(workingDir+"/tags","r"):
    #    if not line.rfind("PatAlgos") == -1:
    #        patTAG=line
    #    if not line.rfind("TopTreeProducer") == -1:
    #        topTAG=line

    #os.remove(workingDir+"/tags")

    # get current dir

    cmd = 'pwd'
    pExe = Popen(cmd,
                 shell=True,
                 stdin=PIPE,
                 stdout=PIPE,
                 stderr=STDOUT,
                 close_fds=True)
    dir = pExe.stdout.read()

    # insert dataset into topDB if not present (obsolete)

    #if skipPAT:

    #    db.insertDataSet("TopTree Producer",options.dataset,options.cmssw_ver,"Reco","Produced",0)

    #elif not doStartFromPAT:
    #    db.insertDataSet("TopTree Producer",options.dataset,options.cmssw_ver,"Reco","PATified",1)

    # insert patuple in topDB

    if type == "pat":

        if not doStartFromPAT:

            db.insertPatTuple("TopTree Producer", options.dataset,
                              patPublishName, patTAG, options.cmssw_ver,
                              patLocation,
                              dir + '/' + workingDir + '/' + patCffName,
                              nEventsDBS, nEventsPAT, jobEffPat,
                              patEventContent, CrabJSON, options.RunSelection)

    # insert toptree in topdb

    comment = ""

    if not options.flavourHistoryFilterPath == -1:
        comment += "flavorHistoryPath:" + str(
            options.flavourHistoryFilterPath) + "\n"

    if type == "toptree":

        comment += ""

        if doStartFromPAT:
            db.insertTopTree("TopTree Producer",
                             db.searchPATOrigin(options.dataset),
                             options.dataset, options.cmssw_ver, topTAG,
                             topTreeLocation, topTreeLocation, nEventsTT,
                             jobEffTT,
                             dir + '/' + workingDir + '/' + topCffName,
                             comment, ttreeEventContent, CrabJSON,
                             options.RunSelection)
        else:
            db.insertTopTree(
                "TopTree Producer", options.dataset, patPublishName,
                options.cmssw_ver, topTAG, topTreeLocation, topTreeLocation,
                nEventsTT, jobEffTT, dir + '/' + workingDir + '/' + topCffName,
                comment, ttreeEventContent, CrabJSON, options.RunSelection)

    if type == "pat+toptree":

        comment += "\nTopTree Created from PAT in one single run, PAT was not stored!!!!"

        db.insertPatTuple("TopTree Producer", options.dataset,
                          "PaTuple " + timestamp + " Not Published in DBS",
                          patTAG, options.cmssw_ver,
                          "PaTuple not stored on storage",
                          dir + '/' + workingDir + '/' + patCffName,
                          nEventsDBS, nEventsTT, jobEffPat,
                          "PaTuple not stored on storage", CrabJSON,
                          options.RunSelection)

        db.insertTopTree("TopTree Producer", options.dataset,
                         "PaTuple " + timestamp + " Not Published in DBS",
                         options.cmssw_ver, topTAG, topTreeLocation,
                         topTreeLocation, nEventsTT, jobEffTT,
                         dir + '/' + workingDir + '/' + topCffName, comment,
                         ttreeEventContent, CrabJSON, options.RunSelection)