CMS 3D CMS Logo

Public Member Functions | Private Attributes

ESElectronicsMapper Class Reference

#include <ESElectronicsMapper.h>

List of all members.

Public Member Functions

 ESElectronicsMapper (const edm::ParameterSet &ps)
int getFED (int zside, int plane, int x, int y)
int getFED (const ESDetId &id)
int getKCHIP (int zside, int plane, int x, int y)
int getKCHIP (const ESDetId &id)
void GetListofFEDs (std::vector< int > eeFEDs, std::vector< int > &esFEDs) const
std::vector< int > GetListofFEDs (const std::vector< int > eeFEDs) const
 ~ESElectronicsMapper ()

Private Attributes

std::map< int, std::vector< int > > ee_es_map_
int fed_ [2][2][40][40]
int kchip_ [2][2][40][40]
edm::FileInPath lookup_

Detailed Description

Definition at line 14 of file ESElectronicsMapper.h.


Constructor & Destructor Documentation

ESElectronicsMapper::ESElectronicsMapper ( const edm::ParameterSet ps)

Definition at line 3 of file ESElectronicsMapper.cc.

References gather_cfg::cout, ee_es_map_, fed_, mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), i, j, gen::k, kchip_, lookup_, m, submitDQMOfflineCAF::nLines, and z.

                                                                  {

  lookup_ = ps.getParameter<edm::FileInPath>("LookupTable");

  for (int i=0; i<2; ++i) 
    for (int j=0; j<2; ++j) 
      for (int k=0; k<40; ++k) 
        for (int m=0; m<40; ++m) {
          fed_[i][j][k][m] = -1; 
          kchip_[i][j][k][m] = -1;
        }
  
  // read in look-up table
  int nLines, z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
  std::ifstream file;
  file.open(lookup_.fullPath().c_str());
  if( file.is_open() ) {

    file >> nLines;

    for (int i=0; i<nLines; ++i) {
      file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
      
      if (iz==-1) z = 2;
      else z = iz;
      
      fed_[z-1][ip-1][ix-1][iy-1] = fed;
      kchip_[z-1][ip-1][ix-1][iy-1] = kchip;
    }

  } else {
    std::cout<<"ESElectronicsMapper::ESElectronicsMapper : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<std::endl;
  }
  
  // EE-ES FEDs mapping
  int eefed[18]  = {601, 602, 603, 604, 605, 606, 607, 608, 609, 646, 647, 648, 649, 650, 651, 652, 653, 654};
  int nesfed[18] = { 10,   7,   9,  10,   8,  10,   8,  10,   8,  10,   7,   8,   8,   8,   9,   8,  10,  10};
  int esfed[18][10] = {
    {520, 522, 523, 531, 532, 534, 535, 545, 546, 547},
    {520, 522, 523, 534, 535, 546, 547},
    {520, 522, 523, 524, 525, 534, 535, 537, 539},
    {520, 522, 523, 524, 525, 534, 535, 537, 539, 540},
    {522, 523, 524, 525, 535, 537, 539, 540},
    {524, 525, 528, 529, 530, 537, 539, 540, 541, 542},
    {528, 529, 530, 531, 532, 541, 542, 545},
    {528, 529, 530, 531, 532, 541, 542, 545, 546, 547},
    {529, 530, 531, 532, 542, 545, 546, 547},
    {548, 549, 551, 560, 561, 563, 564, 572, 573, 574},
    {548, 549, 560, 561, 563, 564, 574},
    {548, 549, 551, 553, 563, 564, 565, 566},
    {551, 553, 554, 563, 564, 565, 566, 568},
    {553, 554, 555, 556, 565, 566, 568, 570},
    {553, 554, 555, 556, 565, 566, 568, 570, 571},
    {553, 554, 555, 556, 557, 568, 570, 571},
    {555, 556, 557, 560, 561, 570, 571, 572, 573, 574},
    {548, 549, 557, 560, 561, 570, 571, 572, 573, 574}
  };

  for (int i=0; i<18; ++i) { // loop over EE feds
    std::vector<int> esFeds;
    for(int esFed=0; esFed<nesfed[i]; esFed++) esFeds.push_back(esfed[i][esFed]);
    ee_es_map_.insert( make_pair(eefed[i],esFeds));
  }
  
}
ESElectronicsMapper::~ESElectronicsMapper ( ) [inline]

Definition at line 19 of file ESElectronicsMapper.h.

{};

Member Function Documentation

int ESElectronicsMapper::getFED ( const ESDetId id)

Definition at line 69 of file ESElectronicsMapper.cc.

References fed_.

                                                 { 

  int zside;
  if (id.zside()<0) zside = 2;
  else zside = id.zside();

  return fed_[zside-1][id.plane()-1][id.six()-1][id.siy()-1]; 
} 
int ESElectronicsMapper::getFED ( int  zside,
int  plane,
int  x,
int  y 
)

Definition at line 78 of file ESElectronicsMapper.cc.

References fed_.

                                                                  { 

  return fed_[zside-1][plane-1][x-1][y-1]; 
} 
int ESElectronicsMapper::getKCHIP ( const ESDetId id)

Definition at line 106 of file ESElectronicsMapper.cc.

References kchip_.

                                                   { 

  int zside;
  if (id.zside()<0) zside = 2;
  else zside = id.zside();

  return kchip_[zside-1][id.plane()-1][id.six()-1][id.siy()-1]; 
} 
int ESElectronicsMapper::getKCHIP ( int  zside,
int  plane,
int  x,
int  y 
)

Definition at line 115 of file ESElectronicsMapper.cc.

References kchip_.

                                                                    { 

  return kchip_[zside-1][plane-1][x-1][y-1]; 
} 
void ESElectronicsMapper::GetListofFEDs ( std::vector< int >  eeFEDs,
std::vector< int > &  esFEDs 
) const

Definition at line 89 of file ESElectronicsMapper.cc.

References ee_es_map_, i, j, and python::multivaluedict::sort().

                                                                                            {

  for (unsigned int i=0; i<eeFEDs.size(); ++i) {
    std::map< int, std::vector<int> >::const_iterator itr = ee_es_map_.find(eeFEDs[i]);
    if(itr == ee_es_map_.end()) continue; 
    std::vector<int> fed = itr->second;
    for (unsigned int j=0; j<fed.size(); ++j) {
      esFEDs.push_back(fed[j]);
    }
  }
  
  sort(esFEDs.begin(), esFEDs.end());
  std::vector<int>::iterator it = unique(esFEDs.begin(), esFEDs.end());
  esFEDs.erase(it, esFEDs.end());

}
std::vector< int > ESElectronicsMapper::GetListofFEDs ( const std::vector< int >  eeFEDs) const

Definition at line 83 of file ESElectronicsMapper.cc.

Referenced by EcalRawToRecHitRoI::produce().

                                                                                   {
  std::vector<int> esFEDs;
  GetListofFEDs(eeFEDs, esFEDs);
  return esFEDs;
}

Member Data Documentation

std::map< int, std::vector<int> > ESElectronicsMapper::ee_es_map_ [private]

Definition at line 34 of file ESElectronicsMapper.h.

Referenced by ESElectronicsMapper(), and GetListofFEDs().

int ESElectronicsMapper::fed_[2][2][40][40] [private]

Definition at line 32 of file ESElectronicsMapper.h.

Referenced by ESElectronicsMapper(), and getFED().

int ESElectronicsMapper::kchip_[2][2][40][40] [private]

Definition at line 33 of file ESElectronicsMapper.h.

Referenced by ESElectronicsMapper(), and getKCHIP().

Definition at line 30 of file ESElectronicsMapper.h.

Referenced by ESElectronicsMapper().