Belle II Software  release-08-01-10
prepareSAD.py
1 
8 import subprocess
9 
10 # this scripts prepares SAD files for G4 simulation
11 # merges all files for individual source, cuts -4m < s < 4m
12 
13 bkgs = ("LERT", "LERC", "LERB", "HERT", "HERC", "HERB")
14 bkgs1 = ("Touschek_LER", "Coulomb_LER", "Brems_LER", "Touschek_HER", "Coulomb_HER", "Brems_HER")
15 mainDir = "/group/belle2/BGcampaigns/SAD" # location of input SAD files
16 dirr = "20191207_1X80-60_BG_study" # subdir of input SAD files
17 outFile = "20191207_1X80-60_BG_study" # name of the output SAD file which is created into to the "mainDir/forG4/"
18 
19 i = 0
20 for 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