FairShip
Loading...
Searching...
No Matches
ACTSReco Namespace Reference

Functions

def runTracking ()
 

Variables

os currentPath = os.path.dirname(__file__)
 
os sourcePath = os.path.abspath(os.path.join(currentPath, ".."))
 
ROOT fgeo = ROOT.TFile.Open(global_variables.geoFile)
 
load_from_root_file ShipGeo = load_from_root_file(fgeo, "ShipGeo")
 

Function Documentation

◆ runTracking()

def ACTSReco.runTracking ( )

Definition at line 33 of file ACTSReco.py.

33def runTracking():
34 customLogLevel = acts.examples.defaultLogging(logLevel=acts.logging.VERBOSE)
35 u = acts.UnitConstants
36
37 if global_variables.detector == "SiliconTarget":
38 field = acts.ConstantBField(acts.Vector3(0.0, 0.0, 0.0 * u.T))
39 simHitTree = "siHits"
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(),
46 )
47
48 if global_variables.detector == "MTC":
49 # MTC setup to be updated.
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(),
58 )
59
60 if global_variables.detector == "StrawTracker":
61 # Bfield x/y non-zero, offsets manually set to zero.
62 field = acts.examples.MagneticFieldMapXyz(
63 file=str(sourcePath + "/" + ShipGeo.Bfield.fieldMap),
64 tree="Data",
65 lengthUnit=u.cm,
66 BFieldUnit=u.T,
67 translateToGlobal=acts.Vector3(0, 0, ShipGeo.Bfield.z),
68 rotateAxis=True,
69 firstOctant=False,
70 )
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(),
78 )
79
80 trackingGeometry = detector.trackingGeometry()
81
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)
85
86 s.addReader(
87 acts.examples.RootParticleReader(
88 level=acts.logging.INFO,
89 filePath=str(global_variables.inputFile),
90 outputParticles="particles_generated",
91 treeName="particles",
92 )
93 )
94
95 s.addWhiteboardAlias("particles", "particles_generated")
96 s.addWhiteboardAlias("particles_simulated_selected", "particles_generated")
97
98 s.addReader(
99 acts.examples.RootSimHitReader(
100 level=acts.logging.INFO,
101 filePath=str(global_variables.inputFile),
102 outputSimHits="simhits",
103 treeName=simHitTree,
104 )
105 )
106
107 addDigitization(
108 s,
109 trackingGeometry,
110 field,
111 digiConfigFile=str(digiConfigFile),
112 rnd=rnd,
113 logLevel=acts.logging.INFO,
114 )
115
116 addDigiParticleSelection(
117 s,
118 ParticleSelectorConfig(
119 pt=(global_variables.minPt * u.GeV, None),
120 measurements=(global_variables.minHits, None),
121 removeNeutral=True,
122 removeSecondaries=True,
123 ),
124 )
125
126 if not global_variables.realPR:
127 addSeeding(
128 s,
129 trackingGeometry,
130 field,
131 rnd=rnd,
132 inputParticles="particles_generated",
133 seedingAlgorithm=SeedingAlgorithm.TruthSmeared,
134 particleHypothesis=acts.ParticleHypothesis.muon,
135 trackSmearingSigmas=TrackSmearingSigmas(
136 loc0=0,
137 loc0PtA=0,
138 loc0PtB=0,
139 loc1=0,
140 loc1PtA=0,
141 loc1PtB=0,
142 time=0,
143 phi=0,
144 theta=0,
145 ptRel=0,
146 ),
147 initialSigmas=[
148 1 * u.mm,
149 1 * u.mm,
150 1 * u.degree,
151 1 * u.degree,
152 0 / u.GeV,
153 1 * u.ns,
154 ],
155 initialSigmaQoverPt=0.1 / u.GeV,
156 initialSigmaPtRel=0.1,
157 initialVarInflation=[1e0, 1e0, 1e0, 1e0, 1e0, 1e0],
158 )
159
160 addKalmanTracks(
161 s,
162 trackingGeometry,
163 field,
164 )
165
166 s.addAlgorithm(
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,
173 ),
174 )
175 )
176
177 s.addWhiteboardAlias("tracks", "selected-tracks")
178
179 s.addWriter(
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",
186 writeCovMat=True,
187 )
188 )
189
190 if global_variables.vertexing:
191 s.addReader(
192 acts.examples.RootVertexReader(
193 level=acts.logging.INFO,
194 filePath=global_variables.inputFile,
195 outputVertices="vertices_truth",
196 treeName="vertices",
197 )
198 )
199
200 addVertexFitting(s, field, vertexFinder=VertexFinder.Truth, outputDirRoot=global_variables.outputDir)
201
202 if global_variables.DQM:
203 s.addWriter(
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",
212 )
213 )
214
215 s.addWriter(
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",
222 )
223 )
224
225 s.addWriter(
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",
232 writeCovMat=True,
233 )
234 )
235
236 s.run()

Variable Documentation

◆ currentPath

os ACTSReco.currentPath = os.path.dirname(__file__)

Definition at line 24 of file ACTSReco.py.

◆ fgeo

ROOT ACTSReco.fgeo = ROOT.TFile.Open(global_variables.geoFile)

Definition at line 26 of file ACTSReco.py.

◆ ShipGeo

load_from_root_file ACTSReco.ShipGeo = load_from_root_file(fgeo, "ShipGeo")

Definition at line 30 of file ACTSReco.py.

◆ sourcePath

os ACTSReco.sourcePath = os.path.abspath(os.path.join(currentPath, ".."))

Definition at line 25 of file ACTSReco.py.