CMS 3D CMS Logo

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