CMS 3D CMS Logo

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

#include <ESElectronicsMapper.h>

Public Member Functions

 ESElectronicsMapper (const edm::ParameterSet &ps)
 
int getFED (const ESDetId &id)
 
int getFED (int zside, int plane, int x, int y)
 
int getKCHIP (const ESDetId &id)
 
int getKCHIP (int zside, int plane, int x, int y)
 
std::vector< int > GetListofFEDs (const std::vector< int > &eeFEDs) const
 
void GetListofFEDs (const std::vector< int > &eeFEDs, std::vector< int > &esFEDs) 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, relval_steps::k, kchip_, lookup_, visualization-live-secondInstance_cfg::m, submitDQMOfflineCAF::nLines, and detailsBasic3DVector::z.

3  {
4 
5  lookup_ = ps.getParameter<edm::FileInPath>("LookupTable");
6 
7  for (int i=0; i<2; ++i)
8  for (int j=0; j<2; ++j)
9  for (int k=0; k<40; ++k)
10  for (int m=0; m<40; ++m) {
11  fed_[i][j][k][m] = -1;
12  kchip_[i][j][k][m] = -1;
13  }
14 
15  // read in look-up table
16  int nLines, z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
17  std::ifstream file;
18  file.open(lookup_.fullPath().c_str());
19  if( file.is_open() ) {
20 
21  file >> nLines;
22 
23  for (int i=0; i<nLines; ++i) {
24  file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
25 
26  if (iz==-1) z = 2;
27  else z = iz;
28 
29  fed_[z-1][ip-1][ix-1][iy-1] = fed;
30  kchip_[z-1][ip-1][ix-1][iy-1] = kchip;
31  }
32 
33  } else {
34  std::cout<<"ESElectronicsMapper::ESElectronicsMapper : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<std::endl;
35  }
36 
37  // EE-ES FEDs mapping
38  int eefed[18] = {601, 602, 603, 604, 605, 606, 607, 608, 609, 646, 647, 648, 649, 650, 651, 652, 653, 654};
39  int nesfed[18] = { 10, 7, 9, 10, 8, 10, 8, 10, 8, 10, 7, 8, 8, 8, 9, 8, 10, 10};
40  int esfed[18][10] = {
41  {520, 522, 523, 531, 532, 534, 535, 545, 546, 547},
42  {520, 522, 523, 534, 535, 546, 547},
43  {520, 522, 523, 524, 525, 534, 535, 537, 539},
44  {520, 522, 523, 524, 525, 534, 535, 537, 539, 540},
45  {522, 523, 524, 525, 535, 537, 539, 540},
46  {524, 525, 528, 529, 530, 537, 539, 540, 541, 542},
47  {528, 529, 530, 531, 532, 541, 542, 545},
48  {528, 529, 530, 531, 532, 541, 542, 545, 546, 547},
49  {529, 530, 531, 532, 542, 545, 546, 547},
50  {548, 549, 551, 560, 561, 563, 564, 572, 573, 574},
51  {548, 549, 560, 561, 563, 564, 574},
52  {548, 549, 551, 553, 563, 564, 565, 566},
53  {551, 553, 554, 563, 564, 565, 566, 568},
54  {553, 554, 555, 556, 565, 566, 568, 570},
55  {553, 554, 555, 556, 565, 566, 568, 570, 571},
56  {553, 554, 555, 556, 557, 568, 570, 571},
57  {555, 556, 557, 560, 561, 570, 571, 572, 573, 574},
58  {548, 549, 557, 560, 561, 570, 571, 572, 573, 574}
59  };
60 
61  for (int i=0; i<18; ++i) { // loop over EE feds
62  std::vector<int> esFeds;
63  for(int esFed=0; esFed<nesfed[i]; esFed++) esFeds.push_back(esfed[i][esFed]);
64  ee_es_map_.insert( make_pair(eefed[i],esFeds));
65  }
66 
67 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::map< int, std::vector< int > > ee_es_map_
float float float z
int fed_[2][2][40][40]
int j
Definition: DBlmapReader.cc:9
int kchip_[2][2][40][40]
edm::FileInPath lookup_
tuple cout
Definition: gather_cfg.py:121
std::string fullPath() const
Definition: FileInPath.cc:165
ESElectronicsMapper::~ESElectronicsMapper ( )
inline

Definition at line 19 of file ESElectronicsMapper.h.

19 {};

Member Function Documentation

int ESElectronicsMapper::getFED ( const ESDetId id)

Definition at line 69 of file ESElectronicsMapper.cc.

References fed_, and ecaldqm::zside().

69  {
70 
71  int zside;
72  if (id.zside()<0) zside = 2;
73  else zside = id.zside();
74 
75  return fed_[zside-1][id.plane()-1][id.six()-1][id.siy()-1];
76 }
int zside(DetId const &)
int fed_[2][2][40][40]
int ESElectronicsMapper::getFED ( int  zside,
int  plane,
int  x,
int  y 
)

Definition at line 78 of file ESElectronicsMapper.cc.

References fed_.

78  {
79 
80  return fed_[zside-1][plane-1][x-1][y-1];
81 }
int zside(DetId const &)
int fed_[2][2][40][40]
Definition: DDAxes.h:10
int ESElectronicsMapper::getKCHIP ( const ESDetId id)

Definition at line 106 of file ESElectronicsMapper.cc.

References kchip_, and ecaldqm::zside().

106  {
107 
108  int zside;
109  if (id.zside()<0) zside = 2;
110  else zside = id.zside();
111 
112  return kchip_[zside-1][id.plane()-1][id.six()-1][id.siy()-1];
113 }
int zside(DetId const &)
int kchip_[2][2][40][40]
int ESElectronicsMapper::getKCHIP ( int  zside,
int  plane,
int  x,
int  y 
)

Definition at line 115 of file ESElectronicsMapper.cc.

References kchip_.

115  {
116 
117  return kchip_[zside-1][plane-1][x-1][y-1];
118 }
int zside(DetId const &)
int kchip_[2][2][40][40]
Definition: DDAxes.h:10
std::vector< int > ESElectronicsMapper::GetListofFEDs ( const std::vector< int > &  eeFEDs) const

Definition at line 83 of file ESElectronicsMapper.cc.

83  {
84  std::vector<int> esFEDs;
85  GetListofFEDs(eeFEDs, esFEDs);
86  return esFEDs;
87 }
std::vector< int > GetListofFEDs(const std::vector< int > &eeFEDs) const
void ESElectronicsMapper::GetListofFEDs ( const 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().

89  {
90 
91  for (unsigned int i=0; i<eeFEDs.size(); ++i) {
92  std::map< int, std::vector<int> >::const_iterator itr = ee_es_map_.find(eeFEDs[i]);
93  if(itr == ee_es_map_.end()) continue;
94  std::vector<int> fed = itr->second;
95  for (unsigned int j=0; j<fed.size(); ++j) {
96  esFEDs.push_back(fed[j]);
97  }
98  }
99 
100  sort(esFEDs.begin(), esFEDs.end());
101  std::vector<int>::iterator it = unique(esFEDs.begin(), esFEDs.end());
102  esFEDs.erase(it, esFEDs.end());
103 
104 }
int i
Definition: DBlmapReader.cc:9
std::map< int, std::vector< int > > ee_es_map_
int j
Definition: DBlmapReader.cc:9

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().

edm::FileInPath ESElectronicsMapper::lookup_
private

Definition at line 30 of file ESElectronicsMapper.h.

Referenced by ESElectronicsMapper().