7 unsigned sector,
unsigned subsector,
11 , allLCTs(match_trig_window_size)
12 , dropLowQualityCLCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs"))
13 , dropLowQualityALCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs"))
14 , buildLCTfromALCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM"))
15 , buildLCTfromCLCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM"))
57 if (
gem_g !=
nullptr) {
59 <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
66 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
74 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
79 clct->setCSCGeometry(
csc_g);
82 clctV = clct->run(compdc);
87 int used_clct_mask[20];
88 for (
int c=0;
c<20;++
c) used_clct_mask[
c]=0;
95 const bool hasPads(!
pads_.empty());
96 const bool hasCoPads(!
coPads_.empty());
101 if (
alct->bestALCT[bx_alct].isValid())
109 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
110 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALCT-CLCT matching in ME2/1 chamber: " <<
cscChamber->
id() << std::endl;
111 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl;
112 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Best ALCT Details: ";
113 alct->bestALCT[bx_alct].print();
114 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Second ALCT Details: ";
115 alct->secondALCT[bx_alct].print();
120 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl;
121 LogTrace(
"CSCGEMCMotherboardME21") <<
"Attempt ALCT-CLCT matching in ME2/1 in bx range: [" << bx_clct_start <<
"," << bx_clct_stop <<
"]" << std::endl;
125 int nSuccessFulMatches = 0;
126 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
130 if (clct->bestCLCT[bx_clct].isValid())
133 const int quality(clct->bestCLCT[bx_clct].getQuality());
135 const bool lowQualityALCT(
alct->bestALCT[bx_alct].getQuality() == 0);
137 const bool lowQuality(
quality<4
or lowQualityALCT);
138 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"++Valid ME21 CLCT: " << clct->bestCLCT[bx_clct] << std::endl;
141 matches<GEMPadDigi> mPads;
142 matchingPads<GEMPadDigi>(clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
143 alct->bestALCT[bx_alct],
alct->secondALCT[bx_alct],
ME21, mPads);
144 matches<GEMCoPadDigi> mCoPads;
145 matchingPads<GEMCoPadDigi>(clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
146 alct->bestALCT[bx_alct],
alct->secondALCT[bx_alct],
ME21, mCoPads);
149 int nFound(mPads.size());
150 const bool clctInEdge(clct->bestCLCT[bx_clct].getKeyStrip() < 5
or clct->bestCLCT[bx_clct].getKeyStrip() > 155);
152 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\tInfo: low quality CLCT in CSC chamber edge, don't care about GEM pads" << std::endl;
156 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\tInfo: low quality CLCT with " << nFound <<
" matching GEM trigger pads" << std::endl;
159 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\tWarning: low quality CLCT without matching GEM trigger pad" << std::endl;
165 ++nSuccessFulMatches;
167 int mbx = bx_clct-bx_clct_start;
169 clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
174 LogTrace(
"CSCGEMCMotherboardME21") <<
"Successful ALCT-CLCT match in ME21: bx_alct = " << bx_alct
175 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop
176 <<
"]; bx_clct = " << bx_clct << std::endl;
177 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Best CLCT Details: ";
178 clct->bestCLCT[bx_clct].print();
179 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Second CLCT Details: ";
180 clct->secondCLCT[bx_clct].print();
182 if (
allLCTs(bx_alct,mbx,0).isValid()) {
183 used_clct_mask[bx_clct] += 1;
190 int nSuccessFulGEMMatches = 0;
192 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"++No valid ALCT-CLCT matches in ME21" << std::endl;
193 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
199 matches<GEMCoPadDigi> copads;
200 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
alct->bestALCT[bx_alct],
alct->secondALCT[bx_alct],
ME21, copads);
202 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : "<< copads.size() << std::endl;
203 if (copads.empty()) {
209 if (
allLCTs(bx_alct,0,0).isValid()) {
210 ++nSuccessFulGEMMatches;
214 LogTrace(
"CSCGEMCMotherboardME21") <<
"Successful ALCT-GEM CoPad match in ME21: bx_alct = " << bx_alct << std::endl << std::endl;
215 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl << std::endl;
221 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
222 LogTrace(
"CSCGEMCMotherboardME21") <<
"Summary: " << std::endl;
223 if (nSuccessFulMatches>1)
224 LogTrace(
"CSCGEMCMotherboardME21") <<
"Too many successful ALCT-CLCT matches in ME21: " << nSuccessFulMatches
226 <<
", bx_alct = " << bx_alct
227 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
228 else if (nSuccessFulMatches==1)
229 LogTrace(
"CSCGEMCMotherboardME21") <<
"1 successful ALCT-CLCT match in ME21: " 231 <<
", bx_alct = " << bx_alct
232 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
233 else if (nSuccessFulGEMMatches==1)
234 LogTrace(
"CSCGEMCMotherboardME21") <<
"1 successful ALCT-GEM match in ME21: " 236 <<
", bx_alct = " << bx_alct
237 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
239 LogTrace(
"CSCGEMCMotherboardME21") <<
"Unsuccessful ALCT-CLCT match in ME21: " 241 <<
", bx_alct = " << bx_alct
242 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
253 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
254 LogTrace(
"CSCGEMCMotherboardME21") <<
"GEM-CLCT matching in ME2/1 chamber: "<<
cscChamber->
id()<<
"in bx:"<<bx_alct<<std::endl;
255 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl;
258 int nSuccessFulMatches = 0;
259 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
263 if (clct->bestCLCT[bx_clct].isValid())
265 const int quality(clct->bestCLCT[bx_clct].getQuality());
269 ++nSuccessFulMatches;
271 int mbx =
std::abs(clct->bestCLCT[bx_clct].getBX()-bx_alct);
277 LogTrace(
"CSCGEMCMotherboardME21") <<
"Successful GEM-CLCT match in ME21: bx_alct = " << bx_alct <<std::endl;
280 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Best CLCT Details: ";
281 clct->bestCLCT[bx_clct].print();
282 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Second CLCT Details: ";
283 clct->secondCLCT[bx_clct].print();
285 if (
allLCTs(bx_gem,mbx,0).isValid()) {
286 used_clct_mask[bx_gem] += 1;
302 int cbx = bx + mbx - match_trig_window_size/2;
307 <<
"LCT"<<
i+1<<
" "<<bx<<
"/"<<cbx<<
": "<<
allLCTs(bx,mbx,
i)<<std::endl;
329 int cbx = bx + mbx - match_trig_window_size/2;
334 <<
"LCT"<<
i+1<<
" "<<bx<<
"/"<<cbx<<
": "<<
allLCTs(bx,mbx,
i)<< std::endl;
338 <<
"bx "<<bx<<
" nnLCT:"<<n<<
" "<<n<<std::endl;
346 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
347 LogTrace(
"CSCGEMCMotherboardME21") <<
"Counting the final LCTs" << std::endl;
348 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
354 LogTrace(
"CSCGEMCMotherboardME21") <<
"LCT "<<n<<
" " <<
p <<std::endl;
361 std::vector<CSCCorrelatedLCTDigi>
result;
384 if (secondALCT == bestALCT) secondALCT.
clear();
385 if (secondCLCT == bestCLCT) secondCLCT.
clear();
392 if (!copads.empty()
or !pads.empty()){
395 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads,
p);
396 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads,
p);
397 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads,
p);
398 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads,
p);
401 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads,
p);
402 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads,
p);
403 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads,
p);
404 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads,
p);
407 const bool ok_bb_copad = ok_bb and bb_copad.
isValid();
408 const bool ok_bs_copad = ok_bs and bs_copad.isValid();
409 const bool ok_sb_copad = ok_sb and sb_copad.isValid();
410 const bool ok_ss_copad = ok_ss and ss_copad.isValid();
412 const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.isValid();
413 const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.isValid();
414 const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.isValid();
415 const bool ok_ss_pad = (not ok_ss_copad) and ok_ss and ss_pad.isValid();
418 if (ok_bb_copad
or ok_ss_copad){
419 if (ok_bb_copad) lct1 =
constructLCTsGEM(bestALCT, bestCLCT, bb_copad, p, 1);
420 if (ok_ss_copad) lct2 =
constructLCTsGEM(secondALCT, secondCLCT, ss_copad, p, 2);
422 else if(ok_bs_copad
or ok_sb_copad){
423 if (ok_bs_copad) lct1 =
constructLCTsGEM(bestALCT, secondCLCT, bs_copad, p, 1);
424 if (ok_sb_copad) lct2 =
constructLCTsGEM(secondALCT, bestCLCT, sb_copad, p, 2);
431 if ((ok_bb_pad
or ok_ss_pad) and not (ok_bs_copad
or ok_sb_copad)){
433 if (ok_ss_pad) lct2 =
constructLCTsGEM(secondALCT, secondCLCT, ss_pad, p, 2);
435 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 run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads) override
unsigned int match_trig_window_size
CSCDetId id() const
Get the (concrete) DetId.
void correlateLCTsGEM(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, const GEMPadDigiIds &pads, const GEMCoPadDigiIds &copads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart p) const
bool isValid() const
check ALCT validity (1 - valid ALCT)
GEMCoPadDigiIdsBX coPads_
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, enum CSCPart, int i) const
bool match_earliest_clct_only
void clear()
clear this ALCT
static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
int pref[CSCConstants::MAX_LCT_TBINS]
const CSCChamber * cscChamber
~CSCGEMMotherboardME21() override
matches< GEMCoPadDigi > GEMCoPadDigiIds
std::vector< GEMCoPadDigi > gemCoPadV
std::vector< CSCALCTDigi > alctV
bool dropLowQualityCLCTsNoGEMs_
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
const CSCGeometry * csc_g
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
void correlateLCTsGEM(T &best, T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart) const
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_
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
bool buildLCTfromALCTandGEM_
std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
std::unique_ptr< CSCAnodeLCTProcessor > alct
std::vector< CSCCLCTDigi > clctV
std::unique_ptr< CSCCathodeLCTProcessor > clct
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)