11 from ROOT
import gSystem
12 gSystem.Load(
'libtracking')
13 gSystem.Load(
'libtracking_trackFindingCDC')
15 from ROOT
import Belle2
34 return logging.getLogger(__name__)
37 CONTACT =
"oliver.frost@desy.de"
41 """Prepare and execute a basf2 job to read generated events or generate new events then validate the CDC cluster filter"""
43 cluster_preparation_module = basf2.register_module(
"TFCDC_ClusterPreparer")
48 output_file_name =
"ClusterFilterValidation.root"
51 """Configure the basf2 job script using the translated command-line arguments"""
53 return argument_parser
57 Sets up a path that plays back pregenerated events or generates events
58 based on the properties in the base class.
60 main_path = super(ClusterFilterValidationRun, self).
create_path()
63 main_path.add_module(cluster_preparation_module)
68 main_path.add_module(metamodules.PyProfilingModule(validation_module))
70 main_path.add_module(validation_module)
77 """Module to collect information about the facet creation cuts and compose validation plots on terminate."""
81 super(ClusterFilterValidationModule, self).
__init__(foreach=
"CDCWireHitClusterVector",
82 output_file_name=output_file_name)
89 """Receive signal at the start of event processing"""
91 super(ClusterFilterValidationModule, self).
initialize()
94 """Receive signal at the end of event processing"""
96 super(ClusterFilterValidationModule, self).
terminate()
99 """Fill the MC hit table"""
103 """Always pick, never reject"""
107 """Extract and store CDC hit and cluster information"""
113 cluster_crops = dict(cluster_crops)
117 for wireHit
in list(cluster.items()):
118 cdcHit = wireHit.getHit()
119 if mc_hit_lookup.isBackground(cdcHit):
123 n_background_truth=n_background,
124 background_fraction_truth=1.0 * n_background / cluster.size()
127 cluster_crops.update(truth_dict)
132 save_tree = refiners.save_tree(folder_name=
"tree")
134 save_histograms = refiners.save_histograms(outlier_z_score=5.0,
136 folder_name=
"histograms")
141 run.configure_and_execute_from_commandline()
144 if __name__ ==
"__main__":
145 logging.basicConfig(stream=sys.stdout, level=logging.INFO, format=
'%(levelname)s:%(message)s')