CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
clustering3d.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from L1Trigger.L1THGCal.hgcalBackEndLayer2Producer_cfi import distance_C3d_params, \
3  dbscan_C3d_params, \
4  histoMax_C3d_clustering_params, \
5  histoMax_C3d_seeding_params, \
6  histoMaxVariableDR_C3d_params, \
7  histoMaxXYVariableDR_C3d_params, \
8  histoSecondaryMax_C3d_params, \
9  histoInterpolatedMax_C3d_params, \
10  histoThreshold_C3d_params, \
11  neighbour_weights_1stOrder, \
12  neighbour_weights_2ndOrder
13 
14 from L1Trigger.L1THGCal.customClustering import set_histomax_clustering_params
15 from L1Trigger.L1THGCal.customHistoSeeding import set_histomax_seeding_params
16 
17 
18 def create_distance(process, inputs,
19  distance=distance_C3d_params.dR_multicluster
20  ):
21  producer = process.hgcalBackEndLayer2Producer.clone(
22  InputCluster = cms.InputTag('{}:HGCalBackendLayer1Processor2DClustering'.format(inputs))
23  )
24  producer.ProcessorParameters.C3d_parameters = distance_C3d_params.clone(
25  dR_multicluster = distance
26  )
27  return producer
28 
29 
30 def create_dbscan(process, inputs,
31  distance=dbscan_C3d_params.dist_dbscan_multicluster,
32  min_points=dbscan_C3d_params.minN_dbscan_multicluster
33  ):
34  producer = process.hgcalBackEndLayer2Producer.clone(
35  InputCluster = cms.InputTag('{}:HGCalBackendLayer1Processor2DClustering'.format(inputs))
36  )
37  producer.ProcessorParameters.C3d_parameters = dbscan_C3d_params.clone(
38  dist_dbscan_multicluster = distance,
39  minN_dbscan_multicluster = min_points
40  )
41  return producer
42 
43 
44 def create_histoMax(process, inputs,
45  distance=histoMax_C3d_clustering_params.dR_multicluster,
46  nBins_X1=histoMax_C3d_seeding_params.nBins_X1_histo_multicluster,
47  nBins_X2=histoMax_C3d_seeding_params.nBins_X2_histo_multicluster,
48  binSumsHisto=histoMax_C3d_seeding_params.binSumsHisto,
49  seed_threshold=histoMax_C3d_seeding_params.threshold_histo_multicluster,
50  shape_threshold=histoMax_C3d_clustering_params.shape_threshold,
51  shape_distance=histoMax_C3d_clustering_params.shape_distance,
52  ):
53  producer = process.hgcalBackEndLayer2Producer.clone(
54  InputCluster = cms.InputTag('{}:HGCalBackendLayer1Processor2DClustering'.format(inputs))
55  )
56  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters = histoMax_C3d_clustering_params.clone()
57  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters = histoMax_C3d_seeding_params.clone()
58  set_histomax_seeding_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters, nBins_X1, nBins_X2, binSumsHisto,
59  seed_threshold)
60  set_histomax_clustering_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters, distance, shape_threshold, shape_distance)
61 
62  return producer
63 
64 
65 def create_histoMax_variableDr(process, inputs,
66  distances=histoMaxVariableDR_C3d_params.dR_multicluster_byLayer_coefficientA,
67  nBins_X1=histoMax_C3d_seeding_params.nBins_X1_histo_multicluster,
68  nBins_X2=histoMax_C3d_seeding_params.nBins_X2_histo_multicluster,
69  binSumsHisto=histoMax_C3d_seeding_params.binSumsHisto,
70  seed_threshold=histoMax_C3d_seeding_params.threshold_histo_multicluster,
71  shape_threshold=histoMaxVariableDR_C3d_params.shape_threshold,
72  shape_distance=histoMaxVariableDR_C3d_params.shape_distance,
73  ):
74  producer = process.hgcalBackEndLayer2Producer.clone(
75  InputCluster = cms.InputTag('{}:HGCalBackendLayer1Processor2DClustering'.format(inputs))
76  )
77  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters = histoMax_C3d_clustering_params.clone(
78  dR_multicluster_byLayer_coefficientA = distances
79  )
80  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters = histoMax_C3d_seeding_params.clone()
81 
82  set_histomax_seeding_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters, nBins_X1, nBins_X2, binSumsHisto,
83  seed_threshold)
84  set_histomax_clustering_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters, 0, shape_threshold, shape_distance)
85 
86  return producer
87 
88 
89 def create_histoMaxXY_variableDr(process, inputs,
90  distances=histoMaxVariableDR_C3d_params.dR_multicluster_byLayer_coefficientA,
91  nBins_X1=histoMaxXYVariableDR_C3d_params.nBins_X1_histo_multicluster,
92  nBins_X2=histoMaxXYVariableDR_C3d_params.nBins_X2_histo_multicluster,
93  seed_threshold=histoMaxXYVariableDR_C3d_params.threshold_histo_multicluster,
94  shape_threshold=histoMaxVariableDR_C3d_params.shape_threshold,
95  shape_distance=histoMaxVariableDR_C3d_params.shape_distance,
96  ):
97  producer = process.hgcalBackEndLayer2Producer.clone(
98  InputCluster = cms.InputTag('{}:HGCalBackendLayer1Processor2DClustering'.format(inputs))
99  )
100  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters = histoMax_C3d_clustering_params.clone(
101  dR_multicluster_byLayer_coefficientA = distances
102  )
103  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters = histoMaxXYVariableDR_C3d_params.clone()
104 
105  set_histomax_seeding_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters, nBins_X1, nBins_X2, histoMaxXYVariableDR_C3d_params.binSumsHisto,
106  seed_threshold)
107  set_histomax_clustering_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters, 0, shape_threshold, shape_distance)
108 
109  return producer
110 
111 
112 def create_histoInterpolatedMax1stOrder(process, inputs,
113  distance=histoMax_C3d_clustering_params.dR_multicluster,
114  nBins_X1=histoInterpolatedMax_C3d_params.nBins_X1_histo_multicluster,
115  nBins_X2=histoInterpolatedMax_C3d_params.nBins_X2_histo_multicluster,
116  binSumsHisto=histoInterpolatedMax_C3d_params.binSumsHisto,
117  seed_threshold=histoInterpolatedMax_C3d_params.threshold_histo_multicluster,
118  shape_threshold=histoMax_C3d_clustering_params.shape_threshold,
119  shape_distance=histoMax_C3d_clustering_params.shape_distance,
120  ):
121  producer = process.hgcalBackEndLayer2Producer.clone(
122  InputCluster = cms.InputTag('{}:HGCalBackendLayer1Processor2DClustering'.format(inputs))
123  )
124  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters = histoInterpolatedMax_C3d_params.clone(
125  neighbour_weights = neighbour_weights_1stOrder
126  )
127  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters = histoMax_C3d_clustering_params.clone()
128 
129  set_histomax_seeding_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters, nBins_X1, nBins_X2, binSumsHisto,
130  seed_threshold)
131  set_histomax_clustering_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters, distance, shape_threshold, shape_distance)
132 
133  return producer
134 
135 
136 def create_histoInterpolatedMax2ndOrder(process, inputs,
137  distance=histoMax_C3d_clustering_params.dR_multicluster,
138  nBins_X1=histoInterpolatedMax_C3d_params.nBins_X1_histo_multicluster,
139  nBins_X2=histoInterpolatedMax_C3d_params.nBins_X2_histo_multicluster,
140  binSumsHisto=histoInterpolatedMax_C3d_params.binSumsHisto,
141  seed_threshold=histoInterpolatedMax_C3d_params.threshold_histo_multicluster,
142  shape_threshold=histoMax_C3d_clustering_params.shape_threshold,
143  shape_distance=histoMax_C3d_clustering_params.shape_distance,
144  ):
145  producer = process.hgcalBackEndLayer2Producer.clone(
146  InputCluster = cms.InputTag('{}:HGCalBackendLayer1Processor2DClustering'.format(inputs))
147  )
148  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters = histoInterpolatedMax_C3d_params.clone(
149  neighbour_weights = neighbour_weights_2ndOrder
150  )
151  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters = histoMax_C3d_clustering_params.clone()
152  set_histomax_seeding_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters, nBins_X1, nBins_X2, binSumsHisto,
153  seed_threshold)
154  set_histomax_clustering_params(producer.ProcessorParameters.histoMax_C3d_clustering_parameters, distance, shape_threshold, shape_distance)
155 
156  return producer
157 
158 
159 def create_histoThreshold(process, inputs,
160  threshold=histoThreshold_C3d_params.threshold_histo_multicluster,
161  distance=histoMax_C3d_clustering_params.dR_multicluster,
162  nBins_X1=histoThreshold_C3d_params.nBins_X1_histo_multicluster,
163  nBins_X2=histoThreshold_C3d_params.nBins_X2_histo_multicluster,
164  binSumsHisto=histoThreshold_C3d_params.binSumsHisto,
165  shape_threshold=histoMax_C3d_clustering_params.shape_threshold,
166  shape_distance=histoMax_C3d_clustering_params.shape_distance,
167  ):
168  producer = process.hgcalBackEndLayer2Producer.clone(
169  InputCluster = cms.InputTag('{}:HGCalBackendLayer1Processor2DClustering'.format(inputs))
170  )
171  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters = histoThreshold_C3d_params.clone()
172  producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters = histoMax_C3d_clustering_params.clone()
173  set_histomax_seeding_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters, nBins_X1, nBins_X2, binSumsHisto,
174  seed_threshold)
175  set_histomax_clustering_params(producer.ProcessorParameters.C3d_parameters.histoMax_C3d_clustering_parameters, distance, shape_threshold, shape_distance)
176 
177  return producer
def create_histoMaxXY_variableDr
Definition: clustering3d.py:96
def create_histoInterpolatedMax2ndOrder
def create_histoInterpolatedMax1stOrder
def set_histomax_clustering_params
def create_distance
Definition: clustering3d.py:20
def create_histoMax_variableDr
Definition: clustering3d.py:73
def create_histoThreshold
def create_histoMax
Definition: clustering3d.py:52