hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
anaKalVtxTuple_cfg.py
Go to the documentation of this file.
1import HpstrConf
2import sys
3import os
4import baseConfig as base
5
6base.parser.add_argument("-f", "--makeFlatTuple", type=int, dest="makeFlatTuple", help="Make True to make vertex ana flat tuple", metavar="makeFlatTuple", default=0)
7base.parser.add_argument("-w", "--tracking", type=str, dest="tracking",
8 help="Which tracking to use to make plots", metavar="tracking", default="KF")
9options = base.parser.parse_args()
10
11
12# Use the input file to set the output file name
13infile = options.inFilename
14outfile = options.outFilename
15
16outfile = outfile.split(".root")[0]+"_"+options.tracking+".root"
17
18print('Input file: %s' % infile)
19print('Output file: %s' % outfile)
20
22
23p.run_mode = 1
24p.skip_events = options.skip_events
25p.max_events = options.nevents
26
27#p.max_events = 1000
28
29# Library containing processors
30p.add_library("libprocessors")
31
32
35
36recoana_kf = HpstrConf.Processor('vtxana_kf', 'VertexAnaProcessor')
37recoana_gbl = HpstrConf.Processor('vtxana_gbl', 'VertexAnaProcessor')
38
39
43recoana_kf.parameters["anaName"] = "vtxana_kf"
44recoana_kf.parameters["trkColl"] = "KalmanFullTracks"
45recoana_kf.parameters["vtxColl"] = "UnconstrainedV0Vertices_KF"
46recoana_kf.parameters["mcColl"] = "" # "MCParticle"
47recoana_kf.parameters["hitColl"] = "SiClustersOnTrack"
48recoana_kf.parameters["vtxSelectionjson"] = os.environ['HPSTR_BASE']+'/analysis/selections/customCuts.json'
49recoana_kf.parameters["histoCfg"] = os.environ['HPSTR_BASE']+"/analysis/plotconfigs/tracking/vtxAnalysis_2019.json"
50recoana_kf.parameters["beamE"] = base.beamE[str(options.year)]
51recoana_kf.parameters["isData"] = options.isData
52recoana_kf.parameters["debug"] = 0
53recoana_kf.parameters["makeFlatTuple"] = options.makeFlatTuple
54CalTimeOffset = -999.
55
56if (options.isData == 1):
57 CalTimeOffset = 56.
58 print("Running on data file: Setting CalTimeOffset %d" % CalTimeOffset)
59
60elif (options.isData == 0):
61 CalTimeOffset = 43.
62 print("Running on MC file: Setting CalTimeOffset %d" % CalTimeOffset)
63else:
64 print("Specify which type of ntuple you are running on: -t 1 [for Data] / -t 0 [for MC]")
65
66
67recoana_kf.parameters["CalTimeOffset"] = CalTimeOffset
68#Region definitions
69
70RegionPath = os.environ['HPSTR_BASE']+"/analysis/selections/"
71recoana_kf.parameters["regionDefinitions"] = [RegionPath+'L1CutPos.json', RegionPath+'tightUncVChi2.json']
72
73#RecoHitAna
74recoana_gbl.parameters = recoana_kf.parameters.copy()
75recoana_gbl.parameters["anaName"] = "vtxana_gbl"
76recoana_gbl.parameters["vtxColl"] = "UnconstrainedV0Vertices"
77recoana_gbl.parameters["hitColl"] = "RotatedHelicalOnTrackHits"
78recoana_gbl.parameters["trkColl"] = "GBLTracks"
79recoana_gbl.parameters["makeFlatTuple"] = options.makeFlatTuple
80
81#
82# RegionPath+'ESumCR.json',
83# RegionPath+'TightNoSharedL0.json',
84# RegionPath+'TightNoShared.json',
85
86# Sequence which the processors will run.
87#p.sequence = [recoana_kf,recoana_gbl]
88if (options.tracking == "KF"):
89 print("Run KalmanFullTracks analysis")
90 p.sequence = [recoana_kf]
91elif (options.tracking == "GBL"):
92 print("Run GBL analysis")
93 p.sequence = [recoana_gbl]
94else:
95 print("ERROR::Need to specify which tracks KF or GBL")
96 exit(1)
97
98p.input_files = infile
99p.output_files = [outfile]
100
101p.printProcess()
Process python class.
Definition HpstrConf.py:20
Processor python class.
Definition HpstrConf.py:4