9from tracking
import modules
16from ROOT
import Belle2
18from ROOT
import gSystem
19gSystem.Load(
'libtracking')
20gSystem.Load(
'libtracking_trackFindingCDC')
24 """Validate the track fit"""
28 mc_track_cands_store_array_name,
29 legendre_track_cand_store_array_name,
33 foreach=legendre_track_cand_store_array_name,
34 output_file_name=output_file_name)
47 """ Initialize the harvester"""
50 return HarvestingModule.prepare(self)
52 def peel(self, legendre_track_cand):
53 """Aggregate the track and MC information for track-fit validation"""
55 cdc_hit_store_array = self.
cdcHits
59 hits = ROOT.std.vector(
"Belle2::TrackFindingCDC::TrackHit*")()
61 cdc_hit_ids = legendre_track_cand.getHitIDs(Belle2.Const.CDC)
62 for cdc_hit_id
in cdc_hit_ids:
63 cdc_hit = cdc_hit_store_array[cdc_hit_id]
66 if cdc_hit.getISuperLayer() % 2 == 0:
69 wireRefPos2D = cdc_wire_hit.getRefPos2D()
70 drift_length = cdc_wire_hit.getRefDriftLength()
71 observations.append(wireRefPos2D.x(), wireRefPos2D.y(), 0, 1 / abs(drift_length))
72 hits.push_back(Belle2.TrackFindingCDC.TrackHit(cdc_wire_hit))
75 track_par = ROOT.std.pair(
"double, double")()
76 ref_point = ROOT.std.pair(
"double, double")()
78 viktor_chi2 = self.
fast_fitter.fitTrackCandidateFast(hits, track_par, ref_point,
False) * (hits.size() - 4)
83 riemann_chi2 = trajectory2D.getChi2()
86 riemann_chi2=riemann_chi2,
87 viktor_chi2=viktor_chi2,
94 save_tree = refiners.save_tree(folder_name=
"tree")
98 """Read generated events or generate new events, simulate, fit the tracks and validate"""
100 def create_path(self):
101 """Create and populate the basf2 path"""
103 main_path = super().create_path()
105 main_path.add_module(
"TFCDC_WireHitPreparer")
107 main_path.add_module(modules.CDCMCFinder())
110 legendre_track_cand_store_array_name=
"MCTrackCands",
111 output_file_name=
"fit_validation.root"))
118 run.configure_and_execute_from_commandline()
121if __name__ ==
"__main__":
122 logging.basicConfig(stream=sys.stdout, level=logging.INFO, format=
'%(levelname)s:%(message)s')
A (simplified) python wrapper for StoreArray.
Class serving as a storage of observed drift circles to present to the Riemann fitter.
static const CDCRiemannFitter & getFitter()
Static getter for a general Riemann fitter.
Particle trajectory as it is seen in xy projection represented as a circle.
Class representing a hit wire in the central drift chamber.
mc_track_cands_store_array_name
cached name of the MCTrackCands StoreArray
circle_fitter
Use the Riemann fitter for circles.
fast_fitter
Use the standard track fitter for speed.
def __init__(self, mc_track_cands_store_array_name, legendre_track_cand_store_array_name, output_file_name)
def peel(self, legendre_track_cand)
legendre_track_cand_store_array_name
cached name of the LegendreTrackCands StoreArray
cdcHits
cached name of the CDCHits StoreArray