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