53 group_detector_parent=[]):
54 """
55 function create multilevel of detectors , which is like n-tree
56 (each detector has many layers of subdetectors)
57
58 :param level: define layers of detectors tree, default is 5
59 :param number_subdetectors_of_each_detector: define number of
60 subdetectors for each parent detector, default is 4
61 :param detector_root_name: define the base name of detector,
62 default value is "detector"
63 :param parent_path: specify parent_path of subdetector,
64 if there is no basic detector can be used,
65 it should be None as create first level detectors, default is None
66 :param[inout] group_detector_parent: a list stores
67 the data structure of multilevel detector, default is []
68 return null. The result will be stored in the group_detector_parent param.
69
70 usage example: create_multilevel_detectors(5, 4, "detector", None, group_detector_parent)
71 example explanation: it create a five levels detectors tree each detector has 4 subdetector,
72 """
73
74
75
76 if level == 0:
77 return
78
79 first_level_detector = create_big_detectors(
80 number_subdetectors_of_each_detector, parent_path, detector_root_name)
81
82 for first_level_item in first_level_detector:
83 group_detector_parent.append(first_level_item)
84 detector_name = first_level_item[0]
85
86 if parent_path is None:
87 path = detector_name
88 else:
89 path = parent_path + "/" + detector_name
90
91 create_multilevel_detectors(level - 1, number_subdetectors_of_each_detector,
92 "sub" + detector_root_name, path,
93 group_detector_parent)