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
kalSimpTuple_simps_2016_dev_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",
9 metavar="tracking", default="KF")
10base.parser.add_argument("-TS", "--trackstate", type=str, dest="trackstate",
11 help="Specify Track State | 'AtECal', 'AtTarget'. Default is origin ", metavar="trackstate", default="")
12base.parser.add_argument("-s", "--truthHits", type=int, dest="svtHits",
13 help="Get svt hits: 1=yes", metavar="svtHits", default=1)
14base.parser.add_argument("-r", "--rawHits", type=int, dest="rawHits",
15 help="Keep raw svt hits: 1=yes", metavar="rawHits", default=1)
16
17options = base.parser.parse_args()
18
19# Use the input file to set the output file name
20lcio_file = options.inFilename
21root_file = options.outFilename
22
23print('LCIO file: %s' % lcio_file)
24print('Root file: %s' % root_file)
25
27
28# p.max_events = 1000
29p.run_mode = 0
30p.skip_events = options.skip_events
31p.max_events = options.nevents
32
33# Library containing processors
34p.add_library("libprocessors")
35
36
39header = HpstrConf.Processor('header', 'EventProcessor')
40track = HpstrConf.Processor('track', 'TrackingProcessor')
41targtrack = HpstrConf.Processor('targtrack', 'TrackingProcessor')
42trackgbl = HpstrConf.Processor('trackgbl', 'TrackingProcessor')
43trackrefitgbl = HpstrConf.Processor('trackrefitgbl', 'TrackingProcessor')
44svthits = HpstrConf.Processor('svthitskf', 'Tracker2DHitProcessor')
45svthitsgbl = HpstrConf.Processor('svthitsgbl', 'Tracker3DHitProcessor')
46rawsvt = HpstrConf.Processor('rawsvt', 'SvtRawDataProcessor')
47ecal = HpstrConf.Processor('ecal', 'ECalDataProcessor')
48vtx = HpstrConf.Processor('vtx', 'VertexProcessor')
49cvtx = HpstrConf.Processor('cvtx', 'VertexProcessor')
50vtxgbl = HpstrConf.Processor('vtxgbl', 'VertexProcessor')
51cvtxgbl = HpstrConf.Processor('cvtxgbl', 'VertexProcessor')
52mcpart = HpstrConf.Processor('mcpart', 'MCParticleProcessor')
53
54
58header.parameters["debug"] = 0
59header.parameters["headCollRoot"] = "EventHeader"
60header.parameters["trigCollLcio"] = "TriggerBank"
61header.parameters["rfCollLcio"] = "RFHits"
62header.parameters["vtpCollLcio"] = "VTPBank"
63header.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# Tracker2DHits
74svthits.parameters["debug"] = 0
75svthits.parameters["hitCollLcio"] = 'StripClusterer_SiTrackerHitStrip1D'
76svthits.parameters["hitCollRoot"] = 'SiClusters'
77svthits.parameters["mcPartRelLcio"] = 'SVTTrueHitRelations'
78svthits.parameters["hitFitCollLcio"] = 'SVTFittedRawTrackerHits'
79
80# Tracker3DHits
81svthitsgbl.parameters["debug"] = 0
82svthitsgbl.parameters["hitCollLcio"] = 'RotatedHelicalTrackHits'
83svthitsgbl.parameters["hitCollRoot"] = 'RotatedHelicalTrackHits'
84svthitsgbl.parameters["mcPartRelLcio"] = 'RotatedHelicalTrackMCRelations'
85
86# Tracking
87track.parameters["debug"] = 0
88track.parameters["trkCollLcio"] = 'KalmanFullTracks'
89track.parameters["trkCollRoot"] = 'KalmanFullTracks%s'%(options.trackstate)
90track.parameters["trackStateLocation"] = options.trackstate
91track.parameters["kinkRelCollLcio"] = ''
92track.parameters["trkRelCollLcio"] = 'KFTrackDataRelations'
93track.parameters["trkhitCollRoot"] = 'SiClustersOnTrack'
94track.parameters["hitFitsCollLcio"] = 'SVTFittedRawTrackerHits'
95track.parameters["bfield"] = bfield[str(options.year)]
96track.parameters["rawhitCollRoot"] = 'SVTRawHitsOnTrack_KF'
97
98# Target Tracks
99targtrack.parameters["debug"] = 0
100targtrack.parameters["trkCollLcio"] = 'KalmanFullTracks'
101targtrack.parameters["trkCollRoot"] = 'KalmanFullTracksAtTarget'
102targtrack.parameters["trackStateLocation"] = 'AtTarget'
103targtrack.parameters["kinkRelCollLcio"] = ''
104targtrack.parameters["trkRelCollLcio"] = 'KFTrackDataRelations'
105targtrack.parameters["trkhitCollRoot"] = 'SiClustersOnTrack'
106targtrack.parameters["hitFitsCollLcio"] = 'SVTFittedRawTrackerHits'
107#targtrack.parameters["bfield"] = bfield[str(options.year)]
108targtrack.parameters["rawhitCollRoot"] = 'SVTRawHitsOnTrack_KF'
109
110# LT uncommented
111# if (not options.isData):
112# track.parameters["truthTrackCollLcio"] = 'KalmanFullTracksToTruthTrackRelations'
113# track.parameters["truthTrackCollRoot"] = 'Truth_KFTracks'
114
115# LT check if we need the b field or not -- version of HPS java
116# for Jess's files need to give it b-field
117
118
119trackgbl.parameters["debug"] = 0
120trackgbl.parameters["trkCollLcio"] = 'GBLTracks'
121trackgbl.parameters["trkCollRoot"] = 'GBLTracks'
122trackgbl.parameters["kinkRelCollLcio"] = 'GBLKinkDataRelations'
123trackgbl.parameters["trkRelCollLcio"] = 'TrackDataRelations'
124trackgbl.parameters["trkhitCollRoot"] = 'RotatedHelicalOnTrackHits'
125trackgbl.parameters["hitFitsCollLcio"] = 'SVTFittedRawTrackerHits'
126
127# Only for detail studies
128# LT uncomment
129trackgbl.parameters["rawhitCollRoot"] = 'SVTRawHitsOnTrack'
130
131# LT uncommented
132# if (not options.isData):
133# trackgbl.parameters["truthTrackCollLcio"] = 'GBLTracksToTruthTrackRelations'
134# trackgbl.parameters["truthTrackCollRoot"] = 'Truth_GBLTracks'
135
136# LT check if we need the b field or not -- version of HPS java
137trackgbl.parameters["bfield"] = bfield[str(options.year)]
138
139# ECalData
140ecal.parameters["debug"] = 0
141ecal.parameters["hitCollLcio"] = 'EcalCalHits'
142ecal.parameters["hitCollRoot"] = 'RecoEcalHits'
143ecal.parameters["clusCollLcio"] = "EcalClustersCorr"
144ecal.parameters["clusCollRoot"] = "RecoEcalClusters"
145
146# Vertex
147vtx.parameters["debug"] = 0
148vtx.parameters["vtxCollLcio"] = 'UnconstrainedV0Vertices_KF'
149vtx.parameters["vtxCollRoot"] = 'UnconstrainedV0Vertices_KF'
150vtx.parameters["partCollRoot"] = 'ParticlesOnUVertices_KF'
151vtx.parameters["kinkRelCollLcio"] = ''
152vtx.parameters["trkRelCollLcio"] = 'KFTrackDataRelations'
153vtx.parameters["trackStateLocation"] = options.trackstate
154
155cvtx.parameters["debug"] = 0
156cvtx.parameters["vtxCollLcio"] = 'TargetConstrainedV0Vertices_KF'
157cvtx.parameters["vtxCollRoot"] = 'TargetConstrainedV0Vertices_KF'
158cvtx.parameters["partCollRoot"] = 'ParticlesOnCVertices_KF'
159cvtx.parameters["kinkRelCollLcio"] = ''
160cvtx.parameters["trkRelCollLcio"] = 'KFTrackDataRelations'
161vtx.parameters["trackStateLocation"] = options.trackstate
162
163vtxgbl.parameters["debug"] = 0
164vtxgbl.parameters["vtxCollLcio"] = 'UnconstrainedV0Vertices'
165vtxgbl.parameters["vtxCollRoot"] = 'UnconstrainedV0Vertices'
166vtxgbl.parameters["partCollRoot"] = 'ParticlesOnUVertices'
167vtxgbl.parameters["kinkRelCollLcio"] = 'GBLKinkDataRelations'
168vtxgbl.parameters["trkRelCollLcio"] = 'TrackDataRelations'
169
170cvtxgbl.parameters["debug"] = 0
171cvtxgbl.parameters["vtxCollLcio"] = 'TargetConstrainedV0Vertices'
172cvtxgbl.parameters["vtxCollRoot"] = 'TargetConstrainedV0Vertices'
173cvtxgbl.parameters["partCollRoot"] = 'ParticlesOnCVertices'
174cvtxgbl.parameters["kinkRelCollLcio"] = 'GBLKinkDataRelations'
175cvtxgbl.parameters["trkRelCollLcio"] = 'TrackDataRelations'
176
177# MCParticle
178mcpart.parameters["debug"] = 0
179mcpart.parameters["mcPartCollLcio"] = 'MCParticle'
180mcpart.parameters["mcPartCollRoot"] = 'MCParticle'
181
182if (options.tracking == "KF"):
183 sequence = [header, vtx, ecal, track, targtrack]
184 # Get KF svt truth hits
185 if (options.svtHits > 0):
186 sequence.append(svthits)
187elif (options.tracking == "GBL"):
188 sequence = [header, vtxgbl, ecal, trackgbl]
189 # Get GBL svt truth hits
190 if (options.truthHits > 0):
191 sequence.append(svthitsgbl)
192elif (options.tracking == "BOTH"):
193 sequence = [header, vtxgbl, trackgbl, vtx, ecal, track]
194 # Get KF and GBL svt truth hits
195 if (options.svtHits > 0):
196 sequence.append(svthits)
197 sequence.append(svthitsgbl)
198else:
199 print("ERROR::Need to specify which tracks KF, GBL, or BOTH")
200
201# Keep svt raw hits
202if (options.rawHits > 0):
203 sequence.append(rawsvt)
204# If MC, get MCParticles
205if (not options.isData):
206 sequence.append(mcpart)
207
208p.sequence = sequence
209
210p.input_files = lcio_file
211p.output_files = [root_file]
212
213p.printProcess()
Process python class.
Definition HpstrConf.py:20
Processor python class.
Definition HpstrConf.py:4