CMS 3D CMS Logo

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::ESElectronicsMapper ( const edm::ParameterSet ps)

Definition at line 4 of file ESElectronicsMapper.cc.

References ee_es_map_, fed_, geometryDiff::file, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, kchip_, lookup_, visualization-live-secondInstance_cfg::m, submitDQMOfflineCAF::nLines, and z.

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  file >> nLines;
21 
22  for (int i = 0; i < nLines; ++i) {
23  file >> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
24 
25  if (iz == -1)
26  z = 2;
27  else
28  z = iz;
29 
30  fed_[z - 1][ip - 1][ix - 1][iy - 1] = fed;
31  kchip_[z - 1][ip - 1][ix - 1][iy - 1] = kchip;
32  }
33 
34  } else {
35  edm::LogVerbatim("EcalMapping")
36  << "ESElectronicsMapper::ESElectronicsMapper : Look up table file can not be found in "
37  << lookup_.fullPath().c_str();
38  }
39 
40  // EE-ES FEDs mapping
41  int eefed[18] = {601, 602, 603, 604, 605, 606, 607, 608, 609, 646, 647, 648, 649, 650, 651, 652, 653, 654};
42  int nesfed[18] = {10, 7, 9, 10, 8, 10, 8, 10, 8, 10, 7, 8, 8, 8, 9, 8, 10, 10};
43  int esfed[18][10] = {{520, 522, 523, 531, 532, 534, 535, 545, 546, 547},
44  {520, 522, 523, 534, 535, 546, 547},
45  {520, 522, 523, 524, 525, 534, 535, 537, 539},
46  {520, 522, 523, 524, 525, 534, 535, 537, 539, 540},
47  {522, 523, 524, 525, 535, 537, 539, 540},
48  {524, 525, 528, 529, 530, 537, 539, 540, 541, 542},
49  {528, 529, 530, 531, 532, 541, 542, 545},
50  {528, 529, 530, 531, 532, 541, 542, 545, 546, 547},
51  {529, 530, 531, 532, 542, 545, 546, 547},
52  {548, 549, 551, 560, 561, 563, 564, 572, 573, 574},
53  {548, 549, 560, 561, 563, 564, 574},
54  {548, 549, 551, 553, 563, 564, 565, 566},
55  {551, 553, 554, 563, 564, 565, 566, 568},
56  {553, 554, 555, 556, 565, 566, 568, 570},
57  {553, 554, 555, 556, 565, 566, 568, 570, 571},
58  {553, 554, 555, 556, 557, 568, 570, 571},
59  {555, 556, 557, 560, 561, 570, 571, 572, 573, 574},
60  {548, 549, 557, 560, 561, 570, 571, 572, 573, 574}};
61 
62  for (int i = 0; i < 18; ++i) { // loop over EE feds
63  std::vector<int> esFeds;
64  esFeds.reserve(nesfed[i]);
65  for (int esFed = 0; esFed < nesfed[i]; esFed++)
66  esFeds.emplace_back(esfed[i][esFed]);
67  ee_es_map_.insert(make_pair(eefed[i], esFeds));
68  }
69 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string fullPath() const
Definition: FileInPath.cc:161
int fed_[2][2][40][40]
int kchip_[2][2][40][40]
edm::FileInPath lookup_
std::map< int, std::vector< int > > ee_es_map_

◆ ~ESElectronicsMapper()

ESElectronicsMapper::~ESElectronicsMapper ( )
inline

Definition at line 17 of file ESElectronicsMapper.h.

17 {};

Member Function Documentation

◆ getFED() [1/2]

int ESElectronicsMapper::getFED ( const ESDetId id)

Definition at line 71 of file ESElectronicsMapper.cc.

References fed_, and ecaldqm::zside().

71  {
72  int zside;
73  if (id.zside() < 0)
74  zside = 2;
75  else
76  zside = id.zside();
77 
78  return fed_[zside - 1][id.plane() - 1][id.six() - 1][id.siy() - 1];
79 }
int zside(DetId const &)
int fed_[2][2][40][40]

◆ getFED() [2/2]

int ESElectronicsMapper::getFED ( int  zside,
int  plane,
int  x,
int  y 
)

Definition at line 81 of file ESElectronicsMapper.cc.

References fed_, x, y, and ecaldqm::zside().

81 { return fed_[zside - 1][plane - 1][x - 1][y - 1]; }
int zside(DetId const &)
int fed_[2][2][40][40]

◆ getKCHIP() [1/2]

int ESElectronicsMapper::getKCHIP ( const ESDetId id)

Definition at line 105 of file ESElectronicsMapper.cc.

References kchip_, and ecaldqm::zside().

105  {
106  int zside;
107  if (id.zside() < 0)
108  zside = 2;
109  else
110  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]

◆ getKCHIP() [2/2]

int ESElectronicsMapper::getKCHIP ( int  zside,
int  plane,
int  x,
int  y 
)

Definition at line 115 of file ESElectronicsMapper.cc.

References kchip_, x, y, and ecaldqm::zside().

115  {
116  return kchip_[zside - 1][plane - 1][x - 1][y - 1];
117 }
int zside(DetId const &)
int kchip_[2][2][40][40]

◆ GetListofFEDs() [1/2]

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

◆ GetListofFEDs() [2/2]

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_, dqmiolumiharvest::j, jetUpdater_cfi::sort, and tier0::unique().

89  {
90  for (int eeFED : eeFEDs) {
91  std::map<int, std::vector<int> >::const_iterator itr = ee_es_map_.find(eeFED);
92  if (itr == ee_es_map_.end())
93  continue;
94  std::vector<int> fed = itr->second;
95  for (int j : fed) {
96  esFEDs.emplace_back(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 }
def unique(seq, keepstr=True)
Definition: tier0.py:24
std::map< int, std::vector< int > > ee_es_map_

Member Data Documentation

◆ ee_es_map_

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

Definition at line 31 of file ESElectronicsMapper.h.

Referenced by ESElectronicsMapper(), and GetListofFEDs().

◆ fed_

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

Definition at line 29 of file ESElectronicsMapper.h.

Referenced by ESElectronicsMapper(), and getFED().

◆ kchip_

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

Definition at line 30 of file ESElectronicsMapper.h.

Referenced by ESElectronicsMapper(), and getKCHIP().

◆ lookup_

edm::FileInPath ESElectronicsMapper::lookup_
private

Definition at line 27 of file ESElectronicsMapper.h.

Referenced by ESElectronicsMapper().