CMS 3D CMS Logo

FastL1RegionMap Class Reference

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

#include <FastSimulation/L1CaloTriggerProducer/interface/FastL1RegionMap.h>

List of all members.

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, intgetRegionEtaPhiIndex (int regionId)
std::pair< int, intgetRegionEtaPhiIndex (CaloTowerDetId towerId)
std::pair< int, intgetRegionEtaPhiIndex (std::pair< int, int > iEtaPhi)
int getRegionIndex (CaloTowerDetId tower)
int getRegionIndex (int ieta, int iphi)
int getRegionTowerIndex (CaloTowerDetId towerId)
int getRegionTowerIndex (int ieta, int iphi)
int getRegionTowerIndex (std::pair< int, int > iEtaPhi)
std::pair< int, intGetTowerEastEtaPhi (int ieta, int iphi)
std::pair< int, intGetTowerNEEtaPhi (int ieta, int iphi)
std::pair< int, intGetTowerNorthEtaPhi (int ieta, int iphi)
std::pair< int, intGetTowerNWEtaPhi (int ieta, int iphi)
std::pair< int, intGetTowerSEEtaPhi (int ieta, int iphi)
std::pair< int, intGetTowerSouthEtaPhi (int ieta, int iphi)
std::pair< int, intGetTowerSWEtaPhi (int ieta, int iphi)
std::pair< int, intGetTowerWestEtaPhi (int ieta, int iphi)
 ~FastL1RegionMap ()

Static Public Member Functions

static FastL1RegionMapgetL1RegionMap ()

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 22 of file FastL1RegionMap.cc.

References nRegion, and nTower.

Referenced by getL1RegionMap().

00023 {
00024   nTower = 4608;
00025   nRegion = 396;
00026 
00027 }

FastL1RegionMap::~FastL1RegionMap (  ) 


Member Function Documentation

int FastL1RegionMap::convertFromECal_to_HCal_iphi ( int  iphi_ecal  ) 

Definition at line 312 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::checkMapping().

00313 {
00314   int iphi = 999;
00315   if (iphi_ecal>=3)
00316     iphi = iphi_ecal - 2;
00317   else if (iphi_ecal==1 || iphi_ecal==2)
00318     iphi = 70 + iphi_ecal;
00319  
00320   return iphi; 
00321 }

int FastL1RegionMap::convertFromHCal_to_ECal_iphi ( int  iphi_hcal  ) 

Definition at line 327 of file FastL1RegionMap.cc.

00328 {
00329   int iphi = 999;
00330   if (iphi_hcal>=1 && iphi_hcal<=70)
00331     iphi = iphi_hcal + 2;
00332   else if (iphi_hcal==71 || iphi_hcal==72)
00333     iphi = iphi_hcal - 70;
00334  
00335   return iphi; 
00336 }

void FastL1RegionMap::display (  ) 

Definition at line 231 of file FastL1RegionMap.cc.

References TestMuL1L2Filter_cff::cerr, and lat::endl().

00231                          {
00232   // Region IDs
00233   for (int iRgn=0; iRgn<396; iRgn++) {
00234     if (iRgn%22 == 0) std::cerr << std::endl;   
00235     std::cerr << iRgn << " ";
00236   }
00237 
00238   for (int iRgn=0; iRgn<396; iRgn++) {
00239     if (iRgn%22 == 0) std::cerr << std::endl;   
00240     //std::pair<int, int> pep = m_Regions[iRgn].SetEtaPhiIndex();
00241     for (int iTwr=0; iTwr<16; iTwr++) {
00242       
00243       if (iTwr%4 == 0) std::cerr << " | ";   
00244       std::cerr << iRgn << " ";
00245     }
00246   }
00247   
00248 }

FastL1RegionMap * FastL1RegionMap::getL1RegionMap (  )  [static]

Definition at line 32 of file FastL1RegionMap.cc.

References FastL1RegionMap(), and theInstance.

Referenced by FastL1GlobalAlgo::FastL1GlobalAlgo().

00033 {
00034   if(theInstance == 0)
00035     {
00036       theInstance = new FastL1RegionMap();
00037     }
00038   return theInstance;
00039 }

int FastL1RegionMap::getNRegion (  )  [inline]

Definition at line 69 of file FastL1RegionMap.h.

References nRegion.

00069 { return nRegion; };

int FastL1RegionMap::getNTower (  )  [inline]

Definition at line 68 of file FastL1RegionMap.h.

References nTower.

00068 { return nTower; };

std::pair< double, double > FastL1RegionMap::getRegionCenterEtaPhi ( int  iRgn  ) 

Definition at line 251 of file FastL1RegionMap.cc.

References eta, getRegionEtaPhiIndex(), and phi.

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

00252 {
00253 
00254   std::pair<int, int> ep = getRegionEtaPhiIndex(iRgn);
00255 
00256   // this only true for barrel + endcap!
00257   double eta = 999.;  
00258   double phi = 999.;  
00259 
00260   // phi
00261   if (ep.second <= 9) {
00262     //phi = ep.second * 0.349065 + 0.1745329; // 10 degrees
00263     phi = ep.second * 0.349065 ;
00264     //phi = ep.second * 0.3490658504 + 0.1745329252; // 10 degrees
00265   } else {
00266     //phi = (18-ep.second)  * (-0.349065)  + 0.1745329; // -10 degrees
00267     phi = (18-ep.second)  * (-0.349065);
00268   }
00269   // eta
00270   if (ep.first >= 11 && ep.first <= 15 )
00271     eta = (ep.first-11)*0.349 + 0.1745;
00272     //eta = (ep.first-11)*0.3490658504 + 0.1745329252;
00273   if (ep.first == 16 )
00274     eta = 1.956;
00275   if (ep.first == 17 )
00276     eta = 2.586;
00277   if (ep.first == 18 )
00278     eta = 3.25;
00279   if (ep.first == 19 )
00280     eta = 3.75;
00281   if (ep.first == 20 )
00282     eta = 4.25;
00283   if (ep.first == 21 )
00284     eta = 4.75;
00285 
00286   if (ep.first >= 6 && ep.first <= 10 )
00287     eta = (10-ep.first)*(-0.348) - 0.174;
00288   if (ep.first == 5 )
00289     eta = -1.956;
00290   if (ep.first == 4 )
00291     eta = -2.586;
00292   if (ep.first == 3 )
00293     eta = -3.25;
00294   if (ep.first == 2 )
00295     eta = -3.75;
00296   if (ep.first == 1 )
00297     eta = -4.25;
00298   if (ep.first == 0 )
00299     eta = -4.75;
00300 
00301   //std::cout << "eta, phi ID: "<< ep.first << ", " << ep.second << std::endl;
00302   //std::cout << "eta, phi: "<< eta << ", " << phi << std::endl;
00303  
00304 
00305   return std::pair<double, double>(eta, phi);
00306 }

std::pair< int, int > FastL1RegionMap::getRegionEtaPhiIndex ( int  regionId  ) 

Definition at line 203 of file FastL1RegionMap.cc.

00204 {
00205   int ieta = regionId%22;  
00206   int iphi = regionId/22;
00207 
00208   return std::pair<int, int>(ieta, iphi);
00209 }

std::pair< int, int > FastL1RegionMap::getRegionEtaPhiIndex ( CaloTowerDetId  towerId  ) 

Definition at line 43 of file FastL1RegionMap.cc.

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

00044 {
00045 
00046   return FastL1RegionMap::getRegionEtaPhiIndex(std::pair<int, int>(tower.ieta(), tower.iphi()));
00047 }

std::pair< int, int > FastL1RegionMap::getRegionEtaPhiIndex ( std::pair< int, int iEtaPhi  ) 

Definition at line 61 of file FastL1RegionMap.cc.

References funct::abs().

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

00062 {
00064   // barrel: 2x(17x72) [eta,phi] -> 2x1224 (etaid: +/- 1-17  phiid: 1-72)
00065   // endcap: 2x(11x72) [eta,phi] -> 2x792  (etaid: +/- 18-28 phiid: 1-72)
00066   // forward: 2x(4x18) [eta,phi] -> 2x72   (etaid: +/- 29-32 phiid: 1-18)
00068   // barrel:  2x(20x72) [eta,phi] -> 2x1440 (etaid: +/- 1-20  phiid: 1-72)
00069   // endcap:  2x(18x36) [eta,phi] -> 2x648  (etaid: +/- 21-38 phiid: 1-36)
00070   // forward: 2x(3x18)  [eta,phi] -> 2x54   (etaid: +/- 40-41 phiid: 1-18)
00072   // barrel: 2x(20x72) [eta,phi] -> 2x1440 (etaid: +/- 1-20  phiid: 1-72 interv: 1)
00073   // endcap: 2x(19x36) [eta,phi] -> 2x684  (etaid: +/- 21-39 phiid: 1-72 interv: 2)
00074   // forward: 2x(2x18) [eta,phi] -> 2x36   (etaid: +/- 40-41 phiid: 1-72 interv: 4)
00076   // barrel: 2x(20x72) [eta,phi] -> 2x1440 (etaid: +/- 1-20  phiid: 1-72 interv: 1)
00077   // endcap: 2x(18x36) [eta,phi] -> 2x684  (etaid: +/- 21-28 phiid: 1-72 interv: 2)
00078   // forward: 2x(2x18) [eta,phi] -> 2x36   (etaid: +/- 29-32 phiid: 1-72 interv: 4)
00079 
00080   int iTwrEta = EtaPhi.first;
00081   int iTwrPhi = EtaPhi.second;
00082 
00083   //iTwrPhi = convertFromECal_to_HCal_iphi(iTwrPhi);
00084 
00085   int iphi=999; // 0-17 
00086   int ieta=999; // 0-21 (barrel: 6-15, endcap: 4,5,16,17, HF: 0-3,18-21??)
00087 
00088   // Right now: only barrel/endcap parts work!!!
00089   if (abs(iTwrEta)<=28) {
00090 
00091     //int isub; // 0-15 4x4 region matrix 
00092     
00093     iphi = ((iTwrPhi + 1) / 4) % 18;
00094     
00095     if (iTwrEta > 0) {
00096       ieta = (iTwrEta - 1) / 4  + 11;
00097     } else {
00098       ieta = (iTwrEta + 1) / 4  + 10;
00099     }
00100   }
00101 
00102   // Test HF!!!
00103   if (abs(iTwrEta)>=29 && abs(iTwrEta)<=32) {
00104     iphi = ((iTwrPhi + 1) / 4) % 18;
00105 
00106     if (iTwrEta == 29) {
00107       ieta = 18;
00108     } 
00109 
00110     if (iTwrEta == 30) {
00111       ieta = 19;
00112     } 
00113 
00114     if (iTwrEta == 31) {
00115       ieta = 20;
00116     } 
00117 
00118     if (iTwrEta == 32) {
00119       ieta = 21;
00120     } 
00121 
00122     if (iTwrEta == -29) {
00123       ieta = 3;
00124     } 
00125 
00126     if (iTwrEta == -30) {
00127       ieta = 2;
00128     } 
00129 
00130     if (iTwrEta == -31) {
00131       ieta = 1;
00132     } 
00133 
00134     if (iTwrEta == -32) {
00135       ieta = 0;
00136     } 
00137 
00138     /*
00139     if (iTwrEta >= 29 && iTwrEta <= 32) {
00140       ieta = 18;
00141     } 
00142     if (iTwrEta >= 33 && iTwrEta <= 35) {
00143       ieta = 19;
00144     } 
00145     if (iTwrEta >= 36 && iTwrEta <= 38) {
00146       ieta = 20;
00147     } 
00148     if (iTwrEta >= 39 && iTwrEta <= 41) {
00149       ieta = 21;
00150     } 
00151 
00152     if (iTwrEta <= -29 && iTwrEta >= -32) {
00153       ieta = 3;
00154     } 
00155     if (iTwrEta <= -33 && iTwrEta >= -35) {
00156       ieta = 2;
00157     } 
00158     if (iTwrEta <= -36 && iTwrEta >= -38) {
00159       ieta = 1;
00160     } 
00161     if (iTwrEta <= -39 && iTwrEta >= -41) {
00162       ieta = 0;
00163     } 
00164     */
00165   }
00166 
00167   return std::pair<int, int>(ieta, iphi);
00168 }

int FastL1RegionMap::getRegionIndex ( CaloTowerDetId  tower  ) 

Definition at line 224 of file FastL1RegionMap.cc.

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

00225 {
00226   return getRegionIndex(tower.ieta(), tower.iphi());
00227 }

int FastL1RegionMap::getRegionIndex ( int  ieta,
int  iphi 
)

Definition at line 212 of file FastL1RegionMap.cc.

References getRegionEtaPhiIndex().

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

00213 {
00214 
00215   std::pair<int, int> ietaphi(ieta,iphi);
00216   std::pair<int, int> iep = getRegionEtaPhiIndex(ietaphi);
00217 
00218   int rgnid = iep.second*22 + iep.first;
00219 
00220   return rgnid;
00221 }

int FastL1RegionMap::getRegionTowerIndex ( CaloTowerDetId  towerId  ) 

Definition at line 51 of file FastL1RegionMap.cc.

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

00052 {
00053   return FastL1RegionMap::getRegionTowerIndex(std::pair<int, int>(tower.ieta(), tower.iphi()));
00054 }

int FastL1RegionMap::getRegionTowerIndex ( int  ieta,
int  iphi 
)

Definition at line 197 of file FastL1RegionMap.cc.

References getRegionTowerIndex().

00198 {
00199   return FastL1RegionMap::getRegionTowerIndex(std::pair<int, int>(iEta,iPhi));
00200 }

int FastL1RegionMap::getRegionTowerIndex ( std::pair< int, int iEtaPhi  ) 

Definition at line 174 of file FastL1RegionMap.cc.

References funct::abs().

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

00175 {
00176   int iTwrEta = EtaPhi.first;
00177   int iTwrPhi = EtaPhi.second;
00178 
00179   //iTwrPhi = convertFromECal_to_HCal_iphi(iTwrPhi);
00180 
00181   // Right now: only barrel/encap part!!!
00182   int isub = 999; // 0-15 4x4 region matrix 
00183 
00184   if (abs(iTwrEta)<=41) {
00185     //if (abs(iTwrEta)<=28) {
00186     if (iTwrEta > 0) {
00187       isub = 4*(3 - (iTwrPhi + 1) %4) + ((iTwrEta  - 1)  % 4) ;
00188     } else {
00189       isub = 4*(3 - (iTwrPhi + 1) %4) + (3 + (iTwrEta+1)%4) ;
00190     }
00191   }
00192 
00193   return isub;
00194 }

std::pair< int, int > FastL1RegionMap::GetTowerEastEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 368 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

00369 { 
00370   if (ieta == -1) return std::pair<int, int>(1, iphi);
00371 
00372   if (ieta < 32) 
00373     return std::pair<int, int>(ieta+1, iphi); 
00374   else 
00375     return std::pair<int, int>(999, iphi); 
00376 }

std::pair< int, int > FastL1RegionMap::GetTowerNEEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 394 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

00395 { 
00396   int iEta = ieta + 1;
00397   int iPhi = iphi + 1;
00398   if (ieta >= 32) 
00399     iEta = 999;
00400   if (ieta == -1) 
00401     iEta = 1;
00402   if (iphi == 72) 
00403     iPhi = 1;
00404 
00405   return std::pair<int, int>(iEta, iPhi); 
00406 }

std::pair< int, int > FastL1RegionMap::GetTowerNorthEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 339 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

00340 { 
00341   if (iphi < 72) 
00342     return std::pair<int, int>(ieta, iphi+1); 
00343   else 
00344     return std::pair<int, int>(ieta, 1); 
00345 }

std::pair< int, int > FastL1RegionMap::GetTowerNWEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 379 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

00380 { 
00381   int iEta = ieta - 1;
00382   int iPhi = iphi + 1;
00383   if (ieta <= -32) 
00384     iEta = 999;
00385   if (ieta == 1) 
00386     iEta = -1;
00387   if (iphi == 72) 
00388     iPhi = 1;
00389 
00390   return std::pair<int, int>(iEta, iPhi); 
00391 }

std::pair< int, int > FastL1RegionMap::GetTowerSEEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 426 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

00427 { 
00428   int iEta = ieta + 1;
00429   int iPhi = iphi - 1;
00430   if (ieta >= 32) 
00431     iEta = 999;
00432   if (ieta == -1) 
00433     iEta = 1;
00434   if (iphi == 1) 
00435     iPhi = 72;
00436 
00437   return std::pair<int, int>(iEta, iPhi); 
00438 }

std::pair< int, int > FastL1RegionMap::GetTowerSouthEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 348 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

00349 { 
00350   if (iphi > 1) 
00351     return std::pair<int, int>(ieta, iphi-1); 
00352   else 
00353     return std::pair<int, int>(ieta, 72); 
00354 }

std::pair< int, int > FastL1RegionMap::GetTowerSWEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 411 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

00412 { 
00413   int iEta = ieta - 1;
00414   int iPhi = iphi - 1;
00415   if (ieta <= -32) 
00416     iEta = 999;
00417   if (ieta == 1) 
00418     iEta = -1;
00419   if (iphi == 1) 
00420     iPhi = 72;
00421 
00422   return std::pair<int, int>(iEta, iPhi); 
00423 }

std::pair< int, int > FastL1RegionMap::GetTowerWestEtaPhi ( int  ieta,
int  iphi 
)

Definition at line 357 of file FastL1RegionMap.cc.

Referenced by FastL1GlobalAlgo::isEMCand().

00358 { 
00359   if (ieta == 1) return std::pair<int, int>(-1, iphi);
00360 
00361   if (ieta > -32) 
00362     return std::pair<int, int>(ieta-1, iphi); 
00363   else 
00364     return std::pair<int, int>(999, iphi); 
00365 }


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 [static, private]

Definition at line 88 of file FastL1RegionMap.h.

Referenced by getL1RegionMap().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:43 2009 for CMSSW by  doxygen 1.5.4