CMS 3D CMS Logo

egammaIdentification.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 from Configuration.Eras.Modifier_phase2_hgcalV10_cff import phase2_hgcalV10
4 from Configuration.Eras.Modifier_phase2_hgcalV11_cff import phase2_hgcalV11
5 
6 inputs_small = ['cl3d_firstlayer', 'cl3d_coreshowerlength', 'cl3d_maxlayer', 'cl3d_srrmean']
7 inputs_large = ['cl3d_coreshowerlength', 'cl3d_showerlength', 'cl3d_firstlayer', 'cl3d_maxlayer', 'cl3d_szz', 'cl3d_srrmean', 'cl3d_srrtot', 'cl3d_seetot', 'cl3d_spptot']
8 
9 class Category:
10  def __init__(self, eta_min, eta_max, pt_min, pt_max):
11  self.eta_min = eta_min
12  self.eta_max = eta_max
13  self.pt_min = pt_min
14  self.pt_max = pt_max
15 
16 
17 categories = [
18  # Low eta
19  Category(eta_min=1.5, eta_max=2.7, pt_min=0., pt_max=1e6),
20  # High eta
21  Category(eta_min=2.7, eta_max=3.0, pt_min=0., pt_max=1e6),
22  ]
23 
24 # Identification for dRNN 2D clustering and cone 3D clustering
25 bdt_weights_drnn_cone = [
26  # Low eta
27  'L1Trigger/L1THGCal/data/egamma_id_drnn_cone_loweta_v0.xml',
28  # High eta
29  'L1Trigger/L1THGCal/data/egamma_id_drnn_cone_higheta_v0.xml',
30  ]
31 
32 working_points_drnn_cone = [
33  # Low eta
34  {
35  '900':0.14057436,
36  '950':0.05661769,
37  '975':-0.01481255,
38  '995':-0.19656579,
39  },
40  # High eta
41  {
42  '900':0.05995301,
43  '950':-0.02947988,
44  '975':-0.10577436,
45  '995':-0.26401181,
46  },
47  ]
48 
49 
50 # Identification for dRNN 2D clustering and DBSCAN 3D clustering
51 bdt_weights_drnn_dbscan = [
52  # Low eta
53  'L1Trigger/L1THGCal/data/egamma_id_drnn_dbscan_loweta_v0.xml',
54  # High eta
55  'L1Trigger/L1THGCal/data/egamma_id_drnn_dbscan_higheta_v0.xml',
56  ]
57 
58 working_points_drnn_dbscan = [
59  # Low eta
60  {
61  '900':0.08421164,
62  '950':0.06436077,
63  '975':-0.04547527,
64  '995':-0.23717142,
65  },
66  # High eta
67  {
68  '900':0.05559443,
69  '950':-0.0171725,
70  '975':-0.10630798,
71  '995':-0.27290947,
72  },
73  ]
74 
75 # Identification for 3D HistoMax clustering: switch between configurations for v8 and v9 geometry
76 input_features_histomax = {
77  "v8_352":inputs_small,
78  "v9_370":inputs_large,
79  "v9_394":inputs_large,
80  "v10_3151":inputs_large
81  }
82 
83 bdt_weights_histomax = {
84  "v8_352":[ #trained using TPG software version 3.5.2
85  # Low eta
86  'L1Trigger/L1THGCal/data/egamma_id_histomax_352_loweta_v0.xml',
87  # High eta
88  'L1Trigger/L1THGCal/data/egamma_id_histomax_352_higheta_v0.xml'
89  ],
90  "v9_370":[ #trained using TPG software version 3.7.0
91  # Low eta
92  'L1Trigger/L1THGCal/data/egamma_id_histomax_370_loweta_v0.xml',
93  # High eta
94  'L1Trigger/L1THGCal/data/egamma_id_histomax_370_higheta_v0.xml'
95  ],
96  "v9_394":[ #trained using TPG software version 3.9.4
97  # Low eta
98  'L1Trigger/L1THGCal/data/egamma_id_histomax_394_loweta_v0.xml',
99  # High eta
100  'L1Trigger/L1THGCal/data/egamma_id_histomax_394_higheta_v0.xml'
101  ],
102  "v10_3151":[ #trained using TPG software version 3.15.1
103  # Low eta
104  'L1Trigger/L1THGCal/data/egamma_id_histomax_3151_loweta_v0.xml',
105  # High eta
106  'L1Trigger/L1THGCal/data/egamma_id_histomax_3151_higheta_v0.xml'
107  ]
108  }
109 
110 working_points_histomax = {
111  "v8_352":[
112  # Low eta
113  {
114  '900':0.19146989,
115  '950':0.1379665,
116  '975':0.03496629,
117  '995':-0.24383164,
118  },
119  # High eta
120  {
121  '900':0.13347613,
122  '950':0.04267797,
123  '975':-0.03698097,
124  '995':-0.23077505,
125  }
126  ],
127  "v9_370":[
128  # Low eta
129  {
130  '900':0.8815851, # epsilon_b = 2.5%
131  '950':0.5587649, # epsilon_b = 4.0%
132  '975':-0.1937952, # epsilon_b = 5.5%
133  '995':-0.9394884, # epsilon_b = 10.1%
134  },
135  # High eta
136  {
137  '900':0.7078400, #epsilon_b = 3.5%
138  '950':-0.0239623, #epsilon_b = 6.9%
139  '975':-0.7045071, #epsilon_b = 11.6%
140  '995':-0.9811426, #epsilon_b = 26.1%
141  }
142  ],
143  "v9_394":[
144  # Low eta
145  {
146  '900':0.9794103, # epsilon_b = 1.9%
147  '950':0.9052764, # epsilon_b = 3.9%
148  '975':0.5276631, # epsilon_b = 6.6%
149  '995':-0.9153535, # epsilon_b = 20.4%
150  },
151  # High eta
152  {
153  '900':0.8825340, #epsilon_b = 1.0%
154  '950':0.2856039, #epsilon_b = 1.7%
155  '975':-0.5274948, #epsilon_b = 2.8%
156  '995':-0.9864445, #epsilon_b = 7.6%
157  }
158  ],
159  "v10_3151": [
160  # Low eta
161  {
162  '900': 0.9903189,
163  '950': 0.9646683,
164  '975': 0.8292287,
165  '995': -0.7099538,
166  },
167  # High eta
168  {
169  '900': 0.9932326,
170  '950': 0.9611762,
171  '975': 0.7616282,
172  '995': -0.9163715,
173  }
174  ]
175  }
176 
177 tight_wp = ['975', '900']
178 loose_wp = ['995', '950']
179 
180 
181 egamma_identification_drnn_cone = cms.PSet(
182  Inputs=cms.vstring(inputs_small),
183  CategoriesEtaMin=cms.vdouble([cat.eta_min for cat in categories]),
184  CategoriesEtaMax=cms.vdouble([cat.eta_max for cat in categories]),
185  CategoriesPtMin=cms.vdouble([cat.pt_min for cat in categories]),
186  CategoriesPtMax=cms.vdouble([cat.pt_max for cat in categories]),
187  Weights=cms.vstring(bdt_weights_drnn_cone),
188  WorkingPoints=cms.vdouble([wps[eff] for wps,eff in zip(working_points_drnn_cone,tight_wp)]),
189  )
190 
191 egamma_identification_drnn_dbscan = cms.PSet(
192  Inputs=cms.vstring(inputs_small),
193  CategoriesEtaMin=cms.vdouble([cat.eta_min for cat in categories]),
194  CategoriesEtaMax=cms.vdouble([cat.eta_max for cat in categories]),
195  CategoriesPtMin=cms.vdouble([cat.pt_min for cat in categories]),
196  CategoriesPtMax=cms.vdouble([cat.pt_max for cat in categories]),
197  Weights=cms.vstring(bdt_weights_drnn_dbscan),
198  WorkingPoints=cms.vdouble([wps[eff] for wps,eff in zip(working_points_drnn_dbscan,tight_wp)]),
199  )
200 
201 egamma_identification_histomax = cms.PSet(
202  Inputs=cms.vstring(input_features_histomax['v10_3151']),
203  CategoriesEtaMin=cms.vdouble([cat.eta_min for cat in categories]),
204  CategoriesEtaMax=cms.vdouble([cat.eta_max for cat in categories]),
205  CategoriesPtMin=cms.vdouble([cat.pt_min for cat in categories]),
206  CategoriesPtMax=cms.vdouble([cat.pt_max for cat in categories]),
207  Weights=cms.vstring(bdt_weights_histomax['v10_3151']),
208  WorkingPoints=cms.VPSet([
209  cms.PSet(
210  Name=cms.string('tight'),
211  WorkingPoint=cms.vdouble([wps[eff] for wps,eff in zip(working_points_histomax['v10_3151'],tight_wp)])
212  ),
213  cms.PSet(
214  Name=cms.string('loose'),
215  WorkingPoint=cms.vdouble([wps[eff] for wps,eff in zip(working_points_histomax['v10_3151'],loose_wp)])
216  ),
217  ])
218  )
219 
220 phase2_hgcalV10.toModify(egamma_identification_histomax,
221  Inputs=cms.vstring(input_features_histomax['v10_3151']),
222  Weights=cms.vstring(bdt_weights_histomax['v10_3151']),
223  WorkingPoints=cms.VPSet([
224  cms.PSet(
225  Name=cms.string('tight'),
226  WorkingPoint=cms.vdouble([wps[eff] for wps,eff in zip(working_points_histomax['v10_3151'],tight_wp)])
227  ),
228  cms.PSet(
229  Name=cms.string('loose'),
230  WorkingPoint=cms.vdouble([wps[eff] for wps,eff in zip(working_points_histomax['v10_3151'],loose_wp)])
231  ),
232  ])
233  )
234 
235 phase2_hgcalV11.toModify(egamma_identification_histomax,
236  Inputs=cms.vstring(input_features_histomax['v10_3151']),
237  Weights=cms.vstring(bdt_weights_histomax['v10_3151']),
238  WorkingPoints=cms.VPSet([
239  cms.PSet(
240  Name=cms.string('tight'),
241  WorkingPoint=cms.vdouble([wps[eff] for wps,eff in zip(working_points_histomax['v10_3151'],tight_wp)])
242  ),
243  cms.PSet(
244  Name=cms.string('loose'),
245  WorkingPoint=cms.vdouble([wps[eff] for wps,eff in zip(working_points_histomax['v10_3151'],loose_wp)])
246  ),
247  ])
248  )
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float zip(ConstView const &tracks, int32_t i)
Definition: TracksSoA.h:90
def __init__(self, eta_min, eta_max, pt_min, pt_max)