diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h index 8a502189cf9d9..f82397aa59d2e 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h @@ -198,8 +198,12 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { // enum used in the wire hit assignment enum ALCT_WireInfo { INVALID_WIRE = 65535 }; + // remove the invalid wires from the container void cleanWireContainer(CSCALCTDigi::WireContainer& wireHits) const; + // set the wire hit container + void setWireContainer(CSCALCTDigi&, CSCALCTDigi::WireContainer& wireHits) const; + /* This function looks for LCTs on the previous and next wires. If one exists and it has a better quality and a bx_time up to 4 clocks earlier than the present, then the present LCT is cancelled. The present LCT diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index ae9e16bcfe2bb..faab45720279f 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -327,14 +327,8 @@ void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAY int valid = (ghost_cleared[0] == 0) ? 1 : 0; //cancelled, valid=0, otherwise it is 1 CSCALCTDigi newALCT(valid, quality[i_wire][0], 1, 0, i_wire, bx); - // get the comparator hits for this pattern - auto wireHits = hits_in_patterns[i_wire][0]; - - // purge the wire digi collection - cleanWireContainer(wireHits); - - // set the hit collection - newALCT.setHits(wireHits); + // set the wire digis for this pattern + setWireContainer(newALCT, hits_in_patterns[i_wire][0]); lct_list.push_back(newALCT); ALCTContainer_[bx][ALCTIndex_[bx]] = newALCT; @@ -349,14 +343,8 @@ void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAY CSCALCTDigi newALCT(valid, quality[i_wire][1], 0, quality[i_wire][2], i_wire, bx); - // get the comparator hits for this pattern - auto wireHits = hits_in_patterns[i_wire][1]; - - // purge the wire digi collection - cleanWireContainer(wireHits); - - // set the hit collection - newALCT.setHits(wireHits); + // set the wire digis for this pattern + setWireContainer(newALCT, hits_in_patterns[i_wire][1]); lct_list.push_back(newALCT); ALCTContainer_[bx][ALCTIndex_[bx]] = newALCT; @@ -638,6 +626,7 @@ bool CSCAnodeLCTProcessor::patternDetection( // clear a single pattern! CSCALCTDigi::WireContainer hits_single_pattern; + hits_single_pattern.clear(); hits_single_pattern.resize(CSCConstants::NUM_LAYERS); for (auto& p : hits_single_pattern) { p.resize(CSCConstants::ALCT_PATTERN_WIDTH, INVALID_WIRE); @@ -1404,3 +1393,11 @@ void CSCAnodeLCTProcessor::cleanWireContainer(CSCALCTDigi::WireContainer& wireHi p.end()); } } + +void CSCAnodeLCTProcessor::setWireContainer(CSCALCTDigi& alct, CSCALCTDigi::WireContainer& wireHits) const { + // clean the wire digi container + cleanWireContainer(wireHits); + + // set the hit container + alct.setHits(wireHits); +}