CMS 3D CMS Logo

CSCUpgradeAnodeLCTProcessor.cc
Go to the documentation of this file.
2 
4  unsigned station,
5  unsigned sector,
6  unsigned subsector,
7  unsigned chamber,
10  if (!runPhase2_)
11  edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
12  << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while runPhase2_ is not set! +++\n";
13 
14  if (!enableAlctPhase2_)
15  edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
16  << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while enableAlctPhase2_ is not set! +++\n";
17 }
18 
19 void CSCUpgradeAnodeLCTProcessor::ghostCancellationLogicOneWire(const int key_wire, int* ghost_cleared) {
20  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
21  ghost_cleared[i_pattern] = 0;
22  if (key_wire == 0)
23  continue;
24 
25  // Non-empty wire group.
26  int qual_this = quality[key_wire][i_pattern];
27  if (qual_this > 0) {
28  if (runPhase2_ and runME21ILT_ and isME21_)
29  qual_this = (qual_this & 0x03);
30  // Previous wire.
31  int dt = -1;
32  for (auto& p : lct_list) {
33  if (not(p.isValid() and p.getKeyWG() == key_wire - 1 and 1 - p.getAccelerator() == i_pattern))
34  continue;
35 
36  bool ghost_cleared_prev = false;
37  int qual_prev = p.getQuality();
38  int first_bx_prev = p.getBX();
39  if (infoV > 1)
40  LogTrace("CSCAnodeLCTProcessor")
41  << "ghost concellation logic " << ((i_pattern == 0) ? "Accelerator" : "Collision") << " key_wire "
42  << key_wire << " quality " << qual_this << " bx " << first_bx[key_wire] << " previous key_wire "
43  << key_wire - 1 << " quality " << qual_prev << " bx " << first_bx[key_wire - 1];
44 
45  //int dt = first_bx[key_wire] - first_bx[key_wire-1];
46  if (use_corrected_bx)
47  dt = first_bx_corrected[key_wire] - first_bx_prev;
48  else
49  dt = first_bx[key_wire] - first_bx_prev;
50  // hack to run the Phase-II ME2/1, ME3/1 and ME4/1 ILT
51  if (runPhase2_ and runME21ILT_ and isME21_)
52  qual_prev = (qual_prev & 0x03);
53 
54  // Cancel this wire
55  // 1) If the candidate at the previous wire is at the same bx
56  // clock and has better quality (or equal? quality - this has
57  // been implemented only in 2004).
58  // 2) If the candidate at the previous wire is up to 4 clocks
59  // earlier, regardless of quality.
60  if (dt == 0) {
61  if (qual_prev > qual_this)
62  ghost_cleared[i_pattern] = 1;
63  } else if (dt > 0 && dt <= ghost_cancellation_bx_depth) {
64  if ((!ghost_cancellation_side_quality) || (qual_prev > qual_this))
65  ghost_cleared[i_pattern] = 1;
66  } else if (dt < 0 && dt * (-1) <= ghost_cancellation_bx_depth) {
67  if ((!ghost_cancellation_side_quality) || (qual_prev < qual_this))
68  ghost_cleared_prev = true;
69  }
70 
71  if (ghost_cleared[i_pattern] == 1) {
72  if (infoV > 1)
73  LogTrace("CSCUpgradeAnodeLCTProcessor")
74  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
75  << key_wire << " q=" << qual_this << " by wire " << key_wire - 1 << " q=" << qual_prev
76  << " dt=" << dt;
77  //cancellation for key_wire is done when ALCT is created and pushed to lct_list
78  }
79  if (ghost_cleared_prev) {
80  if (infoV > 1)
81  LogTrace("CSCAnodeLCTProcessor")
82  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
83  << key_wire - 1 << " q=" << qual_prev << " by wire " << key_wire << " q=" << qual_this;
84  p.setValid(0); //clean prev ALCT
85  }
86  }
87  }
88  }
89 }
90 
92  // Quality definition changed on 22 June 2007: it no longer depends
93  // on pattern_thresh.
94  int Q;
95  // hack to run the Phase-II GE2/1-ME2/1 with 3-layer ALCTs
96  if (temp_quality == 3 and runPhase2_ and runME21ILT_ and isME21_)
97  Q = 1;
98  else if (temp_quality > 3)
99  Q = temp_quality - 3;
100  else
101  Q = 0; // quality code 0 is valid!
102 
103  return Q;
104 }
float dt
Definition: AMPTWrapper.h:136
bool enableAlctPhase2_
Definition: CSCBaseboard.h:108
int first_bx_corrected[CSCConstants::MAX_NUM_WIREGROUPS]
Log< level::Error, false > LogError
CSCUpgradeAnodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, CSCBaseboard::Parameters &conf)
#define LogTrace(id)
std::vector< CSCALCTDigi > lct_list
void ghostCancellationLogicOneWire(const int key_wire, int *ghost_cleared) override
int getTempALCTQuality(int temp_quality) const override
int first_bx[CSCConstants::MAX_NUM_WIREGROUPS]
int quality[CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]