1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
|
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cassert>
#include <utility>
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/Ref.h"
#include "DataFormats/L1TGlobal/interface/GlobalObjectMapFwd.h"
#include "DataFormats/L1TGlobal/interface/GlobalObjectMap.h"
#include "DataFormats/L1TGlobal/interface/GlobalObjectMapRecord.h"
#include "DataFormats/L1TGlobal/interface/GlobalObject.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/MessageLogger/interface/MessageDrop.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h"
#include "HLTL1TSeed.h"
using namespace std;
// constructors
HLTL1TSeed::HLTL1TSeed(const edm::ParameterSet& parSet)
: HLTStreamFilter(parSet),
//useObjectMaps_(parSet.getParameter<bool>("L1UseL1TriggerObjectMaps")),
m_l1SeedsLogicalExpression(parSet.getParameter<string>("L1SeedsLogicalExpression")),
m_l1GtObjectMapTag(parSet.getParameter<edm::InputTag>("L1ObjectMapInputTag")),
m_l1GtObjectMapToken(consumes<GlobalObjectMapRecord>(m_l1GtObjectMapTag)),
m_l1GlobalTag(parSet.getParameter<edm::InputTag>("L1GlobalInputTag")),
m_l1GlobalToken(consumes<GlobalAlgBlkBxCollection>(m_l1GlobalTag)),
m_l1MuonCollectionsTag(parSet.getParameter<edm::InputTag>("L1MuonInputTag")), // FIX WHEN UNPACKERS ADDED
m_l1MuonTag(m_l1MuonCollectionsTag),
m_l1MuonToken(consumes<l1t::MuonBxCollection>(m_l1MuonTag)),
m_l1MuonShowerCollectionsTag(
parSet.getParameter<edm::InputTag>("L1MuonShowerInputTag")), // FIX WHEN UNPACKERS ADDED
m_l1MuonShowerTag(m_l1MuonShowerCollectionsTag),
m_l1MuonShowerToken(consumes<l1t::MuonShowerBxCollection>(m_l1MuonShowerTag)),
m_l1EGammaCollectionsTag(parSet.getParameter<edm::InputTag>("L1EGammaInputTag")), // FIX WHEN UNPACKERS ADDED
m_l1EGammaTag(m_l1EGammaCollectionsTag),
m_l1EGammaToken(consumes<l1t::EGammaBxCollection>(m_l1EGammaTag)),
m_l1JetCollectionsTag(parSet.getParameter<edm::InputTag>("L1JetInputTag")), // FIX WHEN UNPACKERS ADDED
m_l1JetTag(m_l1JetCollectionsTag),
m_l1JetToken(consumes<l1t::JetBxCollection>(m_l1JetTag)),
m_l1TauCollectionsTag(parSet.getParameter<edm::InputTag>("L1TauInputTag")), // FIX WHEN UNPACKERS ADDED
m_l1TauTag(m_l1TauCollectionsTag),
m_l1TauToken(consumes<l1t::TauBxCollection>(m_l1TauTag)),
m_l1EtSumCollectionsTag(parSet.getParameter<edm::InputTag>("L1EtSumInputTag")), // FIX WHEN UNPACKERS ADDED
m_l1EtSumTag(m_l1EtSumCollectionsTag),
m_l1EtSumToken(consumes<l1t::EtSumBxCollection>(m_l1EtSumTag)),
m_l1EtSumZdcCollectionsTag(parSet.getParameter<edm::InputTag>("L1EtSumZdcInputTag")), // FIX WHEN UNPACKERS ADDED
m_l1EtSumZdcTag(m_l1EtSumZdcCollectionsTag),
m_l1EtSumZdcToken(consumes<l1t::EtSumBxCollection>(m_l1EtSumZdcTag)),
m_l1GlobalDecision(false),
m_isDebugEnabled(edm::isDebugEnabled()) {
if (m_l1SeedsLogicalExpression.empty()) {
throw cms::Exception("FailModule") << "\nTrying to seed with an empty L1SeedsLogicalExpression.\n" << std::endl;
} else if (m_l1SeedsLogicalExpression != "L1GlobalDecision") {
// check also the logical expression - add/remove spaces if needed
m_l1AlgoLogicParser = GlobalLogicParser(m_l1SeedsLogicalExpression);
// list of required algorithms for seeding
// dummy values for tokenNumber and tokenResult
m_l1AlgoSeeds.reserve((m_l1AlgoLogicParser.operandTokenVector()).size());
m_l1AlgoSeeds = m_l1AlgoLogicParser.expressionSeedsOperandList();
size_t const l1AlgoSeedsSize = m_l1AlgoSeeds.size();
m_l1AlgoSeedsRpn.reserve(l1AlgoSeedsSize);
m_l1AlgoSeedsObjType.reserve(l1AlgoSeedsSize);
} else {
m_l1GlobalDecision = true;
}
}
void HLTL1TSeed::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
makeHLTFilterDescription(desc);
// # logical expression for the required L1 algorithms;
// # the algorithms are specified by name
// # allowed operators: "AND", "OR", "NOT", "(", ")"
// #
// # by convention, "L1GlobalDecision" logical expression means global decision
desc.add<string>("L1SeedsLogicalExpression", "");
desc.add<edm::InputTag>("L1ObjectMapInputTag", edm::InputTag("hltGtStage2ObjectMap"));
desc.add<edm::InputTag>("L1GlobalInputTag", edm::InputTag("hltGtStage2Digis"));
desc.add<edm::InputTag>("L1MuonInputTag", edm::InputTag("hltGtStage2Digis:Muon"));
desc.add<edm::InputTag>("L1MuonShowerInputTag", edm::InputTag("hltGtStage2Digis:MuonShower"));
desc.add<edm::InputTag>("L1EGammaInputTag", edm::InputTag("hltGtStage2Digis:EGamma"));
desc.add<edm::InputTag>("L1JetInputTag", edm::InputTag("hltGtStage2Digis:Jet"));
desc.add<edm::InputTag>("L1TauInputTag", edm::InputTag("hltGtStage2Digis:Tau"));
desc.add<edm::InputTag>("L1EtSumInputTag", edm::InputTag("hltGtStage2Digis:EtSum"));
desc.add<edm::InputTag>("L1EtSumZdcInputTag", edm::InputTag("hltGtStage2Digis:EtSumZDC"));
descriptions.add("hltL1TSeed", desc);
}
bool HLTL1TSeed::hltFilter(edm::Event& iEvent,
const edm::EventSetup& evSetup,
trigger::TriggerFilterObjectWithRefs& filterproduct) {
bool rc = false;
// the filter object
if (saveTags()) {
// muons
filterproduct.addCollectionTag(m_l1MuonTag);
// muon showers
filterproduct.addCollectionTag(m_l1MuonShowerTag);
// egamma
filterproduct.addCollectionTag(m_l1EGammaTag);
// jet
filterproduct.addCollectionTag(m_l1JetTag);
// tau
filterproduct.addCollectionTag(m_l1TauTag);
// etsum
filterproduct.addCollectionTag(m_l1EtSumTag);
// etsum (ZDC)
filterproduct.addCollectionTag(m_l1EtSumZdcTag);
}
// Get all the seeding from iEvent (i.e. L1TriggerObjectMapRecord)
//
rc = seedsL1TriggerObjectMaps(iEvent, filterproduct);
if (m_isDebugEnabled) {
dumpTriggerFilterObjectWithRefs(filterproduct);
}
return rc;
}
// detailed print of filter content
void HLTL1TSeed::dumpTriggerFilterObjectWithRefs(trigger::TriggerFilterObjectWithRefs& filterproduct) const {
LogTrace("HLTL1TSeed") << "\nHLTL1TSeed::hltFilter "
<< "\n Dump TriggerFilterObjectWithRefs\n"
<< endl;
vector<l1t::MuonRef> seedsL1Mu;
filterproduct.getObjects(trigger::TriggerL1Mu, seedsL1Mu);
const size_t sizeSeedsL1Mu = seedsL1Mu.size();
LogTrace("HLTL1TSeed") << "\n HLTL1TSeed: seed logical expression = " << m_l1SeedsLogicalExpression << endl;
LogTrace("HLTL1TSeed") << "\n L1Mu seeds: " << sizeSeedsL1Mu << endl << endl;
for (size_t i = 0; i != sizeSeedsL1Mu; i++) {
l1t::MuonRef obj = l1t::MuonRef(seedsL1Mu[i]);
LogTrace("HLTL1TSeed") << "\tL1Mu "
<< "\t"
<< "q = "
<< obj->hwCharge() // TEMP get hwCharge insead of charge which is not yet set NEED FIX.
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::MuonShowerRef> seedsL1MuShower;
filterproduct.getObjects(trigger::TriggerL1MuShower, seedsL1MuShower);
const size_t sizeSeedsL1MuShower = seedsL1MuShower.size();
LogTrace("HLTL1TSeed") << "\n HLTL1TSeed: seed logical expression = " << m_l1SeedsLogicalExpression << endl;
LogTrace("HLTL1TSeed") << "\n L1MuShower seeds: " << sizeSeedsL1MuShower << endl << endl;
for (size_t i = 0; i != sizeSeedsL1MuShower; i++) {
l1t::MuonShowerRef obj = l1t::MuonShowerRef(seedsL1MuShower[i]);
LogTrace("HLTL1TSeed") << "\tL1MuShower "
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::EGammaRef> seedsL1EG;
filterproduct.getObjects(trigger::TriggerL1EG, seedsL1EG);
const size_t sizeSeedsL1EG = seedsL1EG.size();
LogTrace("HLTL1TSeed") << "\n L1EG seeds: " << sizeSeedsL1EG << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EG; i++) {
l1t::EGammaRef obj = l1t::EGammaRef(seedsL1EG[i]);
LogTrace("HLTL1TSeed") << "\tL1EG "
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::JetRef> seedsL1Jet;
filterproduct.getObjects(trigger::TriggerL1Jet, seedsL1Jet);
const size_t sizeSeedsL1Jet = seedsL1Jet.size();
LogTrace("HLTL1TSeed") << "\n L1Jet seeds: " << sizeSeedsL1Jet << endl << endl;
for (size_t i = 0; i != sizeSeedsL1Jet; i++) {
l1t::JetRef obj = l1t::JetRef(seedsL1Jet[i]);
LogTrace("HLTL1TSeed") << "\tL1Jet "
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::TauRef> seedsL1Tau;
filterproduct.getObjects(trigger::TriggerL1Tau, seedsL1Tau);
const size_t sizeSeedsL1Tau = seedsL1Tau.size();
LogTrace("HLTL1TSeed") << "\n L1Tau seeds: " << sizeSeedsL1Tau << endl << endl;
for (size_t i = 0; i != sizeSeedsL1Tau; i++) {
l1t::TauRef obj = l1t::TauRef(seedsL1Tau[i]);
LogTrace("HLTL1TSeed") << "\tL1Tau "
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::EtSumRef> seedsL1EtSumETT;
filterproduct.getObjects(trigger::TriggerL1ETT, seedsL1EtSumETT);
const size_t sizeSeedsL1EtSumETT = seedsL1EtSumETT.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum ETT seeds: " << sizeSeedsL1EtSumETT << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumETT; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumETT[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum ETT"
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::EtSumRef> seedsL1EtSumHTT;
filterproduct.getObjects(trigger::TriggerL1HTT, seedsL1EtSumHTT);
const size_t sizeSeedsL1EtSumHTT = seedsL1EtSumHTT.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum HTT seeds: " << sizeSeedsL1EtSumHTT << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumHTT; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumHTT[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum HTT"
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::EtSumRef> seedsL1EtSumETM;
filterproduct.getObjects(trigger::TriggerL1ETM, seedsL1EtSumETM);
const size_t sizeSeedsL1EtSumETM = seedsL1EtSumETM.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum ETM seeds: " << sizeSeedsL1EtSumETM << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumETM; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumETM[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum ETM"
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::EtSumRef> seedsL1EtSumETMHF;
filterproduct.getObjects(trigger::TriggerL1ETMHF, seedsL1EtSumETMHF);
const size_t sizeSeedsL1EtSumETMHF = seedsL1EtSumETMHF.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum ETMHF seeds: " << sizeSeedsL1EtSumETMHF << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumETMHF; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumETMHF[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum ETMHF"
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::EtSumRef> seedsL1EtSumHTMHF;
filterproduct.getObjects(trigger::TriggerL1HTMHF, seedsL1EtSumHTMHF);
const size_t sizeSeedsL1EtSumHTMHF = seedsL1EtSumHTMHF.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum HTMHF seeds: " << sizeSeedsL1EtSumHTMHF << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumHTMHF; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumHTMHF[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum HTMHF"
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::EtSumRef> seedsL1EtSumHTM;
filterproduct.getObjects(trigger::TriggerL1HTM, seedsL1EtSumHTM);
const size_t sizeSeedsL1EtSumHTM = seedsL1EtSumHTM.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum HTM seeds: " << sizeSeedsL1EtSumHTM << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumHTM; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumHTM[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum HTM"
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::EtSumRef> seedsL1EtSumCentrality;
filterproduct.getObjects(trigger::TriggerL1Centrality, seedsL1EtSumCentrality);
const size_t sizeSeedsL1EtSumCentrality = seedsL1EtSumCentrality.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum Centrality seeds: " << sizeSeedsL1EtSumCentrality << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumCentrality; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumCentrality[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum Centrality Bits: " << std::bitset<8>(obj->hwPt())
<< " (hwPt = " << obj->hwPt() << ")";
}
vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFP0;
filterproduct.getObjects(trigger::TriggerL1MinBiasHFP0, seedsL1EtSumMinBiasHFP0);
const size_t sizeSeedsL1EtSumMinBiasHFP0 = seedsL1EtSumMinBiasHFP0.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFP0 seeds: " << sizeSeedsL1EtSumMinBiasHFP0 << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFP0; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFP0[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFP0: hwPt = " << obj->hwPt();
}
vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFM0;
filterproduct.getObjects(trigger::TriggerL1MinBiasHFM0, seedsL1EtSumMinBiasHFM0);
const size_t sizeSeedsL1EtSumMinBiasHFM0 = seedsL1EtSumMinBiasHFM0.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFM0 seeds: " << sizeSeedsL1EtSumMinBiasHFM0 << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFM0; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFM0[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFM0: hwPt = " << obj->hwPt();
}
vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFP1;
filterproduct.getObjects(trigger::TriggerL1MinBiasHFP1, seedsL1EtSumMinBiasHFP1);
const size_t sizeSeedsL1EtSumMinBiasHFP1 = seedsL1EtSumMinBiasHFP1.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFP1 seeds: " << sizeSeedsL1EtSumMinBiasHFP1 << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFP1; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFP1[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFP1: hwPt = " << obj->hwPt();
}
vector<l1t::EtSumRef> seedsL1EtSumMinBiasHFM1;
filterproduct.getObjects(trigger::TriggerL1MinBiasHFM1, seedsL1EtSumMinBiasHFM1);
const size_t sizeSeedsL1EtSumMinBiasHFM1 = seedsL1EtSumMinBiasHFM1.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum MinBiasHFM1 seeds: " << sizeSeedsL1EtSumMinBiasHFM1 << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumMinBiasHFM1; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumMinBiasHFM1[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum MinBiasHFM1: hwPt = " << obj->hwPt();
}
vector<l1t::EtSumRef> seedsL1EtSumTowerCount;
filterproduct.getObjects(trigger::TriggerL1TowerCount, seedsL1EtSumTowerCount);
const size_t sizeSeedsL1EtSumTowerCount = seedsL1EtSumTowerCount.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum TowerCount seeds: " << sizeSeedsL1EtSumTowerCount << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumTowerCount; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumTowerCount[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum TowerCount: hwPt = " << obj->hwPt();
}
vector<l1t::EtSumRef> seedsL1EtSumAsymEt;
filterproduct.getObjects(trigger::TriggerL1AsymEt, seedsL1EtSumAsymEt);
const size_t sizeSeedsL1EtSumAsymEt = seedsL1EtSumAsymEt.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum AsymEt seeds: " << sizeSeedsL1EtSumAsymEt << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumAsymEt; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymEt[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum AsymEt: hwPt = " << obj->hwPt();
}
vector<l1t::EtSumRef> seedsL1EtSumAsymHt;
filterproduct.getObjects(trigger::TriggerL1AsymHt, seedsL1EtSumAsymHt);
const size_t sizeSeedsL1EtSumAsymHt = seedsL1EtSumAsymHt.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum AsymHt seeds: " << sizeSeedsL1EtSumAsymHt << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumAsymHt; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymHt[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum AsymHt: hwPt = " << obj->hwPt();
}
vector<l1t::EtSumRef> seedsL1EtSumAsymEtHF;
filterproduct.getObjects(trigger::TriggerL1AsymEtHF, seedsL1EtSumAsymEtHF);
const size_t sizeSeedsL1EtSumAsymEtHF = seedsL1EtSumAsymEtHF.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum AsymEtHF seeds: " << sizeSeedsL1EtSumAsymEtHF << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumAsymEtHF; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymEtHF[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum AsymEtHF: hwPt = " << obj->hwPt();
}
vector<l1t::EtSumRef> seedsL1EtSumAsymHtHF;
filterproduct.getObjects(trigger::TriggerL1AsymHtHF, seedsL1EtSumAsymHtHF);
const size_t sizeSeedsL1EtSumAsymHtHF = seedsL1EtSumAsymHtHF.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum AsymHtHF seeds: " << sizeSeedsL1EtSumAsymHtHF << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumAsymHtHF; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumAsymHtHF[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum AsymHtHF: hwPt = " << obj->hwPt();
}
vector<l1t::EtSumRef> seedsL1EtSumZDCP;
filterproduct.getObjects(trigger::TriggerL1ZDCP, seedsL1EtSumZDCP);
const size_t sizeSeedsL1EtSumZDCP = seedsL1EtSumZDCP.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCP seeds: " << sizeSeedsL1EtSumZDCP << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumZDCP; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCP[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCP"
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
vector<l1t::EtSumRef> seedsL1EtSumZDCM;
filterproduct.getObjects(trigger::TriggerL1ZDCM, seedsL1EtSumZDCM);
const size_t sizeSeedsL1EtSumZDCM = seedsL1EtSumZDCM.size();
LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCM seeds: " << sizeSeedsL1EtSumZDCM << endl << endl;
for (size_t i = 0; i != sizeSeedsL1EtSumZDCM; i++) {
l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCM[i]);
LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCM"
<< "\t"
<< "pt = " << obj->pt() << "\t"
<< "eta = " << obj->eta() << "\t"
<< "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx();
}
LogTrace("HLTL1TSeed") << " \n\n" << endl;
}
// seeding is done via L1 trigger object maps, considering the objects which fired in L1
bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFilterObjectWithRefs& filterproduct) {
// Two GT objects are obtained from the Event: (1) the unpacked GT and (2) the emulated GT.
// Return value of the function is the score of seeding logical expression, evaluated using (1).
// Seeding is performed (per l1_algo) if ACCEPT both in (1) and (2). Seed objects are identified
// and only available from ObjectMaps created in (2).
// define index lists for all particle types
using idxListType = std::list<std::pair<L1TObjBxIndexType, L1TObjIndexType>>;
idxListType listMuon;
idxListType listMuonShower;
idxListType listEG;
idxListType listJet;
idxListType listTau;
idxListType listETM;
idxListType listETT;
idxListType listHTT;
idxListType listHTM;
idxListType listETMHF;
idxListType listHTMHF;
idxListType listCentrality;
idxListType listMinBiasHFP0;
idxListType listMinBiasHFM0;
idxListType listMinBiasHFP1;
idxListType listMinBiasHFM1;
idxListType listTotalEtEm;
idxListType listMissingEtHF;
idxListType listTowerCount;
idxListType listAsymEt;
idxListType listAsymHt;
idxListType listAsymEtHF;
idxListType listAsymHtHF;
idxListType listZDCP;
idxListType listZDCM;
// get handle to unpacked GT
edm::Handle<GlobalAlgBlkBxCollection> uGtAlgoBlocks;
iEvent.getByToken(m_l1GlobalToken, uGtAlgoBlocks);
if (!uGtAlgoBlocks.isValid()) {
edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
<< " requested in configuration, but not found in the event." << std::endl;
return false;
}
// check size (all BXs)
if (uGtAlgoBlocks->size() == 0) {
edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
<< " is empty for all BXs.";
return false;
}
// check size (BX 0)
if (uGtAlgoBlocks->isEmpty(0)) {
edm::LogWarning("HLTL1TSeed") << " Warning: GlobalAlgBlkBxCollection with input tag " << m_l1GlobalTag
<< " is empty for BX=0.";
return false;
}
// get handle to object maps from emulator (one object map per algorithm)
edm::Handle<GlobalObjectMapRecord> gtObjectMapRecord;
iEvent.getByToken(m_l1GtObjectMapToken, gtObjectMapRecord);
if (!gtObjectMapRecord.isValid()) {
edm::LogWarning("HLTL1TSeed") << " Warning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
<< " requested in configuration, but not found in the event." << std::endl;
return false;
}
if (m_isDebugEnabled) {
const std::vector<GlobalObjectMap>& objMaps = gtObjectMapRecord->gtObjectMap();
LogTrace("HLTL1TSeed") << "\nHLTL1Seed"
<< "\n--------------------------------------------------------------------------------------"
"-------------------------------";
LogTrace("HLTL1TSeed")
<< "\n\tAlgorithms in L1TriggerObjectMapRecord and GT results ( emulated | initial | prescaled | final ) "
<< endl;
LogTrace("HLTL1TSeed") << "\n\tmap"
<< "\tAlgoBit" << std::setw(40) << "algoName"
<< "\t (emul|ini|pre|fin)" << endl;
LogTrace("HLTL1TSeed") << "----------------------------------------------------------------------------------------"
"-----------------------------";
for (size_t imap = 0; imap < objMaps.size(); imap++) {
int bit = objMaps[imap].algoBitNumber(); // same as bit from L1T Menu
int emulDecision = objMaps[imap].algoGtlResult();
// For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
int initDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionInitial(bit);
int presDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionInterm(bit);
int finlDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionFinal(bit);
if (emulDecision != initDecision) {
LogTrace("HLTL1TSeed") << "L1T decision (emulated vs. unpacked initial) is not the same:"
<< "\n\tbit = " << std::setw(3) << bit << std::setw(40) << objMaps[imap].algoName()
<< "\t emulated decision = " << emulDecision
<< "\t unpacked initial decision = " << initDecision
<< "\nThis should not happen. Include the L1TGtEmulCompare module in the sequence."
<< endl;
}
LogTrace("HLTL1TSeed") << "\t" << std::setw(3) << imap << "\tbit = " << std::setw(3) << bit << std::setw(40)
<< objMaps[imap].algoName() << "\t ( " << emulDecision << " | " << initDecision << " | "
<< presDecision << " | " << finlDecision << " ) ";
}
LogTrace("HLTL1TSeed") << endl;
}
// Filter decision in case of "L1GlobalDecision" logical expression.
// By convention, it means global decision.
// /////////////////////////////////////////////////////////////////
if (m_l1GlobalDecision) {
// For bx=0 , get 0th AlgoBlock, so in BXvector at(bx=0,i=0)
return (uGtAlgoBlocks->at(0, 0)).getFinalOR();
}
// Update/Reset m_l1AlgoLogicParser by reseting token result
// /////////////////////////////////////////////////////////
std::vector<GlobalLogicParser::OperandToken>& algOpTokenVector = m_l1AlgoLogicParser.operandTokenVector();
for (auto& i : algOpTokenVector) {
// rest token result
//
i.tokenResult = false;
}
// Update m_l1AlgoLogicParser and store emulator results for algOpTokens
// /////////////////////////////////////////////////////////////////////
for (auto& i : algOpTokenVector) {
std::string algoName = i.tokenName;
const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoName);
if (objMap == nullptr) {
throw cms::Exception("FailModule")
<< "\nAlgorithm " << algoName
<< ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
<< "Please check if algorithm " << algoName << " is present in the L1 menu\n"
<< std::endl;
} else {
//(algOpTokenVector[i]).tokenResult = objMap->algoGtlResult();
int bit = objMap->algoBitNumber();
bool finalAlgoDecision = (uGtAlgoBlocks->at(0, 0)).getAlgoDecisionFinal(bit);
i.tokenResult = finalAlgoDecision;
}
}
// Filter decision
// ///////////////
bool seedsResult = m_l1AlgoLogicParser.expressionResult();
if (m_isDebugEnabled) {
LogTrace("HLTL1TSeed") << "\nHLTL1TSeed: l1SeedsLogicalExpression (names) = '" << m_l1SeedsLogicalExpression << "'"
<< "\n Result for logical expression after update of algOpTokens: " << seedsResult << "\n"
<< std::endl;
}
/// Loop over the list of required algorithms for seeding
/// /////////////////////////////////////////////////////
for (std::vector<GlobalLogicParser::OperandToken>::const_iterator itSeed = m_l1AlgoSeeds.begin();
itSeed != m_l1AlgoSeeds.end();
++itSeed) {
std::string algoSeedName = (*itSeed).tokenName;
LogTrace("HLTL1TSeed") << "\n ---------------- algo seed name = " << algoSeedName << endl;
const GlobalObjectMap* objMap = gtObjectMapRecord->getObjectMap(algoSeedName);
if (objMap == nullptr) {
// Should not get here
//
throw cms::Exception("FailModule")
<< "\nAlgorithm " << algoSeedName
<< ", requested as seed by a HLT path, cannot be matched to a L1 algo name in any GlobalObjectMap\n"
<< "Please check if algorithm " << algoSeedName << " is present in the L1 menu\n"
<< std::endl;
}
int algoSeedBitNumber = objMap->algoBitNumber();
bool algoSeedResult = objMap->algoGtlResult();
// unpacked GT results: uGtAlgoBlock has decisions initial, prescaled, and final after masks
bool algoSeedResultMaskAndPresc = uGtAlgoBlocks->at(0, 0).getAlgoDecisionFinal(algoSeedBitNumber);
LogTrace("HLTL1TSeed") << "\n\tAlgo seed " << algoSeedName << " result emulated | final = " << algoSeedResult
<< " | " << algoSeedResultMaskAndPresc << endl;
/// Unpacked GT result of algorithm is false after masks and prescales - no seeds
/// ////////////////////////////////////////////////////////////////////////////////
if (!algoSeedResultMaskAndPresc)
continue;
/// Emulated GT result of algorithm is false - no seeds - but still save the event
// This should not happen if the emulated and unpacked GT are consistent
/// ////////////////////////////////////////////////////////////////////////////////
if (!algoSeedResult)
continue;
const std::vector<GlobalLogicParser::OperandToken>& opTokenVecObjMap = objMap->operandTokenVector();
const std::vector<L1TObjectTypeInCond>& condObjTypeVec = objMap->objectTypeVector();
const std::vector<CombinationsWithBxInCond>& condCombinations = objMap->combinationVector();
LogTrace("HLTL1TSeed") << "\n\talgoName =" << objMap->algoName() << "\talgoBitNumber = " << algoSeedBitNumber
<< "\talgoGtlResult = " << algoSeedResult << endl
<< endl;
if (opTokenVecObjMap.size() != condObjTypeVec.size()) {
edm::LogWarning("HLTL1TSeed")
<< "\nWarning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
<< "\nhas object map for bit number " << algoSeedBitNumber
<< " which contains different size vectors of operand tokens and of condition object types!" << std::endl;
assert(opTokenVecObjMap.size() == condObjTypeVec.size());
}
if (opTokenVecObjMap.size() != condCombinations.size()) {
edm::LogWarning("HLTL1TSeed")
<< "\nWarning: GlobalObjectMapRecord with input tag " << m_l1GtObjectMapTag
<< "\nhas object map for bit number " << algoSeedBitNumber
<< " which contains different size vectors of operand tokens and of condition object combinations!"
<< std::endl;
assert(opTokenVecObjMap.size() == condCombinations.size());
}
// operands are conditions of L1 algo
//
for (size_t condNumber = 0; condNumber < opTokenVecObjMap.size(); condNumber++) {
std::vector<l1t::GlobalObject> const& condObjType = condObjTypeVec[condNumber];
for (auto const& jOb : condObjType) {
LogTrace("HLTL1TSeed") << setw(15) << "\tcondObjType = " << jOb << endl;
}
bool const condResult = opTokenVecObjMap[condNumber].tokenResult;
// only proceed for conditions that passed
//
if (!condResult) {
continue;
}
// loop over combinations for a given condition
//
auto const& condComb = *(objMap->getCombinationsInCond(condNumber));
LogTrace("HLTL1TSeed") << setw(15) << "\tcondCombinations = " << condComb.size();
for (size_t i1 = 0; i1 < condComb.size(); ++i1) {
LogTrace("HLTL1TSeed") << setw(15) << "\tnew combination" << endl;
// loop over objects in a combination for a given condition
//
for (size_t i2 = 0; i2 < condComb[i1].size(); ++i2) {
// in case of object-less triggers (e.g. L1_ZeroBias) condObjType vector is empty, so don't seed!
//
if (condObjType.empty()) {
LogTrace("HLTL1TSeed")
<< "\talgoName = " << objMap->algoName()
<< " is object-less L1 algorithm, so do not attempt to store any objects to the list of seeds.\n"
<< std::endl;
continue;
}
// BX of the L1T object
auto const objBx = condComb[i1][i2].first;
// index of the L1T object in the relevant BXVector
auto const objIdx = condComb[i1][i2].second;
// type of the L1T object
// (the index of the object type is the same as the index of the object)
l1t::GlobalObject const objTypeVal = condObjType[i2];
LogTrace("HLTL1TSeed") << "\tAdd object of type " << objTypeVal << " and index " << objIdx
<< " (BX = " << objBx << ") to the seed list.";
// THESE OBJECT CASES ARE CURRENTLY MISSING:
//gtMinBias,
//gtExternal,
//ObjNull
// fill list(s) of BX:index values
switch (objTypeVal) {
case l1t::gtMu: {
listMuon.emplace_back(objBx, objIdx);
} break;
case l1t::gtMuShower: {
listMuonShower.emplace_back(objBx, objIdx);
} break;
case l1t::gtEG: {
listEG.emplace_back(objBx, objIdx);
} break;
case l1t::gtJet: {
listJet.emplace_back(objBx, objIdx);
} break;
case l1t::gtTau: {
listTau.emplace_back(objBx, objIdx);
} break;
case l1t::gtETM: {
listETM.emplace_back(objBx, objIdx);
} break;
case l1t::gtETT: {
listETT.emplace_back(objBx, objIdx);
} break;
case l1t::gtHTT: {
listHTT.emplace_back(objBx, objIdx);
} break;
case l1t::gtHTM: {
listHTM.emplace_back(objBx, objIdx);
} break;
case l1t::gtETMHF: {
listETMHF.emplace_back(objBx, objIdx);
} break;
case l1t::gtHTMHF: {
listHTMHF.emplace_back(objBx, objIdx);
} break;
case l1t::gtTowerCount: {
listTowerCount.emplace_back(objBx, objIdx);
} break;
case l1t::gtMinBiasHFP0: {
listMinBiasHFP0.emplace_back(objBx, objIdx);
} break;
case l1t::gtMinBiasHFM0: {
listMinBiasHFM0.emplace_back(objBx, objIdx);
} break;
case l1t::gtMinBiasHFP1: {
listMinBiasHFP1.emplace_back(objBx, objIdx);
} break;
case l1t::gtMinBiasHFM1: {
listMinBiasHFM1.emplace_back(objBx, objIdx);
} break;
case l1t::gtETTem: {
listTotalEtEm.emplace_back(objBx, objIdx);
} break;
case l1t::gtAsymmetryEt: {
listAsymEt.emplace_back(objBx, objIdx);
} break;
case l1t::gtAsymmetryHt: {
listAsymHt.emplace_back(objBx, objIdx);
} break;
case l1t::gtAsymmetryEtHF: {
listAsymEtHF.emplace_back(objBx, objIdx);
} break;
case l1t::gtAsymmetryHtHF: {
listAsymHtHF.emplace_back(objBx, objIdx);
} break;
case l1t::gtZDCP: {
listZDCP.emplace_back(objBx, objIdx);
} break;
case l1t::gtZDCM: {
listZDCM.emplace_back(objBx, objIdx);
} break;
case l1t::gtCentrality0:
case l1t::gtCentrality1:
case l1t::gtCentrality2:
case l1t::gtCentrality3:
case l1t::gtCentrality4:
case l1t::gtCentrality5:
case l1t::gtCentrality6:
case l1t::gtCentrality7: {
listCentrality.emplace_back(objBx, objIdx);
} break;
default: {
// should not arrive here
LogTrace("HLTL1TSeed") << "\n HLTL1TSeed::hltFilter "
<< "\n Unknown object of type " << objTypeVal << " and index " << objIdx
<< " (BX = " << objBx << ") in the seed list.";
} break;
} // end switch objTypeVal
} // end for itObj
} // end for itComb
} // end for condition
} // end for itSeed
// eliminate duplicates
listMuon.sort();
listMuon.unique();
listMuonShower.sort();
listMuonShower.unique();
listEG.sort();
listEG.unique();
listJet.sort();
listJet.unique();
listTau.sort();
listTau.unique();
listETM.sort();
listETM.unique();
listETT.sort();
listETT.unique();
listHTT.sort();
listHTT.unique();
listHTM.sort();
listHTM.unique();
listETMHF.sort();
listETMHF.unique();
listHTMHF.sort();
listHTMHF.unique();
listCentrality.sort();
listCentrality.unique();
listMinBiasHFP0.sort();
listMinBiasHFP0.unique();
listMinBiasHFM0.sort();
listMinBiasHFM0.unique();
listMinBiasHFP1.sort();
listMinBiasHFP1.unique();
listMinBiasHFM1.sort();
listMinBiasHFM1.unique();
listTotalEtEm.sort();
listTotalEtEm.unique();
listMissingEtHF.sort();
listMissingEtHF.unique();
listTowerCount.sort();
listTowerCount.unique();
listAsymEt.sort();
listAsymEt.unique();
listAsymHt.sort();
listAsymHt.unique();
listAsymEtHF.sort();
listAsymEtHF.unique();
listAsymHtHF.sort();
listAsymHtHF.unique();
listZDCP.sort();
listZDCP.unique();
listZDCM.sort();
listZDCM.unique();
// record the L1 physics objects in the HLT filterproduct
// //////////////////////////////////////////////////////
// Muon
if (!listMuon.empty()) {
edm::Handle<l1t::MuonBxCollection> muons;
iEvent.getByToken(m_l1MuonToken, muons);
if (!muons.isValid()) {
edm::LogWarning("HLTL1TSeed") << "\nWarning: L1MuonBxCollection with input tag " << m_l1MuonTag
<< "\nrequested in configuration, but not found in the event."
<< "\nNo muons added to filterproduct." << endl;
} else {
for (auto const& [bxIdx, objIdx] : listMuon) {
// skip invalid indices
if (objIdx < 0 or unsigned(objIdx) >= muons->size(bxIdx)) {
edm::LogWarning("HLTL1TSeed")
<< "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::MuonBxCollection):"
<< " index=" << objIdx << " (" << muons->size(bxIdx) << " unpacked L1T objects in BX " << bxIdx << ")";
continue;
}
// Transform to index for Bx = 0 to begin of BxVector
unsigned int index = muons->begin(bxIdx) - muons->begin() + objIdx;
l1t::MuonRef myref(muons, index);
filterproduct.addObject(trigger::TriggerL1Mu, myref);
}
}
}
// Muon Shower
if (!listMuonShower.empty()) {
edm::Handle<l1t::MuonShowerBxCollection> muonShowers;
iEvent.getByToken(m_l1MuonShowerToken, muonShowers);
if (!muonShowers.isValid()) {
edm::LogWarning("HLTL1TSeed") << "\nWarning: L1MuonShowerBxCollection with input tag " << m_l1MuonShowerTag
<< "\nrequested in configuration, but not found in the event."
<< "\nNo muon showers added to filterproduct." << endl;
} else {
for (auto const& [bxIdx, objIdx] : listMuonShower) {
// skip invalid indices
if (objIdx < 0 or unsigned(objIdx) >= muonShowers->size(bxIdx)) {
edm::LogWarning("HLTL1TSeed")
<< "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::MuonShowerBxCollection):"
<< " index=" << objIdx << " (" << muonShowers->size(bxIdx) << " unpacked L1T objects in BX " << bxIdx
<< ")";
continue;
}
// Transform to index for Bx = 0 to begin of BxVector
unsigned int index = muonShowers->begin(bxIdx) - muonShowers->begin() + objIdx;
l1t::MuonShowerRef myref(muonShowers, index);
filterproduct.addObject(trigger::TriggerL1MuShower, myref);
}
}
}
// EG (isolated)
if (!listEG.empty()) {
edm::Handle<l1t::EGammaBxCollection> egammas;
iEvent.getByToken(m_l1EGammaToken, egammas);
if (!egammas.isValid()) {
edm::LogWarning("HLTL1TSeed") << "\nWarning: L1EGammaBxCollection with input tag " << m_l1EGammaTag
<< "\nrequested in configuration, but not found in the event."
<< "\nNo egammas added to filterproduct." << endl;
} else {
for (auto const& [bxIdx, objIdx] : listEG) {
// skip invalid indices
if (objIdx < 0 or unsigned(objIdx) >= egammas->size(bxIdx)) {
edm::LogWarning("HLTL1TSeed")
<< "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::EGammaBxCollection):"
<< " index=" << objIdx << " (" << egammas->size(bxIdx) << " unpacked L1T objects in BX " << bxIdx << ")";
continue;
}
// Transform to begin of BxVector
unsigned int index = egammas->begin(bxIdx) - egammas->begin() + objIdx;
l1t::EGammaRef myref(egammas, index);
filterproduct.addObject(trigger::TriggerL1EG, myref);
}
}
}
// Jet
if (!listJet.empty()) {
edm::Handle<l1t::JetBxCollection> jets;
iEvent.getByToken(m_l1JetToken, jets);
if (!jets.isValid()) {
edm::LogWarning("HLTL1TSeed") << "\nWarning: L1JetBxCollection with input tag " << m_l1JetTag
<< "\nrequested in configuration, but not found in the event."
<< "\nNo jets added to filterproduct." << endl;
} else {
for (auto const& [bxIdx, objIdx] : listJet) {
// skip invalid indices
if (objIdx < 0 or unsigned(objIdx) >= jets->size(bxIdx)) {
edm::LogWarning("HLTL1TSeed")
<< "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::JetBxCollection):"
<< " index=" << objIdx << " (" << jets->size(bxIdx) << " unpacked L1T objects in BX " << bxIdx << ")";
continue;
}
// Transform to begin of BxVector
unsigned int index = jets->begin(bxIdx) - jets->begin() + objIdx;
l1t::JetRef myref(jets, index);
filterproduct.addObject(trigger::TriggerL1Jet, myref);
}
}
}
// Tau
if (!listTau.empty()) {
edm::Handle<l1t::TauBxCollection> taus;
iEvent.getByToken(m_l1TauToken, taus);
if (!taus.isValid()) {
edm::LogWarning("HLTL1TSeed") << "\nWarning: L1TauBxCollection with input tag " << m_l1TauTag
<< "\nrequested in configuration, but not found in the event."
<< "\nNo taus added to filterproduct." << endl;
} else {
for (auto const& [bxIdx, objIdx] : listTau) {
// skip invalid indices
if (objIdx < 0 or unsigned(objIdx) >= taus->size(bxIdx)) {
edm::LogWarning("HLTL1TSeed")
<< "Invalid index from the L1ObjectMap (L1uGT emulator), will be ignored (l1t::TauBxCollection):"
<< " index=" << objIdx << " (" << taus->size(bxIdx) << " unpacked L1T objects in BX " << bxIdx << ")";
continue;
}
// Transform to begin of BxVector
unsigned int index = taus->begin(bxIdx) - taus->begin() + objIdx;
l1t::TauRef myref(taus, index);
filterproduct.addObject(trigger::TriggerL1Tau, myref);
}
}
}
// ETT, HTT, ETM, HTM
auto fillEtSums = [&](edm::Handle<l1t::EtSumBxCollection> const& etSums,
idxListType const& theList,
l1t::EtSum::EtSumType const l1tId,
trigger::TriggerObjectType const trigObjId) {
for (auto const& [bxIdx, objIdx] : theList) {
for (auto iter = etSums->begin(bxIdx); iter != etSums->end(bxIdx); ++iter) {
l1t::EtSumRef myref(etSums, etSums->key(iter));
if (myref->getType() == l1tId) {
filterproduct.addObject(trigObjId, myref);
}
}
}
};
auto const etsums = iEvent.getHandle(m_l1EtSumToken);
if (not etsums.isValid()) {
edm::LogWarning("HLTL1TSeed") << "\nWarning: L1EtSumBxCollection with input tag " << m_l1EtSumTag
<< "\nrequested in configuration, but not found in the event."
<< "\nNo etsums added to filterproduct." << endl;
} else {
fillEtSums(etsums, listETT, l1t::EtSum::kTotalEt, trigger::TriggerL1ETT);
fillEtSums(etsums, listHTT, l1t::EtSum::kTotalHt, trigger::TriggerL1HTT);
fillEtSums(etsums, listETM, l1t::EtSum::kMissingEt, trigger::TriggerL1ETM);
fillEtSums(etsums, listHTM, l1t::EtSum::kMissingHt, trigger::TriggerL1HTM);
fillEtSums(etsums, listETMHF, l1t::EtSum::kMissingEtHF, trigger::TriggerL1ETMHF);
fillEtSums(etsums, listHTMHF, l1t::EtSum::kMissingHtHF, trigger::TriggerL1HTMHF);
fillEtSums(etsums, listCentrality, l1t::EtSum::kCentrality, trigger::TriggerL1Centrality);
fillEtSums(etsums, listMinBiasHFP0, l1t::EtSum::kMinBiasHFP0, trigger::TriggerL1MinBiasHFP0);
fillEtSums(etsums, listMinBiasHFM0, l1t::EtSum::kMinBiasHFM0, trigger::TriggerL1MinBiasHFM0);
fillEtSums(etsums, listMinBiasHFP1, l1t::EtSum::kMinBiasHFP1, trigger::TriggerL1MinBiasHFP1);
fillEtSums(etsums, listMinBiasHFM1, l1t::EtSum::kMinBiasHFM1, trigger::TriggerL1MinBiasHFM1);
fillEtSums(etsums, listTotalEtEm, l1t::EtSum::kTotalEtEm, trigger::TriggerL1TotalEtEm);
fillEtSums(etsums, listTowerCount, l1t::EtSum::kTowerCount, trigger::TriggerL1TowerCount);
fillEtSums(etsums, listAsymEt, l1t::EtSum::kAsymEt, trigger::TriggerL1AsymEt);
fillEtSums(etsums, listAsymHt, l1t::EtSum::kAsymHt, trigger::TriggerL1AsymHt);
fillEtSums(etsums, listAsymEtHF, l1t::EtSum::kAsymEtHF, trigger::TriggerL1AsymEtHF);
fillEtSums(etsums, listAsymHtHF, l1t::EtSum::kAsymHtHF, trigger::TriggerL1AsymHtHF);
}
// ZDCP, ZDCM
auto const etsumzdcs = iEvent.getHandle(m_l1EtSumZdcToken);
if (not etsumzdcs.isValid()) {
edm::LogWarning("HLTL1TSeed") << "\nWarning: L1EtSumBxCollection with input tag " << m_l1EtSumZdcTag
<< "\nrequested in configuration, but not found in the event."
<< "\nNo etsums (ZDC) added to filterproduct.";
} else {
fillEtSums(etsumzdcs, listZDCP, l1t::EtSum::kZDCP, trigger::TriggerL1ZDCP);
fillEtSums(etsumzdcs, listZDCM, l1t::EtSum::kZDCM, trigger::TriggerL1ZDCM);
}
// return filter decision
LogTrace("HLTL1TSeed") << "\nHLTL1Seed:seedsL1TriggerObjectMaps returning " << seedsResult << endl << endl;
return seedsResult;
}
// register as framework plugin
#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(HLTL1TSeed);
|