Belle II Software development
prepareSAD.py
1
8import subprocess
9
10# this scripts prepares SAD files for G4 simulation
11# merges all files for individual source, cuts -4m < s < 4m
12
13bkgs = ("LERT", "LERC", "LERB", "HERT", "HERC", "HERB")
14bkgs1 = ("Touschek_LER", "Coulomb_LER", "Brems_LER", "Touschek_HER", "Coulomb_HER", "Brems_HER")
15mainDir = "/group/belle2/BGcampaigns/SAD" # location of input SAD files
16dirr = "20191207_1X80-60_BG_study" # subdir of input SAD files
17outFile = "20191207_1X80-60_BG_study" # name of the output SAD file which is created into to the "mainDir/forG4/"
18
19i = 0
20for bkg in bkgs:
21 com = [
22 "root",
23 "-l",
24 "-b",
25 "-q",
26 f'background/steering_tools/prepareSADsample.C("{mainDir}/{dirr}/{bkg}*","{mainDir}/forG4/{bkgs1[i]}_{outFile}.root")']
27 with open(f"{mainDir}/forG4/{bkgs1[i]}_{outFile}_log.txt", "w") as log:
28 subprocess.check_call(com, stdout=log)
29
30 print(com)
31 i = i+1