Belle II Software development
SVDDose_test.py
1#!/usr/bin/env python3
2
3
10import argparse
11import basf2 as b2
12
13parser = argparse.ArgumentParser(
14 epilog="About nevt: when asking N events per file, the histograms from that "
15 "file are sent multiple times to the analysis module. Each time, they "
16 "are scaled by i/N, where i is the iteration number.")
17parser.add_argument("files", nargs="+", help="Input root files with histograms")
18parser.add_argument("-e", "--exp", type=int, default=1, help="Experiment number")
19parser.add_argument("-r", "--run", type=int, default=1, help="Run number")
20parser.add_argument("-n", "--nevt", type=int, default=1, help="Events per file")
21args = parser.parse_args()
22
23main = b2.create_path()
24# Input histograms from file(s). This is the module doing the scaling.
25main.add_module(
26 'DQMHistAnalysisInputRootFile', SelectHistograms=['SVDDose*'],
27 FileList=args.files, RunList=[args.run] * len(args.files),
28 EventsList=[args.nevt] * len(args.files), Experiment=args.exp,
29 EventInterval=1, NullHistogramMode=False)
30# main.add_module("DQMHistAutoCanvas") # Plot all Histo from Input not needed
31# Analysis module
32main.add_module(
33 'DQMHistAnalysisSVDDose', logLevel=b2.LogLevel.DEBUG, debugLevel=19,
34 epicsUpdateSeconds=2)
35# Output canvases to root file
36main.add_module(
37 'DQMHistAnalysisOutputFile', SaveHistos=False, SaveCanvases=True,
38 HistoFile=f"analysis_E{args.exp:04d}R{args.run:05d}.root")
39# Output monitoring object to root file
40main.add_module(
41 'DQMHistAnalysisOutputMonObj',
42 Filename=f"mirabelle_E{args.exp:04d}R{args.run:05d}.root")
43
44# Process all events
45b2.process(main)