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,
8  const edm::ParameterSet& conf)
9  : CSCAnodeLCTProcessor(endcap, station, sector, subsector, chamber, conf) {
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 
20  if (!runPhase2_)
21  edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
22  << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while runPhase2_ is not set! +++\n";
23 
24  if (!enableAlctPhase2_)
25  edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
26  << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while enableAlctPhase2_ is not set! +++\n";
27 }
28 
30  int ghost_cleared[CSCConstants::MAX_NUM_WIRES][2];
31 
32  for (int key_wire = 0; key_wire < numWireGroups; key_wire++) {
33  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
34  ghost_cleared[key_wire][i_pattern] = 0;
35 
36  // Non-empty wire group.
37  int qual_this = quality[key_wire][i_pattern];
38  if (qual_this > 0) {
39  if (runPhase2_ and runME21ILT_ and isME21_)
40  qual_this = (qual_this & 0x03);
41  // Previous wire.
42  int dt = -1;
43  int qual_prev = (key_wire > 0) ? quality[key_wire - 1][i_pattern] : 0;
44  if (qual_prev > 0) {
45  if (use_corrected_bx)
46  dt = first_bx_corrected[key_wire] - first_bx_corrected[key_wire - 1];
47  else
48  dt = first_bx[key_wire] - first_bx[key_wire - 1];
49  // hack to run the Phase-II ME2/1, ME3/1 and ME4/1 ILT
50  if (runPhase2_ and runME21ILT_ and isME21_)
51  qual_prev = (qual_prev & 0x03);
52 
53  // Cancel this wire
54  // 1) If the candidate at the previous wire is at the same bx
55  // clock and has better quality (or equal? quality - this has
56  // been implemented only in 2004).
57  // 2) If the candidate at the previous wire is up to 4 clocks
58  // earlier, regardless of quality.
59  if (dt == 0) {
60  if (qual_prev > qual_this)
61  ghost_cleared[key_wire][i_pattern] = 1;
62  } else if (dt > 0 && dt <= ghost_cancellation_bx_depth) {
63  if ((!ghost_cancellation_side_quality) || (qual_prev > qual_this))
64  ghost_cleared[key_wire][i_pattern] = 1;
65  }
66  }
67 
68  // Next wire.
69  // Skip this step if this wire is already declared "ghost".
70  if (ghost_cleared[key_wire][i_pattern] == 1) {
71  if (infoV > 1)
72  LogTrace("CSCUpgradeAnodeLCTProcessor")
73  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
74  << key_wire << " q=" << qual_this << " by wire " << key_wire - 1 << " q=" << qual_prev
75  << " dt=" << dt;
76  continue;
77  }
78 
79  dt = -1;
80  int qual_next = (key_wire < numWireGroups - 1) ? quality[key_wire + 1][i_pattern] : 0;
81  if (qual_next > 0) {
82  if (use_corrected_bx)
83  dt = first_bx_corrected[key_wire] - first_bx_corrected[key_wire + 1];
84  else
85  dt = first_bx[key_wire] - first_bx[key_wire + 1];
86  // hack to run the Phase-II ME2/1, ME3/1 and ME4/1 ILT
87  if (runPhase2_ and runME21ILT_ and isME21_)
88  qual_next = (qual_next & 0x03);
89  // Same cancellation logic as for the previous wire.
90  if (dt == 0) {
91  if (qual_next >= qual_this)
92  ghost_cleared[key_wire][i_pattern] = 1;
93  } else if (dt > 0 && dt <= ghost_cancellation_bx_depth) {
94  if ((!ghost_cancellation_side_quality) || (qual_next >= qual_this))
95  ghost_cleared[key_wire][i_pattern] = 1;
96  }
97  }
98  if (ghost_cleared[key_wire][i_pattern] == 1) {
99  if (infoV > 1)
100  LogTrace("CSCUpgradeAnodeLCTProcessor")
101  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
102  << key_wire << " q=" << qual_this << " by wire " << key_wire + 1 << " q=" << qual_next
103  << " dt=" << dt;
104  continue;
105  }
106  }
107  }
108  }
109 
110  // All cancellation is done in parallel, so wiregroups do not know what
111  // their neighbors are cancelling.
112  for (int key_wire = 0; key_wire < numWireGroups; key_wire++) {
113  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
114  if (ghost_cleared[key_wire][i_pattern] > 0) {
115  clear(key_wire, i_pattern);
116  }
117  }
118  }
119 }
120 
121 void CSCUpgradeAnodeLCTProcessor::ghostCancellationLogicOneWire(const int key_wire, int* ghost_cleared) {
122  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
123  ghost_cleared[i_pattern] = 0;
124  if (key_wire == 0)
125  continue;
126 
127  // Non-empty wire group.
128  int qual_this = quality[key_wire][i_pattern];
129  if (qual_this > 0) {
130  if (runPhase2_ and runME21ILT_ and isME21_)
131  qual_this = (qual_this & 0x03);
132  // Previous wire.
133  int dt = -1;
134  for (auto& p : lct_list) {
135  if (not(p.isValid() and p.getKeyWG() == key_wire - 1 and 1 - p.getAccelerator() == i_pattern))
136  continue;
137 
138  bool ghost_cleared_prev = false;
139  int qual_prev = p.getQuality();
140  int first_bx_prev = p.getBX();
141  if (infoV > 1)
142  LogTrace("CSCAnodeLCTProcessor")
143  << "ghost concellation logic " << ((i_pattern == 0) ? "Accelerator" : "Collision") << " key_wire "
144  << key_wire << " quality " << qual_this << " bx " << first_bx[key_wire] << " previous key_wire "
145  << key_wire - 1 << " quality " << qual_prev << " bx " << first_bx[key_wire - 1];
146 
147  //int dt = first_bx[key_wire] - first_bx[key_wire-1];
148  if (use_corrected_bx)
149  dt = first_bx_corrected[key_wire] - first_bx_prev;
150  else
151  dt = first_bx[key_wire] - first_bx_prev;
152  // hack to run the Phase-II ME2/1, ME3/1 and ME4/1 ILT
153  if (runPhase2_ and runME21ILT_ and isME21_)
154  qual_prev = (qual_prev & 0x03);
155 
156  // Cancel this wire
157  // 1) If the candidate at the previous wire is at the same bx
158  // clock and has better quality (or equal? quality - this has
159  // been implemented only in 2004).
160  // 2) If the candidate at the previous wire is up to 4 clocks
161  // earlier, regardless of quality.
162  if (dt == 0) {
163  if (qual_prev > qual_this)
164  ghost_cleared[i_pattern] = 1;
165  } else if (dt > 0 && dt <= ghost_cancellation_bx_depth) {
166  if ((!ghost_cancellation_side_quality) || (qual_prev > qual_this))
167  ghost_cleared[i_pattern] = 1;
168  } else if (dt < 0 && dt * (-1) <= ghost_cancellation_bx_depth) {
169  if ((!ghost_cancellation_side_quality) || (qual_prev < qual_this))
170  ghost_cleared_prev = true;
171  }
172 
173  if (ghost_cleared[i_pattern] == 1) {
174  if (infoV > 1)
175  LogTrace("CSCUpgradeAnodeLCTProcessor")
176  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
177  << key_wire << " q=" << qual_this << " by wire " << key_wire - 1 << " q=" << qual_prev
178  << " dt=" << dt;
179  //cancellation for key_wire is done when ALCT is created and pushed to lct_list
180  }
181  if (ghost_cleared_prev) {
182  if (infoV > 1)
183  LogTrace("CSCAnodeLCTProcessor")
184  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
185  << key_wire - 1 << " q=" << qual_prev << " by wire " << key_wire << " q=" << qual_this;
186  p.setValid(0); //clean prev ALCT
187  }
188  }
189  }
190  }
191 }
192 
194  // Quality definition changed on 22 June 2007: it no longer depends
195  // on pattern_thresh.
196  int Q;
197  // hack to run the Phase-II ME2/1, ME3/1 and ME4/1 ILT
198  if (temp_quality == 3 and runPhase2_ and runME21ILT_ and isME21_)
199  Q = 4;
200  else if (temp_quality > 3)
201  Q = temp_quality - 3;
202  else
203  Q = 0; // quality code 0 is valid!
204 
205  return Q;
206 }
CSCConstants::MAX_NUM_WIRES
Definition: CSCConstants.h:22
relativeConstraints.station
station
Definition: relativeConstraints.py:67
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CSCUpgradeAnodeLCTProcessor::ghostCancellationLogic
void ghostCancellationLogic() override
Definition: CSCUpgradeAnodeLCTProcessor.cc:29
CSCAnodeLCTProcessor::first_bx_corrected
int first_bx_corrected[CSCConstants::MAX_NUM_WIRES]
Definition: CSCAnodeLCTProcessor.h:116
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCUpgradeAnodeLCTProcessor::CSCUpgradeAnodeLCTProcessor
CSCUpgradeAnodeLCTProcessor()
Definition: CSCUpgradeAnodeLCTProcessor.cc:19
class-composition.Q
Q
Definition: class-composition.py:82
dt
float dt
Definition: AMPTWrapper.h:136
CSCAnodeLCTProcessor::quality
int quality[CSCConstants::MAX_NUM_WIRES][3]
Definition: CSCAnodeLCTProcessor.h:117
CSCAnodeLCTProcessor::lct_list
std::vector< CSCALCTDigi > lct_list
Definition: CSCAnodeLCTProcessor.h:121
CSCAnodeLCTProcessor::clear
void clear()
Definition: CSCAnodeLCTProcessor.cc:192
CSCBaseboard::runPhase2_
bool runPhase2_
Definition: CSCBaseboard.h:84
edm::ParameterSet
Definition: ParameterSet.h:47
CSCUpgradeAnodeLCTProcessor::ghostCancellationLogicOneWire
void ghostCancellationLogicOneWire(const int key_wire, int *ghost_cleared) override
Definition: CSCUpgradeAnodeLCTProcessor.cc:121
CSCBaseboard::enableAlctPhase2_
bool enableAlctPhase2_
Definition: CSCBaseboard.h:85
CSCUpgradeAnodeLCTProcessor.h
CSCAnodeLCTProcessor::use_corrected_bx
bool use_corrected_bx
Definition: CSCAnodeLCTProcessor.h:152
CSCAnodeLCTProcessor::numWireGroups
int numWireGroups
Definition: CSCAnodeLCTProcessor.h:112
CSCAnodeLCTProcessor::ghost_cancellation_side_quality
bool ghost_cancellation_side_quality
Definition: CSCAnodeLCTProcessor.h:146
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
CSCBaseboard::runME21ILT_
bool runME21ILT_
Definition: CSCBaseboard.h:94
CSCBaseboard::isME21_
bool isME21_
Definition: CSCBaseboard.h:52
CSCAnodeLCTProcessor::first_bx
int first_bx[CSCConstants::MAX_NUM_WIRES]
Definition: CSCAnodeLCTProcessor.h:115
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
CSCAnodeLCTProcessor
Definition: CSCAnodeLCTProcessor.h:46
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
CSCAnodeLCTProcessor::ghost_cancellation_bx_depth
int ghost_cancellation_bx_depth
Definition: CSCAnodeLCTProcessor.h:142
CSCUpgradeAnodeLCTProcessor::getTempALCTQuality
int getTempALCTQuality(int temp_quality) const override
Definition: CSCUpgradeAnodeLCTProcessor.cc:193
CSCBaseboard::infoV
int infoV
Definition: CSCBaseboard.h:63