10 dropLowQualityCLCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs")),
11 dropLowQualityALCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs")),
12 buildLCTfromALCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM")),
13 buildLCTfromCLCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM")) {
16 <<
"+++ Upgrade CSCGEMMotherboardME21 constructed while isSLHC is not set! +++\n";
25 <<
"+++ Upgrade CSCGEMMotherboardME21 constructed while isSLHC is not set! +++\n";
39 if (
gem_g !=
nullptr) {
41 edm::LogInfo(
"CSCGEMMotherboardME21|SetupInfo") <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
49 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
57 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
65 clctV = clctProc->run(compdc);
71 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL ALCTs from ME21 " << std::endl;
72 for (
const auto& alct :
alctV)
74 LogTrace(
"CSCGEMCMotherboardME21") << alct << std::endl;
76 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL CLCTs from ME21 " << std::endl;
77 for (
const auto& clct :
clctV)
79 LogTrace(
"CSCGEMCMotherboardME21") << clct << std::endl;
81 int used_clct_mask[20];
82 for (
int c = 0;
c < 20; ++
c)
83 used_clct_mask[
c] = 0;
90 const bool hasCoPads(!
coPads_.empty());
94 if (
alctProc->getBestALCT(bx_alct).isValid()) {
102 <<
"========================================================================" << std::endl
103 <<
"ALCT-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
" in bx range: [" << bx_clct_start <<
"," 104 << bx_clct_stop <<
"] for bx " << bx_alct << std::endl
105 <<
"------------------------------------------------------------------------" << std::endl
106 <<
"+++ Best ALCT Details: " <<
alctProc->getBestALCT(bx_alct) << std::endl
107 <<
"+++ Second ALCT Details: " <<
alctProc->getSecondALCT(bx_alct) << std::endl;
114 int nGoodMatches = 0;
115 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
120 if (clctProc->getBestCLCT(bx_clct).isValid()) {
123 <<
"+++ Best CLCT Details: " << clctProc->getBestCLCT(bx_clct) << std::endl
124 <<
"+++ Second CLCT Details: " << clctProc->getSecondCLCT(bx_clct) << std::endl;
128 const bool lowQualityCLCT(clctProc->getBestCLCT(bx_clct).getQuality() <= 3);
130 const bool lowQualityALCT(
alctProc->getBestALCT(bx_alct).getQuality() == 0);
133 matches<GEMPadDigi> mPads;
134 matchingPads<GEMPadDigi>(clctProc->getBestCLCT(bx_clct),
135 clctProc->getSecondCLCT(bx_clct),
139 matches<GEMCoPadDigi> mCoPads;
140 matchingPads<GEMCoPadDigi>(clctProc->getBestCLCT(bx_clct),
141 clctProc->getSecondCLCT(bx_clct),
146 bool hasMatchingPads(!mPads.empty()
or !mCoPads.empty());
155 int mbx = bx_clct - bx_clct_start;
158 clctProc->getBestCLCT(bx_clct),
159 clctProc->getSecondCLCT(bx_clct),
165 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
166 used_clct_mask[bx_clct] += 1;
171 <<
"Good ALCT-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
172 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n" 175 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
176 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
177 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl
178 <<
allLCTs(bx_alct, mbx, 0).getCLCT() << std::endl;
179 if (
allLCTs(bx_alct, mbx, 0).getType() == 2)
180 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 0).getGEM1() << std::endl;
181 if (
allLCTs(bx_alct, mbx, 0).getType() == 3)
183 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
186 if (
allLCTs(bx_alct, mbx, 1).isValid()) {
187 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
188 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl
189 <<
allLCTs(bx_alct, mbx, 1).getCLCT() << std::endl;
190 if (
allLCTs(bx_alct, mbx, 1).getType() == 2)
191 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 1).getGEM1() << std::endl;
192 if (
allLCTs(bx_alct, mbx, 1).getType() == 3)
194 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
206 int nGoodGEMMatches = 0;
209 LogTrace(
"CSCGEMMotherboardME21") <<
"++No valid ALCT-CLCT matches in ME21" << std::endl;
210 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
216 matches<GEMCoPadDigi> copads;
217 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
222 <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : " << copads.size() << std::endl;
223 if (copads.empty()) {
232 if (
allLCTs(bx_alct, 0, 0).isValid()) {
237 <<
"Good ALCT-GEM CoPad match in ME21: bx_alct = " << bx_alct <<
"\n\n" 238 <<
"------------------------------------------------------------------------" << std::endl
240 if (
allLCTs(bx_alct, 0, 0).isValid()) {
241 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, 0, 0) << std::endl
242 <<
allLCTs(bx_alct, 0, 0).getALCT() << std::endl;
243 if (
allLCTs(bx_alct, 0, 0).getType() == 4)
245 <<
allLCTs(bx_alct, 0, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 0).getGEM2() << std::endl
248 if (
allLCTs(bx_alct, 0, 1).isValid()) {
249 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, 0, 1) << std::endl
250 <<
allLCTs(bx_alct, 0, 1).getALCT() << std::endl;
251 if (
allLCTs(bx_alct, 0, 1).getType() == 4)
253 <<
allLCTs(bx_alct, 0, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 1).getGEM2() << std::endl
260 LogTrace(
"CSCGEMMotherboardME21") <<
"No valid LCT is built from ALCT-GEM matching in ME21" << std::endl;
267 <<
"========================================================================" << std::endl;
268 LogTrace(
"CSCGEMMotherboardME21") <<
"Summary: " << std::endl;
269 if (nGoodMatches > 1)
271 <<
"Too many good ALCT-CLCT matches in ME21: " << nGoodMatches <<
", CSCDetId " <<
cscId_ 272 <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" 274 else if (nGoodMatches == 1)
276 <<
"1 good ALCT-CLCT match in ME21: " 277 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " 278 << bx_clct_stop <<
"]" << std::endl;
279 else if (nGoodGEMMatches == 1)
281 <<
"1 good ALCT-GEM match in ME21: " 282 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " 283 << bx_clct_stop <<
"]" << std::endl;
285 LogTrace(
"CSCGEMMotherboardME21") <<
"Bad ALCT-CLCT match in ME21: " 286 <<
"CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" 287 << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
299 <<
"========================================================================" << std::endl
300 <<
"GEM-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
"in bx:" << bx_alct << std::endl
301 <<
"------------------------------------------------------------------------" << std::endl;
306 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
311 if (clctProc->getBestCLCT(bx_clct).isValid()) {
312 const int quality(clctProc->getBestCLCT(bx_clct).getQuality());
317 int mbx = bx_clct - bx_clct_start;
319 clctProc->getSecondCLCT(bx_clct),
323 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
324 used_clct_mask[bx_clct] += 1;
328 <<
"Good GEM-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
329 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n" 330 <<
"+++ Best CLCT Details: " << clctProc->getBestCLCT(bx_clct) <<
"\n" 331 <<
"+++ Second CLCT Details: " << clctProc->getSecondCLCT(bx_clct) << std::endl;
333 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
334 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
335 if (
allLCTs(bx_alct, mbx, 0).getType() == 5)
337 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
339 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
340 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
341 if (
allLCTs(bx_alct, mbx, 1).getType() == 5)
343 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
365 <<
"LCT" <<
i + 1 <<
" " <<
bx <<
"/" <<
bx + mbx - match_trig_window_size / 2 <<
": " 392 <<
"LCT" <<
i + 1 <<
" " <<
bx <<
"/" <<
bx + mbx - match_trig_window_size / 2 <<
": " 397 if (
infoV > 0 and n > 0)
398 LogDebug(
"CSCGEMMotherboardME21") <<
"bx " <<
bx <<
" nnLCT:" << n <<
" " << n << std::endl;
407 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" 409 LogTrace(
"CSCGEMCMotherboardME21") <<
"Counting the final LCTs in CSCGEM Motherboard ME21" << std::endl;
410 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" 417 LogTrace(
"CSCGEMCMotherboardME21") <<
"LCT " << n <<
" " <<
p << std::endl;
423 std::vector<CSCCorrelatedLCTDigi>
result;
446 if (secondALCT == bestALCT)
448 if (secondCLCT == bestCLCT)
456 if (!copads.empty()
or !pads.empty()) {
458 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
459 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
460 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
461 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
464 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
465 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
466 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
467 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
470 const bool ok_bb_copad = ok_bb and bb_copad.
isValid();
471 const bool ok_bs_copad = ok_bs and bs_copad.isValid();
472 const bool ok_sb_copad = ok_sb and sb_copad.isValid();
473 const bool ok_ss_copad = ok_ss and ss_copad.isValid();
475 const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.isValid();
476 const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.isValid();
477 const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.isValid();
478 const bool ok_ss_pad = (not ok_ss_copad) and ok_ss and ss_pad.isValid();
481 if (ok_bb_copad
or ok_ss_copad) {
486 }
else if (ok_bs_copad
or ok_sb_copad) {
498 if ((ok_bb_pad
or ok_ss_pad) and not(ok_bs_copad
or ok_sb_copad)) {
503 }
else if ((ok_bs_pad
or ok_sb_pad) and not(ok_bb_copad
or ok_ss_copad)) {
void retrieveGEMPads(const GEMPadDigiCollection *pads, unsigned id)
bool gemGeometryAvailable
bool buildLCTfromCLCTandGEM_
void correlateLCTsGEM(const T &best, const T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
std::vector< CSCCLCTDigi > clctV
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads) override
unsigned int match_trig_window_size
bool isValid() const
check ALCT validity (1 - valid ALCT)
GEMCoPadDigiIdsBX coPads_
bool match_earliest_clct_only
void correlateLCTsGEM(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, const GEMPadDigiIds &pads, const GEMCoPadDigiIds &copads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
void clear()
clear this ALCT
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
int pref[CSCConstants::MAX_LCT_TBINS]
~CSCGEMMotherboardME21() override
matches< GEMCoPadDigi > GEMCoPadDigiIds
std::vector< GEMCoPadDigi > gemCoPadV
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
bool dropLowQualityCLCTsNoGEMs_
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::vector< CSCALCTDigi > alctV
static bool sortLCTsByGEMDphi(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
void printGEMTriggerCoPads(int bx_start, int bx_stop, enum CSCPart)
bool isValid() const
check CLCT validity (1 - valid CLCT)
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb) const
std::unique_ptr< CSCGEMMotherboardLUTME21 > tmbLUT_
const CSCGeometry * cscGeometry_
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, int i) const
std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const override
bool buildLCTfromALCTandGEM_
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
bool dropLowQualityALCTsNoGEMs_
void clear()
clear this CLCT
matches< GEMPadDigi > GEMPadDigiIds
const GEMGeometry * gem_g
unsigned int tmb_cross_bx_algo
unsigned int alctClctOffset_
void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart)
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const