4 unsigned sector,
unsigned subsector,
8 , dropLowQualityCLCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs"))
9 , dropLowQualityALCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs"))
10 , buildLCTfromALCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM"))
11 , buildLCTfromCLCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM"))
14 <<
"+++ Upgrade CSCGEMMotherboardME21 constructed while isSLHC is not set! +++\n";
25 <<
"+++ Upgrade CSCGEMMotherboardME21 constructed while isSLHC is not set! +++\n";
43 if (
gem_g !=
nullptr) {
45 <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
52 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
60 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
65 clctProc->setCSCGeometry(
csc_g);
68 clctV = clctProc->run(compdc);
73 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL ALCTs from ME21 "<< std::endl;
74 for (
const auto& alct :
alctV)
76 LogTrace(
"CSCGEMCMotherboardME21") << alct << std::endl;
78 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL CLCTs from ME21 "<< std::endl;
79 for (
const auto& clct :
clctV)
81 LogTrace(
"CSCGEMCMotherboardME21") << clct << std::endl;
83 int used_clct_mask[20];
84 for (
int c=0;
c<20;++
c) used_clct_mask[
c]=0;
91 const bool hasPads(!
pads_.empty());
92 const bool hasCoPads(!
coPads_.empty());
97 if (
alctProc->bestALCT[bx_alct].isValid())
105 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
106 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALCT-CLCT matching in ME2/1 chamber: " <<
cscChamber->
id() << std::endl;
107 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl;
108 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Best ALCT Details: ";
109 alctProc->bestALCT[bx_alct].print();
110 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Second ALCT Details: ";
111 alctProc->secondALCT[bx_alct].print();
116 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl;
117 LogTrace(
"CSCGEMCMotherboardME21") <<
"Attempt ALCT-CLCT matching in ME2/1 in bx range: [" << bx_clct_start <<
"," << bx_clct_stop <<
"]" << std::endl;
121 int nSuccessFulMatches = 0;
122 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
126 if (clctProc->bestCLCT[bx_clct].isValid())
129 const int quality(clctProc->bestCLCT[bx_clct].getQuality());
131 const bool lowQualityALCT(
alctProc->bestALCT[bx_alct].getQuality() == 0);
133 const bool lowQuality(
quality<4
or lowQualityALCT);
134 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"++Valid ME21 CLCT: " << clctProc->bestCLCT[bx_clct] << std::endl;
137 matches<GEMPadDigi> mPads;
138 matchingPads<GEMPadDigi>(clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct],
140 matches<GEMCoPadDigi> mCoPads;
141 matchingPads<GEMCoPadDigi>(clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct],
145 int nFound(mPads.size());
146 const bool clctInEdge(clctProc->bestCLCT[bx_clct].getKeyStrip() < 5
or clctProc->bestCLCT[bx_clct].getKeyStrip() > 155);
148 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\tInfo: low quality CLCT in CSC chamber edge, don't care about GEM pads" << std::endl;
152 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\tInfo: low quality CLCT with " << nFound <<
" matching GEM trigger pads" << std::endl;
155 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\tWarning: low quality CLCT without matching GEM trigger pad" << std::endl;
161 ++nSuccessFulMatches;
163 int mbx = bx_clct-bx_clct_start;
165 clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct],
170 LogTrace(
"CSCGEMCMotherboardME21") <<
"Successful ALCT-CLCT match in ME21: bx_alct = " << bx_alct
171 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop
172 <<
"]; bx_clct = " << bx_clct << std::endl;
173 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Best CLCT Details: ";
174 clctProc->bestCLCT[bx_clct].print();
175 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Second CLCT Details: ";
176 clctProc->secondCLCT[bx_clct].print();
178 if (
allLCTs(bx_alct,mbx,0).isValid()) {
179 used_clct_mask[bx_clct] += 1;
186 int nSuccessFulGEMMatches = 0;
188 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"++No valid ALCT-CLCT matches in ME21" << std::endl;
189 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
195 matches<GEMCoPadDigi> copads;
196 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
alctProc->bestALCT[bx_alct],
alctProc->secondALCT[bx_alct], copads);
198 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : "<< copads.size() << std::endl;
199 if (copads.empty()) {
205 if (
allLCTs(bx_alct,0,0).isValid()) {
206 ++nSuccessFulGEMMatches;
210 LogTrace(
"CSCGEMCMotherboardME21") <<
"Successful ALCT-GEM CoPad match in ME21: bx_alct = " << bx_alct << std::endl << std::endl;
211 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl << std::endl;
217 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
218 LogTrace(
"CSCGEMCMotherboardME21") <<
"Summary: " << std::endl;
219 if (nSuccessFulMatches>1)
220 LogTrace(
"CSCGEMCMotherboardME21") <<
"Too many successful ALCT-CLCT matches in ME21: " << nSuccessFulMatches
222 <<
", bx_alct = " << bx_alct
223 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
224 else if (nSuccessFulMatches==1)
225 LogTrace(
"CSCGEMCMotherboardME21") <<
"1 successful ALCT-CLCT match in ME21: " 227 <<
", bx_alct = " << bx_alct
228 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
229 else if (nSuccessFulGEMMatches==1)
230 LogTrace(
"CSCGEMCMotherboardME21") <<
"1 successful ALCT-GEM match in ME21: " 232 <<
", bx_alct = " << bx_alct
233 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
235 LogTrace(
"CSCGEMCMotherboardME21") <<
"Unsuccessful ALCT-CLCT match in ME21: " 237 <<
", bx_alct = " << bx_alct
238 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
249 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
250 LogTrace(
"CSCGEMCMotherboardME21") <<
"GEM-CLCT matching in ME2/1 chamber: "<<
cscChamber->
id()<<
"in bx:"<<bx_alct<<std::endl;
251 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl;
254 int nSuccessFulMatches = 0;
255 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
259 if (clctProc->bestCLCT[bx_clct].isValid())
261 const int quality(clctProc->bestCLCT[bx_clct].getQuality());
265 ++nSuccessFulMatches;
267 int mbx =
std::abs(clctProc->bestCLCT[bx_clct].getBX()-bx_alct);
273 LogTrace(
"CSCGEMCMotherboardME21") <<
"Successful GEM-CLCT match in ME21: bx_alct = " << bx_alct <<std::endl;
276 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Best CLCT Details: ";
277 clctProc->bestCLCT[bx_clct].print();
278 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Second CLCT Details: ";
279 clctProc->secondCLCT[bx_clct].print();
281 if (
allLCTs(bx_gem,mbx,0).isValid()) {
282 used_clct_mask[bx_gem] += 1;
298 int cbx = bx + mbx - match_trig_window_size/2;
303 <<
"LCT"<<
i+1<<
" "<<bx<<
"/"<<cbx<<
": "<<
allLCTs(bx,mbx,
i)<<std::endl;
325 int cbx = bx + mbx - match_trig_window_size/2;
330 <<
"LCT"<<
i+1<<
" "<<bx<<
"/"<<cbx<<
": "<<
allLCTs(bx,mbx,
i)<< std::endl;
334 <<
"bx "<<bx<<
" nnLCT:"<<n<<
" "<<n<<std::endl;
342 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
343 LogTrace(
"CSCGEMCMotherboardME21") <<
"Counting the final LCTs in CSCGEM Motherboard ME21" << std::endl;
344 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
350 LogTrace(
"CSCGEMCMotherboardME21") <<
"LCT "<<n<<
" " <<
p <<std::endl;
357 std::vector<CSCCorrelatedLCTDigi>
result;
380 if (secondALCT == bestALCT) secondALCT.
clear();
381 if (secondCLCT == bestCLCT) secondCLCT.
clear();
388 if (!copads.empty()
or !pads.empty()){
391 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
392 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
393 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
394 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
397 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
398 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
399 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
400 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
403 const bool ok_bb_copad = ok_bb and bb_copad.
isValid();
404 const bool ok_bs_copad = ok_bs and bs_copad.isValid();
405 const bool ok_sb_copad = ok_sb and sb_copad.isValid();
406 const bool ok_ss_copad = ok_ss and ss_copad.isValid();
408 const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.isValid();
409 const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.isValid();
410 const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.isValid();
411 const bool ok_ss_pad = (not ok_ss_copad) and ok_ss and ss_pad.isValid();
414 if (ok_bb_copad
or ok_ss_copad){
416 if (ok_ss_copad) lct2 =
constructLCTsGEM(secondALCT, secondCLCT, ss_copad, 2);
418 else if(ok_bs_copad
or ok_sb_copad){
419 if (ok_bs_copad) lct1 =
constructLCTsGEM(bestALCT, secondCLCT, bs_copad, 1);
420 if (ok_sb_copad) lct2 =
constructLCTsGEM(secondALCT, bestCLCT, sb_copad, 2);
427 if ((ok_bb_pad
or ok_ss_pad) and not (ok_bs_copad
or ok_sb_copad)){
431 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_
std::vector< CSCCLCTDigi > clctV
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads) override
unsigned int match_trig_window_size
CSCDetId id() const
Get the (concrete) DetId.
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
unsigned int alctClctOffset
void clear()
clear this ALCT
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
int pref[CSCConstants::MAX_LCT_TBINS]
const CSCChamber * cscChamber
const CSCGeometry * csc_g
~CSCGEMMotherboardME21() override
matches< GEMCoPadDigi > GEMCoPadDigiIds
std::vector< GEMCoPadDigi > gemCoPadV
bool dropLowQualityCLCTsNoGEMs_
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
void correlateLCTsGEM(T &best, T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
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 &)
Abs< T >::type abs(const T &t)
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_
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, int i) const
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
bool buildLCTfromALCTandGEM_
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
void clear()
clear this CLCT
matches< GEMPadDigi > GEMPadDigiIds
const GEMGeometry * gem_g
unsigned int tmb_cross_bx_algo
void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart)