CMS 3D CMS Logo

L1MuDTSectorProcessor.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTSectorProcessor
4 //
5 // Description: Sector Processor
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 // J. Troconiz UAM Madrid
12 //
13 //--------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
18 
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 
25 #include <iostream>
26 #include <cmath>
27 
28 //-------------------------------
29 // Collaborating Class Headers --
30 //-------------------------------
31 
42 
43 using namespace std;
44 
45 // --------------------------------
46 // class L1MuDTSectorProcessor
47 //---------------------------------
48 
49 //----------------
50 // Constructors --
51 //----------------
52 
54  const L1MuDTSecProcId& id,
56  : m_tf(tf),
57  m_spid(id),
58  m_SectorReceiver(new L1MuDTSectorReceiver(*this, std::move(iC))),
59  m_DataBuffer(new L1MuDTDataBuffer(*this)),
60  m_EU(new L1MuDTExtrapolationUnit(*this)),
61  m_TA(new L1MuDTTrackAssembler(*this)),
62  m_AUs(),
63  m_TrackCands(),
64  m_TracKCands() {
65  // 2 assignment units
66  m_AUs.reserve(2);
67  m_AUs.push_back(new L1MuDTAssignmentUnit(*this, 0));
68  m_AUs.push_back(new L1MuDTAssignmentUnit(*this, 1));
69 
70  // now the 2 track candidates
71  m_TrackCands.reserve(2);
72  m_TrackCands.push_back(new L1MuDTTrack(m_spid));
73  m_TrackCands.push_back(new L1MuDTTrack(m_spid));
74 
75  m_TracKCands.reserve(2);
76  m_TracKCands.push_back(new L1MuDTTrack(m_spid));
77  m_TracKCands.push_back(new L1MuDTTrack(m_spid));
78 }
79 
80 //--------------
81 // Destructor --
82 //--------------
83 
85  delete m_SectorReceiver;
86  delete m_DataBuffer;
87  delete m_EU;
88  delete m_TA;
89  delete m_AUs[0];
90  delete m_AUs[1];
91  delete m_TrackCands[0];
92  delete m_TrackCands[1];
93  delete m_TracKCands[0];
94  delete m_TracKCands[1];
95 }
96 
97 //--------------
98 // Operations --
99 //--------------
100 
101 //
102 // run Sector Processor
103 //
105  // receive data and store them into the data buffer
106  if (m_SectorReceiver)
107  m_SectorReceiver->run(bx, e, c);
108 
109  // check content of data buffer
110  if (m_DataBuffer) {
111  if (m_tf.config()->Debug(4) && m_DataBuffer->numberTSphi() > 0) {
112  cout << "Phi track segments received by " << m_spid << " : " << endl;
114  }
115  }
116 
117  // perform all extrapolations
118  int n_ext = 0; // number of successful extrapolations
119  if (m_EU && m_DataBuffer && m_DataBuffer->numberTSphi() > 1) {
120  m_EU->run(c);
121  n_ext = m_EU->numberOfExt();
122  if (m_tf.config()->Debug(3) && n_ext > 0) {
123  cout << "Number of successful extrapolations : " << n_ext << endl;
124  m_EU->print();
125  }
126  }
127 
128  // hardware debug (output from Extrapolator and Quality Sorter)
129  // m_EU->print(1);
130 
131  // perform track assembling
132  if (m_TA && n_ext > 0) {
133  m_TA->run();
134  if (m_tf.config()->Debug(3))
135  m_TA->print();
136  }
137 
138  // assign pt, eta, phi and quality
139  if (m_AUs[0] && !m_TA->isEmpty(0))
140  m_AUs[0]->run(c);
141  if (m_AUs[1] && !m_TA->isEmpty(1))
142  m_AUs[1]->run(c);
143 
144  if (m_spid.wheel() == -1) {
145  if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(2) > 3 &&
146  m_TrackCands[0]->address(2) < 6)
147  m_TrackCands[0]->reset();
148  if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(3) > 3 &&
149  m_TrackCands[0]->address(3) < 6)
150  m_TrackCands[0]->reset();
151  if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(4) > 3 &&
152  m_TrackCands[0]->address(4) < 6)
153  m_TrackCands[0]->reset();
154 
155  if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(2) > 3 &&
156  m_TracKCands[0]->address(2) < 6)
157  m_TracKCands[0]->reset();
158  if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(3) > 3 &&
159  m_TracKCands[0]->address(3) < 6)
160  m_TracKCands[0]->reset();
161  if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(4) > 3 &&
162  m_TracKCands[0]->address(4) < 6)
163  m_TracKCands[0]->reset();
164 
165  if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(2) > 3 &&
166  m_TrackCands[1]->address(2) < 6)
167  m_TrackCands[1]->reset();
168  if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(3) > 3 &&
169  m_TrackCands[1]->address(3) < 6)
170  m_TrackCands[1]->reset();
171  if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(4) > 3 &&
172  m_TrackCands[1]->address(4) < 6)
173  m_TrackCands[1]->reset();
174 
175  if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(2) > 3 &&
176  m_TracKCands[1]->address(2) < 6)
177  m_TracKCands[1]->reset();
178  if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(3) > 3 &&
179  m_TracKCands[1]->address(3) < 6)
180  m_TracKCands[1]->reset();
181  if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(4) > 3 &&
182  m_TracKCands[1]->address(4) < 6)
183  m_TracKCands[1]->reset();
184 
185  if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(2) > 7 &&
186  m_TrackCands[0]->address(2) < 10)
187  m_TrackCands[0]->reset();
188  if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(3) > 7 &&
189  m_TrackCands[0]->address(3) < 10)
190  m_TrackCands[0]->reset();
191  if (m_TrackCands[0] && !m_TrackCands[0]->empty() && m_TrackCands[0]->address(4) > 7 &&
192  m_TrackCands[0]->address(4) < 10)
193  m_TrackCands[0]->reset();
194 
195  if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(2) > 7 &&
196  m_TracKCands[0]->address(2) < 10)
197  m_TracKCands[0]->reset();
198  if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(3) > 7 &&
199  m_TracKCands[0]->address(3) < 10)
200  m_TracKCands[0]->reset();
201  if (m_TracKCands[0] && !m_TracKCands[0]->empty() && m_TracKCands[0]->address(4) > 7 &&
202  m_TracKCands[0]->address(4) < 10)
203  m_TracKCands[0]->reset();
204 
205  if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(2) > 7 &&
206  m_TrackCands[1]->address(2) < 10)
207  m_TrackCands[1]->reset();
208  if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(3) > 7 &&
209  m_TrackCands[1]->address(3) < 10)
210  m_TrackCands[1]->reset();
211  if (m_TrackCands[1] && !m_TrackCands[1]->empty() && m_TrackCands[1]->address(4) > 7 &&
212  m_TrackCands[1]->address(4) < 10)
213  m_TrackCands[1]->reset();
214 
215  if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(2) > 7 &&
216  m_TracKCands[1]->address(2) < 10)
217  m_TracKCands[1]->reset();
218  if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(3) > 7 &&
219  m_TracKCands[1]->address(3) < 10)
220  m_TracKCands[1]->reset();
221  if (m_TracKCands[1] && !m_TracKCands[1]->empty() && m_TracKCands[1]->address(4) > 7 &&
222  m_TracKCands[1]->address(4) < 10)
223  m_TracKCands[1]->reset();
224  }
225 }
226 
227 //
228 // reset Sector Processor
229 //
231  if (m_SectorReceiver)
233  if (m_DataBuffer)
234  m_DataBuffer->reset();
235  if (m_EU)
236  m_EU->reset();
237  if (m_TA)
238  m_TA->reset();
239  if (m_AUs[0])
240  m_AUs[0]->reset();
241  if (m_AUs[1])
242  m_AUs[1]->reset();
243  if (m_TrackCands[0])
244  m_TrackCands[0]->reset();
245  if (m_TrackCands[1])
246  m_TrackCands[1]->reset();
247  if (m_TracKCands[0])
248  m_TracKCands[0]->reset();
249  if (m_TracKCands[1])
250  m_TracKCands[1]->reset();
251 }
252 
253 //
254 // print candidates found in Sector Processor
255 //
257  if (anyTrack()) {
258  cout << "Muon candidates found in " << m_spid << " : " << endl;
259  vector<L1MuDTTrack*>::const_iterator iter = m_TrackCands.begin();
260  while (iter != m_TrackCands.end()) {
261  if (*iter)
262  (*iter)->print();
263  iter++;
264  }
265  }
266 }
267 
268 //
269 // return pointer to nextWheel neighbour
270 //
272  int sector = m_spid.sector();
273  int wheel = m_spid.wheel();
274 
275  // the neighbour is in the same wedge with the following definition:
276  // current SP -3 -2 -1 +1 +2 +3
277  // neighbour -2 -1 +1 0 +1 +2
278 
279  if (wheel == 1)
280  return nullptr;
281  wheel = (wheel == -1) ? 1 : (wheel / abs(wheel)) * (abs(wheel) - 1);
282 
283  const L1MuDTSecProcId id(wheel, sector);
284 
285  return m_tf.sp(id);
286 }
287 
288 //
289 // are there any muon candidates?
290 //
292  if (m_TrackCands[0] && !m_TrackCands[0]->empty())
293  return true;
294  if (m_TrackCands[1] && !m_TrackCands[1]->empty())
295  return true;
296 
297  return false;
298 }
L1MuDTSectorProcessor::m_TrackCands
std::vector< L1MuDTTrack * > m_TrackCands
Definition: L1MuDTSectorProcessor.h:118
L1MuDTSectorProcessor::neighbour
const L1MuDTSectorProcessor * neighbour() const
return pointer to the next wheel neighbour
Definition: L1MuDTSectorProcessor.cc:271
L1MuDTTFConfig.h
L1MuDTSecProcId.h
L1MuDTTrackAssembler::reset
void reset() override
reset Track Assembler
Definition: L1MuDTTrackAssembler.cc:461
L1MuDTSectorProcessor::print
void print() const
print muon candidates found by the Sector Processor
Definition: L1MuDTSectorProcessor.cc:256
L1MuDTExtrapolationUnit::run
void run(const edm::EventSetup &c) override
run Extrapolation Unit
Definition: L1MuDTExtrapolationUnit.cc:94
L1MuDTSectorReceiver::reset
void reset()
clear Sector Receiver
Definition: L1MuDTSectorReceiver.cc:91
gather_cfg.cout
cout
Definition: gather_cfg.py:144
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
L1MuDTSectorProcessor.h
L1MuDTSectorProcessor::anyTrack
bool anyTrack() const
are there any non-empty muon candidates?
Definition: L1MuDTSectorProcessor.cc:291
L1MuDTExtrapolationUnit.h
L1MuDTSectorProcessor::m_spid
L1MuDTSecProcId m_spid
Definition: L1MuDTSectorProcessor.h:110
L1MuDTSectorReceiver.h
L1MuDTSectorProcessor::run
virtual void run(int bx, const edm::Event &e, const edm::EventSetup &c)
run the Sector Processor
Definition: L1MuDTSectorProcessor.cc:104
L1MuDTTrackFinder.h
L1MuDTSectorProcessor::m_SectorReceiver
L1MuDTSectorReceiver * m_SectorReceiver
Definition: L1MuDTSectorProcessor.h:112
L1MuDTTrackAssembler::print
void print() const
print result of Track Assembler
Definition: L1MuDTTrackAssembler.cc:479
L1MuDTExtrapolationUnit::print
void print(int level=0) const
print all successful extrapolations
Definition: L1MuDTExtrapolationUnit.cc:248
L1MuDTTrackAssembler.h
L1MuDTSectorProcessor::id
const L1MuDTSecProcId & id() const
return Sector Processor identifier
Definition: L1MuDTSectorProcessor.h:74
L1MuDTSectorProcessor::reset
virtual void reset()
reset the Sector Processor
Definition: L1MuDTSectorProcessor.cc:230
L1MuDTSectorProcessor::m_EU
L1MuDTExtrapolationUnit * m_EU
Definition: L1MuDTSectorProcessor.h:114
L1MuDTSectorProcessor::L1MuDTSectorProcessor
L1MuDTSectorProcessor(const L1MuDTTrackFinder &, const L1MuDTSecProcId &, edm::ConsumesCollector &&)
constructor
Definition: L1MuDTSectorProcessor.cc:53
L1MuDTSecProcId::wheel
int wheel() const
return wheel number
Definition: L1MuDTSecProcId.h:55
L1MuDTTrackAssembler
Definition: L1MuDTTrackAssembler.h:49
L1MuDTExtrapolationUnit::reset
void reset() override
reset Extrapolation Unit
Definition: L1MuDTExtrapolationUnit.cc:144
L1MuDTDataBuffer::numberTSphi
int numberTSphi() const
return number of non-empty phi track segments
Definition: L1MuDTDataBuffer.cc:105
L1MuDTAssignmentUnit
Definition: L1MuDTAssignmentUnit.h:50
L1MuDTTrackFinder::sp
const L1MuDTSectorProcessor * sp(const L1MuDTSecProcId &) const
get a pointer to a Sector Processor
Definition: L1MuDTTrackFinder.cc:294
L1MuDTSectorProcessor::m_tf
const L1MuDTTrackFinder & m_tf
Definition: L1MuDTSectorProcessor.h:109
L1MuDTSectorProcessor::m_DataBuffer
L1MuDTDataBuffer * m_DataBuffer
Definition: L1MuDTSectorProcessor.h:113
L1MuDTSecProcId::sector
int sector() const
return sector number
Definition: L1MuDTSecProcId.h:58
L1MuDTTrack.h
L1MuDTTrackAssembler::isEmpty
bool isEmpty(int id) const
is it a valid Track Class?
Definition: L1MuDTTrackAssembler.h:73
L1MuDTSectorProcessor::m_TracKCands
std::vector< L1MuDTTrack * > m_TracKCands
Definition: L1MuDTSectorProcessor.h:119
L1MuDTSecProcId
Definition: L1MuDTSecProcId.h:40
Event.h
L1MuDTSectorReceiver::run
void run(int bx, const edm::Event &e, const edm::EventSetup &c)
receive track segment data from the DTBX and CSC chamber triggers
Definition: L1MuDTSectorReceiver.cc:75
L1MuDTTrack
Definition: L1MuDTTrack.h:47
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
edm::EventSetup
Definition: EventSetup.h:58
L1MuDTDataBuffer.h
L1MuDTTrackFinder::config
static L1MuDTTFConfig * config()
return configuration
Definition: L1MuDTTrackFinder.h:102
L1MuDTAssignmentUnit.h
L1MuDTExtrapolationUnit::numberOfExt
int numberOfExt() const
return number of successful extrapolations
Definition: L1MuDTExtrapolationUnit.cc:235
L1MuDTSectorReceiver
Definition: L1MuDTSectorReceiver.h:54
L1MuDTSectorProcessor
Definition: L1MuDTSectorProcessor.h:53
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
L1MuDTTrackFinder
Definition: L1MuDTTrackFinder.h:56
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
L1MuDTSectorProcessor::m_TA
L1MuDTTrackAssembler * m_TA
Definition: L1MuDTSectorProcessor.h:115
L1MuDTSectorProcessor::~L1MuDTSectorProcessor
virtual ~L1MuDTSectorProcessor()
destructor
Definition: L1MuDTSectorProcessor.cc:84
L1MuDTTrackAssembler::run
void run() override
run Track Assembler
Definition: L1MuDTTrackAssembler.cc:60
L1MuDTDataBuffer::reset
void reset()
clear Data Buffer
Definition: L1MuDTDataBuffer.cc:63
L1MuDTDataBuffer::printTSphi
void printTSphi() const
print all phi track segments which are in the buffer
Definition: L1MuDTDataBuffer.cc:93
L1MuDTDataBuffer
Definition: L1MuDTDataBuffer.h:41
L1MuDTTFConfig::Debug
static bool Debug()
Definition: L1MuDTTFConfig.h:49
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition: Event.h:73
L1MuDTSectorProcessor::m_AUs
std::vector< L1MuDTAssignmentUnit * > m_AUs
Definition: L1MuDTSectorProcessor.h:116
L1MuDTExtrapolationUnit
Definition: L1MuDTExtrapolationUnit.h:52
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37