35 Runs all steps of track pattern recognition.
39 Path to an input .root file with events.
41 Path to a file with SHiP geometry.
43 Path to an output .root file with quality plots.
45 Name of a track pattern recognition method.
51 if method !=
"Baseline":
53 f
"Warning: pattern-recognition method '{method}' has no effect here; "
54 "this script only produces quality plots from existing reconstruction."
61 fgeo = ROOT.TFile(geo_file)
63 print(
"An error with opening the ship geo file.")
66 sGeo = fgeo.Get(
"FAIRGeom")
69 if not fgeo.FindKey(
"ShipGeo"):
75 ShipGeo = load_from_root_file(fgeo,
"ShipGeo")
78 global_variables.ShipGeo = ShipGeo
82 run = ROOT.FairRunSim()
83 run.SetName(
"TGeant4")
88 sink = ROOT.FairRootFileSink(tempfile.mktemp(suffix=
".root"))
90 ROOT.SetOwnership(sink,
False)
91 run.SetUserConfig(
"g4Config_basic.C")
104 if hasattr(ShipGeo.Bfield,
"fieldMap"):
107 print(
"no fieldmap given, geofile too old, not anymore support")
109 sGeo = fgeo.Get(
"FAIRGeom")
110 geoMat = ROOT.genfit.TGeoMaterialInterface()
111 ROOT.genfit.MaterialEffects.getInstance().init(geoMat)
112 bfield = ROOT.genfit.FairShipFields()
113 bfield.setField(fieldMaker.getGlobalField())
114 fM = ROOT.genfit.FieldManager.getInstance()
124 fn = ROOT.TFile(input_file,
"read")
126 print(
"An error with opening the input data file.")
129 sTree = fn.Get(
"cbmsim")
139 metrics: dict[str, Any] = {
141 "reconstructible": 0,
143 "passed_stereo12": 0,
146 "passed_stereo34": 0,
148 "passed_combined": 0,
150 "reco_passed_no_clones": 0,
170 nEvents = sTree.GetEntries()
172 for iEvent
in range(nEvents):
173 if iEvent % 1000 == 0:
174 print(
"Event ", iEvent)
178 sTree.GetEvent(iEvent)
184 metrics[
"reconstructible"] += len(reconstructible_tracks)
185 for i_reco
in reconstructible_tracks:
186 h[
"TracksPassed"].Fill(
"Reconstructible tracks", 1)
187 h[
"TracksPassedU"].Fill(
"Reconstructible tracks", 1)
198 n_tracks = len(reconstructible_tracks)
208 nTracklets = len(sTree.Tracklets)
210 for i_track
in range(nTracklets):
211 atracklet = sTree.Tracklets[i_track]
213 if atracklet.getType() != 1:
216 atrack = atracklet.getList()
235 ahit = sTree.strawtubesPoint[ihit]
236 hits[
"X"] += [ahit.GetX()]
237 hits[
"Y"] += [ahit.GetY()]
238 hits[
"Z"] += [ahit.GetZ()]
239 hits[
"DetID"] += [ahit.GetDetectorID()]
240 hits[
"TrackID"] += [ahit.GetTrackID()]
241 hits[
"Pz"] += [ahit.GetPz()]
242 hits[
"Px"] += [ahit.GetPx()]
243 hits[
"Py"] += [ahit.GetPy()]
244 hits[
"dist2Wire"] += [ahit.dist2Wire()]
245 hits[
"Pdg"] += [ahit.PdgCode()]
248 hits = {key: numpy.array(values)
for key, values
in hits.items()}
251 decode = global_variables.modules[
"strawtubes"].StrawDecode(hits[
"DetID"])
253 is_stereo = (decode[1] == 1) + (decode[1] == 2)
254 is_y = (decode[1] == 0) + (decode[1] == 3)
255 is_before = (decode[0] == 1) + (decode[0] == 2)
256 is_after = (decode[0] == 3) + (decode[0] == 4)
259 metrics[
"n_hits"] += [
get_n_hits(hits[
"TrackID"])]
262 frac_y12, tmax_y12 =
fracMCsame(hits[
"TrackID"][is_before * is_y])
263 n_hits_y12 =
get_n_hits(hits[
"TrackID"][is_before * is_y])
264 frac_stereo12, tmax_stereo12 =
fracMCsame(hits[
"TrackID"][is_before * is_stereo])
265 n_hits_stereo12 =
get_n_hits(hits[
"TrackID"][is_before * is_stereo])
266 frac_12, tmax_12 =
fracMCsame(hits[
"TrackID"][is_before])
267 n_hits_12 =
get_n_hits(hits[
"TrackID"][is_before])
269 frac_y34, tmax_y34 =
fracMCsame(hits[
"TrackID"][is_after * is_y])
270 n_hits_y34 =
get_n_hits(hits[
"TrackID"][is_after * is_y])
271 frac_stereo34, tmax_stereo34 =
fracMCsame(hits[
"TrackID"][is_after * is_stereo])
272 n_hits_stereo34 =
get_n_hits(hits[
"TrackID"][is_after * is_stereo])
273 frac_34, tmax_34 =
fracMCsame(hits[
"TrackID"][is_after])
274 n_hits_34 =
get_n_hits(hits[
"TrackID"][is_after])
275 frac_tot, tmax_tot =
fracMCsame(hits[
"TrackID"])
278 if tmax_y12 == tmax_stereo12
and tmax_y12 == tmax_y34
and tmax_y12 == tmax_stereo34:
281 and frac_stereo12 >= min_eff
282 and frac_y34 >= min_eff
283 and frac_stereo34 >= min_eff
285 if tmax_y12
in reconstructible_tracks
and tmax_y12
not in found_track_ids:
287 found_track_ids.append(tmax_y12)
288 elif tmax_y12
in reconstructible_tracks
and tmax_y12
in found_track_ids:
290 elif tmax_y12
not in reconstructible_tracks:
300 if tmax_y12
in reconstructible_tracks:
301 metrics[
"passed_y12"] += 1
302 metrics[
"frac_y12"] += [frac_y12]
303 h[
"TracksPassed"].Fill(
"Y view station 1&2", 1)
304 if tmax_y12
not in in_y12:
305 h[
"TracksPassedU"].Fill(
"Y view station 1&2", 1)
306 in_y12.append(tmax_y12)
308 if tmax_stereo12 == tmax_y12:
309 metrics[
"passed_stereo12"] += 1
310 metrics[
"frac_stereo12"] += [frac_stereo12]
311 h[
"TracksPassed"].Fill(
"Stereo station 1&2", 1)
312 if tmax_stereo12
not in in_stereo12:
313 h[
"TracksPassedU"].Fill(
"Stereo station 1&2", 1)
314 in_stereo12.append(tmax_stereo12)
316 if tmax_12 == tmax_y12:
317 metrics[
"passed_12"] += 1
318 metrics[
"frac_12"] += [frac_12]
319 h[
"TracksPassed"].Fill(
"station 1&2", 1)
320 if tmax_12
not in in_12:
321 h[
"TracksPassedU"].Fill(
"station 1&2", 1)
322 in_12.append(tmax_12)
324 if tmax_y34
in reconstructible_tracks:
325 metrics[
"passed_y34"] += 1
326 metrics[
"frac_y34"] += [frac_y34]
327 h[
"TracksPassed"].Fill(
"Y view station 3&4", 1)
328 if tmax_y34
not in in_y34:
329 h[
"TracksPassedU"].Fill(
"Y view station 3&4", 1)
330 in_y34.append(tmax_y34)
332 if tmax_stereo34 == tmax_y34:
333 metrics[
"passed_stereo34"] += 1
334 metrics[
"frac_stereo34"] += [frac_stereo34]
335 h[
"TracksPassed"].Fill(
"Stereo station 3&4", 1)
336 if tmax_stereo34
not in in_stereo34:
337 h[
"TracksPassedU"].Fill(
"Stereo station 3&4", 1)
338 in_stereo34.append(tmax_stereo34)
340 if tmax_34 == tmax_y34:
341 metrics[
"passed_34"] += 1
342 metrics[
"frac_34"] += [frac_34]
343 h[
"TracksPassed"].Fill(
"station 3&4", 1)
344 if tmax_34
not in in_34:
345 h[
"TracksPassedU"].Fill(
"station 3&4", 1)
346 in_34.append(tmax_34)
348 if tmax_12 == tmax_34:
349 metrics[
"passed_combined"] += 1
350 h[
"TracksPassed"].Fill(
"Combined stations 1&2/3&4", 1)
351 metrics[
"reco_passed"] += 1
353 if tmax_34
not in in_combo:
354 h[
"TracksPassedU"].Fill(
"Combined stations 1&2/3&4", 1)
355 metrics[
"reco_passed_no_clones"] += 1
356 in_combo.append(tmax_34)
359 if is_reconstructed == 0:
362 metrics[
"reco_frac_tot"] += [frac_tot]
366 pt = math.sqrt(px**2 + py**2)
371 for ahit
in sTree.strawtubesPoint:
372 if ahit.GetTrackID() == tmax_tot:
373 az, ax, ay = ahit.GetZ(), ahit.GetX(), ahit.GetY()
378 metrics[
"reco_mc_p"] += [p]
379 h[
"TracksPassed_p"].Fill(p, 1)
382 Z = hits[
"Z"][(hits[
"TrackID"] == tmax_tot) * is_before]
383 X = hits[
"X"][(hits[
"TrackID"] == tmax_tot) * is_before]
384 Y = hits[
"Y"][(hits[
"TrackID"] == tmax_tot) * is_before]
388 R = numpy.sqrt(X**2 + Y**2 + Z**2)
389 Theta = numpy.arccos(Z[1:] / R[1:])
390 theta = numpy.mean(Theta)
392 metrics[
"reco_mc_theta"] += [theta]
394 h[
"n_hits_reco_y12"].Fill(n_hits_y12)
395 h[
"n_hits_reco_stereo12"].Fill(n_hits_stereo12)
396 h[
"n_hits_reco_12"].Fill(n_hits_12)
397 h[
"n_hits_reco_y34"].Fill(n_hits_y34)
398 h[
"n_hits_reco_stereo34"].Fill(n_hits_stereo34)
399 h[
"n_hits_reco_34"].Fill(n_hits_34)
400 h[
"n_hits_reco"].Fill(n_hits_tot)
402 h[
"n_hits_y12"].Fill(p, n_hits_y12)
403 h[
"n_hits_stereo12"].Fill(p, n_hits_stereo12)
404 h[
"n_hits_12"].Fill(p, n_hits_12)
405 h[
"n_hits_y34"].Fill(p, n_hits_y34)
406 h[
"n_hits_stereo34"].Fill(p, n_hits_stereo34)
407 h[
"n_hits_34"].Fill(p, n_hits_34)
408 h[
"n_hits_total"].Fill(p, n_hits_tot)
410 h[
"frac_y12"].Fill(p, frac_y12)
411 h[
"frac_stereo12"].Fill(p, frac_stereo12)
412 h[
"frac_12"].Fill(p, frac_12)
413 h[
"frac_y34"].Fill(p, frac_y34)
414 h[
"frac_stereo34"].Fill(p, frac_stereo34)
415 h[
"frac_34"].Fill(p, frac_34)
416 h[
"frac_total"].Fill(p, frac_tot)
418 h[
"frac_y12_dist"].Fill(frac_y12)
419 h[
"frac_stereo12_dist"].Fill(frac_stereo12)
420 h[
"frac_12_dist"].Fill(frac_12)
421 h[
"frac_y34_dist"].Fill(frac_y34)
422 h[
"frac_stereo34_dist"].Fill(frac_stereo34)
423 h[
"frac_34_dist"].Fill(frac_34)
424 h[
"frac_total_dist"].Fill(frac_tot)
428 thetrack = sTree.FitTracks[i_track]
430 fitStatus = thetrack.getFitStatus()
432 nmeas = fitStatus.getNdf()
433 pval = fitStatus.getPVal()
434 chi2 = fitStatus.getChi2() / nmeas
436 metrics[
"fitted_pval"] += [pval]
437 metrics[
"fitted_chi"] += [chi2]
439 h[
"chi2fittedtracks"].Fill(chi2)
440 h[
"pvalfittedtracks"].Fill(pval)
443 fittedState = thetrack.getFittedState()
444 fittedMom = fittedState.getMomMag()
445 fittedMom = fittedMom
447 px_fit, py_fit, pz_fit = fittedState.getMom().x(), fittedState.getMom().y(), fittedState.getMom().z()
449 pt_fit = math.sqrt(px_fit**2 + py_fit**2)
451 metrics[
"fitted_p"] += [p_fit]
452 perr = (p - p_fit) / p
453 h[
"ptrue-p/ptrue"].Fill(perr)
454 h[
"perr"].Fill(p, perr)
455 h[
"perr_direction"].Fill(numpy.rad2deg(theta), perr)
457 pterr = (pt - pt_fit) / pt
458 h[
"pttrue-pt/pttrue"].Fill(pterr)
460 pxerr = (px - px_fit) / px
461 h[
"pxtrue-px/pxtrue"].Fill(pxerr)
463 pyerr = (py - py_fit) / py
464 h[
"pytrue-py/pytrue"].Fill(pyerr)
466 pzerr = (pz - pz_fit) / pz
467 h[
"pztrue-pz/pztrue"].Fill(pzerr)
469 if math.fabs(p) > 0.0:
470 h[
"pvspfitted"].Fill(p, fittedMom)
471 fittedtrackDir = fittedState.getDir()
472 fittedx = math.degrees(math.acos(fittedtrackDir[0]))
473 fittedy = math.degrees(math.acos(fittedtrackDir[1]))
474 fittedz = math.degrees(math.acos(fittedtrackDir[2]))
475 fittedmass = fittedState.getMass()
476 h[
"momentumfittedtracks"].Fill(fittedMom)
477 h[
"xdirectionfittedtracks"].Fill(fittedx)
478 h[
"ydirectionfittedtracks"].Fill(fittedy)
479 h[
"zdirectionfittedtracks"].Fill(fittedz)
480 h[
"massfittedtracks"].Fill(fittedmass)
482 metrics[
"fitted_x"] += [fittedx]
483 metrics[
"fitted_y"] += [fittedy]
484 metrics[
"fitted_z"] += [fittedz]
485 metrics[
"fitted_mass"] += [fittedmass]
492 for az, ax_true, ay_true
in zip(Z_true, X_true, Y_true):
496 Z_fit.append(pos.Z())
497 X_fit.append(pos.X())
498 Y_fit.append(pos.Y())
499 X_true_matched.append(ax_true)
500 Y_true_matched.append(ay_true)
502 for i
in range(len(Z_fit)):
503 xerr = abs(X_fit[i] - X_true_matched[i])
504 yerr = abs(Y_fit[i] - Y_true_matched[i])
505 h[
"abs(x - x-true)"].Fill(xerr)
506 h[
"abs(y - y-true)"].Fill(yerr)
509 rmse_x = numpy.sqrt(numpy.mean((numpy.array(X_fit) - numpy.array(X_true_matched)) ** 2))
510 rmse_y = numpy.sqrt(numpy.mean((numpy.array(Y_fit) - numpy.array(Y_true_matched)) ** 2))
511 h[
"rmse_x"].Fill(rmse_x)
512 h[
"rmse_y"].Fill(rmse_y)
514 except ROOT.genfit.Exception
as e:
519 print(f
"Problem with fitted state: {e!r}")
521 h[
"Reco_tracks"].Fill(
"N total", n_tracks)
522 h[
"Reco_tracks"].Fill(
"N recognized tracks", n_recognized)
523 h[
"Reco_tracks"].Fill(
"N clones", n_clones)
524 h[
"Reco_tracks"].Fill(
"N ghosts", n_ghosts)
525 h[
"Reco_tracks"].Fill(
"N others", n_others)
540 rc, pos, mom =
False,
None,
None
541 parallelToZ = ROOT.TVector3(0.0, 0.0, 1.0)
542 fst = fT.getFitStatus()
543 if fst.isFitConverged():
545 if fT.getPoint(0).getFitterInfo()
and fT.getPoint(1).getFitterInfo():
546 fstate0, fstate1 = fT.getFittedState(0), fT.getFittedState(1)
547 fPos0, fPos1 = fstate0.getPos(), fstate1.getPos()
548 if abs(z - fPos0.z()) < abs(z - fPos1.z()):
553 NewPosition = ROOT.TVector3(0.0, 0.0, zs)
556 rep = ROOT.genfit.RKTrackRep(13 *
cmp(fstate.getPDG(), 0))
557 state = ROOT.genfit.StateOnPlane(rep)
558 pos, mom = fstate.getPos(), fstate.getMom()
559 rep.setPosMom(state, pos, mom)
560 detPlane = ROOT.genfit.DetPlane(NewPosition, parallelToZ)
561 detPlanePtr = ROOT.genfit.SharedPlanePtr(detPlane)
563 rep.extrapolateToPlane(state, detPlanePtr)
564 pos, mom = state.getPos(), state.getMom()
567 print(
"error with extrapolation")
570 px, py, pz = mom.X(), mom.Y(), mom.Z()
571 lam = (z - pos.Z()) / pz
572 pos = ROOT.TVector3(pos.X() + lam * px, pos.Y() + lam * py, z)
620 Estimates reconstructible tracks of an event.
625 sTree : ROOT.TTree or ROOT.TChain
626 Events in raw format.
628 Contains SHiP detector geometry.
630 Contains SHiP detector geometry.
633 MCTrackIDs : array-like
634 List of reconstructible track ids.
640 TStationz = ShipGeo.TrackStation1.z
642 TStationz - 3.0 / 2.0 * ShipGeo.strawtubes_geo.delta_z_view - 1.0 / 2.0 * ShipGeo.strawtubes_geo.delta_z_layer
644 TStation1StartZ = Zpos - ShipGeo.strawtubes_geo.outer_straw_diameter / 2.0
646 TStationz = ShipGeo.TrackStation4.z
648 TStationz + 3.0 / 2.0 * ShipGeo.strawtubes_geo.delta_z_view + 1.0 / 2.0 * ShipGeo.strawtubes_geo.delta_z_layer
650 TStation4EndZ = Zpos + ShipGeo.strawtubes_geo.outer_straw_diameter / 2.0
652 ROOT.TDatabasePDG.Instance()
657 sTree.GetEvent(iEvent)
658 nMCTracks = len(sTree.MCTrack)
661 for i
in reversed(range(nMCTracks)):
662 atrack = sTree.MCTrack[i]
664 if atrack.GetStartZ() > TStation4EndZ:
665 motherId = atrack.GetMotherId()
667 mothertrack = sTree.MCTrack[motherId]
668 mothertrackZ = mothertrack.GetStartZ()
671 if mothertrackZ < TStation1StartZ
and motherId
not in MCTrackIDs:
672 MCTrackIDs.append(motherId)
674 if len(MCTrackIDs) == 0:
699 nHits = len(sTree.strawtubesPoint)
701 duplicatestrawhit = set()
703 for i
in range(nHits):
704 ahit = sTree.strawtubesPoint[i]
705 strawname = str(ahit.GetDetectorID())
707 if strawname
in hitstraws:
709 if ahit.GetX() > hitstraws[strawname][1]:
711 duplicatestrawhit.add(i)
714 duplicatestrawhit.add(hitstraws[strawname][0])
715 hitstraws[strawname] = [i, ahit.GetX()]
717 hitstraws[strawname] = [i, ahit.GetX()]
724 trackoutsidestations = set()
727 x_bound = ShipGeo.strawtubes_geo.width - margin
728 y_bound = ShipGeo.strawtubes_geo.height - margin
730 for i
in range(nHits):
731 if i
in duplicatestrawhit:
734 ahit = sTree.strawtubesPoint[i]
737 if abs(ahit.GetX()) >= x_bound
or abs(ahit.GetY()) >= y_bound:
738 trackoutsidestations.add(ahit.GetTrackID())
740 if ahit.GetTrackID()
not in MCTrackIDs:
745 if str(ahit.GetDetectorID())[:1] ==
"1":
746 if ahit.GetTrackID()
in hits1:
747 hits1[ahit.GetTrackID()] = [hits1[ahit.GetTrackID()][0], i]
749 hits1[ahit.GetTrackID()] = [i]
751 if str(ahit.GetDetectorID())[:1] ==
"2":
752 if ahit.GetTrackID()
in hits2:
753 hits2[ahit.GetTrackID()] = [hits2[ahit.GetTrackID()][0], i]
755 hits2[ahit.GetTrackID()] = [i]
757 if str(ahit.GetDetectorID())[:1] ==
"3":
758 if ahit.GetTrackID()
in hits3:
759 hits3[ahit.GetTrackID()] = [hits3[ahit.GetTrackID()][0], i]
761 hits3[ahit.GetTrackID()] = [i]
763 if str(ahit.GetDetectorID())[:1] ==
"4":
764 if ahit.GetTrackID()
in hits4:
765 hits4[ahit.GetTrackID()] = [hits4[ahit.GetTrackID()][0], i]
767 hits4[ahit.GetTrackID()] = [i]
770 tracks_with_hits_in_all_stations = []
773 if (key
in hits2
and key
in hits3)
and key
in hits4:
774 if key
not in tracks_with_hits_in_all_stations
and key
not in trackoutsidestations:
775 tracks_with_hits_in_all_stations.append(key)
778 if (key
in hits1
and key
in hits3)
and key
in hits4:
779 if key
not in tracks_with_hits_in_all_stations
and key
not in trackoutsidestations:
780 tracks_with_hits_in_all_stations.append(key)
783 if (key
in hits2
and key
in hits1)
and key
in hits4:
784 if key
not in tracks_with_hits_in_all_stations
and key
not in trackoutsidestations:
785 tracks_with_hits_in_all_stations.append(key)
788 if (key
in hits2
and key
in hits3)
and key
in hits1:
789 if key
not in tracks_with_hits_in_all_stations
and key
not in trackoutsidestations:
790 tracks_with_hits_in_all_stations.append(key)
795 for item
in MCTrackIDs:
796 if item
not in tracks_with_hits_in_all_stations:
797 itemstoremove.append(item)
799 for item
in itemstoremove:
800 MCTrackIDs.remove(item)
802 if len(MCTrackIDs) == 0:
807 signalId = find_signal_track(sTree.MCTrack)
810 print(f
"Warning: no signal track found in event {iEvent}, skipping the signal-daughter filter.")
812 itemstoremove = [item
for item
in MCTrackIDs
if sTree.MCTrack[item].GetMotherId() != signalId]
814 for item
in itemstoremove:
815 MCTrackIDs.remove(item)
867 ut.bookHist(h,
"TracksPassed",
"Tracks passing the pattern recognition", 8, -0.5, 7.5)
868 h[
"TracksPassed"].GetXaxis().SetBinLabel(1,
"Reconstructible tracks")
869 h[
"TracksPassed"].GetXaxis().SetBinLabel(2,
"Y view station 1&2")
870 h[
"TracksPassed"].GetXaxis().SetBinLabel(3,
"Stereo station 1&2")
871 h[
"TracksPassed"].GetXaxis().SetBinLabel(4,
"station 1&2")
872 h[
"TracksPassed"].GetXaxis().SetBinLabel(5,
"Y view station 3&4")
873 h[
"TracksPassed"].GetXaxis().SetBinLabel(6,
"Stereo station 3&4")
874 h[
"TracksPassed"].GetXaxis().SetBinLabel(7,
"station 3&4")
875 h[
"TracksPassed"].GetXaxis().SetBinLabel(8,
"Combined stations 1&2/3&4")
877 ut.bookHist(h,
"TracksPassedU",
"Tracks passing the pattern recognition. No clones.", 8, -0.5, 7.5)
878 h[
"TracksPassedU"].GetXaxis().SetBinLabel(1,
"Reconstructible tracks")
879 h[
"TracksPassedU"].GetXaxis().SetBinLabel(2,
"Y view station 1&2")
880 h[
"TracksPassedU"].GetXaxis().SetBinLabel(3,
"Stereo station 1&2")
881 h[
"TracksPassedU"].GetXaxis().SetBinLabel(4,
"station 1&2")
882 h[
"TracksPassedU"].GetXaxis().SetBinLabel(5,
"Y view station 3&4")
883 h[
"TracksPassedU"].GetXaxis().SetBinLabel(6,
"Stereo station 3&4")
884 h[
"TracksPassedU"].GetXaxis().SetBinLabel(7,
"station 3&4")
885 h[
"TracksPassedU"].GetXaxis().SetBinLabel(8,
"Combined stations 1&2/3&4")
887 ut.bookProf(h,
"TracksPassed_p",
"Tracks passing the pattern recognition from momentum", 30, 0, 150)
888 h[
"TracksPassed_p"].GetXaxis().SetTitle(
"Momentum")
889 h[
"TracksPassed_p"].GetYaxis().SetTitle(
"N")
891 ut.bookHist(h,
"ptrue-p/ptrue",
"(p - p-true)/p", 200, -0.25, 0.25)
892 ut.bookHist(h,
"pttrue-pt/pttrue",
"(pt - pt-true)/pt", 200, -0.25, 0.25)
893 ut.bookHist(h,
"pxtrue-px/pxtrue",
"(px - px-true)/px", 200, -0.25, 0.25)
894 ut.bookHist(h,
"pytrue-py/pytrue",
"(py - py-true)/py", 200, -0.25, 0.25)
895 ut.bookHist(h,
"pztrue-pz/pztrue",
"(pz - pz-true)/pz", 200, -0.25, 0.25)
897 ut.bookHist(h,
"n_hits_reco",
"Number of recognized hits per track, total", 64, 0.0, 64.01)
898 ut.bookHist(h,
"n_hits_reco_12",
"Number of recognized hits per track, station 1&2", 32, 0.0, 32.01)
899 ut.bookHist(h,
"n_hits_reco_y12",
"Number of recognized hits per track, Y view station 1&2", 32, 0.0, 32.01)
901 h,
"n_hits_reco_stereo12",
"Number of recognized hits per track, Stereo view station 1&2", 32, 0.0, 32.01
903 ut.bookHist(h,
"n_hits_reco_34",
"Number of recognized hits per track, station 3&4", 32, 0.0, 32.01)
904 ut.bookHist(h,
"n_hits_reco_y34",
"Number of recognized hits per track, Y view station 3&4", 32, 0.0, 32.01)
906 h,
"n_hits_reco_stereo34",
"Number of recognized hits per track, Stereo view station 3&4", 32, 0.0, 32.01
910 ut.bookProf(h,
"n_hits_total",
"Number of recognized hits per track, total", 30, 0, 150)
911 h[
"n_hits_total"].GetXaxis().SetTitle(
"Momentum")
912 h[
"n_hits_total"].GetYaxis().SetTitle(
"N")
914 ut.bookProf(h,
"n_hits_y12",
"Number of recognized hits per track, Y view station 1&2", 30, 0, 150)
915 h[
"n_hits_y12"].GetXaxis().SetTitle(
"Momentum")
916 h[
"n_hits_y12"].GetYaxis().SetTitle(
"N")
918 ut.bookProf(h,
"n_hits_stereo12",
"Number of recognized hits per track, Stereo view station 1&2", 30, 0, 150)
919 h[
"n_hits_stereo12"].GetXaxis().SetTitle(
"Momentum")
920 h[
"n_hits_stereo12"].GetYaxis().SetTitle(
"N")
922 ut.bookProf(h,
"n_hits_12",
"Number of recognized hits per track, station 1&2", 30, 0, 150)
923 h[
"n_hits_12"].GetXaxis().SetTitle(
"Momentum")
924 h[
"n_hits_12"].GetYaxis().SetTitle(
"N")
926 ut.bookProf(h,
"n_hits_y34",
"Number of recognized hits per track, Y view station 3&4", 30, 0, 150)
927 h[
"n_hits_y34"].GetXaxis().SetTitle(
"Momentum")
928 h[
"n_hits_y34"].GetYaxis().SetTitle(
"N")
930 ut.bookProf(h,
"n_hits_stereo34",
"Number of recognized hits per track, Stereo view station 3&4", 30, 0, 150)
931 h[
"n_hits_stereo34"].GetXaxis().SetTitle(
"Momentum")
932 h[
"n_hits_stereo34"].GetYaxis().SetTitle(
"N")
934 ut.bookProf(h,
"n_hits_34",
"Number of recognized hits per track, station 3&4", 30, 0, 150)
935 h[
"n_hits_34"].GetXaxis().SetTitle(
"Momentum")
936 h[
"n_hits_34"].GetYaxis().SetTitle(
"N")
938 ut.bookProf(h,
"perr",
"(p - p-true)/p", 30, 0, 150)
939 h[
"perr"].GetXaxis().SetTitle(
"Momentum")
940 h[
"perr"].GetYaxis().SetTitle(
"(p - p-true)/p")
942 ut.bookProf(h,
"perr_direction",
"(p - p-true)/p from track direction in YZ plane", 20, 0, 10.01)
943 h[
"perr_direction"].GetXaxis().SetTitle(
"Degree")
944 h[
"perr_direction"].GetYaxis().SetTitle(
"(p - p-true)/p")
946 ut.bookProf(h,
"frac_total",
"Fraction of hits the same as MC hits, total", 30, 0, 150)
947 h[
"frac_total"].GetXaxis().SetTitle(
"Momentum")
948 h[
"frac_total"].GetYaxis().SetTitle(
"Fraction")
950 ut.bookProf(h,
"frac_y12",
"Fraction of hits the same as MC hits, Y view station 1&2", 30, 0, 150)
951 h[
"frac_y12"].GetXaxis().SetTitle(
"Momentum")
952 h[
"frac_y12"].GetYaxis().SetTitle(
"Fraction")
954 ut.bookProf(h,
"frac_stereo12",
"Fraction of hits the same as MC hits, Stereo view station 1&2", 30, 0, 150)
955 h[
"frac_stereo12"].GetXaxis().SetTitle(
"Momentum")
956 h[
"frac_stereo12"].GetYaxis().SetTitle(
"Fraction")
958 ut.bookProf(h,
"frac_12",
"Fraction of hits the same as MC hits, station 1&2", 30, 0, 150)
959 h[
"frac_12"].GetXaxis().SetTitle(
"Momentum")
960 h[
"frac_12"].GetYaxis().SetTitle(
"Fraction")
962 ut.bookProf(h,
"frac_y34",
"Fraction of hits the same as MC hits, Y view station 3&4", 30, 0, 150)
963 h[
"frac_y34"].GetXaxis().SetTitle(
"Momentum")
964 h[
"frac_y34"].GetYaxis().SetTitle(
"Fraction")
966 ut.bookProf(h,
"frac_stereo34",
"Fraction of hits the same as MC hits, Stereo view station 3&4", 30, 0, 150)
967 h[
"frac_stereo34"].GetXaxis().SetTitle(
"Momentum")
968 h[
"frac_stereo34"].GetYaxis().SetTitle(
"Fraction")
970 ut.bookProf(h,
"frac_34",
"Fraction of hits the same as MC hits, station 3&4", 30, 0, 150)
971 h[
"frac_34"].GetXaxis().SetTitle(
"Momentum")
972 h[
"frac_34"].GetYaxis().SetTitle(
"Fraction")
974 ut.bookHist(h,
"frac_y12_dist",
"Fraction of hits the same as MC hits, Y view station 1&2", 50, 0.5, 1.001)
976 h,
"frac_stereo12_dist",
"Fraction of hits the same as MC hits, Stereo view station 1&2", 50, 0.5, 1.001
978 ut.bookHist(h,
"frac_12_dist",
"Fraction of hits the same as MC hits, station 1&2", 50, 0.5, 1.001)
979 ut.bookHist(h,
"frac_y34_dist",
"Fraction of hits the same as MC hits, Y view station 3&4", 50, 0.5, 1.001)
981 h,
"frac_stereo34_dist",
"Fraction of hits the same as MC hits, Stereo view station 3&4", 50, 0.5, 1.001
983 ut.bookHist(h,
"frac_34_dist",
"Fraction of hits the same as MC hits, station 3&4", 50, 0.5, 1.001)
984 ut.bookHist(h,
"frac_total_dist",
"Fraction of hits the same as MC hits, total", 50, 0.5, 1.001)
987 h,
"Reco_tracks",
"Number of recognized tracks, clones and ghosts for reconstructible tracks.", 5, -0.5, 4.5
989 h[
"Reco_tracks"].GetXaxis().SetBinLabel(1,
"N total")
990 h[
"Reco_tracks"].GetXaxis().SetBinLabel(2,
"N recognized tracks")
991 h[
"Reco_tracks"].GetXaxis().SetBinLabel(3,
"N clones")
992 h[
"Reco_tracks"].GetXaxis().SetBinLabel(4,
"N ghosts")
993 h[
"Reco_tracks"].GetXaxis().SetBinLabel(5,
"N others")
996 ut.bookHist(h,
"chi2fittedtracks",
"Chi^2 per NDOF for fitted tracks", 210, -0.05, 20.05)
997 ut.bookHist(h,
"pvalfittedtracks",
"pval for fitted tracks", 110, -0.05, 1.05)
998 ut.bookHist(h,
"momentumfittedtracks",
"momentum for fitted tracks", 251, -0.05, 250.05)
999 ut.bookHist(h,
"xdirectionfittedtracks",
"x-direction for fitted tracks", 91, -0.5, 90.5)
1000 ut.bookHist(h,
"ydirectionfittedtracks",
"y-direction for fitted tracks", 91, -0.5, 90.5)
1001 ut.bookHist(h,
"zdirectionfittedtracks",
"z-direction for fitted tracks", 91, -0.5, 90.5)
1002 ut.bookHist(h,
"massfittedtracks",
"mass fitted tracks", 210, -0.005, 0.205)
1003 ut.bookHist(h,
"pvspfitted",
"p-patrec vs p-fitted", 401, -200.5, 200.5, 401, -200.5, 200.5)
1005 ut.bookHist(h,
"abs(x - x-true)",
"Hits abs(x - x-true)", 260, -0.05, 5.05)
1006 ut.bookHist(h,
"abs(y - y-true)",
"Hits abs(y - y-true)", 260, -0.05, 5.05)
1008 ut.bookHist(h,
"rmse_x",
"Hits x fit rmse", 260, -0.05, 5.05)
1009 ut.bookHist(h,
"rmse_y",
"Hits y fit rmse", 260, -0.05, 5.05)