10from acts.examples.reconstruction
import (
18from acts.examples.simulation
import (
19 ParticleSelectorConfig,
20 addDigiParticleSelection,
24currentPath = os.path.dirname(__file__)
25sourcePath = os.path.abspath(os.path.join(currentPath,
".."))
26fgeo = ROOT.TFile.Open(global_variables.geoFile)
28from ShipGeoConfig
import load_from_root_file
30ShipGeo = load_from_root_file(fgeo,
"ShipGeo")
34 customLogLevel = acts.examples.defaultLogging(logLevel=acts.logging.VERBOSE)
35 u = acts.UnitConstants
37 if global_variables.detector ==
"SiliconTarget":
38 field = acts.ConstantBField(acts.Vector3(0.0, 0.0, 0.0 * u.T))
40 digiConfigFile = currentPath +
"/SiliconTarget-digi-config.json"
41 detector = acts.examples.SiTargetBuilder(
42 fileName=str(global_variables.geoFile),
43 surfaceLogLevel=customLogLevel(),
44 layerLogLevel=customLogLevel(),
45 volumeLogLevel=customLogLevel(),
48 if global_variables.detector ==
"MTC":
50 field = acts.ConstantBField(acts.Vector3(0.0, -1.2, 0.0 * u.T))
51 simHitTree =
"mtcHits"
52 digiConfigFile = currentPath +
"/MTC-digi-config.json"
53 detector = acts.examples.MTCBuilder(
54 fileName=str(global_variables.geoFile),
55 surfaceLogLevel=customLogLevel(),
56 layerLogLevel=customLogLevel(),
57 volumeLogLevel=customLogLevel(),
60 if global_variables.detector ==
"StrawTracker":
62 field = acts.examples.MagneticFieldMapXyz(
63 file=str(sourcePath +
"/" + ShipGeo.Bfield.fieldMap),
67 translateToGlobal=acts.Vector3(0, 0, ShipGeo.Bfield.z),
71 simHitTree =
"strawHits"
72 digiConfigFile = currentPath +
"/StrawTracker-digi-config.json"
73 detector = acts.examples.StrawtubeBuilder(
74 fileName=str(global_variables.geoFile),
75 surfaceLogLevel=customLogLevel(),
76 layerLogLevel=customLogLevel(),
77 volumeLogLevel=customLogLevel(),
80 trackingGeometry = detector.trackingGeometry()
82 s = acts.examples.Sequencer(events=global_variables.nEvents, numThreads=-1, trackFpes=
False)
83 s.config.logLevel = acts.logging.INFO
84 rnd = acts.examples.RandomNumbers(seed=42)
87 acts.examples.RootParticleReader(
88 level=acts.logging.INFO,
89 filePath=str(global_variables.inputFile),
90 outputParticles=
"particles_generated",
95 s.addWhiteboardAlias(
"particles",
"particles_generated")
96 s.addWhiteboardAlias(
"particles_simulated_selected",
"particles_generated")
99 acts.examples.RootSimHitReader(
100 level=acts.logging.INFO,
101 filePath=str(global_variables.inputFile),
102 outputSimHits=
"simhits",
111 digiConfigFile=str(digiConfigFile),
113 logLevel=acts.logging.INFO,
116 addDigiParticleSelection(
118 ParticleSelectorConfig(
119 pt=(global_variables.minPt * u.GeV,
None),
120 measurements=(global_variables.minHits,
None),
122 removeSecondaries=
True,
126 if not global_variables.realPR:
132 inputParticles=
"particles_generated",
133 seedingAlgorithm=SeedingAlgorithm.TruthSmeared,
134 particleHypothesis=acts.ParticleHypothesis.muon,
135 trackSmearingSigmas=TrackSmearingSigmas(
155 initialSigmaQoverPt=0.1 / u.GeV,
156 initialSigmaPtRel=0.1,
157 initialVarInflation=[1e0, 1e0, 1e0, 1e0, 1e0, 1e0],
167 acts.examples.TrackSelectorAlgorithm(
168 level=acts.logging.INFO,
169 inputTracks=
"tracks",
170 outputTracks=
"selected-tracks",
171 selectorConfig=acts.TrackSelector.Config(
172 minMeasurements=global_variables.minHits,
177 s.addWhiteboardAlias(
"tracks",
"selected-tracks")
180 acts.examples.SHiPTrackWriter(
181 level=acts.logging.INFO,
182 inputTracks=
"tracks",
183 inputParticles=
"particles_selected",
184 inputTrackParticleMatching=
"track_particle_matching",
185 filePath=str(global_variables.outputDir) +
"/recoTracks.root",
190 if global_variables.vertexing:
192 acts.examples.RootVertexReader(
193 level=acts.logging.INFO,
194 filePath=global_variables.inputFile,
195 outputVertices=
"vertices_truth",
200 addVertexFitting(s, field, vertexFinder=VertexFinder.Truth, outputDirRoot=global_variables.outputDir)
202 if global_variables.DQM:
204 acts.examples.RootTrackStatesWriter(
205 level=acts.logging.INFO,
206 inputTracks=
"tracks",
207 inputParticles=
"particles_selected",
208 inputTrackParticleMatching=
"track_particle_matching",
209 inputSimHits=
"simhits",
210 inputMeasurementSimHitsMap=
"measurement_simhits_map",
211 filePath=str(global_variables.outputDir) +
"/trackstates_kf.root",
216 acts.examples.TrackFitterPerformanceWriter(
217 level=acts.logging.INFO,
218 inputTracks=
"tracks",
219 inputParticles=
"particles_selected",
220 inputTrackParticleMatching=
"track_particle_matching",
221 filePath=str(global_variables.outputDir) +
"/performance_kf.root",
226 acts.examples.RootTrackSummaryWriter(
227 level=acts.logging.INFO,
228 inputTracks=
"tracks",
229 inputParticles=
"particles_selected",
230 inputTrackParticleMatching=
"track_particle_matching",
231 filePath=str(global_variables.outputDir) +
"/tracksummary_kf.root",