CMS 3D CMS Logo

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