9 from tracking
import modules
16 from ROOT
import Belle2
18 from ROOT
import gSystem
19 gSystem.Load(
'libtracking')
20 gSystem.Load(
'libtracking_trackFindingCDC')
24 """Validate the track fit"""
28 mc_track_cands_store_array_name,
29 legendre_track_cand_store_array_name,
35 foreach=legendre_track_cand_store_array_name,
36 output_file_name=output_file_name)
46 self.
fast_fitterfast_fitter = Belle2.TrackFindingCDC.TrackFitter()
49 """ Initialize the harvester"""
52 return HarvestingModule.prepare(self)
54 def peel(self, legendre_track_cand):
55 """Aggregate the track and MC information for track-fit validation"""
57 cdc_hit_store_array = self.
cdcHitscdcHits
61 hits = ROOT.std.vector(
"Belle2::TrackFindingCDC::TrackHit*")()
63 cdc_hit_ids = legendre_track_cand.getHitIDs(Belle2.Const.CDC)
64 for cdc_hit_id
in cdc_hit_ids:
65 cdc_hit = cdc_hit_store_array[cdc_hit_id]
68 if cdc_hit.getISuperLayer() % 2 == 0:
71 wireRefPos2D = cdc_wire_hit.getRefPos2D()
72 drift_length = cdc_wire_hit.getRefDriftLength()
73 observations.append(wireRefPos2D.x(), wireRefPos2D.y(), 0, 1 / abs(drift_length))
74 hits.push_back(Belle2.TrackFindingCDC.TrackHit(cdc_wire_hit))
77 track_par = ROOT.std.pair(
"double, double")()
78 ref_point = ROOT.std.pair(
"double, double")()
80 viktor_chi2 = self.
fast_fitterfast_fitter.fitTrackCandidateFast(hits, track_par, ref_point,
False) * (hits.size() - 4)
84 self.
circle_fittercircle_fitter.update(trajectory2D, observations)
85 riemann_chi2 = trajectory2D.getChi2()
88 riemann_chi2=riemann_chi2,
89 viktor_chi2=viktor_chi2,
96 save_tree = refiners.save_tree(folder_name=
"tree")
100 """Read generated events or generate new events, simulate, fit the tracks and validate"""
103 """Create and populate the basf2 path"""
105 main_path = super(FitValidation, self).
create_path()
107 main_path.add_module(
"TFCDC_WireHitPreparer")
109 main_path.add_module(modules.CDCMCFinder())
112 legendre_track_cand_store_array_name=
"MCTrackCands",
113 output_file_name=
"fit_validation.root"))
120 run.configure_and_execute_from_commandline()
123 if __name__ ==
"__main__":
124 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
int main(int argc, char **argv)
Run all tests.