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 3 of file ESElectronicsMapper.cc.

3  {
4  lookup_ = ps.getParameter<edm::FileInPath>("LookupTable");
5 
6  for (int i = 0; i < 2; ++i)
7  for (int j = 0; j < 2; ++j)
8  for (int k = 0; k < 40; ++k)
9  for (int m = 0; m < 40; ++m) {
10  fed_[i][j][k][m] = -1;
11  kchip_[i][j][k][m] = -1;
12  }
13 
14  // read in look-up table
15  int nLines, z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
16  std::ifstream file;
17  file.open(lookup_.fullPath().c_str());
18  if (file.is_open()) {
19  file >> nLines;
20 
21  for (int i = 0; i < nLines; ++i) {
22  file >> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
23 
24  if (iz == -1)
25  z = 2;
26  else
27  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 "
35  << lookup_.fullPath().c_str() << std::endl;
36  }
37 
38  // EE-ES FEDs mapping
39  int eefed[18] = {601, 602, 603, 604, 605, 606, 607, 608, 609, 646, 647, 648, 649, 650, 651, 652, 653, 654};
40  int nesfed[18] = {10, 7, 9, 10, 8, 10, 8, 10, 8, 10, 7, 8, 8, 8, 9, 8, 10, 10};
41  int esfed[18][10] = {{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  for (int i = 0; i < 18; ++i) { // loop over EE feds
61  std::vector<int> esFeds;
62  esFeds.reserve(nesfed[i]);
63  for (int esFed = 0; esFed < nesfed[i]; esFed++)
64  esFeds.emplace_back(esfed[i][esFed]);
65  ee_es_map_.insert(make_pair(eefed[i], esFeds));
66  }
67 }

References gather_cfg::cout, 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.

◆ ~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 69 of file ESElectronicsMapper.cc.

69  {
70  int zside;
71  if (id.zside() < 0)
72  zside = 2;
73  else
74  zside = id.zside();
75 
76  return fed_[zside - 1][id.plane() - 1][id.six() - 1][id.siy() - 1];
77 }

References fed_, and ecaldqm::zside().

◆ getFED() [2/2]

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

Definition at line 79 of file ESElectronicsMapper.cc.

79 { return fed_[zside - 1][plane - 1][x - 1][y - 1]; }

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

◆ getKCHIP() [1/2]

int ESElectronicsMapper::getKCHIP ( const ESDetId id)

Definition at line 103 of file ESElectronicsMapper.cc.

103  {
104  int zside;
105  if (id.zside() < 0)
106  zside = 2;
107  else
108  zside = id.zside();
109 
110  return kchip_[zside - 1][id.plane() - 1][id.six() - 1][id.siy() - 1];
111 }

References kchip_, and ecaldqm::zside().

◆ getKCHIP() [2/2]

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

Definition at line 113 of file ESElectronicsMapper.cc.

113  {
114  return kchip_[zside - 1][plane - 1][x - 1][y - 1];
115 }

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

◆ GetListofFEDs() [1/2]

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

Definition at line 81 of file ESElectronicsMapper.cc.

81  {
82  std::vector<int> esFEDs;
83  GetListofFEDs(eeFEDs, esFEDs);
84  return esFEDs;
85 }

◆ GetListofFEDs() [2/2]

void ESElectronicsMapper::GetListofFEDs ( const std::vector< int > &  eeFEDs,
std::vector< int > &  esFEDs 
) const

Definition at line 87 of file ESElectronicsMapper.cc.

87  {
88  for (int eeFED : eeFEDs) {
89  std::map<int, std::vector<int> >::const_iterator itr = ee_es_map_.find(eeFED);
90  if (itr == ee_es_map_.end())
91  continue;
92  std::vector<int> fed = itr->second;
93  for (int j : fed) {
94  esFEDs.emplace_back(j);
95  }
96  }
97 
98  sort(esFEDs.begin(), esFEDs.end());
99  std::vector<int>::iterator it = unique(esFEDs.begin(), esFEDs.end());
100  esFEDs.erase(it, esFEDs.end());
101 }

References ee_es_map_, dqmiolumiharvest::j, jetUpdater_cfi::sort, and tier0::unique().

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

DDAxes::y
ESElectronicsMapper::kchip_
int kchip_[2][2][40][40]
Definition: ESElectronicsMapper.h:30
mps_fire.i
i
Definition: mps_fire.py:428
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DDAxes::x
submitDQMOfflineCAF.nLines
nLines
Definition: submitDQMOfflineCAF.py:676
edm::FileInPath
Definition: FileInPath.h:61
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:78
DDAxes::z
dqmdumpme.k
k
Definition: dqmdumpme.py:60
geometryDiff.file
file
Definition: geometryDiff.py:13
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
ESElectronicsMapper::ee_es_map_
std::map< int, std::vector< int > > ee_es_map_
Definition: ESElectronicsMapper.h:31
ESElectronicsMapper::lookup_
edm::FileInPath lookup_
Definition: ESElectronicsMapper.h:27
ESElectronicsMapper::fed_
int fed_[2][2][40][40]
Definition: ESElectronicsMapper.h:29
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ESElectronicsMapper::GetListofFEDs
std::vector< int > GetListofFEDs(const std::vector< int > &eeFEDs) const
Definition: ESElectronicsMapper.cc:81
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161