CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
FastL1RegionMap Class Reference

#include <FastL1RegionMap.h>

Public Member Functions

int convertFromECal_to_HCal_iphi (int iphi_ecal)
 
int convertFromHCal_to_ECal_iphi (int iphi_hcal)
 
void display ()
 
 FastL1RegionMap ()
 
int getNRegion ()
 
int getNTower ()
 
std::pair< double, double > getRegionCenterEtaPhi (int iRgn)
 
std::pair< int, int > getRegionEtaPhiIndex (std::pair< int, int > iEtaPhi)
 
std::pair< int, int > getRegionEtaPhiIndex (CaloTowerDetId towerId)
 
std::pair< int, int > getRegionEtaPhiIndex (int regionId)
 
int getRegionIndex (int ieta, int iphi)
 
int getRegionIndex (CaloTowerDetId tower)
 
int getRegionTowerIndex (std::pair< int, int > iEtaPhi)
 
int getRegionTowerIndex (int ieta, int iphi)
 
int getRegionTowerIndex (CaloTowerDetId towerId)
 
std::pair< int, int > GetTowerEastEtaPhi (int ieta, int iphi)
 
std::pair< int, int > GetTowerNEEtaPhi (int ieta, int iphi)
 
std::pair< int, int > GetTowerNorthEtaPhi (int ieta, int iphi)
 
std::pair< int, int > GetTowerNWEtaPhi (int ieta, int iphi)
 
std::pair< int, int > GetTowerSEEtaPhi (int ieta, int iphi)
 
std::pair< int, int > GetTowerSouthEtaPhi (int ieta, int iphi)
 
std::pair< int, int > GetTowerSWEtaPhi (int ieta, int iphi)
 
std::pair< int, int > GetTowerWestEtaPhi (int ieta, int iphi)
 
 ~FastL1RegionMap ()
 

Static Public Member Functions

static FastL1RegionMapgetFastL1RegionMap ()
 

Private Attributes

int nRegion
 
int nTower
 

Static Private Attributes

static FastL1RegionMaptheInstance = 0
 

Detailed Description

Description: Mapping between DetIds, CaloTower IDs and Region IDs.

Implementation: <Notes on="" implementation>="">

Definition at line 49 of file FastL1RegionMap.h.

Constructor & Destructor Documentation

FastL1RegionMap::FastL1RegionMap ( )

Definition at line 23 of file FastL1RegionMap.cc.

References nRegion, and nTower.

Referenced by getFastL1RegionMap().

24 {
25  nTower = 4608;
26  nRegion = 396;
27 
28 }
FastL1RegionMap::~FastL1RegionMap ( )

Member Function Documentation

int FastL1RegionMap::convertFromECal_to_HCal_iphi ( int  iphi_ecal)

Definition at line 313 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::checkMapping().

314 {
315  int iphi = 999;
316  if (iphi_ecal>=3)
317  iphi = iphi_ecal - 2;
318  else if (iphi_ecal==1 || iphi_ecal==2)
319  iphi = 70 + iphi_ecal;
320 
321  return iphi;
322 }
int FastL1RegionMap::convertFromHCal_to_ECal_iphi ( int  iphi_hcal)

Definition at line 328 of file FastL1RegionMap.cc.

329 {
330  int iphi = 999;
331  if (iphi_hcal>=1 && iphi_hcal<=70)
332  iphi = iphi_hcal + 2;
333  else if (iphi_hcal==71 || iphi_hcal==72)
334  iphi = iphi_hcal - 70;
335 
336  return iphi;
337 }
void FastL1RegionMap::display ( )

Definition at line 232 of file FastL1RegionMap.cc.

References dtNoiseDBValidation_cfg::cerr.

232  {
233  // Region IDs
234  for (int iRgn=0; iRgn<396; iRgn++) {
235  if (iRgn%22 == 0) std::cerr << std::endl;
236  std::cerr << iRgn << " ";
237  }
238 
239  for (int iRgn=0; iRgn<396; iRgn++) {
240  if (iRgn%22 == 0) std::cerr << std::endl;
241  //std::pair<int, int> pep = m_Regions[iRgn].SetEtaPhiIndex();
242  for (int iTwr=0; iTwr<16; iTwr++) {
243 
244  if (iTwr%4 == 0) std::cerr << " | ";
245  std::cerr << iRgn << " ";
246  }
247  }
248 
249 }
FastL1RegionMap * FastL1RegionMap::getFastL1RegionMap ( )
static

Definition at line 33 of file FastL1RegionMap.cc.

References FastL1RegionMap(), and theInstance.

Referenced by FastL1GlobalAlgo::FastL1GlobalAlgo().

34 {
35  if(theInstance == 0)
36  {
38  }
39  return theInstance;
40 }
static FastL1RegionMap * theInstance
int FastL1RegionMap::getNRegion ( )
inline

Definition at line 69 of file FastL1RegionMap.h.

References nRegion.

69 { return nRegion; };
int FastL1RegionMap::getNTower ( )
inline

Definition at line 68 of file FastL1RegionMap.h.

References nTower.

68 { return nTower; };
std::pair< double, double > FastL1RegionMap::getRegionCenterEtaPhi ( int  iRgn)

Definition at line 252 of file FastL1RegionMap.cc.

References eta(), getRegionEtaPhiIndex(), and phi.

Referenced by FastL1GlobalAlgo::addJet(), FastL1GlobalAlgo::checkMapping(), FastL1GlobalAlgo::FillL1RegionsTP(), FastL1GlobalAlgo::FillMET(), FastL1GlobalAlgo::findJets(), and FastL1GlobalAlgo::isEMCand().

253 {
254 
255  std::pair<int, int> ep = getRegionEtaPhiIndex(iRgn);
256 
257  // this only true for barrel + endcap!
258  double eta = 999.;
259  double phi = 999.;
260 
261  // phi
262  if (ep.second <= 9) {
263  //phi = ep.second * 0.349065 + 0.1745329; // 10 degrees
264  phi = ep.second * 0.349065 ;
265  //phi = ep.second * 0.3490658504 + 0.1745329252; // 10 degrees
266  } else {
267  //phi = (18-ep.second) * (-0.349065) + 0.1745329; // -10 degrees
268  phi = (18-ep.second) * (-0.349065);
269  }
270  // eta
271  if (ep.first >= 11 && ep.first <= 15 )
272  eta = (ep.first-11)*0.349 + 0.1745;
273  //eta = (ep.first-11)*0.3490658504 + 0.1745329252;
274  if (ep.first == 16 )
275  eta = 1.956;
276  if (ep.first == 17 )
277  eta = 2.586;
278  if (ep.first == 18 )
279  eta = 3.25;
280  if (ep.first == 19 )
281  eta = 3.75;
282  if (ep.first == 20 )
283  eta = 4.25;
284  if (ep.first == 21 )
285  eta = 4.75;
286 
287  if (ep.first >= 6 && ep.first <= 10 )
288  eta = (10-ep.first)*(-0.348) - 0.174;
289  if (ep.first == 5 )
290  eta = -1.956;
291  if (ep.first == 4 )
292  eta = -2.586;
293  if (ep.first == 3 )
294  eta = -3.25;
295  if (ep.first == 2 )
296  eta = -3.75;
297  if (ep.first == 1 )
298  eta = -4.25;
299  if (ep.first == 0 )
300  eta = -4.75;
301 
302  //std::cout << "eta, phi ID: "<< ep.first << ", " << ep.second << std::endl;
303  //std::cout << "eta, phi: "<< eta << ", " << phi << std::endl;
304 
305 
306  return std::pair<double, double>(eta, phi);
307 }
T eta() const
std::pair< int, int > getRegionEtaPhiIndex(std::pair< int, int > iEtaPhi)
Definition: DDAxes.h:10
std::pair< int, int > FastL1RegionMap::getRegionEtaPhiIndex ( std::pair< int, int >  iEtaPhi)

Definition at line 62 of file FastL1RegionMap.cc.

References abs.

Referenced by FastL1GlobalAlgo::checkMapping(), FastL1GlobalAlgo::FillL1Regions(), getRegionCenterEtaPhi(), getRegionEtaPhiIndex(), getRegionIndex(), and FastL1GlobalAlgo::InitL1Regions().

63 {
65  // barrel: 2x(17x72) [eta,phi] -> 2x1224 (etaid: +/- 1-17 phiid: 1-72)
66  // endcap: 2x(11x72) [eta,phi] -> 2x792 (etaid: +/- 18-28 phiid: 1-72)
67  // forward: 2x(4x18) [eta,phi] -> 2x72 (etaid: +/- 29-32 phiid: 1-18)
69  // barrel: 2x(20x72) [eta,phi] -> 2x1440 (etaid: +/- 1-20 phiid: 1-72)
70  // endcap: 2x(18x36) [eta,phi] -> 2x648 (etaid: +/- 21-38 phiid: 1-36)
71  // forward: 2x(3x18) [eta,phi] -> 2x54 (etaid: +/- 40-41 phiid: 1-18)
73  // barrel: 2x(20x72) [eta,phi] -> 2x1440 (etaid: +/- 1-20 phiid: 1-72 interv: 1)
74  // endcap: 2x(19x36) [eta,phi] -> 2x684 (etaid: +/- 21-39 phiid: 1-72 interv: 2)
75  // forward: 2x(2x18) [eta,phi] -> 2x36 (etaid: +/- 40-41 phiid: 1-72 interv: 4)
77  // barrel: 2x(20x72) [eta,phi] -> 2x1440 (etaid: +/- 1-20 phiid: 1-72 interv: 1)
78  // endcap: 2x(18x36) [eta,phi] -> 2x684 (etaid: +/- 21-28 phiid: 1-72 interv: 2)
79  // forward: 2x(2x18) [eta,phi] -> 2x36 (etaid: +/- 29-32 phiid: 1-72 interv: 4)
80 
81  int iTwrEta = EtaPhi.first;
82  int iTwrPhi = EtaPhi.second;
83 
84  //iTwrPhi = convertFromECal_to_HCal_iphi(iTwrPhi);
85 
86  int iphi=999; // 0-17
87  int ieta=999; // 0-21 (barrel: 6-15, endcap: 4,5,16,17, HF: 0-3,18-21??)
88 
89  // Right now: only barrel/endcap parts work!!!
90  if (abs(iTwrEta)<=28) {
91 
92  //int isub; // 0-15 4x4 region matrix
93 
94  iphi = ((iTwrPhi + 1) / 4) % 18;
95 
96  if (iTwrEta > 0) {
97  ieta = (iTwrEta - 1) / 4 + 11;
98  } else {
99  ieta = (iTwrEta + 1) / 4 + 10;
100  }
101  }
102 
103  // Test HF!!!
104  if (abs(iTwrEta)>=29 && abs(iTwrEta)<=32) {
105  iphi = ((iTwrPhi + 1) / 4) % 18;
106 
107  if (iTwrEta == 29) {
108  ieta = 18;
109  }
110 
111  if (iTwrEta == 30) {
112  ieta = 19;
113  }
114 
115  if (iTwrEta == 31) {
116  ieta = 20;
117  }
118 
119  if (iTwrEta == 32) {
120  ieta = 21;
121  }
122 
123  if (iTwrEta == -29) {
124  ieta = 3;
125  }
126 
127  if (iTwrEta == -30) {
128  ieta = 2;
129  }
130 
131  if (iTwrEta == -31) {
132  ieta = 1;
133  }
134 
135  if (iTwrEta == -32) {
136  ieta = 0;
137  }
138 
139  /*
140  if (iTwrEta >= 29 && iTwrEta <= 32) {
141  ieta = 18;
142  }
143  if (iTwrEta >= 33 && iTwrEta <= 35) {
144  ieta = 19;
145  }
146  if (iTwrEta >= 36 && iTwrEta <= 38) {
147  ieta = 20;
148  }
149  if (iTwrEta >= 39 && iTwrEta <= 41) {
150  ieta = 21;
151  }
152 
153  if (iTwrEta <= -29 && iTwrEta >= -32) {
154  ieta = 3;
155  }
156  if (iTwrEta <= -33 && iTwrEta >= -35) {
157  ieta = 2;
158  }
159  if (iTwrEta <= -36 && iTwrEta >= -38) {
160  ieta = 1;
161  }
162  if (iTwrEta <= -39 && iTwrEta >= -41) {
163  ieta = 0;
164  }
165  */
166  }
167 
168  return std::pair<int, int>(ieta, iphi);
169 }
#define abs(x)
Definition: mlp_lapack.h:159
std::pair< int, int > FastL1RegionMap::getRegionEtaPhiIndex ( CaloTowerDetId  towerId)

Definition at line 44 of file FastL1RegionMap.cc.

References getRegionEtaPhiIndex(), CaloTowerDetId::ieta(), and CaloTowerDetId::iphi().

45 {
46 
47  return FastL1RegionMap::getRegionEtaPhiIndex(std::pair<int, int>(tower.ieta(), tower.iphi()));
48 }
std::pair< int, int > getRegionEtaPhiIndex(std::pair< int, int > iEtaPhi)
std::pair< int, int > FastL1RegionMap::getRegionEtaPhiIndex ( int  regionId)

Definition at line 204 of file FastL1RegionMap.cc.

205 {
206  int ieta = regionId%22;
207  int iphi = regionId/22;
208 
209  return std::pair<int, int>(ieta, iphi);
210 }
int FastL1RegionMap::getRegionIndex ( int  ieta,
int  iphi 
)

Definition at line 213 of file FastL1RegionMap.cc.

References getRegionEtaPhiIndex().

Referenced by FastL1GlobalAlgo::checkMapping(), FastL1GlobalAlgo::FillL1RegionsTP(), getRegionIndex(), and FastL1GlobalAlgo::isEMCand().

214 {
215 
216  std::pair<int, int> ietaphi(ieta,iphi);
217  std::pair<int, int> iep = getRegionEtaPhiIndex(ietaphi);
218 
219  int rgnid = iep.second*22 + iep.first;
220 
221  return rgnid;
222 }
std::pair< int, int > getRegionEtaPhiIndex(std::pair< int, int > iEtaPhi)
int FastL1RegionMap::getRegionIndex ( CaloTowerDetId  tower)

Definition at line 225 of file FastL1RegionMap.cc.

References getRegionIndex(), CaloTowerDetId::ieta(), and CaloTowerDetId::iphi().

226 {
227  return getRegionIndex(tower.ieta(), tower.iphi());
228 }
int getRegionIndex(int ieta, int iphi)
int iphi() const
get the tower iphi
int ieta() const
get the tower ieta
int FastL1RegionMap::getRegionTowerIndex ( std::pair< int, int >  iEtaPhi)

Definition at line 175 of file FastL1RegionMap.cc.

References abs.

Referenced by FastL1GlobalAlgo::checkMapping(), FastL1GlobalAlgo::FillL1Regions(), FastL1GlobalAlgo::FillL1RegionsTP(), getRegionTowerIndex(), and FastL1GlobalAlgo::isEMCand().

176 {
177  int iTwrEta = EtaPhi.first;
178  int iTwrPhi = EtaPhi.second;
179 
180  //iTwrPhi = convertFromECal_to_HCal_iphi(iTwrPhi);
181 
182  // Right now: only barrel/encap part!!!
183  int isub = 999; // 0-15 4x4 region matrix
184 
185  if (abs(iTwrEta)<=41) {
186  //if (abs(iTwrEta)<=28) {
187  if (iTwrEta > 0) {
188  isub = 4*(3 - (iTwrPhi + 1) %4) + ((iTwrEta - 1) % 4) ;
189  } else {
190  isub = 4*(3 - (iTwrPhi + 1) %4) + (3 + (iTwrEta+1)%4) ;
191  }
192  }
193 
194  return isub;
195 }
#define abs(x)
Definition: mlp_lapack.h:159
int FastL1RegionMap::getRegionTowerIndex ( int  ieta,
int  iphi 
)

Definition at line 198 of file FastL1RegionMap.cc.

References getRegionTowerIndex().

199 {
200  return FastL1RegionMap::getRegionTowerIndex(std::pair<int, int>(iEta,iPhi));
201 }
int getRegionTowerIndex(std::pair< int, int > iEtaPhi)
int FastL1RegionMap::getRegionTowerIndex ( CaloTowerDetId  towerId)

Definition at line 52 of file FastL1RegionMap.cc.

References getRegionTowerIndex(), CaloTowerDetId::ieta(), and CaloTowerDetId::iphi().

53 {
54  return FastL1RegionMap::getRegionTowerIndex(std::pair<int, int>(tower.ieta(), tower.iphi()));
55 }
int getRegionTowerIndex(std::pair< int, int > iEtaPhi)
std::pair< int, int > FastL1RegionMap::GetTowerEastEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 369 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

370 {
371  if (ieta == -1) return std::pair<int, int>(1, iphi);
372 
373  if (ieta < 32)
374  return std::pair<int, int>(ieta+1, iphi);
375  else
376  return std::pair<int, int>(999, iphi);
377 }
std::pair< int, int > FastL1RegionMap::GetTowerNEEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 395 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

396 {
397  int iEta = ieta + 1;
398  int iPhi = iphi + 1;
399  if (ieta >= 32)
400  iEta = 999;
401  if (ieta == -1)
402  iEta = 1;
403  if (iphi == 72)
404  iPhi = 1;
405 
406  return std::pair<int, int>(iEta, iPhi);
407 }
std::pair< int, int > FastL1RegionMap::GetTowerNorthEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 340 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

341 {
342  if (iphi < 72)
343  return std::pair<int, int>(ieta, iphi+1);
344  else
345  return std::pair<int, int>(ieta, 1);
346 }
std::pair< int, int > FastL1RegionMap::GetTowerNWEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 380 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

381 {
382  int iEta = ieta - 1;
383  int iPhi = iphi + 1;
384  if (ieta <= -32)
385  iEta = 999;
386  if (ieta == 1)
387  iEta = -1;
388  if (iphi == 72)
389  iPhi = 1;
390 
391  return std::pair<int, int>(iEta, iPhi);
392 }
std::pair< int, int > FastL1RegionMap::GetTowerSEEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 427 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

428 {
429  int iEta = ieta + 1;
430  int iPhi = iphi - 1;
431  if (ieta >= 32)
432  iEta = 999;
433  if (ieta == -1)
434  iEta = 1;
435  if (iphi == 1)
436  iPhi = 72;
437 
438  return std::pair<int, int>(iEta, iPhi);
439 }
std::pair< int, int > FastL1RegionMap::GetTowerSouthEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 349 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

350 {
351  if (iphi > 1)
352  return std::pair<int, int>(ieta, iphi-1);
353  else
354  return std::pair<int, int>(ieta, 72);
355 }
std::pair< int, int > FastL1RegionMap::GetTowerSWEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 412 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

413 {
414  int iEta = ieta - 1;
415  int iPhi = iphi - 1;
416  if (ieta <= -32)
417  iEta = 999;
418  if (ieta == 1)
419  iEta = -1;
420  if (iphi == 1)
421  iPhi = 72;
422 
423  return std::pair<int, int>(iEta, iPhi);
424 }
std::pair< int, int > FastL1RegionMap::GetTowerWestEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 358 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

359 {
360  if (ieta == 1) return std::pair<int, int>(-1, iphi);
361 
362  if (ieta > -32)
363  return std::pair<int, int>(ieta-1, iphi);
364  else
365  return std::pair<int, int>(999, iphi);
366 }

Member Data Documentation

int FastL1RegionMap::nRegion
private

Definition at line 91 of file FastL1RegionMap.h.

Referenced by FastL1RegionMap(), and getNRegion().

int FastL1RegionMap::nTower
private

Definition at line 90 of file FastL1RegionMap.h.

Referenced by FastL1RegionMap(), and getNTower().

FastL1RegionMap * FastL1RegionMap::theInstance = 0
staticprivate

Definition at line 88 of file FastL1RegionMap.h.

Referenced by getFastL1RegionMap().