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";
59 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
67 clctV = clctProc->run(compdc);
72 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL ALCTs from ME21 "<< std::endl;
73 for (
const auto& alct :
alctV)
75 LogTrace(
"CSCGEMCMotherboardME21") << alct << std::endl;
77 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL CLCTs from ME21 "<< std::endl;
78 for (
const auto& clct :
clctV)
80 LogTrace(
"CSCGEMCMotherboardME21") << clct << std::endl;
82 int used_clct_mask[20];
83 for (
int c=0;
c<20;++
c) used_clct_mask[
c]=0;
90 const bool hasPads(!
pads_.empty());
91 const bool hasCoPads(!
coPads_.empty());
95 if (
alctProc->bestALCT[bx_alct].isValid()) {
102 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
103 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALCT-CLCT matching in ME2/1 chamber: " <<
cscId_ << std::endl;
104 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl;
105 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Best ALCT Details: ";
106 alctProc->bestALCT[bx_alct].print();
107 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Second ALCT Details: ";
108 alctProc->secondALCT[bx_alct].print();
113 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl;
114 LogTrace(
"CSCGEMCMotherboardME21") <<
"Attempt ALCT-CLCT matching in ME2/1 in bx range: [" << bx_clct_start <<
"," << bx_clct_stop <<
"]" << std::endl;
118 int nSuccessFulMatches = 0;
119 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
122 if (clctProc->bestCLCT[bx_clct].isValid()) {
124 const int quality(clctProc->bestCLCT[bx_clct].getQuality());
126 const bool lowQualityALCT(
alctProc->bestALCT[bx_alct].getQuality() == 0);
128 const bool lowQuality(
quality<4
or lowQualityALCT);
129 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"++Valid ME21 CLCT: " << clctProc->bestCLCT[bx_clct] << std::endl;
132 matches<GEMPadDigi> mPads;
133 matchingPads<GEMPadDigi>(clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct],
135 matches<GEMCoPadDigi> mCoPads;
136 matchingPads<GEMCoPadDigi>(clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct],
140 int nFound(mPads.size());
141 const bool clctInEdge(clctProc->bestCLCT[bx_clct].getKeyStrip() < 5
or clctProc->bestCLCT[bx_clct].getKeyStrip() > 155);
143 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\tInfo: low quality CLCT in CSC chamber edge, don't care about GEM pads" << std::endl;
147 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\tInfo: low quality CLCT with " << nFound <<
" matching GEM trigger pads" << std::endl;
150 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\tWarning: low quality CLCT without matching GEM trigger pad" << std::endl;
156 ++nSuccessFulMatches;
158 int mbx = bx_clct-bx_clct_start;
160 clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct],
165 LogTrace(
"CSCGEMCMotherboardME21") <<
"Successful ALCT-CLCT match in ME21: bx_alct = " << bx_alct
166 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop
167 <<
"]; bx_clct = " << bx_clct << std::endl;
168 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Best CLCT Details: ";
169 clctProc->bestCLCT[bx_clct].print();
170 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Second CLCT Details: ";
171 clctProc->secondCLCT[bx_clct].print();
173 if (
allLCTs(bx_alct,mbx,0).isValid()) {
174 used_clct_mask[bx_clct] += 1;
181 int nSuccessFulGEMMatches = 0;
183 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"++No valid ALCT-CLCT matches in ME21" << std::endl;
184 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
190 matches<GEMCoPadDigi> copads;
191 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
alctProc->bestALCT[bx_alct],
alctProc->secondALCT[bx_alct], copads);
193 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME21") <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : "<< copads.size() << std::endl;
194 if (copads.empty()) {
200 if (
allLCTs(bx_alct,0,0).isValid()) {
201 ++nSuccessFulGEMMatches;
205 LogTrace(
"CSCGEMCMotherboardME21") <<
"Successful ALCT-GEM CoPad match in ME21: bx_alct = " << bx_alct << std::endl << std::endl;
206 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl << std::endl;
212 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
213 LogTrace(
"CSCGEMCMotherboardME21") <<
"Summary: " << std::endl;
214 if (nSuccessFulMatches>1)
215 LogTrace(
"CSCGEMCMotherboardME21") <<
"Too many successful ALCT-CLCT matches in ME21: " << nSuccessFulMatches
216 <<
", CSCDetId " <<
cscId_ 217 <<
", bx_alct = " << bx_alct
218 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
219 else if (nSuccessFulMatches==1)
220 LogTrace(
"CSCGEMCMotherboardME21") <<
"1 successful ALCT-CLCT match in ME21: " 222 <<
", bx_alct = " << bx_alct
223 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
224 else if (nSuccessFulGEMMatches==1)
225 LogTrace(
"CSCGEMCMotherboardME21") <<
"1 successful ALCT-GEM match in ME21: " 227 <<
", bx_alct = " << bx_alct
228 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
230 LogTrace(
"CSCGEMCMotherboardME21") <<
"Unsuccessful ALCT-CLCT match in ME21: " 232 <<
", bx_alct = " << bx_alct
233 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
244 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
245 LogTrace(
"CSCGEMCMotherboardME21") <<
"GEM-CLCT matching in ME2/1 chamber: "<<
cscId_<<
"in bx:"<<bx_alct<<std::endl;
246 LogTrace(
"CSCGEMCMotherboardME21") <<
"------------------------------------------------------------------------" << std::endl;
249 int nSuccessFulMatches = 0;
250 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
253 if (clctProc->bestCLCT[bx_clct].isValid()) {
254 const int quality(clctProc->bestCLCT[bx_clct].getQuality());
258 ++nSuccessFulMatches;
260 int mbx =
std::abs(clctProc->bestCLCT[bx_clct].getBX()-bx_alct);
266 LogTrace(
"CSCGEMCMotherboardME21") <<
"Successful GEM-CLCT match in ME21: bx_alct = " << bx_alct <<std::endl;
269 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Best CLCT Details: ";
270 clctProc->bestCLCT[bx_clct].print();
271 LogTrace(
"CSCGEMCMotherboardME21") <<
"+++ Second CLCT Details: ";
272 clctProc->secondCLCT[bx_clct].print();
274 if (
allLCTs(bx_gem,mbx,0).isValid()) {
275 used_clct_mask[bx_gem] += 1;
293 <<
"LCT"<<
i+1<<
" "<<bx<<
"/"<<bx + mbx - match_trig_window_size/2<<
": "<<
allLCTs(bx,mbx,
i)<<std::endl;
318 <<
"LCT"<<
i+1<<
" "<<bx<<
"/"<<bx + mbx - match_trig_window_size/2<<
": "<<
allLCTs(bx,mbx,
i)<< std::endl;
323 <<
"bx "<<bx<<
" nnLCT:"<<n<<
" "<<n<<std::endl;
332 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
333 LogTrace(
"CSCGEMCMotherboardME21") <<
"Counting the final LCTs in CSCGEM Motherboard ME21" << std::endl;
334 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================" << std::endl;
340 LogTrace(
"CSCGEMCMotherboardME21") <<
"LCT "<<n<<
" " <<
p <<std::endl;
347 std::vector<CSCCorrelatedLCTDigi>
result;
370 if (secondALCT == bestALCT) secondALCT.
clear();
371 if (secondCLCT == bestCLCT) secondCLCT.
clear();
378 if (!copads.empty()
or !pads.empty()){
381 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
382 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
383 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
384 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
387 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
388 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
389 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
390 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
393 const bool ok_bb_copad = ok_bb and bb_copad.
isValid();
394 const bool ok_bs_copad = ok_bs and bs_copad.isValid();
395 const bool ok_sb_copad = ok_sb and sb_copad.isValid();
396 const bool ok_ss_copad = ok_ss and ss_copad.isValid();
398 const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.isValid();
399 const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.isValid();
400 const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.isValid();
401 const bool ok_ss_pad = (not ok_ss_copad) and ok_ss and ss_pad.isValid();
404 if (ok_bb_copad
or ok_ss_copad){
406 if (ok_ss_copad) lct2 =
constructLCTsGEM(secondALCT, secondCLCT, ss_copad, 2);
408 else if(ok_bs_copad
or ok_sb_copad){
409 if (ok_bs_copad) lct1 =
constructLCTsGEM(bestALCT, secondCLCT, bs_copad, 1);
410 if (ok_sb_copad) lct2 =
constructLCTsGEM(secondALCT, bestCLCT, sb_copad, 2);
417 if ((ok_bb_pad
or ok_ss_pad) and not (ok_bs_copad
or ok_sb_copad)){
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_
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
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_
const CSCGeometry * cscGeometry_
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, int i) const
std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const override
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
bool buildLCTfromALCTandGEM_
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
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)