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