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;
375 if (secondALCT == bestALCT) secondALCT.
clear();
376 if (secondCLCT == bestCLCT) secondCLCT.
clear();
378 if (!copads.empty()
or !pads.empty()){
381 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads,
p);
382 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads,
p);
383 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads,
p);
384 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads,
p);
387 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads,
p);
388 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads,
p);
389 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads,
p);
390 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads,
p);
393 const bool ok_bb_copad = bestALCT.
isValid() and bestCLCT.isValid() and bb_copad.
isValid();
394 const bool ok_bs_copad = bestALCT.isValid() and secondCLCT.isValid() and bs_copad.isValid();
395 const bool ok_sb_copad = secondALCT.isValid() and bestCLCT.isValid() and sb_copad.isValid();
396 const bool ok_ss_copad = secondALCT.isValid() and secondCLCT.isValid() and ss_copad.isValid();
398 const bool ok_bb_pad = (not ok_bb_copad) and bestALCT.isValid() and bestCLCT.isValid() and bb_pad.isValid();
399 const bool ok_bs_pad = (not ok_bs_copad) and bestALCT.isValid() and secondCLCT.isValid() and bs_pad.isValid();
400 const bool ok_sb_pad = (not ok_sb_copad) and secondALCT.isValid() and bestCLCT.isValid() and sb_pad.isValid();
401 const bool ok_ss_pad = (not ok_ss_copad) and secondALCT.isValid() and secondCLCT.isValid() and ss_pad.isValid();
404 if (ok_bb_copad
or ok_ss_copad){
405 if (ok_bb_copad) lct1 =
constructLCTsGEM(bestALCT, bestCLCT, bb_copad, p, 1);
406 if (ok_ss_copad) lct2 =
constructLCTsGEM(secondALCT, secondCLCT, ss_copad, p, 2);
408 else if(ok_bs_copad
or ok_sb_copad){
409 if (ok_bs_copad) lct1 =
constructLCTsGEM(bestALCT, secondCLCT, bs_copad, p, 1);
410 if (ok_sb_copad) lct2 =
constructLCTsGEM(secondALCT, bestCLCT, sb_copad, p, 2);
417 if ((ok_bb_pad
or ok_ss_pad) and not (ok_bs_copad
or ok_sb_copad)){
419 if (ok_ss_pad) lct2 =
constructLCTsGEM(secondALCT, secondCLCT, ss_pad, p, 2);
421 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.
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)
void correlateLCTsGEM(CSCALCTDigi &bestALCT, CSCALCTDigi &secondALCT, CSCCLCTDigi &bestCLCT, CSCCLCTDigi &secondCLCT, const GEMPadDigiIds &pads, const GEMCoPadDigiIds &copads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart p) const
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)