batch_job.py 4.17 KB
Newer Older
1
2
#!/usr/bin/env python3

Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
3
4
5
import os      # operating system interfaces
import sys     # provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter
import shutil  # offers a number of high-level operations on files and collections of files
6
7
8
9
10
11


def main():
    dataDir = sys.argv[1]
    geoSetup = sys.argv[2]
    plutoParticle = sys.argv[3]
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
12
13
    cbmrootConfigPath = "/lustre/nyx/cbm/users/criesen/build/config.sh"
    macroDir = "/lustre/nyx/cbm/users/criesen/cbmroot/macro/analysis/dielectron/"
14
    nofEvents = 1000
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
15
    
16
17
    taskId = os.environ.get('SLURM_ARRAY_TASK_ID')

Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
18
19
20
    jobId = os.environ.get('SLURM_ARRAY_JOB_ID')
    colEnergy = "8gev"
    colSystem = "auau"
21
22
23
24
25
26
27
    print("dataDir:" + dataDir)

    os.system(("source {}").format(cbmrootConfigPath))

    workDir = dataDir + "/workdir/" + jobId + "_" + taskId + "/"
    if os.path.exists(workDir):
        shutil.rmtree(workDir)
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
28
29
    os.makedirs(workDir)
    os.chdir(workDir)
30

Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
31
32
33
34
35
36
    plutoFile = getPlutoPath(colSystem, colEnergy, plutoParticle, taskId)
    #plutoFile = getPlutoPath("auau", "8gev", plutoParticle, taskId)    
    
    urqmdFile = "/lustre/nyx/cbm/prod/gen/urqmd/auau/"+colEnergy+"/centr/urqmd.auau.8gev.centr." + str(taskId).zfill(5) + ".root"
    #urqmdFile = "/lustre/nyx/cbm/prod/gen/urqmd/auau/8gev/centr/urqmd.auau.8gev.centr.00001.root"
    
37
38
39
40
41
42
43
    mcFile = dataDir + "/mc." + taskId + ".root"
    parFile = dataDir + "/param." + taskId + ".root"
    digiFile = dataDir + "/digi." + taskId + ".root"
    recoFile = dataDir + "/reco." + taskId + ".root"
    litQaFile = dataDir + "/litqa." + taskId + ".root"
    analysisFile = dataDir + "/analysis." + taskId + ".root"
    geoSimFile = dataDir + "/geosim." + taskId + ".root"
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
44
45
46
    os.system(('root -l -b -q {}/run_sim.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(
        macroDir, urqmdFile, plutoFile, mcFile, parFile, geoSimFile, geoSetup, nofEvents))
    os.system(('root -l -b -q {}/run_digi.C\(\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(
47
        macroDir, mcFile, parFile, digiFile, nofEvents))
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
48
49
50
51
52
53
    os.system(('root -l -b -q {}/run_reco.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(
        macroDir, mcFile, parFile, digiFile, recoFile, geoSetup, nofEvents))
    os.system(('root -l -b -q {}/run_litqa.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(
        macroDir, mcFile, parFile, digiFile, recoFile, litQaFile, geoSetup, nofEvents))
    os.system(('root -l -b -q {}/run_analysis.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(
        macroDir, mcFile, parFile, digiFile, recoFile, analysisFile, plutoParticle, colSystem, colEnergy, geoSetup, nofEvents))
54
55


Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
56
def getPlutoPath(colSystem, colEnergy, plutoParticle, taskId):
57
    if plutoParticle == "rho0":
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
58
       return "/lustre/nyx/cbm/prod/gen/pluto/auau/cktA/"+colEnergy+"/rho0/epem/pluto.auau."+colEnergy+".rho0.epem." + str(taskId).zfill(4) + ".root"
59
    elif plutoParticle == "omegaepem":
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
60
        return "/lustre/nyx/cbm/prod/gen/pluto/auau/cktA/"+colEnergy+"/omega/epem/pluto.auau."+colEnergy+".omega.epem." + str(taskId).zfill(4) + ".root"
61
    elif plutoParticle == "omegadalitz":
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
62
        return "/lustre/nyx/cbm/prod/gen/pluto/auau/cktA/"+colEnergy+"/omega/pi0epem/pluto.auau."+colEnergy+".omega.pi0epem." + str(taskId).zfill(4) + ".root"
63
    elif plutoParticle == "phi":
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
64
        return "/lustre/nyx/cbm/prod/gen/pluto/auau/cktA/"+colEnergy+"/phi/epem/pluto.auau."+colEnergy+".phi.epem." + str(taskId).zfill(4) + ".root"
65
    elif plutoParticle == "pi0":
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
66
        return "/lustre/nyx/cbm/prod/gen/pluto/auau/cktA/"+colEnergy+"/pi0/gepem/pluto.auau."+colEnergy+".pi0.gepem." + str(taskId).zfill(4) + ".root"
67
    elif plutoParticle == "inmed":
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
68
        return "/lustre/nyx/cbm/prod/gen/pluto/auau/cktRapp/"+colEnergy+"/rapp.inmed/epem/pluto.auau."+colEnergy+".rapp.inmed.epem." + str(taskId).zfill(4) + ".root"
69
    elif plutoParticle == "qgp":
Cornelius Feier-Riesen's avatar
Cornelius Feier-Riesen committed
70
        return "/lustre/nyx/cbm/prod/gen/pluto/auau/cktRapp/"+colEnergy+"/rapp.qgp/epem/pluto.auau."+colEnergy+".rapp.qgp.epem." + str(taskId).zfill(4) + ".root"
71
72
73
74
75
76
    elif plutoParticle == "urqmd":
        return ""


if __name__ == '__main__':
    main()