Skip to content

Commit

Permalink
add option decayTauLeptonic
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiopizz committed Apr 12, 2023
1 parent 5e61b6c commit e432a2a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
23 changes: 15 additions & 8 deletions generation/Generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def create_CMSSW_tar(release, singularity):
if release =="CMSSW_10_2_22":
script += "git cms-init\n"
script += "git cms-merge-topic giorgiopizz:patch_10_2_22_nanoAOD_reweight\n"
elif release == "CMSSW_10_2_6":
print("--> Patching 10_2_6")
script += "git cms-init\n"
script += "git cms-merge-topic GiacomoBoldrini:patch_10_2_6_gridpack\n"
# elif release == "CMSSW_10_2_6":
# print("--> Patching 10_2_6")
# script += "git cms-init\n"
# script += "git cms-merge-topic GiacomoBoldrini:patch_10_2_6_gridpack\n"
script += "scram b\n"
script += "cd ../..\n"
script += "tar -zcf {}.tgz {}\n".format(release, release)
Expand All @@ -54,7 +54,7 @@ def create_CMSSW_tar(release, singularity):
process = subprocess.Popen("chmod +x {}; ./{}; rm {}".format(nameTmpScript,nameTmpScript,nameTmpScript), shell=True)
process.wait()

def generate(name, year, gridpack, removeOldRoot, dipoleRecoil, events, jobs, doBatch, eos_out_path):
def generate(name, year, gridpack, removeOldRoot, dipoleRecoil, decayTauLeptonic, events, jobs, doBatch, eos_out_path):
with open("Steps.json") as file:
Steps = json.load(file)
gridpack = os.path.expanduser(gridpack)
Expand Down Expand Up @@ -197,8 +197,14 @@ def generate(name, year, gridpack, removeOldRoot, dipoleRecoil, events, jobs, do
wrapper += "sed -i 's#^.*input[^=]*=[^=]*cms.untracked.int32.*$# input = cms.untracked.int32({})#g' -i {}\n".format(events, file)
wrapper += 'sed -i "s/^.*nEvents = .*$/ nEvents = cms.untracked.uint32({}),/g" -i {}\n'.format(events, file)
wrapper += 'sed -i "s/^process.RandomNumberGeneratorService.externalLHEProducer.initialSeed.*$/process.RandomNumberGeneratorService.externalLHEProducer.initialSeed=int($(($1+1)))/g" -i {} \n'.format(file)
if dipoleRecoil:
wrapper += "sed -i '/^.*pythia8CP5Settings[^=]*=.*/i \ \ \ \ \ \ \ \ processParameters = cms.vstring(\"SpaceShower:dipoleRecoil = on\"),' -i {}\n".format(file)
if dipoleRecoil or decayTauLeptonic:
procParams = []
if dipoleRecoil:
procParams.append("\"SpaceShower:dipoleRecoil = on\"")
if decayTauLeptonic:
procParams.extend(["\"15:onMode = off\"", "\"15:onIfMatch = 16 11 -12\"", "\"15:onIfMatch = 16 11 -12\""])
# wrapper += "sed -i '/^.*pythia8CP5Settings[^=]*=.*/i \ \ \ \ \ \ \ \ processParameters = cms.vstring(\"SpaceShower:dipoleRecoil = on\", \"15:onMode = off\", \"15:onIfMatch = 16 11 -12\", \"15:onIfMatch = 16 11 -12\"),' -i {}\n".format(file)
wrapper += "sed -i '/^.*pythia8CP5Settings[^=]*=.*/i \ \ \ \ \ \ \ \ processParameters = cms.vstring({}),' -i {}\n".format(', '.join(procParams),file)

if Steps[year]['lhe'].get('runTarball', 'default') != 'default':
runTarballFilename = Steps[year]['lhe']['runTarball'].split('/')[-1]
Expand Down Expand Up @@ -260,6 +266,7 @@ def helperJsonParse(Samples, sample):
paramsD = {
"removeOldRoot": True,
"dipoleRecoil": True,
"decaytauleptonic": True,
"events": 2500,
"jobs": 400,
"doBatch": 0,
Expand All @@ -275,7 +282,7 @@ def helperJsonParse(Samples, sample):
return True, []
paramsD[p] = Samples[sample][p]

optional_params = ["removeOldRoot", "dipoleRecoil", "events", "jobs", "doBatch", "eosPath"]
optional_params = ["removeOldRoot", "dipoleRecoil", "decayTauLeptonic", "events", "jobs", "doBatch", "eosPath"]
for p in optional_params:
if p in Samples[sample].keys():
paramsD[p] = Samples[sample][p]
Expand Down
21 changes: 20 additions & 1 deletion generation/Samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,24 @@
"events": 2500,
"jobs": 300,
"doBatch":0
},
"provaNano": {
"year": "2018",
"gridpack": "~/Zjj_ewk_dim6_all_slc7_amd64_gcc700_CMSSW_10_6_19_tarball.tar.xz",
"dipoleRecoil": true,
"decayTauLeptonic": true,
"removeOldRoot": false,
"events": 10,
"jobs": 1,
"doBatch":0
},
"provaNano2": {
"year": "2018",
"gridpack": "~/Zjj_ewk_dim6_all_slc7_amd64_gcc700_CMSSW_10_6_19_tarball.tar.xz",
"dipoleRecoil": true,
"removeOldRoot": false,
"events": 500,
"jobs": 2,
"doBatch":1
}
}
}

0 comments on commit e432a2a

Please sign in to comment.