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";
113 std::vector<CSCCLCTDigi> lctList;
138 while (start_bx < stop_bx) {
153 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
154 <<
"..... pretrigger at bx = " << first_bx <<
"; waiting drift delay .....";
160 std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> > hits_in_patterns;
161 hits_in_patterns.clear();
169 if (
nhits[hstrip] > 0) {
170 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
171 <<
" bx = " << std::setw(2) << latch_bx <<
" --->" 172 <<
" halfstrip = " << std::setw(3) << hstrip <<
" best pid = " << std::setw(2) <<
best_pid[hstrip]
173 <<
" nhits = " <<
nhits[hstrip];
183 best_halfstrip[ilct] = -1;
184 best_quality[ilct] = 0;
213 if (
quality[hstrip] > best_quality[0] && pretrig_zone[hstrip] && !
busyMap_[hstrip][first_bx]) {
214 best_halfstrip[0] = hstrip;
215 best_quality[0] =
quality[hstrip];
217 const int best_hs(best_halfstrip[0]);
218 const int best_pat(
best_pid[best_hs]);
222 tempBestCLCT =
constructCLCT(first_bx, best_hs, hits_in_patterns[best_hs][best_pat]);
229 if (best_halfstrip[0] >= 0) {
242 if (
quality[hstrip] > best_quality[1] && pretrig_zone[hstrip] && !
busyMap_[hstrip][first_bx]) {
243 best_halfstrip[1] = hstrip;
244 best_quality[1] =
quality[hstrip];
246 const int best_hs(best_halfstrip[1]);
247 const int best_pat(
best_pid[best_hs]);
251 tempSecondCLCT =
constructCLCT(first_bx, best_hs, hits_in_patterns[best_hs][best_pat]);
259 bool changeOrder =
false;
261 unsigned qualityBest = 0, qualitySecond = 0;
262 unsigned patternBest = 0, patternSecond = 0;
263 unsigned halfStripBest = 0, halfStripSecond = 0;
278 if (qualitySecond > qualityBest)
280 else if ((qualitySecond == qualityBest) and (
int(patternSecond / 2) >
int(patternBest / 2)))
282 else if ((qualitySecond == qualityBest) and (
int(patternSecond / 2) ==
int(patternBest / 2)) and
283 (halfStripSecond < halfStripBest))
289 tempCLCT = tempBestCLCT;
290 tempBestCLCT = tempSecondCLCT;
291 tempSecondCLCT = tempCLCT;
296 lctList.push_back(tempBestCLCT);
298 if (tempSecondCLCT.
isValid()) {
299 lctList.push_back(tempSecondCLCT);
305 start_bx = first_bx + 1;
314 pretrig_zone[hstrip] =
false;
328 for (
int hs = min_hs; hs <= max_hs; hs++)
329 pretrig_zone[hs] =
true;
331 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
332 <<
" marked pretrigger halfstrip zone [" << min_hs <<
"," << max_hs <<
"]";
351 for (
int hs = min_hstrip; hs <= max_hstrip; hs++)
354 LogTrace(
"CSCUpgradeCathodeLCTProcessor")
355 <<
" marked zone around pretriggerred halfstrip " << hstrip <<
" as dead zone for pretriggering at bx" 356 <<
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)
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
std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) override
unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const
bool use_dead_time_zoning_
bool isValid() const
check CLCT validity (1 - valid CLCT)
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
unsigned int nplanes_hit_pattern
void markBusyZone(const int bx)
virtual std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
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
CSCCLCTDigi constructCLCT(const int bx, const unsigned halfstrip_withstagger, const CSCCLCTDigi::ComparatorContainer &hits)
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]