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