48 { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5,
52 -4, -3, -2, -1, 0, 1, 2, 3, 4,
53 -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 };
56 { 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
57 999, 999, 999, 999, 999,
59 999, 999, 999, 999, 999,
60 999, 999, 999, 999, 999, 999, 999, 999, 999,
61 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, -1, 0},
63 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
67 4, 4, 4, 4, 4, 4, 4, 4, 4,
68 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, 11},
70 { 999, 999, 999, 999, 999, 999, 999, 999, 0, 0, 0,
74 4, 4, 4, 999, 999, 999, 999, 999, 999,
75 5, 5, 5, 999, 999, 999, 999, 999, 999, 999, 999, 0, 11},
77 { 0, 0, 0, 999, 999, 999, 999, 999, 999, 999, 999,
81 999, 999, 999, 999, 999, 999, 4, 4, 4,
82 999, 999, 999, 999, 999, 999, 999, 999, 5, 5, 5, 1, 11},
84 { 999, 999, 999, 999, 999, 999, 999, 0, 0, 0, 999,
88 4, 4, 4, 999, 999, 999, 999, 999, 999,
89 999, 5, 5, 5, 999, 999, 999, 999, 999, 999, 999, 0, 9},
91 { 999, 0, 0, 0, 999, 999, 999, 999, 999, 999, 999,
95 999, 999, 999, 999, 999, 999, 4, 4, 4,
96 999, 999, 999, 999, 999, 999, 999, 5, 5, 5, 999, 1, 9},
98 { 999, 999, 999, 999, 999, 999, 0, 0, 0, 999, 999,
102 999, 999, 4, 4, 999, 999, 999, 999, 999,
103 999, 999, 5, 5, 5, 999, 999, 999, 999, 999, 999, 0, 7},
105 { 999, 999, 0, 0, 0, 999, 999, 999, 999, 999, 999,
109 999, 999, 999, 999, 999, 4, 4, 999, 999,
110 999, 999, 999, 999, 999, 999, 5, 5, 5, 999, 999, 1, 7},
112 { 999, 999, 999, 999, 999, 0, 0, 0, 999, 999, 999,
116 999, 999, 4, 4, 4, 999, 999, 999, 999,
117 999, 999, 999, 5, 5, 5, 999, 999, 999, 999, 999, 0, 5},
119 { 999, 999, 999, 0, 0, 0, 999, 999, 999, 999, 999,
123 999, 999, 999, 999, 4, 4, 4, 999, 999,
124 999, 999, 999, 999, 999, 5, 5, 5, 999, 999, 999, 1, 5},
126 { 999, 999, 999, 999, 0, 0, 0, 999, 999, 999, 999,
127 999, 999, 1, 999, 999,
129 999, 999, 3, 999, 999,
130 999, 999, 999, 4, 4, 4, 999, 999, 999,
131 999, 999, 999, 999, 5, 5, 5, 999, 999, 999, 999, 0, 3}
164 theEndcap(endcap), theStation(station), theSector(sector),
165 theSubsector(subsector), theTrigChamber(chamber) {
166 static std::atomic<bool> config_dumped{
false};
173 conf.
getParameter<
unsigned int>(
"clctNplanesHitPretrig");
175 conf.
getParameter<
unsigned int>(
"clctNplanesHitPattern");
197 if (isSLHC && !smartME1aME1b)
edm::LogError(
"L1CSCTPEmulatorConfigError")
198 <<
"+++ SLHC upgrade configuration is used (isSLHC=True) but smartME1aME1b=False!\n" 199 <<
"Only smartME1aME1b algorithm is so far supported for upgrade! +++\n";
202 conf.
getParameter<
unsigned int>(
"clctPidThreshPretrig");
237 if ((infoV > 0 || isSLHC) && !config_dumped) {
240 config_dumped =
true;
246 if ((i_layer+1)%2 == 0)
stagger[i_layer] = 0;
265 static std::atomic<bool> config_dumped{
false};
283 if (!config_dumped) {
285 config_dumped =
true;
291 if ((i_layer+1)%2 == 0)
stagger[i_layer] = 0;
318 static std::atomic<bool> config_dumped{
false};
331 if (!config_dumped) {
334 config_dumped =
true;
342 static const unsigned int max_fifo_tbins = 1 << 5;
343 static const unsigned int max_fifo_pretrig = 1 << 5;
344 static const unsigned int max_hit_persist = 1 << 4;
345 static const unsigned int max_drift_delay = 1 << 2;
346 static const unsigned int max_nplanes_hit_pretrig = 1 << 3;
347 static const unsigned int max_nplanes_hit_pattern = 1 << 3;
348 static const unsigned int max_pid_thresh_pretrig = 1 << 4;
350 static const unsigned int max_tmb_l1a_window_size = 1 << 4;
356 <<
", exceeds max allowed, " << max_fifo_tbins-1 <<
" +++\n" 357 <<
"+++ Try to proceed with the default value, fifo_tbins=" 364 <<
", exceeds max allowed, " << max_fifo_pretrig-1 <<
" +++\n" 365 <<
"+++ Try to proceed with the default value, fifo_pretrig=" 372 <<
", exceeds max allowed, " << max_hit_persist-1 <<
" +++\n" 373 <<
"+++ Try to proceed with the default value, hit_persist=" 380 <<
", exceeds max allowed, " << max_drift_delay-1 <<
" +++\n" 381 <<
"+++ Try to proceed with the default value, drift_delay=" 388 <<
", exceeds max allowed, " << max_nplanes_hit_pretrig-1 <<
" +++\n" 389 <<
"+++ Try to proceed with the default value, nplanes_hit_pretrig=" 396 <<
", exceeds max allowed, " << max_nplanes_hit_pattern-1 <<
" +++\n" 397 <<
"+++ Try to proceed with the default value, nplanes_hit_pattern=" 405 <<
", exceeds max allowed, " << max_pid_thresh_pretrig-1 <<
" +++\n" 406 <<
"+++ Try to proceed with the default value, pid_thresh_pretrig=" 413 <<
", exceeds max allowed, " << max_min_separation-1 <<
" +++\n" 414 <<
"+++ Try to proceed with the default value, min_separation=" 422 <<
", exceeds max allowed, " << max_tmb_l1a_window_size-1 <<
" +++\n" 423 <<
"+++ Try to proceed with the default value, tmb_l1a_window_size=" 438 std::vector<CSCCLCTDigi>
446 static std::atomic<bool> config_dumped{
false};
450 config_dumped =
true;
488 <<
"+++ CSC geometry looks garbled; no emulation possible +++\n";
506 (
chamber->layer(i_layer+1)->geometry()->stagger() + 1) / 2;
514 <<
" is not defined in current geometry! +++\n" 515 <<
"+++ CSC geometry looks garbled; no emulation possible +++\n";
525 <<
" numStrips = " <<
numStrips <<
"; CLCT emulation skipped! +++";
526 std::vector<CSCCLCTDigi> emptyV;
545 unsigned int layersHit = 0;
549 if (!halfstrip[i_layer][i_hstrip].
empty()) {layersHit++;
break;}
559 std::vector<CSCCLCTDigi> tmpV =
getCLCTs();
568 for (
auto&
p : tmpV){
582 std::vector<CSCCLCTDigi> CLCTlist;
587 else CLCTlist =
findLCTs(halfstrip);
590 if (CLCTlist.size() > 1)
591 sort(CLCTlist.begin(), CLCTlist.end(), std::greater<CSCCLCTDigi>());
594 for (std::vector<CSCCLCTDigi>::const_iterator plct = CLCTlist.begin();
595 plct != CLCTlist.end(); plct++) {
596 int bx = plct->getBX();
599 <<
"+++ Bx of CLCT candidate, " << bx <<
", exceeds max allowed, " 637 digiV[i_layer].clear();
660 <<
"found " <<
digiV[i_layer].size()
661 <<
" comparator digi(s) in layer " << i_layer <<
" of " <<
675 bool me1b = (
id.station() == 1) && (
id.
ring() == 1);
676 bool me1a = (
id.station() == 1) && (
id.
ring() == 4);
679 digiIt != rcompd.second; ++digiIt) {
680 unsigned int origStrip = digiIt->getStrip();
681 unsigned int maxStripsME1a =
gangedME1a ? 16 : 48;
686 digiIt->getComparator(),
687 digiIt->getTimeBinWord());
688 digiV[
id.layer()-1].push_back(digi_corr);
693 if (me1aProc && me1b && origStrip > 64){
696 digiIt->getComparator(),
697 digiIt->getTimeBinWord());
698 digiV[
id.layer()-1].push_back(digi_corr);
699 }
else if ((me1bProc && me1b && origStrip <= 64)
700 || ((me1aProc && me1a))
702 digiV[
id.layer()-1].push_back(*digiIt);
706 digiV[
id.layer()-1].push_back(*digiIt);
719 for (std::vector<CSCComparatorDigi>::iterator pld =
digiV[i_layer].
begin();
720 pld !=
digiV[i_layer].end(); pld++, i_digi++) {
723 std::ostringstream strstrm;
724 strstrm <<
"Comparator digi: comparator = " << pld->getComparator()
725 <<
" strip #" << pld->getStrip()
727 std::vector<int> bx_times = pld->getTimeBinsOn();
728 for (
unsigned int tbin = 0; tbin < bx_times.size(); tbin++)
729 strstrm <<
" " << bx_times[tbin];
730 LogTrace(
"CSCCathodeLCTProcessor") << strstrm.str();
735 int thisComparator = pld->getComparator();
736 if (thisComparator != 0 && thisComparator != 1) {
738 <<
"+++ Found comparator digi with wrong comparator value = " 739 << thisComparator <<
"; skipping it... +++\n";
744 int thisStrip = pld->getStrip() - 1;
745 if (thisStrip < 0 || thisStrip >=
numStrips) {
747 <<
"+++ Found comparator digi with wrong strip number = " 749 <<
" (max strips = " <<
numStrips <<
"); skipping it... +++\n";
755 int thisHalfstrip = 2*thisStrip + thisComparator +
stagger[i_layer];
758 <<
"+++ Found wrong halfstrip number = " << thisHalfstrip
759 <<
"; skipping this digi... +++\n";
764 std::vector<int> bx_times = pld->getTimeBinsOn();
765 for (
unsigned int i = 0;
i < bx_times.size();
i++) {
773 if (bx_times[
i] > 1 && bx_times[
i] < static_cast<int>(
fifo_tbins)) {
775 if (
i == 0 || (
i > 0 && bx_times[
i]-bx_times[
i-1] >=
781 <<
"Comp digi: layer " << i_layer+1
782 <<
" digi #" << i_digi+1
783 <<
" strip " << thisStrip
784 <<
" halfstrip " << thisHalfstrip
785 <<
" time " << bx_times[
i]
786 <<
" comparator " << thisComparator
787 <<
" stagger " << stagger[i_layer];
788 halfstrip[i_layer][thisHalfstrip].push_back(bx_times[
i]);
792 <<
" Skipping comparator digi: strip = " << thisStrip
793 <<
", layer = " << i_layer+1 <<
", bx = " << bx_times[
i]
794 <<
", bx of previous hit = " << bx_times[
i-1];
799 <<
"+++ Skipping comparator digi: strip = " << thisStrip
800 <<
", layer = " << i_layer+1 <<
", bx = " << bx_times[
i] <<
" +++";
816 std::vector<CSCCLCTDigi> lctList;
819 const int maxHalfStrips = 2*
numStrips + 1;
835 while (start_bx < stop_bx) {
839 bool pre_trig =
preTrigger(pulse, start_bx, first_bx);
846 <<
"..... pretrigger at bx = " << first_bx
847 <<
"; waiting drift delay .....";
851 bool hits_in_time =
ptnFinding(pulse, maxHalfStrips, latch_bx);
855 hstrip < maxHalfStrips; hstrip++) {
856 if (
nhits[hstrip] > 0) {
858 <<
" bx = " << std::setw(2) << latch_bx <<
" --->" 859 <<
" halfstrip = " << std::setw(3) << hstrip
860 <<
" best pid = " << std::setw(2) <<
best_pid[hstrip]
861 <<
" nhits = " <<
nhits[hstrip];
868 start_bx = first_bx + 1;
874 best_halfstrip[ilct] = -1;
875 best_quality[ilct] = 0;
882 hstrip < maxHalfStrips; hstrip++) {
885 quality[hstrip] = (
best_pid[hstrip] & 14) | (
nhits[hstrip] << 5);
886 if (quality[hstrip] > best_quality[0]) {
887 best_halfstrip[0] = hstrip;
888 best_quality[0] = quality[hstrip];
890 if (
infoV > 1 && quality[hstrip] > 0) {
892 <<
" 1st CLCT: halfstrip = " << std::setw(3) << hstrip
893 <<
" quality = " << std::setw(3) << quality[hstrip]
894 <<
" nhits = " << std::setw(3) <<
nhits[hstrip]
895 <<
" pid = " << std::setw(3) <<
best_pid[hstrip]
896 <<
" best halfstrip = " << std::setw(3) << best_halfstrip[0]
897 <<
" best quality = " << std::setw(3) << best_quality[0];
903 if (best_halfstrip[0] >= 0) {
909 hstrip < maxHalfStrips; hstrip++) {
910 if (quality[hstrip] > best_quality[1]) {
911 best_halfstrip[1] = hstrip;
912 best_quality[1] = quality[hstrip];
914 if (
infoV > 1 && quality[hstrip] > 0) {
916 <<
" 2nd CLCT: halfstrip = " << std::setw(3) << hstrip
917 <<
" quality = " << std::setw(3) << quality[hstrip]
918 <<
" nhits = " << std::setw(3) <<
nhits[hstrip]
919 <<
" pid = " << std::setw(3) <<
best_pid[hstrip]
920 <<
" best halfstrip = " << std::setw(3) << best_halfstrip[1]
921 <<
" best quality = " << std::setw(3) << best_quality[1];
926 bool ptn_trig =
false;
928 int best_hs = best_halfstrip[ilct];
937 keystrip_data[ilct][
CLCT_BX] = first_bx;
942 int halfstrip_in_cfeb = keystrip_data[ilct][
CLCT_STRIP] -
946 <<
" Final selection: ilct " << ilct
947 <<
" key halfstrip " << keystrip_data[ilct][
CLCT_STRIP]
950 <<
" bx " << keystrip_data[ilct][
CLCT_BX];
959 lctList.push_back(thisLCT);
974 for (
unsigned int bx = latch_bx + 1; bx < stop_time; bx++) {
975 bool return_to_idle =
true;
976 bool hits_in_time =
ptnFinding(pulse, maxHalfStrips, bx);
979 hstrip < maxHalfStrips; hstrip++) {
982 <<
" State machine busy at bx = " << bx;
983 return_to_idle =
false;
988 if (return_to_idle) {
990 <<
" State machine returns to idle state at bx = " << bx;
999 start_bx = first_bx + 1;
1013 static const unsigned int bits_in_pulse = 8*
sizeof(
pulse[0][0]);
1024 for (
int i_strip = 0; i_strip < nStrips; i_strip++)
1025 pulse[i_layer][i_strip] = 0;
1029 for (
int i_strip = 0; i_strip < nStrips; i_strip++) {
1033 std::vector<int> bx_times =
time[i_layer][i_strip];
1034 for (
unsigned int i = 0;
i < bx_times.size();
i++) {
1036 if (bx_times[
i] < 0 || bx_times[
i] +
hit_persist >= bits_in_pulse) {
1038 <<
"+++ BX time of comparator digi (halfstrip = " << i_strip
1039 <<
" layer = " << i_layer <<
") bx = " << bx_times[
i]
1040 <<
" is not within the range (0-" << bits_in_pulse
1041 <<
"] allowed for pulse extension. Skip this digi! +++\n";
1045 for (
unsigned int bx = bx_times[
i]; bx < bx_times[
i] +
hit_persist; ++bx)
1046 pulse[i_layer][i_strip] =
pulse[i_layer][i_strip] | (1 << bx);
1058 const int start_bx,
int& first_bx) {
1060 <<
"....................PreTrigger...........................";
1065 int nPreTriggers = 0;
1067 bool pre_trig =
false;
1069 for (
unsigned int bx_time = start_bx; bx_time <
fifo_tbins; bx_time++) {
1078 hstrip < nStrips; hstrip++) {
1080 if (
nhits[hstrip] > 0) {
1082 <<
" bx = " << std::setw(2) << bx_time <<
" --->" 1083 <<
" halfstrip = " << std::setw(3) << hstrip
1084 <<
" best pid = " << std::setw(2) <<
best_pid[hstrip]
1085 <<
" nhits = " <<
nhits[hstrip];
1098 1, bend, hstrip%32, hstrip/32, bx_time, nPreTriggers, 0));
1111 "no pretrigger, returning \n";
1120 const int nStrips,
const unsigned int bx_time)
1127 unsigned int layers_hit = 0;
1130 for (
int i_hstrip = 0; i_hstrip < nStrips; i_hstrip++)
1132 if (((
pulse[i_layer][i_hstrip] >> bx_time) & 1) == 1)
1141 for (
int key_hstrip = 0; key_hstrip < nStrips; key_hstrip++)
1144 nhits[key_hstrip] = 0;
1157 hit_layer[ilayer] =
false;
1159 double num_pattern_hits=0., times_sum=0.;
1160 std::multiset<int> mset_for_median;
1161 mset_for_median.clear();
1168 if (this_layer >= 0 && this_layer < CSCConstants::NUM_LAYERS)
1171 if (this_strip >= 0 && this_strip < nStrips) {
1173 <<
" In ptnFinding: key_strip = " << key_hstrip
1174 <<
" pid = " <<
pid <<
" strip_num = " << strip_num
1175 <<
" layer = " << this_layer <<
" strip = " << this_strip;
1177 if (((
pulse[this_layer][this_strip] >> bx_time) & 1) == 1)
1179 if (hit_layer[this_layer] ==
false)
1181 hit_layer[this_layer] =
true;
1187 int first_bx_layer = bx_time;
1188 for (
unsigned int dbx = 0; dbx <
hit_persist; dbx++)
1190 if (((
pulse[this_layer][this_strip] >> (first_bx_layer - 1)) & 1) == 1)
1195 times_sum += (double) first_bx_layer;
1196 num_pattern_hits += 1.;
1197 mset_for_median.insert(first_bx_layer);
1199 LogTrace(
"CSCCathodeLCTProcessor") <<
" 1st bx in layer: " << first_bx_layer <<
" sum bx: " << times_sum
1200 <<
" #pat. hits: " << num_pattern_hits;
1206 if (layers_hit >
nhits[key_hstrip])
1209 nhits[key_hstrip] = layers_hit;
1212 const int sz = mset_for_median.size();
1214 std::multiset<int>::iterator im = mset_for_median.begin();
1215 if (sz>1) std::advance(im,sz/2-1);
1220 #if defined(EDM_ML_DEBUG) 1223 auto lt =
LogTrace(
"CSCCathodeLCTProcessor")
1225 for (im = mset_for_median.begin(); im != mset_for_median.end(); im++) {
1233 if (
nhits[key_hstrip] == CSCConstants::NUM_LAYERS)
break;
1243 const int best_patid,
1252 for (
int hstrip = best_hstrip-nspan; hstrip <= best_hstrip+pspan; hstrip++) {
1253 if (hstrip >= 0 && hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS) {
1265 std::vector<CSCCLCTDigi>
1268 std::vector<CSCCLCTDigi> lctList;
1271 const int maxHalfStrips = 2 *
numStrips + 1;
1279 busyMap[
i][j] =
false;
1281 std::vector<CSCCLCTDigi> lctListBX;
1295 while (start_bx < stop_bx)
1301 bool pre_trig =
preTrigger(pulse, start_bx, first_bx);
1308 LogTrace(
"CSCCathodeLCTProcessor") <<
"..... pretrigger at bx = " << first_bx <<
"; waiting drift delay .....";
1312 bool hits_in_time =
ptnFinding(pulse, maxHalfStrips, latch_bx);
1319 if (
nhits[hstrip] > 0)
1321 LogTrace(
"CSCCathodeLCTProcessor") <<
" bx = " << std::setw(2) << latch_bx <<
" --->" <<
" halfstrip = " 1322 << std::setw(3) << hstrip <<
" best pid = " << std::setw(2) <<
best_pid[hstrip] <<
" nhits = " <<
nhits[hstrip];
1329 start_bx = first_bx + 1;
1339 best_halfstrip[ilct] = -1;
1340 best_quality[ilct] = 0;
1352 pretrig_zone[hstrip] =
false;
1361 if (max_hs > CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1)
1362 max_hs = CSCConstants::NUM_HALF_STRIPS_7CFEBS - 1;
1363 for (
int hs = min_hs; hs <= max_hs; hs++)
1364 pretrig_zone[hs] =
true;
1366 LogTrace(
"CSCCathodeLCTProcessor") <<
" marked pretrigger halfstrip zone [" << min_hs <<
"," << max_hs <<
"]";
1373 quality[hstrip] = (
best_pid[hstrip] & 14) | (
nhits[hstrip] << 5);
1377 if (quality[hstrip] > best_quality[0] &&
1378 pretrig_zone[hstrip] &&
1379 !busyMap[hstrip][first_bx] )
1381 best_halfstrip[0] = hstrip;
1382 best_quality[0] = quality[hstrip];
1385 LogTrace(
"CSCCathodeLCTProcessor") <<
" 1st CLCT: halfstrip = " << std::setw(3) << hstrip <<
" quality = " 1386 << std::setw(3) << quality[hstrip] <<
" best halfstrip = " << std::setw(3) << best_halfstrip[0]
1387 <<
" best quality = " << std::setw(3) << best_quality[0];
1394 if (best_halfstrip[0] >= 0)
1401 if (quality[hstrip] > best_quality[1] &&
1402 pretrig_zone[hstrip] &&
1403 !busyMap[hstrip][first_bx] )
1405 best_halfstrip[1] = hstrip;
1406 best_quality[1] = quality[hstrip];
1409 LogTrace(
"CSCCathodeLCTProcessor") <<
" 2nd CLCT: halfstrip = " << std::setw(3) << hstrip <<
" quality = " 1410 << std::setw(3) << quality[hstrip] <<
" best halfstrip = " << std::setw(3) << best_halfstrip[1]
1411 <<
" best quality = " << std::setw(3) << best_quality[1];
1417 bool ptn_trig =
false;
1420 int best_hs = best_halfstrip[ilct];
1434 keystrip_data[ilct][
CLCT_BX] = bx;
1441 LogTrace(
"CSCCathodeLCTProcessor") <<
" Final selection: ilct " << ilct <<
" key halfstrip " 1449 lctList.push_back(thisLCT);
1450 lctListBX.push_back(thisLCT);
1463 for (
unsigned int ilct = 0; ilct < lctListBX.size(); ilct++)
1471 int min_hstrip = key_hstrip - delta_hs;
1472 int max_hstrip = key_hstrip + delta_hs;
1476 if (max_hstrip > maxHalfStrips)
1477 max_hstrip = maxHalfStrips;
1480 LogTrace(
"CSCCathodeLCTProcessor") <<
" marking post-trigger zone after bx=" << lctListBX[ilct].getBX() <<
" [" 1481 << min_hstrip <<
"," << max_hstrip <<
"]";
1488 for (
size_t bx = first_bx + 1; bx <
fifo_tbins; bx++)
1490 bool busy_bx =
false;
1491 if (bx <= (
size_t)latch_bx)
1495 bool hits_in_time =
ptnFinding(pulse, maxHalfStrips, bx);
1499 LogTrace(
"CSCCathodeLCTProcessor") <<
" at bx=" << bx <<
" hits_in_time=" << hits_in_time <<
" nhits=" 1500 <<
nhits[key_hstrip];
1503 LogTrace(
"CSCCathodeLCTProcessor") <<
" at bx=" << bx <<
" busy=" << busy_bx;
1505 for (
int hstrip = min_hstrip; hstrip <= max_hstrip; hstrip++)
1506 busyMap[hstrip][bx] =
true;
1516 start_bx = first_bx + 1;
1529 std::ostringstream strm;
1531 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1532 strm <<
"+ CLCT configuration parameters: +\n";
1533 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1534 strm <<
" fifo_tbins [total number of time bins in DAQ readout] = " 1536 strm <<
" fifo_pretrig [start time of cathode raw hits in DAQ readout] = " 1538 strm <<
" hit_persist [duration of signal pulse, in 25 ns bins] = " 1540 strm <<
" drift_delay [time after pre-trigger before TMB latches LCTs] = " 1542 strm <<
" nplanes_hit_pretrig [min. number of layers hit for pre-trigger] = " 1544 strm <<
" nplanes_hit_pattern [min. number of layers hit for trigger] = " 1546 strm <<
" pid_thresh_pretrig [lower threshold on pattern id] = " 1548 strm <<
" min_separation [region of busy key strips] = " 1550 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1551 LogDebug(
"CSCCathodeLCTProcessor") << strm.str();
1560 <<
" strip type " << stripType <<
" nStrips " << nStrips;
1562 std::ostringstream strstrm;
1563 for (
int i_strip = 0; i_strip < nStrips; i_strip++) {
1564 if (i_strip%10 == 0) {
1565 if (i_strip < 100) strstrm << i_strip/10;
1566 else strstrm << (i_strip-100)/10;
1568 else strstrm <<
" ";
1569 if ((i_strip+1)%
cfeb_strips[stripType] == 0) strstrm <<
" ";
1572 for (
int i_strip = 0; i_strip < nStrips; i_strip++) {
1573 strstrm << i_strip%10;
1574 if ((i_strip+1)%
cfeb_strips[stripType] == 0) strstrm <<
" ";
1578 for (
int i_strip = 0; i_strip < nStrips; i_strip++) {
1580 std::vector<int> bx_times =
strip[i_layer][i_strip];
1582 strstrm << std::hex << bx_times[0] <<
std::dec;
1587 if ((i_strip+1)%
cfeb_strips[stripType] == 0) strstrm <<
" ";
1590 LogTrace(
"CSCCathodeLCTProcessor") << strstrm.str();
1596 std::vector<CSCCLCTDigi> tmpV;
1608 static std::atomic<int> lct_bins;
1610 static std::atomic<int> late_tbins;
1613 static std::atomic<int> ifois{0};
1618 <<
"; in-time CLCTs are not getting read-out!!! +++" <<
"\n";
1623 <<
"+++ Allowed range of time bins, [0-" << late_tbins
1625 <<
"+++ Set late_tbins to max allowed +++\n";
1626 late_tbins = CSCConstants::MAX_CLCT_TBINS-1;
1633 int bx_readout = -1;
1634 std::vector<CSCCLCTDigi> all_lcts =
getCLCTs();
1635 for (std::vector <CSCCLCTDigi>::const_iterator plct = all_lcts.begin();
1636 plct != all_lcts.end(); plct++) {
1637 if (!plct->isValid())
continue;
1639 int bx = (*plct).getBX();
1643 <<
" Do not report CLCT on key halfstrip " << plct->getKeyStrip()
1644 <<
": found at bx " << bx <<
", whereas the earliest allowed bx is " 1650 if (bx > late_tbins) {
1652 <<
" Do not report CLCT on key halfstrip " << plct->getKeyStrip()
1653 <<
": found at bx " << bx <<
", whereas the latest allowed bx is " 1662 if (bx_readout == -1 || bx == bx_readout) {
1663 tmpV.push_back(*plct);
1664 if (bx_readout == -1) bx_readout = bx;
1667 else tmpV.push_back(*plct);
1674 std::vector<CSCCLCTDigi> tmpV;
1686 for (
int ptn = 0; ptn < 8; ptn++) {
1687 for (
int bend = 0; bend < 2; bend++) {
1690 for (
int bx = 0; bx < 7; bx++) {
1691 for (
int stripType = 0; stripType < 2; stripType++) {
1694 key_strip, cfeb, bx);
1697 <<
"pattern mismatch: " << ptn <<
" " 1699 if (bend != thisLCT.
getBend())
1701 <<
"bend mismatch: " << bend <<
" " << thisLCT.
getBend();
1702 if (cfeb != thisLCT.
getCFEB())
1704 <<
"cfeb mismatch: " << cfeb <<
" " << thisLCT.
getCFEB();
1707 <<
"strip mismatch: " << key_strip <<
" " 1709 if (bx != thisLCT.
getBX())
1711 <<
"bx mismatch: " << bx <<
" " << thisLCT.
getBX();
1714 <<
"Strip Type mismatch: " << stripType <<
" " 1718 <<
"quality mismatch: " <<
quality <<
" "
int getQuality() const
return quality of a pattern (number of layers hit!)
static const unsigned int def_drift_delay
T getParameter(std::string const &) const
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
void setDefaultConfigParameters()
std::vector< CSCCLCTDigi > readoutCLCTs()
bool use_dead_time_zoning
unsigned int nplanes_hit_pretrig
static const unsigned int def_fifo_tbins
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
unsigned int min_separation
static const int cfeb_strips[2]
unsigned int clctHitPersist() const
std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
static std::string chamberName(int endcap, int station, int ring, int chamber)
const unsigned theTrigChamber
int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
unsigned int clctNplanesHitPattern() const
const unsigned theSubsector
void dumpConfigParams() const
const unsigned theStation
static const int pattern2007_offset[CSCConstants::MAX_HALFSTRIPS_IN_PATTERN]
static const unsigned int def_min_separation
unsigned int clctMinSeparation() const
unsigned int clctNplanesHitPretrig() const
static const unsigned int def_nplanes_hit_pretrig
static int ringFromTriggerLabels(int station, int triggerCSCID)
const CSCGeometry * csc_g
bool preTrigger(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int start_bx, int &first_bx)
int getStripType() const
return striptype
unsigned int clctDriftDelay() const
int getBend() const
return bend
static const unsigned int def_pid_thresh_pretrig
unsigned int fifo_pretrig
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
unsigned int clctPidThreshPretrig() const
void readComparatorDigis(std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int stripType, const int nStrips) const
int getCFEB() const
return Key CFEB ID
static const int pattern2007[CSCConstants::NUM_CLCT_PATTERNS][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+2]
static const unsigned int def_tmb_l1a_window_size
int getBX() const
return BX
bool getDigis(const CSCComparatorDigiCollection *compdc)
static const unsigned int def_nplanes_hit_pattern
unsigned int pretrig_trig_zone
unsigned int clctFifoPretrig() const
unsigned int clct_state_machine_zone
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
unsigned int nplanes_hit_pattern
bool ptnFinding(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, const unsigned int bx_time)
std::string chamberName() const
double pulse(double x, double y, double z, double t)
void checkConfigParameters()
static const unsigned int def_fifo_pretrig
int getPattern() const
return pattern
std::vector< int > thePreTriggerBXs
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
static const unsigned int def_hit_persist
unsigned int alctClctOffset
int stagger[CSCConstants::NUM_LAYERS]
std::vector< CSCComparatorDigi >::const_iterator const_iterator
void setFullBX(const uint16_t fullbx)
Set 12-bit full BX.
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
std::vector< CSCCLCTDigi > run(const CSCComparatorDigiCollection *compdc)
unsigned int clctFifoTbins() const
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
void clear()
clear this CLCT
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
std::pair< const_iterator, const_iterator > Range
unsigned int tmb_l1a_window_size
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
std::vector< CSCCLCTDigi > findLCTsSLHC(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
unsigned int pid_thresh_pretrig
std::vector< CSCCLCTDigi > getCLCTs()
void setConfigParameters(const CSCDBL1TPParameters *conf)
bool dynamic_state_machine_zone
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting CLCTs.