CMS 3D CMS Logo

CSCUpgradeAnodeLCTProcessor.cc
Go to the documentation of this file.
2 
4  unsigned sector, unsigned subsector,
5  unsigned chamber,
6  const edm::ParameterSet& conf) :
7  CSCAnodeLCTProcessor(endcap, station, sector, subsector, chamber, conf)
8 {
9  if (!isSLHC_) edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
10  << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while isSLHC_ is not set! +++\n";
11 
12  if (!enableAlctSLHC_) edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
13  << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while enableAlctSLHC_ is not set! +++\n";
14 }
15 
18 {
19  if (!isSLHC_) edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
20  << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while isSLHC_ is not set! +++\n";
21 
22  if (!enableAlctSLHC_) edm::LogError("CSCUpgradeAnodeLCTProcessor|ConfigError")
23  << "+++ Upgrade CSCUpgradeAnodeLCTProcessor constructed while enableAlctSLHC_ is not set! +++\n";
24 }
25 
27 {
28  int ghost_cleared[CSCConstants::MAX_NUM_WIRES][2];
29 
30  for (int key_wire = 0; key_wire < numWireGroups; key_wire++) {
31  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
32  ghost_cleared[key_wire][i_pattern] = 0;
33 
34  // Non-empty wire group.
35  int qual_this = quality[key_wire][i_pattern];
36  if (qual_this > 0) {
37 
39  qual_this = (qual_this & 0x03);
40  // Previous wire.
41  int dt = -1;
42  int qual_prev = (key_wire > 0) ? quality[key_wire-1][i_pattern] : 0;
43  if (qual_prev > 0) {
44  if (use_corrected_bx)
45  dt = first_bx_corrected[key_wire] - first_bx_corrected[key_wire-1];
46  else
47  dt = first_bx[key_wire] - first_bx[key_wire-1];
48  // hack to run the Phase-II ME2/1, ME3/1 and ME4/1 ILT
49  if (isSLHC_ and (runME21ILT_ or runME31Up_ or runME41Up_))
50  qual_prev = (qual_prev & 0x03);
51 
52  // Cancel this wire
53  // 1) If the candidate at the previous wire is at the same bx
54  // clock and has better quality (or equal? quality - this has
55  // been implemented only in 2004).
56  // 2) If the candidate at the previous wire is up to 4 clocks
57  // earlier, regardless of quality.
58  if (dt == 0) {
59  if (qual_prev > qual_this) ghost_cleared[key_wire][i_pattern] = 1;
60  }
61  else if (dt > 0 && dt <= ghost_cancellation_bx_depth ) {
63  (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) LogTrace("CSCUpgradeAnodeLCTProcessor")
72  << ((i_pattern == 0) ? "Accelerator" : "Collision")
73  << " pattern ghost cancelled on key_wire " << key_wire <<" q="<<qual_this
74  << " by wire " << key_wire-1<<" q="<<qual_prev<<" dt="<<dt;
75  continue;
76  }
77 
78  dt = -1;
79  int qual_next =
80  (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 (isSLHC_ and (runME21ILT_ or runME31Up_ or runME41Up_))
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) ghost_cleared[key_wire][i_pattern] = 1;
92  }
93  else if (dt > 0 && dt <= ghost_cancellation_bx_depth ) {
95  (qual_next >= qual_this) )
96  ghost_cleared[key_wire][i_pattern] = 1;
97  }
98  }
99  if (ghost_cleared[key_wire][i_pattern] == 1) {
100  if (infoV > 1) LogTrace("CSCUpgradeAnodeLCTProcessor")
101  << ((i_pattern == 0) ? "Accelerator" : "Collision")
102  << " pattern ghost cancelled on key_wire " << key_wire <<" q="<<qual_this
103  << " by wire " << key_wire+1<<" q="<<qual_next<<" 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 
122 
123 void CSCUpgradeAnodeLCTProcessor::ghostCancellationLogicOneWire(const int key_wire, int *ghost_cleared)
124 {
125 
126  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
127  ghost_cleared[i_pattern] = 0;
128  if (key_wire == 0) continue;
129 
130  // Non-empty wire group.
131  int qual_this = quality[key_wire][i_pattern];
132  if (qual_this > 0) {
133 
135  qual_this = (qual_this & 0x03);
136  // Previous wire.
137  int dt = -1;
138  for (auto& p : lct_list){
139  if (not (p.isValid() and p.getKeyWG() == key_wire -1 and 1-p.getAccelerator() == i_pattern)) continue;
140 
141  bool ghost_cleared_prev = false;
142  int qual_prev = p.getQuality();
143  int first_bx_prev = p.getBX();
144  if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
145  << "ghost concellation logic " << ((i_pattern == 0) ? "Accelerator" : "Collision")
146  << " key_wire "<< key_wire <<" quality "<< qual_this <<" bx " << first_bx[key_wire]
147  << " previous key_wire "<< key_wire -1 <<" quality "<< qual_prev <<" bx " << first_bx[key_wire-1];
148 
149  //int dt = first_bx[key_wire] - first_bx[key_wire-1];
150  if (use_corrected_bx)
151  dt = first_bx_corrected[key_wire] - first_bx_prev;
152  else
153  dt = first_bx[key_wire] - first_bx_prev;
154  // hack to run the Phase-II ME2/1, ME3/1 and ME4/1 ILT
155  if (isSLHC_ and (runME21ILT_ or runME31Up_ or runME41Up_))
156  qual_prev = (qual_prev & 0x03);
157 
158  // Cancel this wire
159  // 1) If the candidate at the previous wire is at the same bx
160  // clock and has better quality (or equal? quality - this has
161  // been implemented only in 2004).
162  // 2) If the candidate at the previous wire is up to 4 clocks
163  // earlier, regardless of quality.
164  if (dt == 0) {
165  if (qual_prev > qual_this) ghost_cleared[i_pattern] = 1;
166  }
167  else if (dt > 0 && dt <= ghost_cancellation_bx_depth ) {
169  (qual_prev > qual_this) )
170  ghost_cleared[i_pattern] = 1;
171  }
172  else if (dt < 0 && dt*(-1) <= ghost_cancellation_bx_depth){
174  (qual_prev < qual_this) )
175  ghost_cleared_prev = true;
176  }
177 
178  if (ghost_cleared[i_pattern] == 1) {
179  if (infoV > 1) LogTrace("CSCUpgradeAnodeLCTProcessor")
180  << ((i_pattern == 0) ? "Accelerator" : "Collision")
181  << " pattern ghost cancelled on key_wire " << key_wire <<" q="<<qual_this
182  << " by wire " << key_wire-1<<" q="<<qual_prev<<" dt="<<dt;
183  //cancellation for key_wire is done when ALCT is created and pushed to lct_list
184  }
185  if (ghost_cleared_prev) {
186  if (infoV > 1) LogTrace("CSCAnodeLCTProcessor")
187  << ((i_pattern == 0) ? "Accelerator" : "Collision")
188  << " pattern ghost cancelled on key_wire " << key_wire - 1 <<" q="<<qual_prev
189  << " by wire " << key_wire <<" q="<<qual_this;
190  p.setValid(0);//clean prev ALCT
191  }
192 
193  }
194 
195  }
196  }
197 
198 
199 }
200 
201 
203 {
204  // Quality definition changed on 22 June 2007: it no longer depends
205  // on pattern_thresh.
206  int Q;
207  // hack to run the Phase-II ME2/1, ME3/1 and ME4/1 ILT
208  if (temp_quality == 3 and isSLHC_ and (runME21ILT_ or runME31Up_ or runME41Up_)) Q = 4;
209  else if (temp_quality > 3) Q = temp_quality - 3;
210  else Q = 0; // quality code 0 is valid!
211 
212  return Q;
213 }
float dt
Definition: AMPTWrapper.h:126
int quality[CSCConstants::MAX_NUM_WIRES][3]
int first_bx_corrected[CSCConstants::MAX_NUM_WIRES]
bool runME21ILT_
Definition: CSCBaseboard.h:92
bool enableAlctSLHC_
Definition: CSCBaseboard.h:74
std::vector< CSCALCTDigi > lct_list
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
#define LogTrace(id)
void ghostCancellationLogicOneWire(const int key_wire, int *ghost_cleared) override
int first_bx[CSCConstants::MAX_NUM_WIRES]
int getTempALCTQuality(int temp_quality) const override