CMS 3D CMS Logo

customClustering.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from L1Trigger.L1THGCal.hgcalBackEndLayer1Producer_cfi import dummy_C2d_params, \
3  distance_C2d_params, \
4  topological_C2d_params, \
5  constrTopological_C2d_params
6 from L1Trigger.L1THGCal.hgcalBackEndLayer2Producer_cfi import distance_C3d_params, \
7  dbscan_C3d_params, \
8  histoMax_C3d_params, \
9  histoMaxVariableDR_C3d_params, \
10  histoSecondaryMax_C3d_params, \
11  histoInterpolatedMax_C3d_params, \
12  histoThreshold_C3d_params, \
13  dr_layerbylayer, \
14  dr_layerbylayer_Bcoefficient, \
15  neighbour_weights_1stOrder, \
16  neighbour_weights_2ndOrder, \
17  MAX_LAYERS
18 
19 
20 def set_threshold_params(pset, seed_threshold, cluster_threshold):
21  pset.seeding_threshold_silicon = seed_threshold
22  pset.seeding_threshold_scintillator = seed_threshold
23  pset.clustering_threshold_silicon = cluster_threshold
24  pset.clustering_threshold_scintillator = cluster_threshold
25 
26 
28  distance=distance_C2d_params.dR_cluster, # cm
29  seed_threshold=distance_C2d_params.seeding_threshold_silicon, # MipT
30  cluster_threshold=distance_C2d_params.clustering_threshold_silicon # MipT
31  ):
32  parameters_c2d = distance_C2d_params.clone(dR_cluster = distance)
33  set_threshold_params(parameters_c2d, seed_threshold, cluster_threshold)
34  process.hgcalBackEndLayer1Producer.ProcessorParameters.C2d_parameters = parameters_c2d
35  return process
36 
37 
39  seed_threshold=topological_C2d_params.seeding_threshold_silicon, # MipT
40  cluster_threshold=topological_C2d_params.clustering_threshold_silicon # MipT
41  ):
42  parameters_c2d = topological_C2d_params.clone()
43  set_threshold_params(parameters_c2d, seed_threshold, cluster_threshold)
44  process.hgcalBackEndLayer1Producer.ProcessorParameters.C2d_parameters = parameters_c2d
45  return process
46 
47 
49  distance=constrTopological_C2d_params.dR_cluster, # cm
50  seed_threshold=constrTopological_C2d_params.seeding_threshold_silicon, # MipT
51  cluster_threshold=constrTopological_C2d_params.clustering_threshold_silicon # MipT
52  ):
53  parameters_c2d = constrTopological_C2d_params.clone(dR_cluster = distance)
54  set_threshold_params(parameters_c2d, seed_threshold, cluster_threshold)
55  process.hgcalBackEndLayer1Producer.ProcessorParameters.C2d_parameters = parameters_c2d
56  return process
57 
58 
60  process.hgcalBackEndLayer1Producer.ProcessorParameters.C2d_parameters = dummy_C2d_params.clone()
61  return process
62 
63 
65  distance=distance_C3d_params.dR_multicluster
66  ):
67  parameters_c3d = distance_C3d_params.clone(dR_multicluster = distance)
68  process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
69  return process
70 
71 
72 def custom_3dclustering_dbscan(process,
73  distance=dbscan_C3d_params.dist_dbscan_multicluster,
74  min_points=dbscan_C3d_params.minN_dbscan_multicluster
75  ):
76  parameters_c3d = dbscan_C3d_params.clone(
77  dist_dbscan_multicluster = distance,
78  minN_dbscan_multicluster = min_points
79  )
80  process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
81  return process
82 
83 
84 def set_histomax_params(parameters_c3d, distance, nBins_R, nBins_Phi, binSumsHisto, seed_threshold):
85  parameters_c3d.dR_multicluster = distance
86  parameters_c3d.nBins_R_histo_multicluster = nBins_R
87  parameters_c3d.nBins_Phi_histo_multicluster = nBins_Phi
88  parameters_c3d.binSumsHisto = binSumsHisto
89  parameters_c3d.threshold_histo_multicluster = seed_threshold
90 
91 
93  distance=histoMax_C3d_params.dR_multicluster,
94  nBins_R=histoMax_C3d_params.nBins_R_histo_multicluster,
95  nBins_Phi=histoMax_C3d_params.nBins_Phi_histo_multicluster,
96  binSumsHisto=histoMax_C3d_params.binSumsHisto,
97  seed_threshold=histoMax_C3d_params.threshold_histo_multicluster,
98  ):
99  parameters_c3d = histoMax_C3d_params.clone()
100  set_histomax_params(parameters_c3d, distance, nBins_R, nBins_Phi, binSumsHisto, seed_threshold)
101  process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
102  return process
103 
104 
106  distance=histoSecondaryMax_C3d_params.dR_multicluster,
107  threshold=histoSecondaryMax_C3d_params.threshold_histo_multicluster,
108  nBins_R=histoSecondaryMax_C3d_params.nBins_R_histo_multicluster,
109  nBins_Phi=histoSecondaryMax_C3d_params.nBins_Phi_histo_multicluster,
110  binSumsHisto=histoSecondaryMax_C3d_params.binSumsHisto,
111  ):
112  parameters_c3d = histoSecondaryMax_C3d_params.clone()
113  set_histomax_params(parameters_c3d, distance, nBins_R, nBins_Phi, binSumsHisto, threshold)
114  process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
115  return process
116 
117 
119  distances=histoMaxVariableDR_C3d_params.dR_multicluster_byLayer_coefficientA,
120  nBins_R=histoMaxVariableDR_C3d_params.nBins_R_histo_multicluster,
121  nBins_Phi=histoMaxVariableDR_C3d_params.nBins_Phi_histo_multicluster,
122  binSumsHisto=histoMaxVariableDR_C3d_params.binSumsHisto,
123  seed_threshold=histoMaxVariableDR_C3d_params.threshold_histo_multicluster,
124  ):
125  parameters_c3d = histoMaxVariableDR_C3d_params.clone(
126  dR_multicluster_byLayer_coefficientA = cms.vdouble(distances)
127  )
128  set_histomax_params(parameters_c3d, 0, nBins_R, nBins_Phi, binSumsHisto, seed_threshold)
129  process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
130  return process
131 
132 
134  distance=histoInterpolatedMax_C3d_params.dR_multicluster,
135  nBins_R=histoInterpolatedMax_C3d_params.nBins_R_histo_multicluster,
136  nBins_Phi=histoInterpolatedMax_C3d_params.nBins_Phi_histo_multicluster,
137  binSumsHisto=histoInterpolatedMax_C3d_params.binSumsHisto,
138  seed_threshold=histoInterpolatedMax_C3d_params.threshold_histo_multicluster
139  ):
140  parameters_c3d = histoInterpolatedMax_C3d_params.clone(
141  neighbour_weights = neighbour_weights_1stOrder
142  )
143  set_histomax_params(parameters_c3d, distance, nBins_R, nBins_Phi, binSumsHisto, seed_threshold)
144  process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
145  return process
146 
147 
149  distance=histoInterpolatedMax_C3d_params.dR_multicluster,
150  nBins_R=histoInterpolatedMax_C3d_params.nBins_R_histo_multicluster,
151  nBins_Phi=histoInterpolatedMax_C3d_params.nBins_Phi_histo_multicluster,
152  binSumsHisto=histoInterpolatedMax_C3d_params.binSumsHisto,
153  seed_threshold=histoInterpolatedMax_C3d_params.threshold_histo_multicluster):
154  parameters_c3d = histoInterpolatedMax_C3d_params.clone(
155  neighbour_weights = neighbour_weights_2ndOrder
156  )
157  set_histomax_params(parameters_c3d, distance, nBins_R, nBins_Phi, binSumsHisto, seed_threshold)
158  process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
159  return process
160 
161 
163  distance=histoThreshold_C3d_params.dR_multicluster,
164  nBins_R=histoThreshold_C3d_params.nBins_R_histo_multicluster,
165  nBins_Phi=histoThreshold_C3d_params.nBins_Phi_histo_multicluster,
166  binSumsHisto=histoThreshold_C3d_params.binSumsHisto,
167  seed_threshold=histoThreshold_C3d_params.threshold_histo_multicluster
168  ):
169  parameters_c3d = histoThreshold_C3d_params.clone()
170  set_histomax_params(parameters_c3d, distance, nBins_R, nBins_Phi, binSumsHisto, seed_threshold)
171  process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters = parameters_c3d
172  return process
173 
174 
176  distance_coefficientA=dr_layerbylayer,
177  distance_coefficientB=dr_layerbylayer_Bcoefficient):
178  parameters_c3d = process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters
179  parameters_c3d.dR_multicluster_byLayer_coefficientA = distance_coefficientA
180  parameters_c3d.dR_multicluster_byLayer_coefficientB = distance_coefficientB
181  return process
182 
183 
185  distance_coefficientA=dr_layerbylayer):
186  parameters_c3d = process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters
187  parameters_c3d.dR_multicluster_byLayer_coefficientA = distance_coefficientA
188  parameters_c3d.dR_multicluster_byLayer_coefficientB = cms.vdouble( [0]*(MAX_LAYERS+1) )
189  return process
190 
192  distance_coefficientA=0.03):
193  parameters_c3d = process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters
194  parameters_c3d.dR_multicluster_byLayer_coefficientA = cms.vdouble( [distance_coefficientA]*(MAX_LAYERS+1) )
195  parameters_c3d.dR_multicluster_byLayer_coefficientB = cms.vdouble( [0]*(MAX_LAYERS+1) )
196  return process
197 
199  distance_coefficientA=0.03,
200  distance_coefficientB=0.02):
201  parameters_c3d = process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters
202  parameters_c3d.dR_multicluster_byLayer_coefficientA = cms.vdouble( [distance_coefficientA]*(MAX_LAYERS+1) )
203  parameters_c3d.dR_multicluster_byLayer_coefficientB = cms.vdouble( [distance_coefficientB]*(MAX_LAYERS+1) )
204  return process
205 
206 
208  parameters_c3d = process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters
209  parameters_c3d.cluster_association = cms.string('NearestNeighbour')
210 
211  return process
212 
214 
215  parameters_c3d = process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters
216  parameters_c3d.cluster_association = cms.string('EnergySplit')
217  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_3dclustering_histoInterpolatedMax1stOrder(process, distance=histoInterpolatedMax_C3d_params.dR_multicluster, nBins_R=histoInterpolatedMax_C3d_params.nBins_R_histo_multicluster, nBins_Phi=histoInterpolatedMax_C3d_params.nBins_Phi_histo_multicluster, binSumsHisto=histoInterpolatedMax_C3d_params.binSumsHisto, seed_threshold=histoInterpolatedMax_C3d_params.threshold_histo_multicluster)
def custom_3dclustering_histoMax(process, distance=histoMax_C3d_params.dR_multicluster, nBins_R=histoMax_C3d_params.nBins_R_histo_multicluster, nBins_Phi=histoMax_C3d_params.nBins_Phi_histo_multicluster, binSumsHisto=histoMax_C3d_params.binSumsHisto, seed_threshold=histoMax_C3d_params.threshold_histo_multicluster)
def custom_3dclustering_distance(process, distance=distance_C3d_params.dR_multicluster)
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_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_histoSecondaryMax(process, distance=histoSecondaryMax_C3d_params.dR_multicluster, threshold=histoSecondaryMax_C3d_params.threshold_histo_multicluster, nBins_R=histoSecondaryMax_C3d_params.nBins_R_histo_multicluster, nBins_Phi=histoSecondaryMax_C3d_params.nBins_Phi_histo_multicluster, binSumsHisto=histoSecondaryMax_C3d_params.binSumsHisto)
def custom_3dclustering_EnergySplitAssociation(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_dbscan(process, distance=dbscan_C3d_params.dist_dbscan_multicluster, min_points=dbscan_C3d_params.minN_dbscan_multicluster)
def custom_3dclustering_histoInterpolatedMax2ndOrder(process, distance=histoInterpolatedMax_C3d_params.dR_multicluster, nBins_R=histoInterpolatedMax_C3d_params.nBins_R_histo_multicluster, nBins_Phi=histoInterpolatedMax_C3d_params.nBins_Phi_histo_multicluster, binSumsHisto=histoInterpolatedMax_C3d_params.binSumsHisto, seed_threshold=histoInterpolatedMax_C3d_params.threshold_histo_multicluster)
def custom_3dclustering_histoThreshold(process, distance=histoThreshold_C3d_params.dR_multicluster, nBins_R=histoThreshold_C3d_params.nBins_R_histo_multicluster, nBins_Phi=histoThreshold_C3d_params.nBins_Phi_histo_multicluster, binSumsHisto=histoThreshold_C3d_params.binSumsHisto, seed_threshold=histoThreshold_C3d_params.threshold_histo_multicluster)
def set_histomax_params(parameters_c3d, distance, nBins_R, nBins_Phi, binSumsHisto, seed_threshold)
def custom_3dclustering_histoMax_variableDr(process, distances=histoMaxVariableDR_C3d_params.dR_multicluster_byLayer_coefficientA, nBins_R=histoMaxVariableDR_C3d_params.nBins_R_histo_multicluster, nBins_Phi=histoMaxVariableDR_C3d_params.nBins_Phi_histo_multicluster, binSumsHisto=histoMaxVariableDR_C3d_params.binSumsHisto, seed_threshold=histoMaxVariableDR_C3d_params.threshold_histo_multicluster)
def custom_3dclustering_clusteringRadiusLayerbyLayerVariableEta(process, distance_coefficientA=dr_layerbylayer, distance_coefficientB=dr_layerbylayer_Bcoefficient)
def custom_3dclustering_clusteringRadiusLayerbyLayerFixedEta(process, distance_coefficientA=dr_layerbylayer)