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