18 from ROOT
import Belle2
23 from ROOT
import gSystem
24 gSystem.Load(
'libtracking')
25 gSystem.Load(
'libtracking_trackFindingCDC')
29 return logging.getLogger(__name__)
32 CONTACT =
"oliver.frost@desy.de"
36 """Prepare and execute a basf2 job to read generated events or generate new events then validate the CDC cluster filter"""
38 cluster_preparation_module = basf2.register_module(
"TFCDC_ClusterPreparer")
43 output_file_name =
"ClusterFilterValidation.root"
46 """Configure the basf2 job script using the translated command-line arguments"""
48 return argument_parser
52 Sets up a path that plays back pregenerated events or generates events
53 based on the properties in the base class.
55 main_path = super(ClusterFilterValidationRun, self).
create_path()
58 main_path.add_module(cluster_preparation_module)
63 main_path.add_module(metamodules.PyProfilingModule(validation_module))
65 main_path.add_module(validation_module)
72 """Module to collect information about the facet creation cuts and compose validation plots on terminate."""
76 super(ClusterFilterValidationModule, self).
__init__(foreach=
"CDCWireHitClusterVector",
77 output_file_name=output_file_name)
81 self.
cluster_varsetcluster_varset = Belle2.TrackFindingCDC.CDCWireHitClusterVarSet()
84 """Receive signal at the start of event processing"""
86 super(ClusterFilterValidationModule, self).
initialize()
89 """Receive signal at the end of event processing"""
91 super(ClusterFilterValidationModule, self).
terminate()
94 """Fill the MC hit table"""
98 """Always pick, never reject"""
102 """Extract and store CDC hit and cluster information"""
107 cluster_crops = self.
cluster_varsetcluster_varset.getNamedValues()
108 cluster_crops = dict(cluster_crops)
112 for wireHit
in list(cluster.items()):
113 cdcHit = wireHit.getHit()
114 if mc_hit_lookup.isBackground(cdcHit):
118 n_background_truth=n_background,
119 background_fraction_truth=1.0 * n_background / cluster.size()
122 cluster_crops.update(truth_dict)
127 save_tree = refiners.save_tree(
133 save_histograms = refiners.save_histograms(
137 folder_name=
"histograms"
144 run.configure_and_execute_from_commandline()
147 if __name__ ==
"__main__":
148 logging.basicConfig(stream=sys.stdout, level=logging.INFO, format=
'%(levelname)s:%(message)s')
static const CDCMCHitLookUp & getInstance()
Getter for the singletone instance.
mc_hit_lookup
reference to the CDCMCHitlookUp singleton
cluster_varset
reference to the CDCWireHitClusterVarSet
def __init__(self, output_file_name)
def create_argument_parser(self, **kwds)
string output_file_name
output ROOT file
cluster_preparation_module
basf2 module for CDC cluster preparation
bool py_profile
create a python profile
output_file_name
There is no default for the name of the output TFile.
int main(int argc, char **argv)
Run all tests.