14 <<
"+++ Upgrade CSCUpgradeCathodeLCTProcessor constructed while runPhase2_ is not set! +++\n";
35 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
36 <<
"....................PreTrigger, Phase2 version with localized dead time zone...........................";
40 bool pre_trig =
false;
43 for (
unsigned int bx_time = start_bx; bx_time <
fifo_tbins; bx_time++) {
49 std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> > hits_in_patterns;
50 hits_in_patterns.clear();
56 if (
nhits[hstrip] > 0) {
57 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
58 <<
" bx = " << std::setw(2) << bx_time <<
" --->" 59 <<
" halfstrip = " << std::setw(3) << hstrip <<
" best pid = " << std::setw(2) <<
best_pid[hstrip]
60 <<
" nhits = " <<
nhits[hstrip];
77 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
78 <<
" halfstrip " << std::setw(3) << hstrip <<
" in dead zone and is pretriggerred";
100 LogTrace(
"CSCUpgradeCathodeLCTProcessor") <<
"no pretrigger, returning \n";
114 std::vector<CSCCLCTDigi> lctList;
139 while (start_bx < stop_bx) {
154 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
155 <<
"..... pretrigger at bx = " << first_bx <<
"; waiting drift delay .....";
161 std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> > hits_in_patterns;
162 hits_in_patterns.clear();
170 if (
nhits[hstrip] > 0) {
171 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
172 <<
" bx = " << std::setw(2) << latch_bx <<
" --->" 173 <<
" halfstrip = " << std::setw(3) << hstrip <<
" best pid = " << std::setw(2) <<
best_pid[hstrip]
174 <<
" nhits = " <<
nhits[hstrip];
184 best_halfstrip[ilct] = -1;
185 best_quality[ilct] = 0;
214 if (
quality[hstrip] > best_quality[0] && pretrig_zone[hstrip] && !
busyMap_[hstrip][first_bx]) {
215 best_halfstrip[0] = hstrip;
216 best_quality[0] =
quality[hstrip];
218 const int best_hs(best_halfstrip[0]);
219 const int best_pat(
best_pid[best_hs]);
223 tempBestCLCT =
constructCLCT(first_bx, best_hs, hits_in_patterns[best_hs][best_pat], lookupTable);
230 if (best_halfstrip[0] >= 0) {
243 if (
quality[hstrip] > best_quality[1] && pretrig_zone[hstrip] && !
busyMap_[hstrip][first_bx]) {
244 best_halfstrip[1] = hstrip;
245 best_quality[1] =
quality[hstrip];
247 const int best_hs(best_halfstrip[1]);
248 const int best_pat(
best_pid[best_hs]);
252 tempSecondCLCT =
constructCLCT(first_bx, best_hs, hits_in_patterns[best_hs][best_pat], lookupTable);
260 bool changeOrder =
false;
262 unsigned qualityBest = 0, qualitySecond = 0;
263 unsigned patternBest = 0, patternSecond = 0;
264 unsigned halfStripBest = 0, halfStripSecond = 0;
279 if (qualitySecond > qualityBest)
281 else if ((qualitySecond == qualityBest) and (
int(patternSecond / 2) >
int(patternBest / 2)))
283 else if ((qualitySecond == qualityBest) and (
int(patternSecond / 2) ==
int(patternBest / 2)) and
284 (halfStripSecond < halfStripBest))
290 tempCLCT = tempBestCLCT;
291 tempBestCLCT = tempSecondCLCT;
292 tempSecondCLCT = tempCLCT;
297 lctList.push_back(tempBestCLCT);
299 if (tempSecondCLCT.
isValid()) {
300 lctList.push_back(tempSecondCLCT);
306 start_bx = first_bx + 1;
315 pretrig_zone[hstrip] =
false;
329 for (
int hs = min_hs; hs <= max_hs; hs++)
330 pretrig_zone[hs] =
true;
332 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
333 <<
" marked pretrigger halfstrip zone [" << min_hs <<
"," << max_hs <<
"]";
352 for (
int hs = min_hstrip; hs <= max_hstrip; hs++)
355 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
356 <<
" marked zone around pretriggerred halfstrip " << hstrip <<
" as dead zone for pretriggering at bx" 357 <<
bx + 1 <<
" halfstrip: [" << min_hstrip <<
"," << max_hstrip <<
"]";
T getParameter(std::string const &) const
unsigned int nplanes_hit_pretrig
unsigned int pretrig_trig_zone_
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
uint16_t getKeyStrip(const uint16_t n=2) const
bool patternFinding(const unsigned int bx_time, std::map< int, std::map< int, CSCCLCTDigi::ComparatorContainer > > &hits_in_patterns)
virtual std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], const CSCL1TPLookupTableCCLUT *lookupTable)
Log< level::Error, false > LogError
void markPreTriggerZone(bool pretrig_zone[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const
CSCUpgradeCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, CSCBaseboard::Parameters &conf)
edm::ParameterSet const & clctParams() const
unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const
CSCCLCTDigi constructCLCT(const int bx, const unsigned halfstrip_withstagger, const CSCCLCTDigi::ComparatorContainer &hits, const CSCL1TPLookupTableCCLUT *lookupTable)
bool use_dead_time_zoning_
static constexpr int MAX_NUM_HALF_STRIPS_RUN2_TRIGGER
std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], const CSCL1TPLookupTableCCLUT *lookupTable) override
bool isValid() const
check CLCT validity (1 - valid CLCT)
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
unsigned int nplanes_hit_pattern
void markBusyZone(const int bx)
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
bool busyMap_[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER][CSCConstants::MAX_CLCT_TBINS]
void dumpDigis(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const
int stagger[CSCConstants::NUM_LAYERS]
uint16_t getPattern() const
return pattern
unsigned int clct_state_machine_zone_
virtual bool preTrigger(const int start_bx, int &first_bx)
uint16_t getRun3Pattern() const
return pattern
bool preTrigger(const int start_bx, int &first_bx) override
unsigned int pid_thresh_pretrig
bool ispretrig_[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]