forked from cms-sw/cmssw
/
CSCCathodeLCTProcessor.cc
1300 lines (1150 loc) · 55.3 KB
/
CSCCathodeLCTProcessor.cc
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
#include "L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h"
#include <iomanip>
#include <memory>
// Default values of configuration parameters.
const unsigned int CSCCathodeLCTProcessor::def_fifo_tbins = 12;
const unsigned int CSCCathodeLCTProcessor::def_fifo_pretrig = 7;
const unsigned int CSCCathodeLCTProcessor::def_hit_persist = 6;
const unsigned int CSCCathodeLCTProcessor::def_drift_delay = 2;
const unsigned int CSCCathodeLCTProcessor::def_nplanes_hit_pretrig = 2;
const unsigned int CSCCathodeLCTProcessor::def_nplanes_hit_pattern = 4;
const unsigned int CSCCathodeLCTProcessor::def_pid_thresh_pretrig = 2;
const unsigned int CSCCathodeLCTProcessor::def_min_separation = 10;
const unsigned int CSCCathodeLCTProcessor::def_tmb_l1a_window_size = 7;
//----------------
// Constructors --
//----------------
CSCCathodeLCTProcessor::CSCCathodeLCTProcessor(unsigned endcap,
unsigned station,
unsigned sector,
unsigned subsector,
unsigned chamber,
const edm::ParameterSet& conf)
: CSCBaseboard(endcap, station, sector, subsector, chamber, conf) {
static std::atomic<bool> config_dumped{false};
// CLCT configuration parameters.
fifo_tbins = clctParams_.getParameter<unsigned int>("clctFifoTbins");
hit_persist = clctParams_.getParameter<unsigned int>("clctHitPersist");
drift_delay = clctParams_.getParameter<unsigned int>("clctDriftDelay");
nplanes_hit_pretrig = clctParams_.getParameter<unsigned int>("clctNplanesHitPretrig");
nplanes_hit_pattern = clctParams_.getParameter<unsigned int>("clctNplanesHitPattern");
// Not used yet.
fifo_pretrig = clctParams_.getParameter<unsigned int>("clctFifoPretrig");
pid_thresh_pretrig = clctParams_.getParameter<unsigned int>("clctPidThreshPretrig");
min_separation = clctParams_.getParameter<unsigned int>("clctMinSeparation");
start_bx_shift = clctParams_.getParameter<int>("clctStartBxShift");
// Motherboard parameters: common for all configurations.
tmb_l1a_window_size = // Common to CLCT and TMB
tmbParams_.getParameter<unsigned int>("tmbL1aWindowSize");
/*
In Summer 2021 the CLCT readout function was updated so that the
window is based on a number of time bins around the central CLCT
time BX7. In the past the window was based on early_tbins and late_tbins.
The parameter is kept, but is not used.
*/
early_tbins = tmbParams_.getParameter<int>("tmbEarlyTbins");
if (early_tbins < 0)
early_tbins = fifo_pretrig - CSCConstants::CLCT_EMUL_TIME_OFFSET;
// wether to readout only the earliest two LCTs in readout window
readout_earliest_2 = tmbParams_.getParameter<bool>("tmbReadoutEarliest2");
// Verbosity level, set to 0 (no print) by default.
infoV = clctParams_.getParameter<int>("verbosity");
// Do not exclude pattern 0 and 1 when the Run-3 patterns are enabled!!
// Valid Run-3 patterns are 0,1,2,3,4
if (runCCLUT_) {
pid_thresh_pretrig = 0;
}
// Check and print configuration parameters.
checkConfigParameters();
if ((infoV > 0) && !config_dumped) {
dumpConfigParams();
config_dumped = true;
}
numStrips_ = 0; // Will be set later.
// Provisional, but should be OK for all stations except ME1.
for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
if ((i_layer + 1) % 2 == 0)
stagger[i_layer] = 0;
else
stagger[i_layer] = 1;
}
// which patterns should we use?
if (runCCLUT_) {
clct_pattern_ = CSCPatternBank::clct_pattern_run3_;
// comparator code lookup table algorithm for Phase-2
cclut_ = std::make_unique<ComparatorCodeLUT>(conf);
} else {
clct_pattern_ = CSCPatternBank::clct_pattern_legacy_;
}
const auto& shower = showerParams_.getParameterSet("cathodeShower");
thresholds_ = shower.getParameter<std::vector<unsigned>>("showerThresholds");
showerNumTBins_ = shower.getParameter<unsigned>("showerNumTBins");
minLayersCentralTBin_ = shower.getParameter<unsigned>("minLayersCentralTBin");
peakCheck_ = shower.getParameter<bool>("peakCheck");
thePreTriggerDigis.clear();
// quality control of stubs
qualityControl_ = std::make_unique<LCTQualityControl>(endcap, station, sector, subsector, chamber, conf);
}
void CSCCathodeLCTProcessor::setDefaultConfigParameters() {
// Set default values for configuration parameters.
fifo_tbins = def_fifo_tbins;
fifo_pretrig = def_fifo_pretrig;
hit_persist = def_hit_persist;
drift_delay = def_drift_delay;
nplanes_hit_pretrig = def_nplanes_hit_pretrig;
nplanes_hit_pattern = def_nplanes_hit_pattern;
pid_thresh_pretrig = def_pid_thresh_pretrig;
min_separation = def_min_separation;
tmb_l1a_window_size = def_tmb_l1a_window_size;
}
// Set configuration parameters obtained via EventSetup mechanism.
void CSCCathodeLCTProcessor::setConfigParameters(const CSCDBL1TPParameters* conf) {
static std::atomic<bool> config_dumped{false};
fifo_tbins = conf->clctFifoTbins();
fifo_pretrig = conf->clctFifoPretrig();
hit_persist = conf->clctHitPersist();
drift_delay = conf->clctDriftDelay();
nplanes_hit_pretrig = conf->clctNplanesHitPretrig();
nplanes_hit_pattern = conf->clctNplanesHitPattern();
pid_thresh_pretrig = conf->clctPidThreshPretrig();
min_separation = conf->clctMinSeparation();
// Check and print configuration parameters.
checkConfigParameters();
if (!config_dumped) {
dumpConfigParams();
config_dumped = true;
}
}
void CSCCathodeLCTProcessor::setESLookupTables(const CSCL1TPLookupTableCCLUT* conf) { cclut_->setESLookupTables(conf); }
void CSCCathodeLCTProcessor::checkConfigParameters() {
// Make sure that the parameter values are within the allowed range.
// Max expected values.
static const unsigned int max_fifo_tbins = 1 << 5;
static const unsigned int max_fifo_pretrig = 1 << 5;
static const unsigned int max_hit_persist = 1 << 4;
static const unsigned int max_drift_delay = 1 << 2;
static const unsigned int max_nplanes_hit_pretrig = 1 << 3;
static const unsigned int max_nplanes_hit_pattern = 1 << 3;
static const unsigned int max_pid_thresh_pretrig = 1 << 4;
static const unsigned int max_min_separation = CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER;
static const unsigned int max_tmb_l1a_window_size = 1 << 4;
// Checks.
CSCBaseboard::checkConfigParameters(fifo_tbins, max_fifo_tbins, def_fifo_tbins, "fifo_tbins");
CSCBaseboard::checkConfigParameters(fifo_pretrig, max_fifo_pretrig, def_fifo_pretrig, "fifo_pretrig");
CSCBaseboard::checkConfigParameters(hit_persist, max_hit_persist, def_hit_persist, "hit_persist");
CSCBaseboard::checkConfigParameters(drift_delay, max_drift_delay, def_drift_delay, "drift_delay");
CSCBaseboard::checkConfigParameters(
nplanes_hit_pretrig, max_nplanes_hit_pretrig, def_nplanes_hit_pretrig, "nplanes_hit_pretrig");
CSCBaseboard::checkConfigParameters(
nplanes_hit_pattern, max_nplanes_hit_pattern, def_nplanes_hit_pattern, "nplanes_hit_pattern");
CSCBaseboard::checkConfigParameters(
pid_thresh_pretrig, max_pid_thresh_pretrig, def_pid_thresh_pretrig, "pid_thresh_pretrig");
CSCBaseboard::checkConfigParameters(min_separation, max_min_separation, def_min_separation, "min_separation");
CSCBaseboard::checkConfigParameters(
tmb_l1a_window_size, max_tmb_l1a_window_size, def_tmb_l1a_window_size, "tmb_l1a_window_size");
}
void CSCCathodeLCTProcessor::clear() {
thePreTriggerDigis.clear();
thePreTriggerBXs.clear();
for (int bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
bestCLCT[bx].clear();
secondCLCT[bx].clear();
cathode_showers_[bx].clear();
}
}
std::vector<CSCCLCTDigi> CSCCathodeLCTProcessor::run(const CSCComparatorDigiCollection* compdc) {
// This is the version of the run() function that is called when running
// over the entire detector. It gets the comparator & timing info from the
// comparator digis and then passes them on to another run() function.
static std::atomic<bool> config_dumped{false};
if ((infoV > 0) && !config_dumped) {
dumpConfigParams();
config_dumped = true;
}
// Get the number of strips and stagger of layers for the given chamber.
// Do it only once per chamber.
if (numStrips_ <= 0 or numStrips_ > CSCConstants::MAX_NUM_STRIPS_RUN2) {
if (cscChamber_) {
numStrips_ = cscChamber_->layer(1)->geometry()->numberOfStrips();
// ME1/a is known to the readout hardware as strips 65-80 of ME1/1.
// Still need to decide whether we do any special adjustments to
// reconstruct LCTs in this region (3:1 ganged strips); for now, we
// simply allow for hits in ME1/a and apply standard reconstruction
// to them.
// For Phase2 ME1/1 is set to have 4 CFEBs in ME1/b and 3 CFEBs in ME1/a
if (isME11_) {
if (theRing == 4) {
edm::LogError("CSCCathodeLCTProcessor|SetupError")
<< "+++ Invalid ring number for this processor " << theRing << " was set in the config."
<< " +++\n"
<< "+++ CSC geometry looks garbled; no emulation possible +++\n";
}
if (!disableME1a_ && theRing == 1 && !gangedME1a_)
numStrips_ = CSCConstants::MAX_NUM_STRIPS_RUN2;
if (!disableME1a_ && theRing == 1 && gangedME1a_)
numStrips_ = CSCConstants::MAX_NUM_STRIPS_RUN1;
if (disableME1a_ && theRing == 1)
numStrips_ = CSCConstants::NUM_STRIPS_ME1B;
}
numHalfStrips_ = 2 * numStrips_ + 1;
numCFEBs_ = numStrips_ / CSCConstants::NUM_STRIPS_PER_CFEB;
if (numStrips_ > CSCConstants::MAX_NUM_STRIPS_RUN2) {
edm::LogError("CSCCathodeLCTProcessor|SetupError")
<< "+++ Number of strips, " << numStrips_ << " found in " << theCSCName_ << " (sector " << theSector
<< " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
<< " exceeds max expected, " << CSCConstants::MAX_NUM_STRIPS_RUN2 << " +++\n"
<< "+++ CSC geometry looks garbled; no emulation possible +++\n";
numStrips_ = -1;
numHalfStrips_ = -1;
numCFEBs_ = -1;
}
// The strips for a given layer may be offset from the adjacent layers.
// This was done in order to improve resolution. We need to find the
// 'staggering' for each layer and make necessary conversions in our
// arrays. -JM
// In the TMB-07 firmware, half-strips in odd layers (layers are
// counted as ly0-ly5) are shifted by -1 half-strip, whereas in
// the previous firmware versions half-strips in even layers
// were shifted by +1 half-strip. This difference is due to a
// change from ly3 to ly2 in the choice of the key layer, and
// the intention to keep half-strips in the key layer unchanged.
// In the emulator, we use the old way for both cases, to avoid
// negative half-strip numbers. This will necessitate a
// subtraction of 1 half-strip for TMB-07 later on. -SV.
for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
stagger[i_layer] = (cscChamber_->layer(i_layer + 1)->geometry()->stagger() + 1) / 2;
}
} else {
edm::LogError("CSCCathodeLCTProcessor|ConfigError")
<< " " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. "
<< theTrigChamber << ")"
<< " is not defined in current geometry! +++\n"
<< "+++ CSC geometry looks garbled; no emulation possible +++\n";
numStrips_ = -1;
numHalfStrips_ = -1;
numCFEBs_ = -1;
}
}
if (numStrips_ <= 0 or 2 * (unsigned)numStrips_ > qualityControl_->get_csc_max_halfstrip(theStation, theRing)) {
edm::LogError("CSCCathodeLCTProcessor|ConfigError")
<< " " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. "
<< theTrigChamber << "):"
<< " numStrips_ = " << numStrips_ << "; CLCT emulation skipped! +++";
std::vector<CSCCLCTDigi> emptyV;
return emptyV;
}
// Get comparator digis in this chamber.
bool hasDigis = getDigis(compdc);
if (hasDigis) {
// Get halfstrip times from comparator digis.
std::vector<int> halfStripTimes[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER];
readComparatorDigis(halfStripTimes);
// Pass arrays of halfstrips on to another run() doing the
// LCT search.
// If the number of layers containing digis is smaller than that
// required to trigger, quit right away. (If LCT-based digi suppression
// is implemented one day, this condition will have to be changed
// to the number of planes required to pre-trigger.)
unsigned int layersHit = 0;
for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i_hstrip++) {
if (!halfStripTimes[i_layer][i_hstrip].empty()) {
layersHit++;
break;
}
}
}
// Run the algorithm only if the probability for the pre-trigger
// to fire is not null. (Pre-trigger decisions are used for the
// strip read-out conditions in DigiToRaw.)
if (layersHit >= nplanes_hit_pretrig)
run(halfStripTimes);
// Get the high multiplicity bits in this chamber
encodeHighMultiplicityBits();
}
// Return vector of CLCTs.
std::vector<CSCCLCTDigi> tmpV = getCLCTs();
// shift the BX from 7 to 8
// the unpacked real data CLCTs have central BX at bin 7
// however in simulation the central BX is bin 8
// to make a proper comparison with ALCTs we need
// CLCT and ALCT to have the central BX in the same bin
// this shift does not affect the readout of the CLCTs
// emulated CLCTs put in the event should be centered at bin 7 (as in data)
for (auto& p : tmpV) {
p.setBX(p.getBX() + CSCConstants::ALCT_CLCT_OFFSET);
}
return tmpV;
}
void CSCCathodeLCTProcessor::run(
const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) {
// This version of the run() function can either be called in a standalone
// test, being passed the halfstrip times, or called by the
// run() function above. It uses the findLCTs() method to find vectors
// of LCT candidates. These candidates are already sorted and the best two per bx
// are returned.
// initialize the pulse array.
// add 1 for possible stagger
pulse_.initialize(numHalfStrips_ + 1);
std::vector<CSCCLCTDigi> CLCTlist = findLCTs(halfstrip);
for (const auto& p : CLCTlist) {
const int bx = p.getBX();
if (bx >= CSCConstants::MAX_CLCT_TBINS) {
if (infoV > 0)
edm::LogWarning("L1CSCTPEmulatorOutOfTimeCLCT")
<< "+++ Bx of CLCT candidate, " << bx << ", exceeds max allowed, " << CSCConstants::MAX_CLCT_TBINS - 1
<< "; skipping it... +++\n";
continue;
}
if (!bestCLCT[bx].isValid()) {
bestCLCT[bx] = p;
} else if (!secondCLCT[bx].isValid()) {
secondCLCT[bx] = p;
}
}
for (int bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
if (bestCLCT[bx].isValid()) {
bestCLCT[bx].setTrknmb(1);
// check if the LCT is valid
qualityControl_->checkValid(bestCLCT[bx]);
if (infoV > 0)
LogDebug("CSCCathodeLCTProcessor")
<< bestCLCT[bx] << " found in " << CSCDetId::chamberName(theEndcap, theStation, theRing, theChamber)
<< " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
<< "\n";
}
if (secondCLCT[bx].isValid()) {
secondCLCT[bx].setTrknmb(2);
// check if the LCT is valid
qualityControl_->checkValid(secondCLCT[bx]);
if (infoV > 0)
LogDebug("CSCCathodeLCTProcessor")
<< secondCLCT[bx] << " found in " << CSCDetId::chamberName(theEndcap, theStation, theRing, theChamber)
<< " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
<< "\n";
}
}
// Now that we have our best CLCTs, they get correlated with the best
// ALCTs and then get sent to the MotherBoard. -JM
}
bool CSCCathodeLCTProcessor::getDigis(const CSCComparatorDigiCollection* compdc) {
bool hasDigis = false;
// Loop over layers and save comparator digis on each one into digiV[layer].
for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
digiV[i_layer].clear();
CSCDetId detid(theEndcap, theStation, theRing, theChamber, i_layer + 1);
getDigis(compdc, detid);
if (isME11_ && !disableME1a_) {
CSCDetId detid_me1a(theEndcap, theStation, 4, theChamber, i_layer + 1);
getDigis(compdc, detid_me1a);
}
if (!digiV[i_layer].empty()) {
hasDigis = true;
if (infoV > 1) {
LogTrace("CSCCathodeLCTProcessor") << "found " << digiV[i_layer].size() << " comparator digi(s) in layer "
<< i_layer << " of " << detid.chamberName() << " (trig. sector " << theSector
<< " subsector " << theSubsector << " id " << theTrigChamber << ")";
}
}
}
return hasDigis;
}
void CSCCathodeLCTProcessor::getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id) {
const bool me1a = (id.station() == 1) && (id.ring() == 4);
const CSCComparatorDigiCollection::Range rcompd = compdc->get(id);
for (CSCComparatorDigiCollection::const_iterator digiIt = rcompd.first; digiIt != rcompd.second; ++digiIt) {
const unsigned int origStrip = digiIt->getStrip();
const unsigned int maxStripsME1a =
gangedME1a_ ? CSCConstants::NUM_STRIPS_ME1A_GANGED : CSCConstants::NUM_STRIPS_ME1A_UNGANGED;
// this special case can only be reached in MC
// in real data, the comparator digis have always ring==1
if (me1a && origStrip <= maxStripsME1a && !disableME1a_) {
// Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not
// been done already.
CSCComparatorDigi digi_corr(
origStrip + CSCConstants::NUM_STRIPS_ME1B, digiIt->getComparator(), digiIt->getTimeBinWord());
digiV[id.layer() - 1].push_back(digi_corr);
} else {
digiV[id.layer() - 1].push_back(*digiIt);
}
}
}
void CSCCathodeLCTProcessor::readComparatorDigis(
std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) {
for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
int i_digi = 0; // digi counter, for dumps.
for (std::vector<CSCComparatorDigi>::iterator pld = digiV[i_layer].begin(); pld != digiV[i_layer].end();
pld++, i_digi++) {
// Dump raw digi info.
if (infoV > 1) {
std::ostringstream strstrm;
strstrm << "Comparator digi: comparator = " << pld->getComparator() << " strip #" << pld->getStrip()
<< " time bins on:";
std::vector<int> bx_times = pld->getTimeBinsOn();
for (unsigned int tbin = 0; tbin < bx_times.size(); tbin++)
strstrm << " " << bx_times[tbin];
LogTrace("CSCCathodeLCTProcessor") << strstrm.str();
}
// Get comparator: 0/1 for left/right halfstrip for each comparator
// that fired.
int thisComparator = pld->getComparator();
if (thisComparator != 0 && thisComparator != 1) {
if (infoV >= 0)
edm::LogWarning("L1CSCTPEmulatorWrongInput")
<< "+++ station " << theStation << " ring " << theRing << " chamber " << theChamber
<< " Found comparator digi with wrong comparator value = " << thisComparator << "; skipping it... +++\n";
continue;
}
// Get strip number.
int thisStrip = pld->getStrip() - 1; // count from 0
if (thisStrip < 0 || thisStrip >= numStrips_) {
if (infoV >= 0)
edm::LogWarning("L1CSCTPEmulatorWrongInput")
<< "+++ station " << theStation << " ring " << theRing << " chamber " << theChamber
<< " Found comparator digi with wrong strip number = " << thisStrip << " (max strips = " << numStrips_
<< "); skipping it... +++\n";
continue;
}
// 2*strip: convert strip to 1/2 strip
// comp : comparator output
// stagger: stagger for this layer
int thisHalfstrip = 2 * thisStrip + thisComparator + stagger[i_layer];
if (thisHalfstrip >= numHalfStrips_) {
if (infoV >= 0)
edm::LogWarning("L1CSCTPEmulatorWrongInput")
<< "+++ station " << theStation << " ring " << theRing << " chamber " << theChamber
<< " Found wrong halfstrip number = " << thisHalfstrip << "; skipping this digi... +++\n";
continue;
}
// Get bx times on this digi and check that they are within the bounds.
std::vector<int> bx_times = pld->getTimeBinsOn();
for (unsigned int i = 0; i < bx_times.size(); i++) {
// Total number of time bins in DAQ readout is given by fifo_tbins,
// which thus determines the maximum length of time interval.
//
// In data, only the CLCT in the time bin that was matched with L1A are read out
// while comparator digi is read out by 12 time bin, which includes 12 time bin info
// in other word, CLCTs emulated from comparator digis usually showed the OTMB behavior in 12 time bin
// while CLCT from data only showed 1 time bin OTMB behavior
// the CLCT emulated from comparator digis usually is centering at time bin 7 (BX7) and
// it is definitly safe to ignore any CLCTs in bx 0 or 1 and those CLCTs will never impacts on any triggers
if (bx_times[i] > 1 && bx_times[i] < static_cast<int>(fifo_tbins)) {
if (i == 0 || (i > 0 && bx_times[i] - bx_times[i - 1] >= static_cast<int>(hit_persist))) {
// A later hit on the same strip is ignored during the
// number of clocks defined by the "hit_persist" parameter
// (i.e., 6 bx's by default).
if (infoV > 1)
LogTrace("CSCCathodeLCTProcessor")
<< "Comp digi: layer " << i_layer + 1 << " digi #" << i_digi + 1 << " strip " << thisStrip
<< " halfstrip " << thisHalfstrip << " time " << bx_times[i] << " comparator " << thisComparator
<< " stagger " << stagger[i_layer];
halfstrip[i_layer][thisHalfstrip].push_back(bx_times[i]);
} else if (i > 0) {
if (infoV > 1)
LogTrace("CSCCathodeLCTProcessor")
<< "+++ station " << theStation << " ring " << theRing << " chamber " << theChamber
<< " Skipping comparator digi: strip = " << thisStrip << ", layer = " << i_layer + 1
<< ", bx = " << bx_times[i] << ", bx of previous hit = " << bx_times[i - 1];
}
} else {
if (infoV > 1)
LogTrace("CSCCathodeLCTProcessor") << "+++ station " << theStation << " ring " << theRing << " chamber "
<< theChamber << "+++ Skipping comparator digi: strip = " << thisStrip
<< ", layer = " << i_layer + 1 << ", bx = " << bx_times[i] << " +++";
}
}
}
}
}
// TMB-07 version.
std::vector<CSCCLCTDigi> CSCCathodeLCTProcessor::findLCTs(
const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) {
std::vector<CSCCLCTDigi> lctList;
if (infoV > 1)
dumpDigis(halfstrip);
// Fire half-strip one-shots for hit_persist bx's (4 bx's by default).
pulseExtension(halfstrip);
unsigned int start_bx = start_bx_shift;
// Stop drift_delay bx's short of fifo_tbins since at later bx's we will
// not have a full set of hits to start pattern search anyway.
unsigned int stop_bx = fifo_tbins - drift_delay;
// Allow for more than one pass over the hits in the time window.
while (start_bx < stop_bx) {
// temp CLCT objects
CSCCLCTDigi tempBestCLCT;
CSCCLCTDigi tempSecondCLCT;
// All half-strip pattern envelopes are evaluated simultaneously, on every
// clock cycle.
int first_bx = 999;
bool pre_trig = preTrigger(start_bx, first_bx);
// If any of half-strip envelopes has enough layers hit in it, TMB
// will pre-trigger.
if (pre_trig) {
thePreTriggerBXs.push_back(first_bx);
if (infoV > 1)
LogTrace("CSCCathodeLCTProcessor") << "..... pretrigger at bx = " << first_bx << "; waiting drift delay .....";
// TMB latches LCTs drift_delay clocks after pretrigger.
// in the configuration the drift_delay is set to 2bx by default
// this is the time that is required for the electrons to drift to the
// cathode strips. 15ns drift time --> 45 ns is 3 sigma for the delay
// this corresponds to 2bx
int latch_bx = first_bx + drift_delay;
// define a new pattern map
// for each key half strip, and for each pattern, store the 2D collection of fired comparator digis
std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer>> hits_in_patterns;
hits_in_patterns.clear();
// We check if there is at least one key half strip for which at least
// one pattern id has at least the minimum number of hits
bool hits_in_time = patternFinding(latch_bx, hits_in_patterns);
if (infoV > 1) {
if (hits_in_time) {
for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
if (nhits[hstrip] > 0) {
LogTrace("CSCCathodeLCTProcessor")
<< " bx = " << std::setw(2) << latch_bx << " --->"
<< " halfstrip = " << std::setw(3) << hstrip << " best pid = " << std::setw(2) << best_pid[hstrip]
<< " nhits = " << nhits[hstrip];
}
}
}
}
// This trigger emulator does not have an active CFEB flag for DAQ (csc trigger hardware: AFF)
// This is a fundamental difference with the firmware where the TMB prepares the DAQ to
// read out the chamber
// The pattern finder runs continuously, so another pre-trigger
// could occur already at the next bx.
// Quality for sorting.
int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER];
int best_halfstrip[CSCConstants::MAX_CLCTS_PER_PROCESSOR];
int best_quality[CSCConstants::MAX_CLCTS_PER_PROCESSOR];
for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) {
best_halfstrip[ilct] = -1;
best_quality[ilct] = 0;
}
// Calculate quality from pattern id and number of hits, and
// simultaneously select best-quality LCT.
if (hits_in_time) {
for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
// The bend-direction bit pid[0] is ignored (left and right
// bends have equal quality).
quality[hstrip] = (best_pid[hstrip] & 14) | (nhits[hstrip] << 5);
if (quality[hstrip] > best_quality[0]) {
best_halfstrip[0] = hstrip;
best_quality[0] = quality[hstrip];
}
// temporary alias
const int best_hs(best_halfstrip[0]);
// construct a CLCT if the trigger condition has been met
if (best_hs >= 0 && nhits[best_hs] >= nplanes_hit_pattern) {
// overwrite the current best CLCT
tempBestCLCT = constructCLCT(first_bx, best_hs, hits_in_patterns[best_hs][best_pid[best_hs]]);
}
}
}
// If 1st best CLCT is found, look for the 2nd best.
if (best_halfstrip[0] >= 0) {
// Get the half-strip of the best CLCT in this BX that was put into the list.
// You do need to re-add the any stagger, because the busy keys are based on
// the pulse array which takes into account strip stagger!!!
const unsigned halfStripBestCLCT(tempBestCLCT.getKeyStrip() + stagger[CSCConstants::KEY_CLCT_LAYER - 1]);
// Mark keys near best CLCT as busy by setting their quality to
// zero, and repeat the search.
markBusyKeys(halfStripBestCLCT, best_pid[halfStripBestCLCT], quality);
for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
if (quality[hstrip] > best_quality[1]) {
best_halfstrip[1] = hstrip;
best_quality[1] = quality[hstrip];
}
// temporary alias
const int best_hs(best_halfstrip[1]);
// construct a CLCT if the trigger condition has been met
if (best_hs >= 0 && nhits[best_hs] >= nplanes_hit_pattern) {
// overwrite the current second best CLCT
tempSecondCLCT = constructCLCT(first_bx, best_hs, hits_in_patterns[best_hs][best_pid[best_hs]]);
}
}
// Sort bestCLCT and secondALCT by quality
// if qualities are the same, sort by run-2 or run-3 pattern
// if qualities and patterns are the same, sort by half strip number
bool changeOrder = false;
unsigned qualityBest = 0, qualitySecond = 0;
unsigned patternBest = 0, patternSecond = 0;
unsigned halfStripBest = 0, halfStripSecond = 0;
if (tempBestCLCT.isValid() and tempSecondCLCT.isValid()) {
qualityBest = tempBestCLCT.getQuality();
qualitySecond = tempSecondCLCT.getQuality();
if (!runCCLUT_) {
patternBest = tempBestCLCT.getPattern();
patternSecond = tempSecondCLCT.getPattern();
} else {
patternBest = tempBestCLCT.getRun3Pattern();
patternSecond = tempSecondCLCT.getRun3Pattern();
}
halfStripBest = tempBestCLCT.getKeyStrip();
halfStripSecond = tempSecondCLCT.getKeyStrip();
if (qualitySecond > qualityBest)
changeOrder = true;
else if ((qualitySecond == qualityBest) and (int(patternSecond / 2) > int(patternBest / 2)))
changeOrder = true;
else if ((qualitySecond == qualityBest) and (int(patternSecond / 2) == int(patternBest / 2)) and
(halfStripSecond < halfStripBest))
changeOrder = true;
}
CSCCLCTDigi tempCLCT;
if (changeOrder) {
tempCLCT = tempBestCLCT;
tempBestCLCT = tempSecondCLCT;
tempSecondCLCT = tempCLCT;
}
// add the CLCTs to the collection
if (tempBestCLCT.isValid()) {
lctList.push_back(tempBestCLCT);
}
if (tempSecondCLCT.isValid()) {
lctList.push_back(tempSecondCLCT);
}
} //find CLCT, end of best_halfstrip[0] >= 0
// If there is a trigger, CLCT pre-trigger state machine
// checks the number of hits that lie within a pattern template
// at every bx, and waits for it to drop below threshold.
// The search for CLCTs resumes only when the number of hits
// drops below threshold.
start_bx = fifo_tbins;
// Stop checking drift_delay bx's short of fifo_tbins since
// at later bx's we won't have a full set of hits for a
// pattern search anyway.
unsigned int stop_time = fifo_tbins - drift_delay;
for (unsigned int bx = latch_bx + 1; bx < stop_time; bx++) {
bool return_to_idle = true;
bool hits_in_time = patternFinding(bx, hits_in_patterns);
if (hits_in_time) {
for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
// the dead-time is done at the pre-trigger, not at the trigger
if (nhits[hstrip] >= nplanes_hit_pretrig) {
if (infoV > 1)
LogTrace("CSCCathodeLCTProcessor") << " State machine busy at bx = " << bx;
return_to_idle = false;
break;
}
}
}
if (return_to_idle) {
if (infoV > 1)
LogTrace("CSCCathodeLCTProcessor") << " State machine returns to idle state at bx = " << bx;
start_bx = bx;
break;
}
}
} //pre_trig
else {
start_bx = first_bx + 1; // no dead time
}
}
return lctList;
} // findLCTs -- TMB-07 version.
// Common to all versions.
void CSCCathodeLCTProcessor::pulseExtension(
const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) {
const unsigned bits_in_pulse = pulse_.bitsInPulse();
// Clear pulse array. This array will be used as a bit representation of
// hit times. For example: if strip[1][2] has a value of 3, then 1 shifted
// left 3 will be bit pattern of pulse[1][2]. This would make the pattern
// look like 0000000000001000. Then add on additional bits to signify
// the duration of a signal (hit_persist, formerly bx_width) to simulate
// the TMB's drift delay. So for the same pulse[1][2] with a hit_persist
// of 3 would look like 0000000000111000. This is similating the digital
// one-shot in the TMB.
pulse_.clear();
// Loop over all layers and halfstrips.
for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
for (int i_strip = 0; i_strip < numHalfStrips_; i_strip++) {
// If there is a hit, simulate digital one-shot persistence starting
// in the bx of the initial hit. Fill this into pulse[][].
if (!time[i_layer][i_strip].empty()) {
std::vector<int> bx_times = time[i_layer][i_strip];
for (unsigned int i = 0; i < bx_times.size(); i++) {
// Check that min and max times are within the allowed range.
if (bx_times[i] < 0 || bx_times[i] + hit_persist >= bits_in_pulse) {
if (infoV > 0)
edm::LogWarning("L1CSCTPEmulatorOutOfTimeDigi")
<< "+++ BX time of comparator digi (halfstrip = " << i_strip << " layer = " << i_layer
<< ") bx = " << bx_times[i] << " is not within the range (0-" << bits_in_pulse
<< "] allowed for pulse extension. Skip this digi! +++\n";
continue;
}
if (bx_times[i] >= start_bx_shift) {
pulse_.extend(i_layer, i_strip, bx_times[i], hit_persist);
}
}
}
}
}
} // pulseExtension.
// TMB-07 version.
bool CSCCathodeLCTProcessor::preTrigger(const int start_bx, int& first_bx) {
if (infoV > 1)
LogTrace("CSCCathodeLCTProcessor") << "....................PreTrigger...........................";
int nPreTriggers = 0;
bool pre_trig = false;
// Now do a loop over bx times to see (if/when) track goes over threshold
for (unsigned int bx_time = start_bx; bx_time < fifo_tbins; bx_time++) {
// For any given bunch-crossing, start at the lowest keystrip and look for
// the number of separate layers in the pattern for that keystrip that have
// pulses at that bunch-crossing time. Do the same for the next keystrip,
// etc. Then do the entire process again for the next bunch-crossing, etc
// until you find a pre-trigger.
std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer>> hits_in_patterns;
hits_in_patterns.clear();
bool hits_in_time = patternFinding(bx_time, hits_in_patterns);
if (hits_in_time) {
// clear the pretriggers
clearPreTriggers();
for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
// check the properties of the pattern on this halfstrip
if (infoV > 1) {
if (nhits[hstrip] > 0) {
LogTrace("CSCCathodeLCTProcessor")
<< " bx = " << std::setw(2) << bx_time << " --->"
<< " halfstrip = " << std::setw(3) << hstrip << " best pid = " << std::setw(2) << best_pid[hstrip]
<< " nhits = " << nhits[hstrip];
}
}
// a pretrigger was found
if (nhits[hstrip] >= nplanes_hit_pretrig && best_pid[hstrip] >= pid_thresh_pretrig) {
pre_trig = true;
ispretrig_[hstrip] = true;
// write each pre-trigger to output
nPreTriggers++;
thePreTriggerDigis.push_back(constructPreCLCT(bx_time, hstrip, nPreTriggers));
}
}
// upon the first pretrigger, we save first BX and exit
if (pre_trig) {
first_bx = bx_time; // bx at time of pretrigger
return true;
}
}
} // end loop over bx times
if (infoV > 1)
LogTrace("CSCCathodeLCTProcessor") << "no pretrigger, returning \n";
first_bx = fifo_tbins;
return false;
} // preTrigger -- TMB-07 version.
// TMB-07 version.
bool CSCCathodeLCTProcessor::patternFinding(
const unsigned int bx_time, std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer>>& hits_in_patterns) {
if (bx_time >= fifo_tbins)
return false;
unsigned layers_hit = pulse_.numberOfLayersAtBX(bx_time);
if (layers_hit < nplanes_hit_pretrig)
return false;
for (int key_hstrip = 0; key_hstrip < numHalfStrips_; key_hstrip++) {
best_pid[key_hstrip] = 0;
nhits[key_hstrip] = 0;
}
bool hit_layer[CSCConstants::NUM_LAYERS];
// Loop over candidate key strips.
for (int key_hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; key_hstrip < numHalfStrips_; key_hstrip++) {
// Loop over patterns and look for hits matching each pattern.
for (unsigned int pid = clct_pattern_.size() - 1; pid >= pid_thresh_pretrig and pid < clct_pattern_.size(); pid--) {
layers_hit = 0;
// clear all layers
for (int ilayer = 0; ilayer < CSCConstants::NUM_LAYERS; ilayer++) {
hit_layer[ilayer] = false;
}
// clear a single pattern!
CSCCLCTDigi::ComparatorContainer hits_single_pattern;
hits_single_pattern.resize(6);
for (auto& p : hits_single_pattern) {
p.resize(CSCConstants::CLCT_PATTERN_WIDTH, CSCConstants::INVALID_HALF_STRIP);
}
// clear all medians
double num_pattern_hits = 0., times_sum = 0.;
std::multiset<int> mset_for_median;
mset_for_median.clear();
// Loop over halfstrips in trigger pattern mask and calculate the
// "absolute" halfstrip number for each.
for (int this_layer = 0; this_layer < CSCConstants::NUM_LAYERS; this_layer++) {
for (int strip_num = 0; strip_num < CSCConstants::CLCT_PATTERN_WIDTH; strip_num++) {
// ignore "0" half-strips in the pattern
if (clct_pattern_[pid][this_layer][strip_num] == 0)
continue;
// the current strip is the key half-strip plus the offset (can be negative or positive)
int this_strip = CSCPatternBank::clct_pattern_offset_[strip_num] + key_hstrip;
// current strip should be valid of course
if (this_strip >= 0 && this_strip < numHalfStrips_) {
if (infoV > 3) {
LogTrace("CSCCathodeLCTProcessor") << " In patternFinding: key_strip = " << key_hstrip << " pid = " << pid
<< " layer = " << this_layer << " strip = " << this_strip << std::endl;
}
// Determine if "one shot" is high at this bx_time
if (pulse_.isOneShotHighAtBX(this_layer, this_strip, bx_time)) {
if (hit_layer[this_layer] == false) {
hit_layer[this_layer] = true;
layers_hit++; // determines number of layers hit
// add this strip in this layer to the pattern we are currently considering
hits_single_pattern[this_layer][strip_num] = this_strip - stagger[this_layer];
}
// find at what bx did pulse on this halsfstrip & layer have started
// use hit_persist constraint on how far back we can go
int first_bx_layer = bx_time;
for (unsigned int dbx = 0; dbx < hit_persist; dbx++) {
if (pulse_.isOneShotHighAtBX(this_layer, this_strip, first_bx_layer - 1))
first_bx_layer--;
else
break;
}
times_sum += (double)first_bx_layer;
num_pattern_hits += 1.;
mset_for_median.insert(first_bx_layer);
if (infoV > 2)
LogTrace("CSCCathodeLCTProcessor") << " 1st bx in layer: " << first_bx_layer << " sum bx: " << times_sum
<< " #pat. hits: " << num_pattern_hits;
}
}
} // end loop over strips in pretrigger pattern
} // end loop over layers
// save the pattern information when a trigger was formed!
if (layers_hit >= nplanes_hit_pattern) {
hits_in_patterns[key_hstrip][pid] = hits_single_pattern;
}
// determine the current best pattern!
if (layers_hit > nhits[key_hstrip]) {
best_pid[key_hstrip] = pid;
nhits[key_hstrip] = layers_hit;
// Do not loop over the other (worse) patterns if max. numbers of
// hits is found.
if (nhits[key_hstrip] == CSCConstants::NUM_LAYERS)
break;
}
} // end loop over pid
} // end loop over candidate key strips
// At this point there exists at least one halfstrip for which at least one pattern
// has at least 3 layers --> definition of a pre-trigger
return true;
} // patternFinding -- TMB-07 version.
// TMB-07 version.
void CSCCathodeLCTProcessor::markBusyKeys(const int best_hstrip,
const int best_patid,
int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) {
int nspan = min_separation;
int pspan = min_separation;
for (int hstrip = best_hstrip - nspan; hstrip <= best_hstrip + pspan; hstrip++) {
if (hstrip >= 0 && hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER) {
quality[hstrip] = 0;
}
}
} // markBusyKeys -- TMB-07 version.
CSCCLCTDigi CSCCathodeLCTProcessor::constructCLCT(const int bx,
const unsigned halfstrip_withstagger,
const CSCCLCTDigi::ComparatorContainer& hits) {
// Assign the CLCT properties
const unsigned quality = nhits[halfstrip_withstagger];
const unsigned pattern = best_pid[halfstrip_withstagger];
const unsigned bend = CSCPatternBank::getPatternBend(clct_pattern_[pattern]);
const unsigned keyhalfstrip = halfstrip_withstagger - stagger[CSCConstants::KEY_CLCT_LAYER - 1];
const unsigned cfeb = keyhalfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
const unsigned halfstrip = keyhalfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
// set the Run-2 properties
CSCCLCTDigi clct(1,
quality,
pattern,
// CLCTs are always of type halfstrip (not strip or distrip)
1,
bend,
halfstrip,
cfeb,
bx,
0,
0,
-1,
CSCCLCTDigi::Version::Legacy);
// set the hit collection
clct.setHits(hits);
// do the CCLUT procedures for Run-3
if (runCCLUT_) {
cclut_->run(clct, numCFEBs_);
}
// purge the comparator digi collection from the obsolete "65535" entries...
cleanComparatorContainer(clct);
if (infoV > 1) {
LogTrace("CSCCathodeLCTProcessor") << "Produce CLCT " << clct << std::endl;
}
return clct;
}
CSCCLCTPreTriggerDigi CSCCathodeLCTProcessor::constructPreCLCT(const int bx_time,
const unsigned hstrip,
const unsigned nPreTriggers) const {
const int bend = clct_pattern_[best_pid[hstrip]][CSCConstants::NUM_LAYERS - 1][CSCConstants::CLCT_PATTERN_WIDTH];