CMS 3D CMS Logo

L1MuGMTMipIsoAU.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuGMTMipIsoAU
4 //
5 // Description: GMT MIP & ISO bit assignment unit
6 //
7 //
8 //
9 // Author :
10 // H. Sakulin CERN EP
11 //
12 // Migrated to CMSSW:
13 // I. Mikulec
14 //
15 //--------------------------------------------------
16 
17 //-----------------------
18 // This Class's Header --
19 //-----------------------
20 
22 
23 //---------------
24 // C++ Headers --
25 //---------------
26 
27 #include <iostream>
28 #include <vector>
29 #include <cmath>
30 #include <string>
31 #include <sstream>
32 
33 //-------------------------------
34 // Collaborating Class Headers --
35 //-------------------------------
36 
42 
45 
46 // --------------------------------
47 // class L1MuGMTMipIsoAU
48 //---------------------------------
49 
50 //----------------
51 // Constructors --
52 //----------------
54  : m_gmt(gmt), m_id(id), m_muons(8), m_MIP(8), m_ISO(8), m_MIP_PPUs(8), m_MIP_EPUs(8), m_ISO_PPUs(8), m_ISO_EPUs(8) {
55  m_muons.reserve(8);
56  m_MIP.reserve(8);
57  m_ISO.reserve(8);
58 
59  // reserve MIP and ISO phi and eta projection units
60  m_MIP_PPUs.reserve(8);
61  m_MIP_EPUs.reserve(8);
62  m_ISO_PPUs.reserve(8);
63  m_ISO_EPUs.reserve(8);
64 
65  for (int i = 0; i < 8; i++) {
66  m_MIP_PPUs[i] = new L1MuGMTPhiProjectionUnit(*this, 16 * m_id + i);
67  m_MIP_EPUs[i] = new L1MuGMTEtaProjectionUnit(*this, 16 * m_id + i);
68 
69  m_ISO_PPUs[i] = new L1MuGMTPhiProjectionUnit(*this, 16 * m_id + 8 + i);
70  m_ISO_EPUs[i] = new L1MuGMTEtaProjectionUnit(*this, 16 * m_id + 8 + i);
71  }
72 }
73 
74 //--------------
75 // Destructor --
76 //--------------
78  reset();
79 
80  // delete MIP phi projection units
81  std::vector<L1MuGMTPhiProjectionUnit*>::iterator p_iter;
82  for (p_iter = m_MIP_PPUs.begin(); p_iter != m_MIP_PPUs.end(); p_iter++)
83  delete *p_iter;
84  m_MIP_PPUs.clear();
85 
86  // delete ISO phi projection units
87  for (p_iter = m_ISO_PPUs.begin(); p_iter != m_ISO_PPUs.end(); p_iter++)
88  delete *p_iter;
89  m_ISO_PPUs.clear();
90 
91  // delete MIP eta projection units
92  std::vector<L1MuGMTEtaProjectionUnit*>::iterator e_iter;
93  for (e_iter = m_MIP_EPUs.begin(); e_iter != m_MIP_EPUs.end(); e_iter++)
94  delete *e_iter;
95  m_MIP_EPUs.clear();
96 
97  // delete ISO eta projection units
98  for (e_iter = m_ISO_EPUs.begin(); e_iter != m_ISO_EPUs.end(); e_iter++)
99  delete *e_iter;
100  m_ISO_EPUs.clear();
101 }
102 
103 //--------------
104 // Operations --
105 //--------------
106 
107 //
108 // run MIP & ISO assignment unit
109 //
111  load();
112 
113  // run MIP phi projection units
114  std::vector<L1MuGMTPhiProjectionUnit*>::iterator p_iter;
115  for (p_iter = m_MIP_PPUs.begin(); p_iter != m_MIP_PPUs.end(); p_iter++)
116  (*p_iter)->run();
117 
118  // run ISO phi projection units
119  for (p_iter = m_ISO_PPUs.begin(); p_iter != m_ISO_PPUs.end(); p_iter++)
120  (*p_iter)->run();
121 
122  // run MIP eta projection units
123  std::vector<L1MuGMTEtaProjectionUnit*>::iterator e_iter;
124  for (e_iter = m_MIP_EPUs.begin(); e_iter != m_MIP_EPUs.end(); e_iter++)
125  (*e_iter)->run();
126 
127  // run ISO eta projection units
128  for (e_iter = m_ISO_EPUs.begin(); e_iter != m_ISO_EPUs.end(); e_iter++)
129  (*e_iter)->run();
130 
131  assignMIP();
132  assignISO();
133 }
134 
135 //
136 // reset MIP & ISO assignment unit
137 //
139  for (int i = 0; i < 8; i++) {
140  m_muons[i] = nullptr;
141  m_MIP[i] = false;
142  m_ISO[i] = false;
143  }
144 
145  // reset MIP phi projection units
146  std::vector<L1MuGMTPhiProjectionUnit*>::iterator p_iter;
147  for (p_iter = m_MIP_PPUs.begin(); p_iter != m_MIP_PPUs.end(); p_iter++) {
148  (*p_iter)->reset();
149  }
150 
151  // reset ISO phi projection units
152  for (p_iter = m_ISO_PPUs.begin(); p_iter != m_ISO_PPUs.end(); p_iter++)
153  (*p_iter)->reset();
154 
155  // reset MIP eta projection units
156  std::vector<L1MuGMTEtaProjectionUnit*>::iterator e_iter;
157  for (e_iter = m_MIP_EPUs.begin(); e_iter != m_MIP_EPUs.end(); e_iter++)
158  (*e_iter)->reset();
159 
160  // reset ISO eta projection units
161  for (e_iter = m_ISO_EPUs.begin(); e_iter != m_ISO_EPUs.end(); e_iter++)
162  (*e_iter)->reset();
163 }
164 
165 //
166 // print results of MIP & ISO assignment
167 //
169  std::stringstream outmip;
170  outmip << "Assigned MIP bits : ";
171  std::vector<bool>::const_iterator iter;
172  for (iter = m_MIP.begin(); iter != m_MIP.end(); iter++) {
173  outmip << (*iter) << " ";
174  }
175  edm::LogVerbatim("GMT_MipIso_info") << outmip.str();
176 
177  std::stringstream outiso;
178  outiso << "Assigned ISO bits : ";
179  for (iter = m_ISO.begin(); iter != m_ISO.end(); iter++) {
180  outiso << (*iter) << " ";
181  }
182  edm::LogVerbatim("GMT_MipIso_info") << outiso.str();
183 }
184 
185 //
186 // load MIP & ISO assignment unit (get data from PSB)
187 //
189  // barrel MIP & ISO assignment unit gets DTBX and barrel RPC muons
190  if (m_id == 0) {
191  for (unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++) {
192  m_muons[idt] = m_gmt.Data()->DTBXMuon(idt);
193  }
194  for (unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCbarrel; irpc++) {
195  m_muons[irpc + 4] = m_gmt.Data()->RPCMuon(irpc);
196  }
197  }
198 
199  // endcap MIP & ISO assignment unit gets CSC and endcap RPC muons
200  if (m_id == 1) {
201  for (unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++) {
202  m_muons[icsc] = m_gmt.Data()->CSCMuon(icsc);
203  }
204  for (unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCendcap; irpc++) {
205  m_muons[irpc + 4] = m_gmt.Data()->RPCMuon(irpc + 4);
206  }
207  }
208 }
209 
210 //
211 // run MIP assignment
212 //
214  // get MIP bits from PSB
215  const L1MuGMTMatrix<bool>& mip = m_gmt.Data()->mipBits();
216 
217  for (int imuon = 0; imuon < 8; imuon++)
218  if (m_muons[imuon] && !m_muons[imuon]->empty()) {
219  bool tmpMIP = false;
220 
221  for (int iphi = 0; iphi < 18; iphi++)
222  for (int ieta = 0; ieta < 14; ieta++) {
223  if (m_MIP_PPUs[imuon]->isSelected(iphi) && m_MIP_EPUs[imuon]->isSelected(ieta)) {
224  tmpMIP |= mip(ieta, iphi);
225  if (L1MuGMTConfig::Debug(3))
226  edm::LogVerbatim("GMT_MipIso_info")
227  << "L1MuGMTMipIsoAU::assignMIP() checking calo region phi=" << iphi << ", eta=" << ieta;
228  }
229  }
230  m_MIP[imuon] = tmpMIP;
231  m_gmt.DebugBlockForFill()->SetIsMIPISO(m_MIP_PPUs[imuon]->id(), tmpMIP ? 1 : 0);
232  }
233 }
234 
235 //
236 // run ISO assignment
237 //
239  // get isolation bits from PSB
240  const L1MuGMTMatrix<bool>& isol = m_gmt.Data()->isolBits();
241 
242  for (int imuon = 0; imuon < 8; imuon++)
243  if (m_muons[imuon] && !m_muons[imuon]->empty()) {
244  bool tmpISO = true;
245  bool any = false;
246 
247  for (int iphi = 0; iphi < 18; iphi++)
248  for (int ieta = 0; ieta < 14; ieta++) {
249  if (m_ISO_PPUs[imuon]->isSelected(iphi) && m_ISO_EPUs[imuon]->isSelected(ieta)) {
250  tmpISO &= isol(ieta, iphi);
251  any = true;
252  if (L1MuGMTConfig::Debug(3))
253  edm::LogVerbatim("GMT_MipIso_info")
254  << "L1MuGMTMipIsoAU::assignISO() checking calo region phi=" << iphi << ", eta=" << ieta;
255  }
256  }
257  if (any)
258  m_ISO[imuon] = tmpISO;
259  else
260  edm::LogWarning("MipISOProblem") << "L1MuGMTMipIsoAU::assignISO(): no calo region was checked!!";
261 
262  m_gmt.DebugBlockForFill()->SetIsMIPISO(m_ISO_PPUs[imuon]->id(), m_ISO[imuon] ? 1 : 0);
263  }
264 }
L1MuGMTMipIsoAU::assignISO
void assignISO()
Definition: L1MuGMTMipIsoAU.cc:238
L1MuGMTConfig::MAXCSC
static const unsigned int MAXCSC
Definition: L1MuGMTConfig.h:85
L1MuGMTConfig::MAXRPCendcap
static const unsigned int MAXRPCendcap
Definition: L1MuGMTConfig.h:85
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
L1MuGMTMipIsoAU::reset
void reset()
clear MIP & ISO bit assignment unit
Definition: L1MuGMTMipIsoAU.cc:138
L1MuGMTMipIsoAU::m_ISO_EPUs
std::vector< L1MuGMTEtaProjectionUnit * > m_ISO_EPUs
Definition: L1MuGMTMipIsoAU.h:100
L1MuGlobalMuonTrigger::DebugBlockForFill
L1MuGMTDebugBlock * DebugBlockForFill() const
for debug: return the debug block (in order to fill it)
Definition: L1MuGlobalMuonTrigger.h:101
L1MuGMTConfig::MAXRPCbarrel
static const unsigned int MAXRPCbarrel
Definition: L1MuGMTConfig.h:85
L1MuGMTMipIsoAU::load
void load()
Definition: L1MuGMTMipIsoAU.cc:188
L1MuGMTConfig::MAXDTBX
static const unsigned int MAXDTBX
Definition: L1MuGMTConfig.h:85
L1MuGMTMipIsoAU::m_id
int m_id
Definition: L1MuGMTMipIsoAU.h:89
L1MuGMTMipIsoAU::m_MIP
std::vector< bool > m_MIP
Definition: L1MuGMTMipIsoAU.h:93
L1MuGMTMipIsoAU::print
void print() const
print results after MIP & ISO bit assignment
Definition: L1MuGMTMipIsoAU.cc:168
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
L1MuGMTPSB::isolBits
const L1MuGMTMatrix< bool > & isolBits() const
return isolation bits
Definition: L1MuGMTPSB.h:88
L1MuGMTMipIsoAU::m_MIP_PPUs
std::vector< L1MuGMTPhiProjectionUnit * > m_MIP_PPUs
Definition: L1MuGMTMipIsoAU.h:96
any
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:38
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
irpc
int irpc
Definition: CascadeWrapper.h:67
L1MuGMTMipIsoAU.h
L1MuGlobalMuonTrigger
Definition: L1MuGlobalMuonTrigger.h:64
L1MuGMTConfig.h
L1MuGlobalMuonTrigger::Data
const L1MuGMTPSB * Data() const
return pointer to PSB
Definition: L1MuGlobalMuonTrigger.h:75
L1MuGMTMipIsoAU::~L1MuGMTMipIsoAU
virtual ~L1MuGMTMipIsoAU()
destructor
Definition: L1MuGMTMipIsoAU.cc:77
L1MuGMTMipIsoAU::m_ISO_PPUs
std::vector< L1MuGMTPhiProjectionUnit * > m_ISO_PPUs
Definition: L1MuGMTMipIsoAU.h:99
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
L1MuGMTMipIsoAU::m_ISO
std::vector< bool > m_ISO
Definition: L1MuGMTMipIsoAU.h:94
L1MuGMTPhiProjectionUnit.h
L1MuGMTEtaProjectionUnit
Definition: L1MuGMTEtaProjectionUnit.h:49
L1MuGMTDebugBlock.h
L1MuGMTDebugBlock::SetIsMIPISO
void SetIsMIPISO(int idx, unsigned ismipiso)
Set MIP/ISO bits for current bx.
Definition: L1MuGMTDebugBlock.h:81
L1MuGMTMipIsoAU::m_muons
std::vector< const L1MuRegionalCand * > m_muons
Definition: L1MuGMTMipIsoAU.h:91
L1MuGMTPSB::mipBits
const L1MuGMTMatrix< bool > & mipBits() const
return minimum ionizing bits
Definition: L1MuGMTPSB.h:91
L1MuGMTPSB.h
L1MuGMTMipIsoAU::assignMIP
void assignMIP()
Definition: L1MuGMTMipIsoAU.cc:213
L1MuGMTMipIsoAU::m_MIP_EPUs
std::vector< L1MuGMTEtaProjectionUnit * > m_MIP_EPUs
Definition: L1MuGMTMipIsoAU.h:97
L1MuGMTPSB::RPCMuon
const L1MuRegionalCand * RPCMuon(int index) const
get RPC muon
Definition: L1MuGMTPSB.cc:224
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
L1MuGMTEtaProjectionUnit.h
L1MuGMTMipIsoAU::m_gmt
const L1MuGlobalMuonTrigger & m_gmt
Definition: L1MuGMTMipIsoAU.h:88
L1MuGMTPSB::CSCMuon
const L1MuRegionalCand * CSCMuon(int index) const
get CSC muon
Definition: L1MuGMTPSB.cc:238
L1MuGlobalMuonTrigger.h
L1MuGMTMipIsoAU::L1MuGMTMipIsoAU
L1MuGMTMipIsoAU(const L1MuGlobalMuonTrigger &gmt, int id)
constructor
Definition: L1MuGMTMipIsoAU.cc:53
L1MuGMTPSB::DTBXMuon
const L1MuRegionalCand * DTBXMuon(int index) const
get DTBX muon
Definition: L1MuGMTPSB.cc:231
L1MuGMTConfig::Debug
static bool Debug()
Definition: L1MuGMTConfig.h:101
L1MuGMTMipIsoAU::run
void run()
run GMT MIP & ISO bit assignment unit
Definition: L1MuGMTMipIsoAU.cc:110
L1MuGMTMatrix< bool >
L1MuGMTPhiProjectionUnit
Definition: L1MuGMTPhiProjectionUnit.h:50