Skip to content

Conversation

@cerminar
Copy link

@cerminar cerminar commented Apr 4, 2023

PR description:

This PR integrates the new Composite ID for TkElectrons in the endcap.

The default Layer-1 and Layer-2 collections will now run the new algorithm. New collections running the old algorithm are kept for physics validation purposes.

See Peter's talk @ Level-1 Trigger Weekly Meeting

PR validation:

A full set of validation plots is available at:
https://cerminar.web.cern.ch/cerminar/plots/V91-CMSSW12.5/

Barrel objects are untouched.
TkEm objects are untouched.

PR to master: cms-sw#41290

@cerminar cerminar marked this pull request as draft April 4, 2023 10:11
@aloeliger aloeliger added Phase-2 Pertains to phase-2 development Algorithm Development labels Apr 4, 2023
@aloeliger
Copy link

@cerminar Would you have any objection to squashing these commits?

@cerminar
Copy link
Author

cerminar commented Apr 4, 2023

@aloeliger, no objection: they are way too many. I will give it a try tomorrow.

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

Attempts to compile this PR succeeded!

Info Value
return code 0
command cmsenv && scram b -j 8

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found no issues with the code checks!

Info Value
return code 0
command cmsenv && scram b -k -j 8 code-checks && scram b -k -j 8 code-checks

I found no issues with the headers!

Info Value
return code 0
command cmsenv && scram b -k -j 8 check-headers

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found no files with code format issues!

Info Value
return code 0
command cmsenv && scram b -k -j 8 code-format-all

Comment on lines +64 to +85
#pragma HLS inline
#pragma HLS inline region recursive
#endif
assert(T::BITWIDTH_SLIM <= NB);
for (unsigned int i = 0; i < N; ++i) {
#ifdef __SYNTHESIS__
#pragma HLS unroll
#endif
data[i + OFFS] = objs[i].pack_slim();
}
}

template <unsigned int N, unsigned int OFFS = 0, typename T, int NB>
inline void l1pf_pattern_unpack_slim(const ap_uint<NB> data[], T objs[N]) {
#ifdef __SYNTHESIS__
#pragma HLS inline
#pragma HLS inline region recursive
#endif
assert(T::BITWIDTH_SLIM <= NB);
for (unsigned int i = 0; i < N; ++i) {
#ifdef __SYNTHESIS__
#pragma HLS unroll

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, are these pragmas understood at the CMSSW level? The checking script may not have caught it, but it may generate unknown pragma warnings in central CMSSW

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they're protected by the #ifdef __SYNTHESIS__, which is defined by HLS during synthesis but not by gcc ir clang during CMSSW compilation.

Comment on lines +178 to +179
//FIXME: 3 bits would be enough
redChi2Bin_t hwRedChi2Bend; // 4 bits

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be fixed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not now, the comment is for future reference.

@@ -0,0 +1 @@
{"max_depth": 4, "n_trees": 10, "n_classes": 2, "n_features": 11, "trees": [[{"feature": [1, 2, 0, 3, 0, 8, 2, 3, 5, 5, 1, 5, 2, 1, 1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [0.140625, 0.264648438, 11.4795256, 3.5, 16.6602802, 8.5, 0.245117188, -2.5, 0.0630929098, 0.585964918, 0.109375, 0.594282091, 0.252929688, 0.171875, 0.171875, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "children_left": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.415820152, 0.556879818, 0.25938049, -0.557010412, -0.523303628, 0.309383601, 0.345235407, -0.177057937, -0.577262163, -0.463166773, -0.295891047, -0.521123528, 0.248503745, -0.140788257, -0.208826631, -0.495121777], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}], [{"feature": [1, 1, 0, 4, 0, 8, 2, 8, 3, 8, 6, 0, 3, 5, 5, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [0.140625, 0.109375, 12.9026089, -13.5, 15.8960209, 7.5, 0.256835938, 2.5, -2.5, 3.5, 19.5, 8.71144676, 2.5, 0.981220245, 1.01574898, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "children_left": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.358234763, 0.404870719, -0.173584998, 0.459649861, -0.37743035, -0.0318962, 0.344911397, -0.540425003, -0.450546473, -0.387152672, -0.232723728, -0.485472769, 0.149142668, -0.281907678, -0.319123685, -0.469176918], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}], [{"feature": [1, 2, 0, 0, 0, 8, 6, 1, 1, 0, 8, 5, 3, 2, 1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [0.140625, 0.256835938, 9.48655319, 6.65358782, 30.484045, 9.5, 16.5, 0.109375, 0.109375, 11.8594818, 9.5, 0.701351345, -2.5, 0.260742188, 0.171875, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "children_left": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.17315872, -0.212719589, 0.398817331, 0.243386999, -0.380143821, -0.169372901, 0.430269539, -0.376156092, -0.378161937, 0.694794357, -0.450359076, -0.180556566, 0.0424509495, -0.275738239, -0.161556199, -0.390238196], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}], [{"feature": [1, 1, 0, 4, 0, 8, 2, 8, 2, 2, 5, 5, 3, 1, 6, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [0.140625, 0.109375, 7.69071722, -13.5, 14.5519686, 8.5, 0.254882812, 2.5, 0.256835938, 0.219726562, 0.951564014, 0.0752535984, -1.5, 0.171875, 16.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "children_left": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.301308185, 0.304734617, 0.359152883, 0.0685707554, 0.139380425, -0.196517661, 0.26767078, -0.092287831, 0.0782259256, -0.350551367, -0.37530303, -0.175267071, 0.193004847, -0.116770878, -0.22124359, -0.341241091], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}], [{"feature": [1, 3, 1, 3, 5, 3, 3, 5, 4, 10, 5, 3, 5, 3, 3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [0.109375, 4.5, 0.171875, -2.5, 0.0630929098, 2.5, 2.5, 0.0503542498, -26.5, 1.5, 0.0889862627, -1.5, 0.0574394017, -2.5, 3.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "children_left": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.528415024, -0.341509908, -0.224257782, 0.332276493, 0.414823771, -0.166062027, -0.161982179, -0.427514702, -0.287400812, 0.144089252, 0.727860332, -0.371313125, -0.353289098, -0.11641188, -0.313981056, -0.364676535], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}], [{"feature": [1, 4, 2, 8, 10, 3, 2, 0, 4, 2, -2, 3, 3, 0, 0, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [0.109375, -13.5, 0.262695312, 2.5, 6.5, 1.5, 0.290039062, 6.54269695, -39.5, 0.252929688, 0, -2.5, 3.5, 9.02065659, 47.6570053, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.0, -2.0], "children_left": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 29, 21, 23, 25, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 30, 22, 24, 26, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.20732594, 0, 0, 0, 0, -0.0745446905, -0.490941644, -0.30292502, 0.351926744, 0.317744046, 0.0299588144, -0.341244638, 0.0837424397, -0.1667739, -0.344421178, -0.299592078, -0.171457857, -0.324574828, 0.0762122124, -1.20732594, -1.20732594], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 11, 11, 12, 12, 13, 13, 14, 14, 10, 10], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}], [{"feature": [1, 0, 2, 5, 2, 0, 0, 0, 8, 10, 3, 8, 5, 5, 6, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [0.109375, 7.04383469, 0.254882812, 0.0827398598, 0.280273438, 14.939868, 9.47421837, 2.81626415, 9.5, 3.5, 1.5, 3.5, 1.05517507, 0.057422813, 16.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "children_left": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.0296402257, 0.372503281, -0.279174328, 0.221156016, 0.313555121, 0.181570679, 0.0492865816, -0.56892544, -0.23718825, -0.00179062958, 0.199230328, -0.261860698, 0.66392386, -0.278425187, -0.0756268799, -0.2803078], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}], [{"feature": [1, 0, 3, 10, 2, 3, 5, 3, 2, 10, 8, 0, 6, 2, 3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [0.109375, 20.5230389, 2.5, 5.5, 0.280273438, -2.5, 0.0702819526, 4.5, 0.241210938, 3.5, 9.5, 39.9494553, 17.5, 0.291992188, 3.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "children_left": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.183256373, -0.15534921, 0.0191810895, -1.47547853, 0.31037724, 0.204687983, 0.284539312, -0.43629247, -0.310324848, 0.889182568, 0.0579996705, -0.232304126, 0.737877786, -0.190356895, -0.212541878, -0.326160461], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}], [{"feature": [0, 3, 5, 1, 3, 6, 0, -2, 3, 1, 5, 4, 0, 6, 9, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [20.5809975, -2.5, 1.04217935, 0.078125, 1.5, 19.5, 58.5983238, 0, -4.5, 0.234375, 0.0664517879, -10.0, 24.7252579, 11.5, 7.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.0, -2.0], "children_left": [1, 3, 5, 7, 9, 11, 13, 29, 15, 17, 19, 21, 23, 25, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 30, 16, 18, 20, 22, 24, 26, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0.363402009, 0, 0, 0, 0, 0, 0, 0, -0.312803566, -0.204151258, 0.0456621125, -0.14882116, 0.20181866, -0.25203824, -1.20155859, 0.277422816, -0.404247284, 0.160260811, 0.580196619, -0.262717366, 0.406997979, -0.171044543, 0.363402009, 0.363402009], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 7, 7], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}], [{"feature": [0, 2, 5, 3, 2, 2, 0, 1, 3, 4, 5, 6, 0, 9, 9, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], "threshold": [30.4840431, 0.245117188, 1.16153455, -1.5, 0.282226562, 0.280273438, 58.5983238, 0.140625, 2.5, 9.5, 0.948028684, 11.5, 35.0835876, 3.5, 7.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "children_left": [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "children_right": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "value": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0297101662, -0.228048578, 0.0833817348, -0.235787436, -0.063608937, -0.25884518, -0.224756852, -0.356927872, -0.296937495, 0.299284011, 0.524167776, -0.222849742, -0.0959210619, -0.489832073, 0.43333599, -0.154233307], "parent": [-1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14], "depth": [0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], "iLeaf": [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}]], "init_predict": [0, 0], "norm": 1} No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file will likely need to go into data externals and cannot be committed into regular CMSSW. Likely nor will it be allowed into the history (if just deleted)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aloeliger How would you like to proceed? In the squash, I can single out the commits touching this file. We can then further squash those out for the integration in the CMSSW master, once the json makes it to the data repository. Is that ok?

Comment on lines 1 to 63
#ifndef CC_INVERSION_H__
#define CC_INVERSION_H__

constexpr int ceillog2(int x) { return (x <= 2) ? 1 : 1 + ceillog2((x + 1) / 2); }

template <class data_T, int N>
inline float real_val_from_idx(unsigned i) {
// Treat the index as the top N bits
static constexpr int NB = ceillog2(N); // number of address bits for table
data_T x(0);
// The MSB of 1 is implicit in the table
x[x.width - 1] = 1;
// So we can use the next NB bits for real data
x(x.width - 2, x.width - NB - 1) = i;
return (float)x;
}

template <class data_T, int N>
inline unsigned idx_from_real_val(data_T x) {
// Slice the top N bits to get an index into the table
static constexpr int NB = ceillog2(N); // number of address bits for table
// Slice the top-1 NB bits of the value
// the MSB of '1' is implicit, so only slice below that
ap_uint<NB> y = x(x.width - 2, x.width - NB - 1);
return (unsigned)y(NB - 1, 0);
}

template <class data_T, class table_T, int N>
void init_invert_table(table_T table_out[N]) {
// The template data_T is the data type used to address the table
for (unsigned i = 0; i < N; i++) {
float x = real_val_from_idx<data_T, N>(i);
table_T inv_x = 1 / x;
table_out[i] = inv_x;
}
}

template <class in_t, class table_t, int N>
table_t invert_with_shift(in_t in) {
table_t inv_table[N];
init_invert_table<in_t, table_t, N>(inv_table);

// find the first '1' in the denominator
int msb = 0;
for (int b = 0; b < in.width; b++) {
// #pragma HLS unroll
if (in[b])
msb = b;
}
// shift up the denominator such that the left-most bit (msb) is '1'
in_t in_shifted = in << (in.width - msb - 1);
// lookup the inverse of the shifted input
int idx = idx_from_real_val<in_t, N>(in_shifted);
table_t inv_in = inv_table[idx];
// shift the output back
table_t out = inv_in << (in.width - msb - 1);
return out;
}

#endif No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions should be preferably name-spaced instead of global.

Comment on lines 102 to 103
// FIXME: maybe we round these?
const CompIDParameters &compIDparams = {0.7927004, 0.9826955, "compositeID.json"},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be fixed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rounded!

Comment on lines +199 to +205
// FIXME: find best sort criteria, for now we use dpt
std::sort(candidates.begin(),
candidates.end(),
[](const CompositeCandidate &a, const CompositeCandidate &b) -> bool { return a.dpt < b.dpt; });
unsigned int nCandPerCluster = std::min<unsigned int>(candidates.size(), cfg.nCompCandPerCluster);
if (nCandPerCluster == 0)
continue;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be fixed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not now: comment for future reference.

Comment on lines +13 to +14
// FIXME: we use a spare space in the word for hoe which is not in the current interface
ap_uint<12> w_hoe = in(127, 116);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be fixed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not now: comment for future reference.

Comment on lines 24 to 26
// FIXME: variables use by composite-ID need to be added here
out.hwSrrTot = w_srrtot * l1ct::srrtot_t(l1ct::Scales::SRRTOT_LSB);
out.hwMeanZ = (w_meanz == 0) ? l1ct::meanz_t(0) : l1ct::meanz_t(w_meanz - l1ct::meanz_t(l1ct::Scales::MEANZ_OFFSET));
out.hwHoe = w_hoe * l1ct::hoe_t(l1ct::Scales::HOE_LSB);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be fixed?

out.hwMeanZ = (w_meanz == 0) ? l1ct::meanz_t(0) : l1ct::meanz_t(w_meanz - l1ct::meanz_t(l1ct::Scales::MEANZ_OFFSET));
out.hwHoe = w_hoe * l1ct::hoe_t(l1ct::Scales::HOE_LSB);

// std::cout << "[HadCaloObjEmu] meanz in: " << w_meanz << " out: " << out.hwMeanZ << std::endl;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented code

Comment on lines 1 to 139
import argparse
import sys

# example: cmsRun L1Trigger/Phase2L1ParticleFlow/test/make_l1ct_patternFiles_cfg.py -- --dumpFilesOFF
# example: cmsRun L1Trigger/Phase2L1ParticleFlow/test/make_l1ct_patternFiles_cfg.py -- --dumpFilesOFF

parser = argparse.ArgumentParser(prog=sys.argv[0], description='Optional parameters')

parser.add_argument("--dumpFilesOFF", help="switch on dump file production", action="store_true", default=False)
parser.add_argument("--patternFilesOFF", help="switch on Layer-1 pattern file production", action="store_true", default=False)

argv = sys.argv[:]
if '--' in argv:
argv.remove("--")
args, unknown = parser.parse_known_args(argv)

if args.dumpFilesOFF:
print(f'Switching off dump file creation: dumpFilesOFF is {args.dumpFilesOFF}')
if args.patternFilesOFF:
print(f'Switching off pattern file creation: patternFilesOFF is {args.patternFilesOFF}')


import FWCore.ParameterSet.Config as cms
from Configuration.StandardSequences.Eras import eras

process = cms.Process("RESP", eras.Phase2C9)

process.load('Configuration.StandardSequences.Services_cff')
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True), allowUnscheduled = cms.untracked.bool(False) )
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1000))
process.MessageLogger.cerr.FwkReport.reportEvery = 1

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring('file:inputs110X.root'),
inputCommands = cms.untracked.vstring("keep *",
"drop l1tPFClusters_*_*_*",
"drop l1tPFTracks_*_*_*",
"drop l1tPFCandidates_*_*_*",
"drop l1tTkPrimaryVertexs_*_*_*")
)

process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D49_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff') # needed to read HCal TPs
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')

from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, '123X_mcRun4_realistic_v3', '')

process.load('L1Trigger.Phase2L1ParticleFlow.l1ctLayer1_cff')
process.load('L1Trigger.Phase2L1ParticleFlow.l1ctLayer2EG_cff')
process.load('L1Trigger.L1TTrackMatch.l1tGTTInputProducer_cfi')
process.load('L1Trigger.VertexFinder.l1tVertexProducer_cfi')
process.l1tVertexFinderEmulator = process.l1tVertexProducer.clone()
process.l1tVertexFinderEmulator.VertexReconstruction.Algorithm = "fastHistoEmulation"
process.l1tVertexFinderEmulator.l1TracksInputTag = cms.InputTag("l1tGTTInputProducer", "Level1TTTracksConverted")
from L1Trigger.Phase2L1GMT.gmt_cfi import l1tStandaloneMuons
process.l1tSAMuonsGmt = l1tStandaloneMuons.clone()

from L1Trigger.Phase2L1ParticleFlow.l1tSeedConePFJetProducer_cfi import l1tSeedConePFJetEmulatorProducer
from L1Trigger.Phase2L1ParticleFlow.l1tDeregionizerProducer_cfi import l1tDeregionizerProducer
from L1Trigger.Phase2L1ParticleFlow.l1tJetFileWriter_cfi import l1tSeededConeJetFileWriter
process.l1tLayer2Deregionizer = l1tDeregionizerProducer.clone()
process.l1tLayer2SeedConeJetsCorrected = l1tSeedConePFJetEmulatorProducer.clone(L1PFObject = cms.InputTag('l1tLayer2Deregionizer', 'Puppi'),
doCorrections = cms.bool(True),
correctorFile = cms.string("L1Trigger/Phase2L1ParticleFlow/data/jecs/jecs_20220308.root"),
correctorDir = cms.string('L1PuppiSC4EmuJets'))
process.l1tLayer2SeedConeJetWriter = l1tSeededConeJetFileWriter.clone(jets = "l1tLayer2SeedConeJetsCorrected")

process.l1tLayer1Barrel9 = process.l1tLayer1Barrel.clone()
process.l1tLayer1Barrel9.puAlgo.nFinalSort = 32
process.l1tLayer1Barrel9.regions[0].etaBoundaries = [ -1.5, -0.5, 0.5, 1.5 ]
process.l1tLayer1Barrel9.boards=cms.VPSet(
cms.PSet(
regions=cms.vuint32(*[0+9*ie+i for ie in range(3) for i in range(3)])),
cms.PSet(
regions=cms.vuint32(*[3+9*ie+i for ie in range(3) for i in range(3)])),
cms.PSet(
regions=cms.vuint32(*[6+9*ie+i for ie in range(3) for i in range(3)])),
)

from L1Trigger.Phase2L1ParticleFlow.l1ctLayer1_patternWriters_cff import *
if not args.patternFilesOFF:
process.l1tLayer1Barrel.patternWriters = cms.untracked.VPSet(*barrelWriterConfigs)
# process.l1tLayer1Barrel9.patternWriters = cms.untracked.VPSet(*barrel9WriterConfigs) # not enabled for now
process.l1tLayer1HGCal.patternWriters = cms.untracked.VPSet(*hgcalWriterConfigs)
process.l1tLayer1HGCalNoTK.patternWriters = cms.untracked.VPSet(*hgcalNoTKWriterConfigs)
process.l1tLayer1HF.patternWriters = cms.untracked.VPSet(*hfWriterConfigs)

process.runPF = cms.Path(
process.l1tSAMuonsGmt +
process.l1tGTTInputProducer +
process.l1tVertexFinderEmulator +
process.l1tLayer1Barrel +
process.l1tLayer1Barrel9 +
process.l1tLayer1HGCal +
process.l1tLayer1HGCalNoTK +
process.l1tLayer1HF +
process.l1tLayer1 +
process.l1tLayer2Deregionizer +
process.l1tLayer2SeedConeJetsCorrected +
# process.l1tLayer2SeedConeJetWriter +
process.l1tLayer2EG
)
process.runPF.associate(process.L1TLayer1TaskInputsTask)


#####################################################################################################################
## Layer 2 e/gamma

if not args.patternFilesOFF:
process.l1tLayer2EG.writeInPattern = True
process.l1tLayer2EG.writeOutPattern = True
process.l1tLayer2EG.inPatternFile.maxLinesPerFile = eventsPerFile_*54
process.l1tLayer2EG.outPatternFile.maxLinesPerFile = eventsPerFile_*54

#####################################################################################################################
## Layer 2 seeded-cone jets
if not args.patternFilesOFF:
process.runPF.insert(process.runPF.index(process.l1tLayer2SeedConeJetsCorrected)+1, process.l1tLayer2SeedConeJetWriter)
process.l1tLayer2SeedConeJetWriter.maxLinesPerFile = eventsPerFile_*54

if not args.dumpFilesOFF:
for det in "Barrel", "Barrel9", "HGCal", "HGCalNoTK", "HF":
l1pf = getattr(process, 'l1tLayer1'+det)
l1pf.dumpFileName = cms.untracked.string("TTbar_PU200_"+det+".dump")


process.source.fileNames = [ '/store/cmst3/group/l1tr/gpetrucc/11_1_0/NewInputs110X/110121.done/TTbar_PU200/inputs110X_%d.root' % i for i in (1,3,7,8,9) ]
process.l1tPFClustersFromL1EGClusters.src = cms.InputTag("L1EGammaClusterEmuProducer",)
process.l1tPFClustersFromCombinedCaloHCal.phase2barrelCaloTowers = [cms.InputTag("L1EGammaClusterEmuProducer",)]
process.l1tPFClustersFromHGC3DClusters.src = cms.InputTag("hgcalBackEndLayer2Producer","HGCalBackendLayer2Processor3DClustering")
process.l1tPFClustersFromCombinedCaloHF.hcalCandidates = [ cms.InputTag("hgcalBackEndLayer2Producer","HGCalBackendLayer2Processor3DClustering")]
process.l1tPFTracksFromL1Tracks.L1TrackTag = cms.InputTag("TTTracksFromTrackletEmulation","Level1TTTracks")
process.l1tGTTInputProducer.l1TracksInputTag = cms.InputTag("TTTracksFromTrackletEmulation","Level1TTTracks")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this designed for general CMSSW testing/unit testing? Or is this personal use?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's run in the Correlator firmware CI and for development there, but not in standard CMSSW release building & testing

@cerminar cerminar force-pushed the composite_eleid_125X_v0 branch from 0102a20 to 49e6d17 Compare April 5, 2023 08:42
@cerminar cerminar marked this pull request as ready for review April 5, 2023 09:38
@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

Attempts to compile this PR succeeded!

Info Value
return code 0
command cmsenv && scram b -j 8

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found no issues with the code checks!

Info Value
return code 0
command cmsenv && scram b -k -j 8 code-checks && scram b -k -j 8 code-checks

I found no issues with the headers!

Info Value
return code 0
command cmsenv && scram b -k -j 8 check-headers

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found no files with code format issues!

Info Value
return code 0
command cmsenv && scram b -k -j 8 code-format-all

@gpetruc
Copy link

gpetruc commented Apr 24, 2023

Hi @aloeliger , @epalencia could you let us know soon if the code is OK, especially in terms of number of commits etc?

We would like to merge this into our correlator integration branch to allow other developments to progress, but once we do we won't be able to rebase or edit the history of this branch anymore. We've paused everything for a couple of weeks but we can't do it forever.

Thanks,

@gpetruc

@aloeliger
Copy link

@gpetruc unfortunately right now the tests actually fail on this (please see cms-sw#41290) due to undefined variables in configuration. Right now the correlator project is out ahead of every other L1 software project with large amounts of work outstanding that have not been merged into central CMSSW (cms-sw#41279 & #1066). It may not be a good idea to get any further ahead on developments that have not been merged, and on basing development on developments that are subject to change as they get merged into the authoritative version of CMSSW.

@gpetruc
Copy link

gpetruc commented May 18, 2023

Hi,
I noticed that when I solved the conflicts with the head of the correlator fork to merge this PR there I unintentionally pushed the merge commit a817437 also here.
@cerminar , when you have time can you remove it with

git reset --hard 382fffe70ad
git push -f my-cmssw composite_eleid_125X_v0

It seems github allowed me to push in the branch while there was the PR open to the correlator fork, but not after I merged it

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

Attempts to compile this PR succeeded!

Info Value
return code 0
command eval scramv1 runtime -sh && scram b -j 8

@gpetruc
Copy link

gpetruc commented May 19, 2023

Hi,
The CMSSW master PR for this is now merged cms-sw#41290

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found no issues with the code checks!

Info Value
return code 0
command eval scramv1 runtime -sh && scram b -k -j 8 code-checks && scram b -k -j 8 code-checks

I found no issues with the headers!

Info Value
return code 0
command eval scramv1 runtime -sh && scram b -k -j 8 check-headers

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found no files with code format issues!

Info Value
return code 0
command eval scramv1 runtime -sh && scram b -k -j 8 code-format-all

@cerminar cerminar force-pushed the composite_eleid_125X_v0 branch from a817437 to 382fffe Compare May 23, 2023 11:58
@gpetruc
Copy link

gpetruc commented May 23, 2023

Hello @aloeliger @epalencia now that the bad merge commit has been removed and the extra commit from the code review in CMSSW has been added, can we integrate this?
Then I can update #1129 fixing conflicts.

@aloeliger aloeliger merged commit 8d99b90 into cms-l1t-offline:phase2-l1t-integration-1252patch1 May 24, 2023
@aloeliger
Copy link

Apologies for the delay, it's been merged. I'll tag it in a second.

@aloeliger
Copy link

merged and tagged as l1t-phase2-v63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Algorithm Development Phase-2 Pertains to phase-2 development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants