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)
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'
89if(options.useBField):
90 track.parameters["bfield"] = bfield[str(options.year)]
91
92trackgbl.parameters["debug"] = 0
93trackgbl.parameters["useTrackerHits"] = 1
94trackgbl.parameters["trkCollLcio"] = 'GBLTracks'
95trackgbl.parameters["trkCollRoot"] = 'GBLTracks'
96trackgbl.parameters["kinkRelCollLcio"] = 'GBLKinkDataRelations'
97trackgbl.parameters["trkRelCollLcio"] = 'TrackDataRelations'
98trackgbl.parameters["trkhitCollRoot"] = 'RotatedHelicalOnTrackHits'
99trackgbl.parameters["hitFitsCollLcio"] = 'SVTFittedRawTrackerHits'
100trackgbl.parameters["rawhitCollRoot"] = ''#'SVTRawHitsOnTrack'
101if(options.useBField):
102 trackgbl.parameters["bfield"] = bfield[str(options.year)]
103
104# if (not options.isData):
105# trackgbl.parameters["truthTrackCollLcio"] = 'GBLTracksToTruthTrackRelations'
106# trackgbl.parameters["truthTrackCollRoot"] = 'Truth_GBLTracks'
107
108# ECalData
109ecal.parameters["debug"] = 0
110ecal.parameters["hitCollLcio"] = 'EcalCalHits'
111ecal.parameters["hitCollRoot"] = 'RecoEcalHits'
112ecal.parameters["clusCollLcio"] = "EcalClustersCorr"
113ecal.parameters["clusCollRoot"] = "RecoEcalClusters"
114
115# Vertex
116vtx.parameters["debug"] = 0
117vtx.parameters["useTrackerHits"] = 1
118vtx.parameters["vtxCollLcio"] = 'UnconstrainedV0Vertices_KF'
119vtx.parameters["vtxCollRoot"] = 'UnconstrainedV0Vertices_KF'
120vtx.parameters["partCollRoot"] = 'ParticlesOnUVertices_KF'
121vtx.parameters["kinkRelCollLcio"] = ''
122vtx.parameters["trkRelCollLcio"] = 'KFTrackDataRelations'
123
124cvtx.parameters["debug"] = 0
125cvtx.parameters["useTrackerHits"] = 1
126cvtx.parameters["vtxCollLcio"] = 'TargetConstrainedV0Vertices_KF'
127cvtx.parameters["vtxCollRoot"] = 'TargetConstrainedV0Vertices_KF'
128cvtx.parameters["partCollRoot"] = 'ParticlesOnCVertices_KF'
129cvtx.parameters["kinkRelCollLcio"] = ''
130cvtx.parameters["trkRelCollLcio"] = 'KFTrackDataRelations'
131
132
133vtxgbl.parameters["debug"] = 0
134vtxgbl.parameters["useTrackerHits"] = 1
135vtxgbl.parameters["vtxCollLcio"] = 'UnconstrainedV0Vertices'
136vtxgbl.parameters["vtxCollRoot"] = 'UnconstrainedV0Vertices'
137vtxgbl.parameters["partCollRoot"] = 'ParticlesOnUVertices'
138vtxgbl.parameters["kinkRelCollLcio"] = 'GBLKinkDataRelations'
139vtxgbl.parameters["trkRelCollLcio"] = 'TrackDataRelations'
140
141cvtxgbl.parameters["debug"] = 0
142cvtxgbl.parameters["useTrackerHits"] = 1
143cvtxgbl.parameters["vtxCollLcio"] = 'TargetConstrainedV0Vertices'
144cvtxgbl.parameters["vtxCollRoot"] = 'TargetConstrainedV0Vertices'
145cvtxgbl.parameters["partCollRoot"] = 'ParticlesOnCVertices'
146cvtxgbl.parameters["kinkRelCollLcio"] = 'GBLKinkDataRelations'
147cvtxgbl.parameters["trkRelCollLcio"] = 'TrackDataRelations'
148
149# MCParticle
150mcpart.parameters["debug"] = 0
151mcpart.parameters["mcPartCollLcio"] = 'MCParticle'
152mcpart.parameters["mcPartCollRoot"] = 'MCParticle'
153
154#FinalStateParticleProcessor
155fsp.parameters["debug"] = 0
156fsp.parameters["fspCollLcio"] = "FinalStateParticles_KF"
157fsp.parameters["fspCollRoot"] = "FinalStateParticles_KF"
158fsp.parameters["kinkRelCollLcio"] = ""
159fsp.parameters["trkRelCollLcio"] = "KFTrackDataRelations"
160
161if(options.rawHits==1):
162 fsp.parameters["trkhitCollRoot"] = "fspOnTrackHits"
163 fsp.parameters["rawhitCollRoot"] = "fspOnTrackRawHits"
164 fsp.parameters["hitFitsCollLcio"] = "SVTFittedRawTrackerHits"
165else:
166 fsp.parameters["trkhitCollRoot"] = "fspOnTrackHits"
167 fsp.parameters["rawhitCollRoot"] = ""
168 fsp.parameters["hitFitsCollLcio"] = ""
169
170# Sequence which the processors will run.
171if (options.tracking == "KF"):
172 print("KF")
173 sequence = [header, vtx, cvtx, ecal, track]
174 # Get KF svt truth hits
175 if (options.truthHits > 0):
176 sequence.append(svthits)
177elif (options.tracking == "GBL"):
178 print("GBL")
179 sequence = [header, vtxgbl, cvtxgbl, ecal, trackgbl]
180 # Get GBL svt truth hits
181 if (options.truthHits > 0):
182 sequence.append(svthitsgbl)
183elif (options.tracking == "BOTH"):
184 sequence = [header, vtxgbl, cvtxgbl, trackgbl, vtx, cvtx, ecal, track]
185 # Get KF and GBL svt truth hits
186 if (options.truthHits > 0):
187 sequence.append(svthits)
188 sequence.append(svthitsgbl)
189else:
190 print("ERROR::Need to specify which tracks KF, GBL, or BOTH")
191
192if options.isData == -1:
193 print("Please specficy if this is Data or not via option -t")
194if (not options.isData):
195 sequence.append(mcpart)
196sequence.append(fsp)
197
198p.sequence = sequence
199
200p.input_files = lcio_file
201p.output_files = [root_file]
202
203p.printProcess()
Process python class.
Definition HpstrConf.py:20
Processor python class.
Definition HpstrConf.py:4