File indexing completed on 2024-04-06 12:19:37
0001 #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeAnodeLCTProcessor.h"
0002
0003 CSCUpgradeAnodeLCTProcessor::CSCUpgradeAnodeLCTProcessor(unsigned endcap,
0004 unsigned station,
0005 unsigned sector,
0006 unsigned subsector,
0007 unsigned chamber,
0008 CSCBaseboard::Parameters& conf)
0009 : CSCAnodeLCTProcessor(endcap, station, sector, subsector, chamber, conf) {
0010 if (!runPhase2_)
0011 edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
0012 << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while runPhase2_ is not set! +++\n";
0013
0014 if (!enableAlctPhase2_)
0015 edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
0016 << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while enableAlctPhase2_ is not set! +++\n";
0017 }
0018
0019 void CSCUpgradeAnodeLCTProcessor::ghostCancellationLogicOneWire(const int key_wire, int* ghost_cleared) {
0020 for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
0021 ghost_cleared[i_pattern] = 0;
0022 if (key_wire == 0)
0023 continue;
0024
0025
0026 int qual_this = quality[key_wire][i_pattern];
0027 if (qual_this > 0) {
0028 if (runPhase2_ and runME21ILT_ and isME21_)
0029 qual_this = (qual_this & 0x03);
0030
0031 int dt = -1;
0032 for (auto& p : lct_list) {
0033 if (not(p.isValid() and p.getKeyWG() == key_wire - 1 and 1 - p.getAccelerator() == i_pattern))
0034 continue;
0035
0036 bool ghost_cleared_prev = false;
0037 int qual_prev = p.getQuality();
0038 int first_bx_prev = p.getBX();
0039 if (infoV > 1)
0040 LogTrace("CSCAnodeLCTProcessor")
0041 << "ghost concellation logic " << ((i_pattern == 0) ? "Accelerator" : "Collision") << " key_wire "
0042 << key_wire << " quality " << qual_this << " bx " << first_bx[key_wire] << " previous key_wire "
0043 << key_wire - 1 << " quality " << qual_prev << " bx " << first_bx[key_wire - 1];
0044
0045
0046 if (use_corrected_bx)
0047 dt = first_bx_corrected[key_wire] - first_bx_prev;
0048 else
0049 dt = first_bx[key_wire] - first_bx_prev;
0050
0051 if (runPhase2_ and runME21ILT_ and isME21_)
0052 qual_prev = (qual_prev & 0x03);
0053
0054
0055
0056
0057
0058
0059
0060 if (dt == 0) {
0061 if (qual_prev > qual_this)
0062 ghost_cleared[i_pattern] = 1;
0063 } else if (dt > 0 && dt <= ghost_cancellation_bx_depth) {
0064 if ((!ghost_cancellation_side_quality) || (qual_prev > qual_this))
0065 ghost_cleared[i_pattern] = 1;
0066 } else if (dt < 0 && dt * (-1) <= ghost_cancellation_bx_depth) {
0067 if ((!ghost_cancellation_side_quality) || (qual_prev < qual_this))
0068 ghost_cleared_prev = true;
0069 }
0070
0071 if (ghost_cleared[i_pattern] == 1) {
0072 if (infoV > 1)
0073 LogTrace("CSCUpgradeAnodeLCTProcessor")
0074 << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
0075 << key_wire << " q=" << qual_this << " by wire " << key_wire - 1 << " q=" << qual_prev
0076 << " dt=" << dt;
0077
0078 }
0079 if (ghost_cleared_prev) {
0080 if (infoV > 1)
0081 LogTrace("CSCAnodeLCTProcessor")
0082 << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
0083 << key_wire - 1 << " q=" << qual_prev << " by wire " << key_wire << " q=" << qual_this;
0084 p.setValid(0);
0085 }
0086 }
0087 }
0088 }
0089 }
0090
0091 int CSCUpgradeAnodeLCTProcessor::getTempALCTQuality(int temp_quality) const {
0092
0093
0094 int Q;
0095
0096 if (temp_quality == 3 and runPhase2_ and runME21ILT_ and isME21_)
0097 Q = 1;
0098 else if (temp_quality > 3)
0099 Q = temp_quality - 3;
0100 else
0101 Q = 0;
0102
0103 return Q;
0104 }