30def prepare_svd_overlay(path, inputFiles, outputFileTag="overlay"):
32 This function reads a list of input files and prepare them to be used
in overlay_svd_data
33 @param inputFiles: list of input files to be processed
34 @param outputFileTag: tag added just before the .root
37 for inputfile
in inputFiles:
40 b2.conditions.override_globaltags()
41 b2.conditions.globaltags = [
'svd_basic',
"online"]
43 if(str(outputFileTag) ==
"ZS3"):
44 splittext = inputfile.split(
".root")
46 splittext = inputfile.split(
"_ZS3.root")
47 outputfile = splittext[0]+
"_"+str(outputFileTag)+
".root"
48 main = b2.create_path()
49 main.add_module(
"RootInput", inputFileNames=inputfile)
50 if(str(outputFileTag) ==
"ZS3"):
51 main.add_module(
"SVDUnpacker", svdShaperDigitListName=
"SVDShaperDigitsZS3")
54 if (str(outputFileTag) ==
"overlayZS5"):
57 if not (str(outputFileTag) ==
"ZS3"):
58 main.add_module(
"SVDZeroSuppressionEmulator",
60 ShaperDigits=
'SVDShaperDigitsZS3',
61 ShaperDigitsIN=
'SVDShaperDigits',
63 main.add_module(
"RootOutput", branchNames=[
"SVDEventInfo",
"SVDShaperDigitsZS3"], outputFileName=outputfile)
65 main.add_module(
"RootOutput", branchNames=[
"SVDShaperDigits"], outputFileName=outputfile)
70def overlay_svd_data(path, datatype="randomTrigger", overlayfiles=""):
72 This function overlay events from data to the standard simulation
73 @param datatype: must be chosen among {xTalk, cosmics,randomTrigger, randomTriggerZS5, user-defined}
74 @param overlayfiles:
if the datatype
is user-defiled, the user can specify rootfiles to be overlaied to simulation
77 if not (str(datatype) ==
"xTalk" or str(datatype) ==
"cosmics" or str(datatype) ==
78 "randomTrigger" or str(datatype) ==
"randomTriggerZS5" or str(datatype) ==
"user-defined"):
79 print(
"ERROR in SVDOverlay: the specified datatype ("+str(datatype) +
80 ") is not recognized, choose among: xTalk, cosmics or user-defined")
83 overlayDir =
"/gpfs/fs02/belle2/group/detector/SVD/overlayFiles/"
85 if str(datatype) ==
"xTalk" or str(datatype) ==
"cosmics" or str(datatype) ==
"randomTrigger":
86 overlayfiles = str(overlayDir)+str(datatype)+
"/*_overlay.root"
88 if str(datatype) ==
"randomTriggerZS5":
89 overlayfiles = str(overlayDir)+
"randomTrigger/*_overlayZS5.root"
91 print(
" ** SVD OVERLAY UTIL CALLED **")
92 print(
" -> overlaying the following files to simulation: ")
93 print(str(overlayfiles))
95 bkginput = b2.register_module(
'BGOverlayInput')
96 bkginput.set_name(
'BGOverlayInput_SVDOverlay')
97 bkginput.param(
'bkgInfoName',
'BackgroundInfoSVDOverlay')
98 bkginput.param(
'extensionName',
"_SVDOverlay")
99 bkginput.param(
'inputFileNames', overlayfiles)
100 path.add_module(bkginput)
102 bkgexecutor = b2.register_module(
'BGOverlayExecutor')
103 bkgexecutor.set_name(
'BGOverlayExecutor_SVDOverlay')
104 bkgexecutor.param(
'bkgInfoName',
'BackgroundInfoSVDOverlay')
105 path.add_module(bkgexecutor)
107 path.add_module(
"SVDShaperDigitSorter")