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