CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MEChannel Class Reference

#include <MEChannel.h>

Public Member Functions

MEChanneld (unsigned ii)
 
MEChannelgetAncestor (int ig)
 
MEChannelgetChannel (int ix, int iy)
 
MEChannelgetChannel (int ig, int ix, int iy)
 
MEChannelgetDaughter (int ix, int iy, int ig)
 
MEChannelgetDescendant (int ig, int ii)
 
MEChannelgetFirstDescendant (int ig)
 
bool getListOfAncestors (std::vector< MEChannel *> &)
 
bool getListOfChannels (std::vector< MEChannel *> &)
 
bool getListOfDescendants (std::vector< MEChannel *> &)
 
bool getListOfDescendants (int ig, std::vector< MEChannel *> &)
 
int id () const
 
int ig () const
 
int ix () const
 
int iy () const
 
MEChannelm ()
 
 MEChannel (int ix, int iy, int ii, MEChannel *mother)
 
unsigned n () const
 
TString oneLine (int ig)
 
TString oneLine ()
 
TString oneWord (int ig)
 
TString oneWord ()
 
void print (std::ostream &o, bool recursif=false) const
 
virtual ~MEChannel ()
 

Private Member Functions

MEChanneladdDaughter (int ix, int iy, int ii)
 

Private Attributes

std::vector< MEChannel * > _d
 
std::vector< int > _id
 
int _ig
 
int _ix
 
int _iy
 
MEChannel_m
 

Detailed Description

Definition at line 12 of file MEChannel.h.

Constructor & Destructor Documentation

◆ MEChannel()

MEChannel::MEChannel ( int  ix,
int  iy,
int  ii,
MEChannel mother 
)

Definition at line 12 of file MEChannel.cc.

References _id, _ig, _ix, _iy, _m, cuy::ii, ix(), and iy().

Referenced by addDaughter().

12  : _m(mother) {
13  if (_m == nullptr) {
14  _ig = 0;
15  } else {
16  _ig = _m->_ig + 1;
17  }
18  _id.resize(_ig + 1, -1);
19  for (int ii = 0; ii < _ig; ii++) {
20  _id[ii] = _m->_id[ii];
21  }
22  _id[_ig] = id_;
23  _ix = ix;
24  _iy = iy;
25 }
int _ix
Definition: MEChannel.h:56
int ix() const
Definition: MEChannel.h:18
int _ig
Definition: MEChannel.h:53
int _iy
Definition: MEChannel.h:57
ii
Definition: cuy.py:589
int iy() const
Definition: MEChannel.h:19
std::vector< int > _id
Definition: MEChannel.h:60
MEChannel * _m
Definition: MEChannel.h:49

◆ ~MEChannel()

MEChannel::~MEChannel ( )
virtual

Definition at line 27 of file MEChannel.cc.

References _d, and cuy::ii.

27  {
28  for (unsigned ii = 0; ii < _d.size(); ii++) {
29  delete _d[ii];
30  }
31 }
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
ii
Definition: cuy.py:589

Member Function Documentation

◆ addDaughter()

MEChannel * MEChannel::addDaughter ( int  ix,
int  iy,
int  ii 
)
private

Definition at line 42 of file MEChannel.cc.

References _d, d(), ix(), iy(), and MEChannel().

Referenced by getDaughter().

42  {
43  MEChannel* d = new MEChannel(ix, iy, id_, this);
44  _d.push_back(d);
45  return d;
46 }
int ix() const
Definition: MEChannel.h:18
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
int iy() const
Definition: MEChannel.h:19
MEChannel(int ix, int iy, int ii, MEChannel *mother)
Definition: MEChannel.cc:12
MEChannel * d(unsigned ii)
Definition: MEChannel.h:23

◆ d()

MEChannel* MEChannel::d ( unsigned  ii)
inline

Definition at line 23 of file MEChannel.h.

References _d, cuy::ii, and n().

Referenced by addDaughter().

23  {
24  if (ii >= n())
25  return nullptr;
26  return _d[ii];
27  }
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
unsigned n() const
Definition: MEChannel.h:28
ii
Definition: cuy.py:589

◆ getAncestor()

MEChannel * MEChannel::getAncestor ( int  ig)

Definition at line 71 of file MEChannel.cc.

References _ig, g, getAncestor(), and m().

Referenced by getAncestor().

71  {
72  if (_ig == g)
73  return this;
74 
75  MEChannel* mother = this->m();
76  if (mother != nullptr) {
77  if (mother->_ig == g)
78  return mother;
79  return mother->getAncestor(g);
80  }
81 
82  return nullptr;
83 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
int _ig
Definition: MEChannel.h:53
MEChannel * m()
Definition: MEChannel.h:22
MEChannel * getAncestor(int ig)
Definition: MEChannel.cc:71

◆ getChannel() [1/2]

MEChannel * MEChannel::getChannel ( int  ix,
int  iy 
)

Definition at line 136 of file MEChannel.cc.

References _d, _ix, _iy, cuy::ii, ix(), iy(), and n().

Referenced by getChannel().

136  {
137  if (n() == 0) {
138  if (ix == _ix && iy == _iy) {
139  return this;
140  } else
141  return nullptr;
142  }
143  MEChannel* leaf(nullptr);
144  for (unsigned ii = 0; ii < n(); ii++) {
145  leaf = _d[ii]->getChannel(ix, iy);
146  if (leaf != nullptr)
147  break;
148  }
149  return leaf;
150 }
int _ix
Definition: MEChannel.h:56
int ix() const
Definition: MEChannel.h:18
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
unsigned n() const
Definition: MEChannel.h:28
int _iy
Definition: MEChannel.h:57
ii
Definition: cuy.py:589
int iy() const
Definition: MEChannel.h:19

◆ getChannel() [2/2]

MEChannel * MEChannel::getChannel ( int  ig,
int  ix,
int  iy 
)

Definition at line 125 of file MEChannel.cc.

References _ig, _m, cms::cuda::assert(), getChannel(), ig(), ix(), and iy().

125  {
126  assert(ig >= 0);
127  MEChannel* leaf = getChannel(ix, iy);
128  if (leaf == nullptr)
129  return nullptr;
130  while (ig != leaf->_ig) {
131  leaf = leaf->_m;
132  }
133  return leaf;
134 }
MEChannel * getChannel(int ix, int iy)
Definition: MEChannel.cc:136
int ix() const
Definition: MEChannel.h:18
assert(be >=bs)
int _ig
Definition: MEChannel.h:53
int iy() const
Definition: MEChannel.h:19
int ig() const
Definition: MEChannel.h:29
MEChannel * _m
Definition: MEChannel.h:49

◆ getDaughter()

MEChannel * MEChannel::getDaughter ( int  ix,
int  iy,
int  ig 
)

Definition at line 33 of file MEChannel.cc.

References _d, addDaughter(), cuy::ii, ix(), and iy().

Referenced by ME::regTree().

33  {
34  for (unsigned ii = 0; ii < _d.size(); ii++) {
35  if (_d[ii]->id() == id_) {
36  return _d[ii];
37  }
38  }
39  return addDaughter(ix, iy, id_);
40 }
int ix() const
Definition: MEChannel.h:18
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
MEChannel * addDaughter(int ix, int iy, int ii)
Definition: MEChannel.cc:42
ii
Definition: cuy.py:589
int iy() const
Definition: MEChannel.h:19

◆ getDescendant()

MEChannel * MEChannel::getDescendant ( int  ig,
int  ii 
)

Definition at line 103 of file MEChannel.cc.

References getListOfDescendants(), id(), ig(), and cuy::ii.

Referenced by ME::lmrTree().

103  {
104  std::vector<MEChannel*> vec;
105  bool OK = getListOfDescendants(ig, vec);
106  if (!OK)
107  return nullptr;
108  MEChannel* leaf(nullptr);
109  for (unsigned int ii = 0; ii < vec.size(); ii++) {
110  leaf = vec[ii];
111  if (leaf->id() == id_)
112  return leaf;
113  }
114  return leaf;
115 }
ii
Definition: cuy.py:589
std::pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:126
int ig() const
Definition: MEChannel.h:29
bool getListOfDescendants(std::vector< MEChannel *> &)
Definition: MEChannel.cc:85

◆ getFirstDescendant()

MEChannel * MEChannel::getFirstDescendant ( int  ig)

Definition at line 117 of file MEChannel.cc.

References getListOfDescendants(), and ig().

117  {
118  std::vector<MEChannel*> vec;
119  bool OK = getListOfDescendants(ig, vec);
120  if (!OK)
121  return nullptr;
122  return vec[0];
123 }
std::pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:126
int ig() const
Definition: MEChannel.h:29
bool getListOfDescendants(std::vector< MEChannel *> &)
Definition: MEChannel.cc:85

◆ getListOfAncestors()

bool MEChannel::getListOfAncestors ( std::vector< MEChannel *> &  vec)

Definition at line 62 of file MEChannel.cc.

References getListOfAncestors(), and m().

Referenced by getListOfAncestors().

62  {
63  MEChannel* mother = this->m();
64  if (mother != nullptr) {
65  vec.push_back(mother);
66  mother->getListOfAncestors(vec);
67  }
68  return true;
69 }
bool getListOfAncestors(std::vector< MEChannel *> &)
Definition: MEChannel.cc:62
MEChannel * m()
Definition: MEChannel.h:22

◆ getListOfChannels()

bool MEChannel::getListOfChannels ( std::vector< MEChannel *> &  vec)

Definition at line 50 of file MEChannel.cc.

References _d, cms::cuda::assert(), cuy::ii, n(), and convertSQLiteXML::ok.

Referenced by oneLine().

50  {
51  if (n() == 0) {
52  vec.push_back(this);
53  return true;
54  }
55  for (unsigned ii = 0; ii < n(); ii++) {
56  bool ok = _d[ii]->getListOfChannels(vec);
57  assert(ok);
58  }
59  return true;
60 }
assert(be >=bs)
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
unsigned n() const
Definition: MEChannel.h:28
ii
Definition: cuy.py:589

◆ getListOfDescendants() [1/2]

bool MEChannel::getListOfDescendants ( std::vector< MEChannel *> &  vec)

Definition at line 85 of file MEChannel.cc.

References _d, cuy::ii, and n().

Referenced by getDescendant(), getFirstDescendant(), and getListOfDescendants().

85  {
86  for (unsigned ii = 0; ii < n(); ii++) {
87  vec.push_back(_d[ii]);
88  _d[ii]->getListOfDescendants(vec);
89  }
90  return true;
91 }
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
unsigned n() const
Definition: MEChannel.h:28
ii
Definition: cuy.py:589

◆ getListOfDescendants() [2/2]

bool MEChannel::getListOfDescendants ( int  ig,
std::vector< MEChannel *> &  vec 
)

Definition at line 93 of file MEChannel.cc.

References _d, _ig, getListOfDescendants(), ig(), cuy::ii, and n().

93  {
94  for (unsigned ii = 0; ii < n(); ii++) {
95  MEChannel* curLeaf = _d[ii];
96  if (curLeaf->_ig == ig)
97  vec.push_back(curLeaf);
98  curLeaf->getListOfDescendants(ig, vec);
99  }
100  return true;
101 }
int _ig
Definition: MEChannel.h:53
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
unsigned n() const
Definition: MEChannel.h:28
ii
Definition: cuy.py:589
int ig() const
Definition: MEChannel.h:29
bool getListOfDescendants(std::vector< MEChannel *> &)
Definition: MEChannel.cc:85

◆ id()

int MEChannel::id ( ) const

Definition at line 48 of file MEChannel.cc.

References _id, and _ig.

Referenced by getDescendant().

48 { return _id[_ig]; }
int _ig
Definition: MEChannel.h:53
std::vector< int > _id
Definition: MEChannel.h:60

◆ ig()

int MEChannel::ig ( ) const
inline

Definition at line 29 of file MEChannel.h.

References _ig.

Referenced by getChannel(), getDescendant(), getFirstDescendant(), getListOfDescendants(), oneLine(), and oneWord().

29 { return _ig; }
int _ig
Definition: MEChannel.h:53

◆ ix()

int MEChannel::ix ( ) const
inline

Definition at line 18 of file MEChannel.h.

References _ix.

Referenced by addDaughter(), getChannel(), getDaughter(), MEChannel(), oneLine(), and oneWord().

18 { return _ix; }
int _ix
Definition: MEChannel.h:56

◆ iy()

int MEChannel::iy ( ) const
inline

Definition at line 19 of file MEChannel.h.

References _iy.

Referenced by addDaughter(), getChannel(), getDaughter(), MEChannel(), oneLine(), and oneWord().

19 { return _iy; }
int _iy
Definition: MEChannel.h:57

◆ m()

MEChannel* MEChannel::m ( )
inline

Definition at line 22 of file MEChannel.h.

References _m.

Referenced by getAncestor(), and getListOfAncestors().

22 { return _m; }
MEChannel * _m
Definition: MEChannel.h:49

◆ n()

unsigned MEChannel::n ( ) const
inline

Definition at line 28 of file MEChannel.h.

References _d.

Referenced by d(), getChannel(), getListOfChannels(), getListOfDescendants(), and print().

28 { return _d.size(); }
std::vector< MEChannel * > _d
Definition: MEChannel.h:50

◆ oneLine() [1/2]

TString MEChannel::oneLine ( int  ig)

Definition at line 170 of file MEChannel.cc.

References _id, _ig, cms::cuda::assert(), ME::dccAndSide(), getListOfChannels(), ME::granularity, ME::iCrystal, ME::iEBM, ME::iEBP, ME::iEcalRegion, ig(), ME::iLMModule, ME::iLMRegion, ME::iSector, ME::iSuperCrystal, ix(), iy(), MEEBGeom::localCoord(), MillePedeFileConverter_cfg::out, ME::region, and ME::smName().

170  {
172  int reg_ = _id[ME::iEcalRegion];
173  TString out;
174  if (ig < ME::iLMRegion) {
175  out += ME::region[reg_];
176  if (ig == ME::iSector) {
177  out += "/S=";
178  out += _id[ME::iSector];
179  }
180  return out;
181  }
182  int lmr_ = _id[ME::iLMRegion];
183  std::pair<int, int> p_ = ME::dccAndSide(lmr_);
185  out += "=";
186  out += lmr_;
187  int dcc_ = p_.first;
188  int side_ = p_.second;
189  out += "(DCC=";
190  out += dcc_;
191  out += ",";
192  out += ME::smName(lmr_);
193  out += "/";
194  out += side_;
195  out += ")";
196  if (ig >= _ig)
197  ig = _ig;
198  if (ig >= ME::iLMModule) {
199  int lmm_ = _id[ME::iLMModule];
200  out += "/";
202  out += "=";
203  out += lmm_;
204  if (ig >= ME::iSuperCrystal) {
205  int sc_ = _id[ME::iSuperCrystal];
206  out += "/";
208  out += "=";
209  out += sc_;
210  if (ig >= ME::iCrystal) {
211  int c_ = _id[ME::iCrystal];
212  out += "/";
214  out += "=";
215  out += c_;
216  if (reg_ == ME::iEBM || reg_ == ME::iEBP) {
217  out += "/ieta=";
218  out += ix();
219  out += "/iphi=";
220  out += iy();
222  out += "(ix=";
223  out += ixy_.first;
224  out += "/iy=";
225  out += ixy_.second;
226  out += ")";
227  } else {
228  out += "/ix=";
229  out += ix();
230  out += "/iy=";
231  out += iy();
232  }
233  }
234  }
235  }
236  if (ig < ME::iCrystal) {
237  std::vector<MEChannel*> _channels;
238  getListOfChannels(_channels);
239  int nchan = _channels.size();
240  if (nchan > 1) {
241  out += "(";
242  out += nchan;
243  out += "xTals)";
244  }
245  }
246  return out;
247 }
static XYCoord localCoord(int icr)
Definition: MEEBGeom.cc:142
int ix() const
Definition: MEChannel.h:18
static const TString region[iSizeE]
Definition: ME.h:51
Definition: ME.h:14
assert(be >=bs)
static const TString granularity[iSizeG]
Definition: ME.h:54
int _ig
Definition: MEChannel.h:53
static std::pair< int, int > dccAndSide(int ilmr)
Definition: ME.cc:295
Definition: ME.h:14
std::pair< EBLocalCoord, EBLocalCoord > XYCoord
Definition: MEEBGeom.h:25
int iy() const
Definition: MEChannel.h:19
int ig() const
Definition: MEChannel.h:29
std::vector< int > _id
Definition: MEChannel.h:60
bool getListOfChannels(std::vector< MEChannel *> &)
Definition: MEChannel.cc:50
Definition: ME.h:16
static TString smName(int ilmr)
Definition: ME.cc:391

◆ oneLine() [2/2]

TString MEChannel::oneLine ( )
inline

Definition at line 43 of file MEChannel.h.

References _ig, and oneLine().

Referenced by oneLine().

43 { return oneLine(_ig); }
int _ig
Definition: MEChannel.h:53
TString oneLine()
Definition: MEChannel.h:43

◆ oneWord() [1/2]

TString MEChannel::oneWord ( int  ig)

Definition at line 249 of file MEChannel.cc.

References _id, _ig, cms::cuda::assert(), ME::granularity, ME::iCrystal, ME::iEBM, ME::iEBP, ME::iEcalRegion, ig(), ME::iLMModule, ME::iLMRegion, ME::iSector, ME::iSuperCrystal, ix(), iy(), MEEBGeom::localCoord(), MillePedeFileConverter_cfg::out, and ME::region.

249  {
251  int reg_ = _id[ME::iEcalRegion];
252  TString out;
253  if (ig < ME::iLMRegion) {
254  out = "ECAL_";
255  out += ME::region[reg_];
256  if (ig == ME::iSector) {
257  out += "_S";
258  out += _id[ME::iSector];
259  }
260  return out;
261  }
262  int lmr_ = _id[ME::iLMRegion];
264  out += lmr_;
265  if (ig >= _ig)
266  ig = _ig;
267  if (ig >= ME::iLMModule) {
268  int lmm_ = _id[ME::iLMModule];
269  out += "_";
271  out += lmm_;
272  if (ig >= ME::iSuperCrystal) {
273  int sc_ = _id[ME::iSuperCrystal];
274  out += "_";
276  out += sc_;
277  if (ig >= ME::iCrystal) {
278  int c_ = _id[ME::iCrystal];
279  out += "_";
281  out += c_;
282  if (reg_ == ME::iEBM || reg_ == ME::iEBP) {
284  out += "_";
285  out += ixy_.first;
286  out += "_";
287  out += ixy_.second;
288  } else {
289  out += "_";
290  out += ix();
291  out += "_";
292  out += iy();
293  }
294  }
295  }
296  }
297  return out;
298 }
static XYCoord localCoord(int icr)
Definition: MEEBGeom.cc:142
int ix() const
Definition: MEChannel.h:18
static const TString region[iSizeE]
Definition: ME.h:51
Definition: ME.h:14
assert(be >=bs)
static const TString granularity[iSizeG]
Definition: ME.h:54
int _ig
Definition: MEChannel.h:53
Definition: ME.h:14
std::pair< EBLocalCoord, EBLocalCoord > XYCoord
Definition: MEEBGeom.h:25
int iy() const
Definition: MEChannel.h:19
int ig() const
Definition: MEChannel.h:29
std::vector< int > _id
Definition: MEChannel.h:60
Definition: ME.h:16

◆ oneWord() [2/2]

TString MEChannel::oneWord ( )
inline

Definition at line 45 of file MEChannel.h.

References _ig, and oneWord().

Referenced by oneWord().

45 { return oneWord(_ig); }
int _ig
Definition: MEChannel.h:53
TString oneWord()
Definition: MEChannel.h:45

◆ print()

void MEChannel::print ( std::ostream &  o,
bool  recursif = false 
) const

Definition at line 152 of file MEChannel.cc.

References _d, _id, _ig, _ix, _iy, ME::granularity, cuy::ii, findQualityFiles::jj, n(), and EcalTangentSkim_cfg::o.

152  {
153  o << ME::granularity[_ig] << " ";
154  for (int ii = 0; ii <= _ig; ii++) {
155  o << ME::granularity[ii] << "=" << _id[ii] << " ";
156  }
157  if (n() > 0) {
158  o << "NDau=" << n() << " ";
159  } else {
160  o << "ix=" << _ix << " iy=" << _iy << " ";
161  }
162  o << std::endl;
163  if (recursif) {
164  for (unsigned jj = 0; jj < n(); jj++) {
165  _d[jj]->print(o, true);
166  }
167  }
168 }
int _ix
Definition: MEChannel.h:56
static const TString granularity[iSizeG]
Definition: ME.h:54
int _ig
Definition: MEChannel.h:53
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
unsigned n() const
Definition: MEChannel.h:28
int _iy
Definition: MEChannel.h:57
ii
Definition: cuy.py:589
std::vector< int > _id
Definition: MEChannel.h:60

Member Data Documentation

◆ _d

std::vector<MEChannel*> MEChannel::_d
private

◆ _id

std::vector<int> MEChannel::_id
private

Definition at line 60 of file MEChannel.h.

Referenced by id(), MEChannel(), oneLine(), oneWord(), and print().

◆ _ig

int MEChannel::_ig
private

◆ _ix

int MEChannel::_ix
private

Definition at line 56 of file MEChannel.h.

Referenced by getChannel(), ix(), MEChannel(), and print().

◆ _iy

int MEChannel::_iy
private

Definition at line 57 of file MEChannel.h.

Referenced by getChannel(), iy(), MEChannel(), and print().

◆ _m

MEChannel* MEChannel::_m
private

Definition at line 49 of file MEChannel.h.

Referenced by getChannel(), m(), and MEChannel().