CMS 3D CMS Logo

customClustering.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from L1Trigger.L1THGCal.l1tHGCalBackEndLayer1Producer_cfi import dummy_C2d_params, \
3  distance_C2d_params, \
4  topological_C2d_params, \
5  constrTopological_C2d_params
6 from L1Trigger.L1THGCal.l1tHGCalBackEndLayer2Producer_cfi import distance_C3d_params, \
7  dbscan_C3d_params, \
8  histoMax_C3d_clustering_params, \
9  histoMaxVariableDR_C3d_params, \
10  histoMaxXYVariableDR_C3d_params, \
11  histoSecondaryMax_C3d_params, \
12  histoInterpolatedMax_C3d_params, \
13  histoThreshold_C3d_params, \
14  dr_layerbylayer, \
15  dr_layerbylayer_Bcoefficient, \
16  neighbour_weights_1stOrder, \
17  neighbour_weights_2ndOrder, \
18  MAX_LAYERS
19 
20 
21 def set_threshold_params(pset, seed_threshold, cluster_threshold):
22  pset.seeding_threshold_silicon = seed_threshold
23  pset.seeding_threshold_scintillator = seed_threshold
24  pset.clustering_threshold_silicon = cluster_threshold
25  pset.clustering_threshold_scintillator = cluster_threshold
26 
27 
29  distance=distance_C2d_params.dR_cluster, # cm
30  seed_threshold=distance_C2d_params.seeding_threshold_silicon, # MipT
31  cluster_threshold=distance_C2d_params.clustering_threshold_silicon # MipT
32  ):
33  parameters_c2d = distance_C2d_params.clone(dR_cluster = distance)
34  set_threshold_params(parameters_c2d, seed_threshold, cluster_threshold)
35  process.l1tHGCalBackEndLayer1Producer.ProcessorParameters.C2d_parameters = parameters_c2d
36  return process
37 
38 
40  seed_threshold=topological_C2d_params.seeding_threshold_silicon, # MipT
41  cluster_threshold=topological_C2d_params.clustering_threshold_silicon # MipT
42  ):
43  parameters_c2d = topological_C2d_params.clone()
44  set_threshold_params(parameters_c2d, seed_threshold, cluster_threshold)
45  process.l1tHGCalBackEndLayer1Producer.ProcessorParameters.C2d_parameters = parameters_c2d
46  return process
47 
48 
50  distance=constrTopological_C2d_params.dR_cluster, # cm
51  seed_threshold=constrTopological_C2d_params.seeding_threshold_silicon, # MipT
52  cluster_threshold=constrTopological_C2d_params.clustering_threshold_silicon # MipT
53  ):
54  parameters_c2d = constrTopological_C2d_params.clone(dR_cluster = distance)
55  set_threshold_params(parameters_c2d, seed_threshold, cluster_threshold)
56  process.l1tHGCalBackEndLayer1Producer.ProcessorParameters.C2d_parameters = parameters_c2d
57  return process
58 
59 
61  process.l1tHGCalBackEndLayer1Producer.ProcessorParameters.C2d_parameters = dummy_C2d_params.clone()
62  return process
63 
64 
66  distance=distance_C3d_params.dR_multicluster
67  ):
68  parameters_c3d = distance_C3d_params.clone(dR_multicluster = distance)
69  process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
70  return process
71 
72 
73 def custom_3dclustering_dbscan(process,
74  distance=dbscan_C3d_params.dist_dbscan_multicluster,
75  min_points=dbscan_C3d_params.minN_dbscan_multicluster
76  ):
77  parameters_c3d = dbscan_C3d_params.clone(
78  dist_dbscan_multicluster = distance,
79  minN_dbscan_multicluster = min_points
80  )
81  process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
82  return process
83 
84 
85 def set_histomax_clustering_params(parameters_c3d,
86  distance,
87  shape_threshold,
88  shape_distance
89  ):
90  parameters_c3d.dR_multicluster = distance
91  parameters_c3d.shape_threshold = shape_threshold
92  parameters_c3d.shape_distance = shape_distance
93 
94 
96  distance=histoMax_C3d_clustering_params.dR_multicluster,
97  shape_threshold=histoMax_C3d_clustering_params.shape_threshold,
98  shape_distance=histoMax_C3d_clustering_params.shape_distance
99  ):
100  parameters_c3d = histoMax_C3d_clustering_params.clone()
101  set_histomax_clustering_params(parameters_c3d, distance, shape_threshold, shape_distance)
102  process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters = parameters_c3d
103  return process
104 
105 
106 def custom_3dclustering_variableDr(process, distances=histoMaxVariableDR_C3d_params.dR_multicluster_byLayer_coefficientA,
107  shape_threshold=histoMaxVariableDR_C3d_params.shape_threshold,
108  shape_distance=histoMaxVariableDR_C3d_params.shape_distance
109  ):
110  parameters_c3d = histoMaxVariableDR_C3d_params.clone(
111  dR_multicluster_byLayer_coefficientA = cms.vdouble(distances)
112  )
113  set_histomax_clustering_params(parameters_c3d, 0, shape_threshold, shape_distance)
114  process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters = parameters_c3d
115  return process
116 
117 
119  distance_coefficientA=dr_layerbylayer,
120  distance_coefficientB=dr_layerbylayer_Bcoefficient):
121  parameters_c3d = process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters
122  parameters_c3d.dR_multicluster_byLayer_coefficientA = distance_coefficientA
123  parameters_c3d.dR_multicluster_byLayer_coefficientB = distance_coefficientB
124  return process
125 
126 
128  distance_coefficientA=dr_layerbylayer):
129  parameters_c3d = process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters
130  parameters_c3d.dR_multicluster_byLayer_coefficientA = distance_coefficientA
131  parameters_c3d.dR_multicluster_byLayer_coefficientB = cms.vdouble( [0]*(MAX_LAYERS+1) )
132  return process
133 
135  distance_coefficientA=0.03):
136  parameters_c3d = process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters
137  parameters_c3d.dR_multicluster_byLayer_coefficientA = cms.vdouble( [distance_coefficientA]*(MAX_LAYERS+1) )
138  parameters_c3d.dR_multicluster_byLayer_coefficientB = cms.vdouble( [0]*(MAX_LAYERS+1) )
139  return process
140 
142  distance_coefficientA=0.03,
143  distance_coefficientB=0.02):
144  parameters_c3d = process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters
145  parameters_c3d.dR_multicluster_byLayer_coefficientA = cms.vdouble( [distance_coefficientA]*(MAX_LAYERS+1) )
146  parameters_c3d.dR_multicluster_byLayer_coefficientB = cms.vdouble( [distance_coefficientB]*(MAX_LAYERS+1) )
147  return process
148 
149 
151  parameters_c3d = process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters
152  parameters_c3d.cluster_association = cms.string('NearestNeighbour')
153 
154  return process
155 
157 
158  parameters_c3d = process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters
159  parameters_c3d.cluster_association = cms.string('EnergySplit')
160  return process
def custom_3dclustering_clusteringRadiusNoLayerDependenceFixedEta(process, distance_coefficientA=0.03)
def set_threshold_params(pset, seed_threshold, cluster_threshold)
def custom_3dclustering_clusteringRadiusNoLayerDependenceVariableEta(process, distance_coefficientA=0.03, distance_coefficientB=0.02)
def custom_3dclustering_nearestNeighbourAssociation(process)
def custom_2dclustering_dummy(process)
def custom_2dclustering_topological(process, seed_threshold=topological_C2d_params.seeding_threshold_silicon, cluster_threshold=topological_C2d_params.clustering_threshold_silicon # MipT)
def custom_3dclustering_distance(process, distance=distance_C3d_params.dR_multicluster)
def custom_2dclustering_constrainedtopological(process, distance=constrTopological_C2d_params.dR_cluster, seed_threshold=constrTopological_C2d_params.seeding_threshold_silicon, cluster_threshold=constrTopological_C2d_params.clustering_threshold_silicon # MipT)
def custom_3dclustering_variableDr(process, distances=histoMaxVariableDR_C3d_params.dR_multicluster_byLayer_coefficientA, shape_threshold=histoMaxVariableDR_C3d_params.shape_threshold, shape_distance=histoMaxVariableDR_C3d_params.shape_distance)
def custom_3dclustering_EnergySplitAssociation(process)
def custom_3dclustering_dbscan(process, distance=dbscan_C3d_params.dist_dbscan_multicluster, min_points=dbscan_C3d_params.minN_dbscan_multicluster)
def set_histomax_clustering_params(parameters_c3d, distance, shape_threshold, shape_distance)
def custom_3dclustering_fixedRadius(process, distance=histoMax_C3d_clustering_params.dR_multicluster, shape_threshold=histoMax_C3d_clustering_params.shape_threshold, shape_distance=histoMax_C3d_clustering_params.shape_distance)
def custom_2dclustering_distance(process, distance=distance_C2d_params.dR_cluster, seed_threshold=distance_C2d_params.seeding_threshold_silicon, cluster_threshold=distance_C2d_params.clustering_threshold_silicon # MipT)
def custom_3dclustering_clusteringRadiusLayerbyLayerVariableEta(process, distance_coefficientA=dr_layerbylayer, distance_coefficientB=dr_layerbylayer_Bcoefficient)
def custom_3dclustering_clusteringRadiusLayerbyLayerFixedEta(process, distance_coefficientA=dr_layerbylayer)