Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:37

0001 #include "L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h"
0002 
0003 LCTContainer::LCTContainer(unsigned int trig_window_size) : match_trig_window_size_(trig_window_size) {}
0004 
0005 CSCCorrelatedLCTDigi& LCTContainer::operator()(int bx, int match_bx, int lct) { return data[bx][match_bx][lct]; }
0006 
0007 void LCTContainer::getTimeMatched(const int bx, std::vector<CSCCorrelatedLCTDigi>& lcts) const {
0008   for (unsigned int mbx = 0; mbx < match_trig_window_size_; mbx++) {
0009     for (int i = 0; i < CSCConstants::MAX_LCTS_PER_CSC; i++) {
0010       // consider only valid LCTs
0011       if (not data[bx][mbx][i].isValid())
0012         continue;
0013 
0014       // remove duplicated LCTs
0015       if (std::find(lcts.begin(), lcts.end(), data[bx][mbx][i]) != lcts.end())
0016         continue;
0017 
0018       lcts.push_back(data[bx][mbx][i]);
0019     }
0020   }
0021 }
0022 
0023 void LCTContainer::getMatched(std::vector<CSCCorrelatedLCTDigi>& lcts) const {
0024   for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
0025     std::vector<CSCCorrelatedLCTDigi> temp_lcts;
0026     LCTContainer::getTimeMatched(bx, temp_lcts);
0027     lcts.insert(std::end(lcts), std::begin(temp_lcts), std::end(temp_lcts));
0028   }
0029 }
0030 
0031 void LCTContainer::clear() {
0032   // Loop over all time windows
0033   for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
0034     // Loop over all matched trigger windows
0035     for (unsigned int mbx = 0; mbx < match_trig_window_size_; mbx++) {
0036       // Loop over all stubs
0037       for (int i = 0; i < CSCConstants::MAX_LCTS_PER_CSC; i++) {
0038         data[bx][mbx][i].clear();
0039       }
0040     }
0041   }
0042 }