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
recoTuple_cfg.py
Go to the documentation of this file.
1import HpstrConf
2import sys
3
4import baseConfig as base
5from baseConfig import bfield
6
7base.parser.add_argument("-w", "--tracking", type=str, dest="tracking",
8 help="Which tracking to use to make plots", metavar="tracking", default="KF")
9base.parser.add_argument("-sh", "--truthHits", type=int, dest="truthHits",
10 help="Get svt truth hits: 1=yes", metavar="truthHits", default=0)
11base.parser.add_argument("-r", "--rawHits", type=int, dest="rawHits",
12 help="Keep raw svt hits: 1=yes", metavar="rawHits", default=0)
13
14options = base.parser.parse_args()
15
16# Use the input file to set the output file name
17lcio_file = options.inFilename
18root_file = options.outFilename
19
20print('LCIO file: %s' % lcio_file)
21print('Root file: %s' % root_file)
22
24
25# p.max_events = 1000
26p.run_mode = 0
27p.skip_events = options.skip_events
28p.max_events = options.nevents
29
30# Library containing processors
31p.add_library("libprocessors")
32
33
36header = HpstrConf.Processor('header', 'EventProcessor')
37track = HpstrConf.Processor('track', 'TrackingProcessor')
38trackgbl = HpstrConf.Processor('trackgbl', 'TrackingProcessor')
39svthits = HpstrConf.Processor('svthitskf', 'Tracker2DHitProcessor')
40svthitsgbl = HpstrConf.Processor('svthitsgbl', 'Tracker3DHitProcessor')
41rawsvt = HpstrConf.Processor('rawsvt', 'SvtRawDataProcessor')
42ecal = HpstrConf.Processor('ecal', 'ECalDataProcessor')
43vtx = HpstrConf.Processor('vtx', 'VertexProcessor')
44cvtx = HpstrConf.Processor('cvtx', 'VertexProcessor')
45vtxgbl = HpstrConf.Processor('vtxgbl', 'VertexProcessor')
46cvtxgbl = HpstrConf.Processor('cvtxgbl', 'VertexProcessor')
47mcpart = HpstrConf.Processor('mcpart', 'MCParticleProcessor')
48fsp = HpstrConf.Processor('fps', 'FinalStateParticleProcessor')
49
50
54header.parameters["debug"] = 0
55header.parameters["headCollRoot"] = "EventHeader"
56header.parameters["trigCollLcio"] = "TriggerBank"
57header.parameters["rfCollLcio"] = "RFHits"
58#header.parameters["vtpCollLcio"] = "VTPBank"
59#header.parameters["vtpCollRoot"] = "VTPBank"
60header.parameters["tsCollLcio"] = "TSBank"
61header.parameters["tsCollRoot"] = "TSBank"
62
63# SvtRawData
64rawsvt.parameters["debug"] = 0
65rawsvt.parameters["hitCollLcio"] = 'SVTRawTrackerHits'
66rawsvt.parameters["hitfitCollLcio"] = 'SVTFittedRawTrackerHits'
67rawsvt.parameters["hitCollRoot"] = 'SVTRawTrackerHits'
68
69# Tracker3DHits
70svthits.parameters["debug"] = 0
71svthits.parameters["hitCollLcio"] = 'RotatedHelicalTrackHits'
72svthits.parameters["hitCollRoot"] = 'RotatedHelicalTrackHits'
73
74
75# Tracking
76track.parameters["debug"] = 0
77track.parameters["useTrackerHits"] = 1
78track.parameters["trkCollLcio"] = 'KalmanFullTracks'
79track.parameters["trkCollRoot"] = 'KalmanFullTracks'
80track.parameters["kinkRelCollLcio"] = ''
81track.parameters["trkRelCollLcio"] = 'KFTrackDataRelations'
82track.parameters["trkhitCollRoot"] = 'SiClustersOnTrack'
83track.parameters["hitFitsCollLcio"] = 'SVTFittedRawTrackerHits'
84track.parameters["rawhitCollRoot"] = 'SVTRawHitsOnTrack_KF'
85track.parameters["bfield"] = bfield[str(options.year)]
86
87trackgbl.parameters["debug"] = 0
88trackgbl.parameters["useTrackerHits"] = 1
89trackgbl.parameters["trkCollLcio"] = 'GBLTracks'
90trackgbl.parameters["trkCollRoot"] = 'GBLTracks'
91trackgbl.parameters["kinkRelCollLcio"] = 'GBLKinkDataRelations'
92trackgbl.parameters["trkRelCollLcio"] = 'TrackDataRelations'
93trackgbl.parameters["trkhitCollRoot"] = 'RotatedHelicalOnTrackHits'
94trackgbl.parameters["hitFitsCollLcio"] = 'SVTFittedRawTrackerHits'
95trackgbl.parameters["rawhitCollRoot"] = ''#'SVTRawHitsOnTrack'
96trackgbl.parameters["bfield"] = bfield[str(options.year)]
97
98# if (not options.isData):
99# trackgbl.parameters["truthTrackCollLcio"] = 'GBLTracksToTruthTrackRelations'
100# trackgbl.parameters["truthTrackCollRoot"] = 'Truth_GBLTracks'
101
102# ECalData
103ecal.parameters["debug"] = 0
104ecal.parameters["hitCollLcio"] = 'EcalCalHits'
105ecal.parameters["hitCollRoot"] = 'RecoEcalHits'
106ecal.parameters["clusCollLcio"] = "EcalClustersCorr"
107ecal.parameters["clusCollRoot"] = "RecoEcalClusters"
108
109# Vertex
110vtx.parameters["debug"] = 0
111vtx.parameters["useTrackerHits"] = 1
112vtx.parameters["vtxCollLcio"] = 'UnconstrainedV0Vertices_KF'
113vtx.parameters["vtxCollRoot"] = 'UnconstrainedV0Vertices_KF'
114vtx.parameters["partCollRoot"] = 'ParticlesOnUVertices_KF'
115vtx.parameters["kinkRelCollLcio"] = ''
116vtx.parameters["trkRelCollLcio"] = 'KFTrackDataRelations'
117
118cvtx.parameters["debug"] = 0
119cvtx.parameters["useTrackerHits"] = 1
120cvtx.parameters["vtxCollLcio"] = 'TargetConstrainedV0Vertices_KF'
121cvtx.parameters["vtxCollRoot"] = 'TargetConstrainedV0Vertices_KF'
122cvtx.parameters["partCollRoot"] = 'ParticlesOnCVertices_KF'
123cvtx.parameters["kinkRelCollLcio"] = ''
124cvtx.parameters["trkRelCollLcio"] = 'KFTrackDataRelations'
125
126
127vtxgbl.parameters["debug"] = 0
128vtxgbl.parameters["useTrackerHits"] = 1
129vtxgbl.parameters["vtxCollLcio"] = 'UnconstrainedV0Vertices'
130vtxgbl.parameters["vtxCollRoot"] = 'UnconstrainedV0Vertices'
131vtxgbl.parameters["partCollRoot"] = 'ParticlesOnUVertices'
132vtxgbl.parameters["kinkRelCollLcio"] = 'GBLKinkDataRelations'
133vtxgbl.parameters["trkRelCollLcio"] = 'TrackDataRelations'
134
135cvtxgbl.parameters["debug"] = 0
136cvtxgbl.parameters["useTrackerHits"] = 1
137cvtxgbl.parameters["vtxCollLcio"] = 'TargetConstrainedV0Vertices'
138cvtxgbl.parameters["vtxCollRoot"] = 'TargetConstrainedV0Vertices'
139cvtxgbl.parameters["partCollRoot"] = 'ParticlesOnCVertices'
140cvtxgbl.parameters["kinkRelCollLcio"] = 'GBLKinkDataRelations'
141cvtxgbl.parameters["trkRelCollLcio"] = 'TrackDataRelations'
142
143# MCParticle
144mcpart.parameters["debug"] = 0
145mcpart.parameters["mcPartCollLcio"] = 'MCParticle'
146mcpart.parameters["mcPartCollRoot"] = 'MCParticle'
147
148#FinalStateParticleProcessor
149fsp.parameters["debug"] = 0
150fsp.parameters["fspCollLcio"] = "FinalStateParticles_KF"
151fsp.parameters["fspCollRoot"] = "FinalStateParticles_KF"
152fsp.parameters["kinkRelCollLcio"] = ""
153fsp.parameters["trkRelCollLcio"] = "KFTrackDataRelations"
154
155if(options.rawHits==1):
156 fsp.parameters["trkhitCollRoot"] = "fspOnTrackHits"
157 fsp.parameters["rawhitCollRoot"] = "fspOnTrackRawHits"
158 fsp.parameters["hitFitsCollLcio"] = "SVTFittedRawTrackerHits"
159else:
160 fsp.parameters["trkhitCollRoot"] = "fspOnTrackHits"
161 fsp.parameters["rawhitCollRoot"] = ""
162 fsp.parameters["hitFitsCollLcio"] = ""
163
164# Sequence which the processors will run.
165if (options.tracking == "KF"):
166 print("KF")
167 sequence = [header, vtx, cvtx, ecal, track]
168 # Get KF svt truth hits
169 if (options.truthHits > 0):
170 sequence.append(svthits)
171elif (options.tracking == "GBL"):
172 print("GBL")
173 sequence = [header, vtxgbl, cvtxgbl, ecal, trackgbl]
174 # Get GBL svt truth hits
175 if (options.truthHits > 0):
176 sequence.append(svthitsgbl)
177elif (options.tracking == "BOTH"):
178 sequence = [header, vtxgbl, cvtxgbl, trackgbl, vtx, cvtx, ecal, track]
179 # Get KF and GBL svt truth hits
180 if (options.truthHits > 0):
181 sequence.append(svthits)
182 sequence.append(svthitsgbl)
183else:
184 print("ERROR::Need to specify which tracks KF, GBL, or BOTH")
185
186if options.isData == -1:
187 print("Please specficy if this is Data or not via option -t")
188if (not options.isData):
189 sequence.append(mcpart)
190sequence.append(fsp)
191
192p.sequence = sequence
193
194p.input_files = lcio_file
195p.output_files = [root_file]
196
197p.printProcess()
Process python class.
Definition HpstrConf.py:20
Processor python class.
Definition HpstrConf.py:4