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