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