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 ( 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() const
Definition: MEChannel.h:19
int _iy
Definition: MEChannel.h:57
ii
Definition: cuy.py:590
std::vector< int > _id
Definition: MEChannel.h:60
MEChannel * _m
Definition: MEChannel.h:49
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:590

Member Function Documentation

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

Definition at line 42 of file MEChannel.cc.

References _d, d(), 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
int iy() const
Definition: MEChannel.h:19
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
MEChannel(int ix, int iy, int ii, MEChannel *mother)
Definition: MEChannel.cc:12
MEChannel * d(unsigned ii)
Definition: MEChannel.h:23
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  }
unsigned n() const
Definition: MEChannel.h:28
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
ii
Definition: cuy.py:590
MEChannel * MEChannel::getAncestor ( int  ig)

Definition at line 71 of file MEChannel.cc.

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

Referenced by getAncestor(), and ig().

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
MEChannel * MEChannel::getChannel ( int  ix,
int  iy 
)

Definition at line 136 of file MEChannel.cc.

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

Referenced by getChannel(), and ig().

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
unsigned n() const
Definition: MEChannel.h:28
int ix() const
Definition: MEChannel.h:18
int iy() const
Definition: MEChannel.h:19
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
int _iy
Definition: MEChannel.h:57
ii
Definition: cuy.py:590
MEChannel * MEChannel::getChannel ( int  ig,
int  ix,
int  iy 
)

Definition at line 125 of file MEChannel.cc.

References _ig, _m, and getChannel().

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
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
MEChannel * MEChannel::getDaughter ( int  ix,
int  iy,
int  ig 
)

Definition at line 33 of file MEChannel.cc.

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

Referenced by iy(), and 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
int iy() const
Definition: MEChannel.h:19
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
MEChannel * addDaughter(int ix, int iy, int ii)
Definition: MEChannel.cc:42
ii
Definition: cuy.py:590
MEChannel * MEChannel::getDescendant ( int  ig,
int  ii 
)

Definition at line 103 of file MEChannel.cc.

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

Referenced by ig(), and 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 }
bool getListOfDescendants(std::vector< MEChannel * > &)
Definition: MEChannel.cc:85
ii
Definition: cuy.py:590
std::pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:126
int ig() const
Definition: MEChannel.h:29
MEChannel * MEChannel::getFirstDescendant ( int  ig)

Definition at line 117 of file MEChannel.cc.

References getListOfDescendants().

Referenced by ig().

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

Definition at line 62 of file MEChannel.cc.

References getListOfAncestors(), and m().

Referenced by getListOfAncestors(), and ig().

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
bool MEChannel::getListOfChannels ( std::vector< MEChannel * > &  vec)

Definition at line 50 of file MEChannel.cc.

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

Referenced by ig(), and 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 }
unsigned n() const
Definition: MEChannel.h:28
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
ii
Definition: cuy.py:590
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(), getListOfDescendants(), and ig().

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 }
unsigned n() const
Definition: MEChannel.h:28
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
ii
Definition: cuy.py:590
bool MEChannel::getListOfDescendants ( int  ig,
std::vector< MEChannel * > &  vec 
)

Definition at line 93 of file MEChannel.cc.

References _d, _ig, getListOfDescendants(), 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 }
bool getListOfDescendants(std::vector< MEChannel * > &)
Definition: MEChannel.cc:85
unsigned n() const
Definition: MEChannel.h:28
int _ig
Definition: MEChannel.h:53
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
ii
Definition: cuy.py:590
int ig() const
Definition: MEChannel.h:29
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
int MEChannel::ig ( ) const
inline
int MEChannel::ix ( ) const
inline

Definition at line 18 of file MEChannel.h.

References _ix.

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

18 { return _ix; }
int _ix
Definition: MEChannel.h:56
int MEChannel::iy ( ) const
inline

Definition at line 19 of file MEChannel.h.

References _iy, getDaughter(), and ig().

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

19 { return _iy; }
int _iy
Definition: MEChannel.h:57
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
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
TString MEChannel::oneLine ( int  ig)

Definition at line 170 of file MEChannel.cc.

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

170  {
171  assert(ig >= ME::iEcalRegion);
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
Definition: ME.h:14
bool getListOfChannels(std::vector< MEChannel * > &)
Definition: MEChannel.cc:50
int ix() const
Definition: MEChannel.h:18
static TString granularity[iSizeG]
Definition: ME.h:54
int nchan
Definition: TauolaWrapper.h:80
int _ig
Definition: MEChannel.h:53
static std::pair< int, int > dccAndSide(int ilmr)
Definition: ME.cc:295
int iy() const
Definition: MEChannel.h:19
Definition: ME.h:14
std::pair< EBLocalCoord, EBLocalCoord > XYCoord
Definition: MEEBGeom.h:25
static TString region[4]
Definition: ME.h:51
int ig() const
Definition: MEChannel.h:29
std::vector< int > _id
Definition: MEChannel.h:60
Definition: ME.h:16
static TString smName(int ilmr)
Definition: ME.cc:391
TString MEChannel::oneLine ( )
inline

Definition at line 43 of file MEChannel.h.

References _ig, oneLine(), and oneWord().

Referenced by ig(), and oneLine().

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

Definition at line 249 of file MEChannel.cc.

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

249  {
250  assert(ig >= ME::iEcalRegion);
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
Definition: ME.h:14
int ix() const
Definition: MEChannel.h:18
static TString granularity[iSizeG]
Definition: ME.h:54
int _ig
Definition: MEChannel.h:53
int iy() const
Definition: MEChannel.h:19
Definition: ME.h:14
std::pair< EBLocalCoord, EBLocalCoord > XYCoord
Definition: MEEBGeom.h:25
static TString region[4]
Definition: ME.h:51
int ig() const
Definition: MEChannel.h:29
std::vector< int > _id
Definition: MEChannel.h:60
Definition: ME.h:16
TString MEChannel::oneWord ( )
inline

Definition at line 45 of file MEChannel.h.

References _ig, and oneWord().

Referenced by oneLine(), and oneWord().

45 { return oneWord(_ig); }
int _ig
Definition: MEChannel.h:53
TString oneWord()
Definition: MEChannel.h:45
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, and n().

Referenced by ig().

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
unsigned n() const
Definition: MEChannel.h:28
static TString granularity[iSizeG]
Definition: ME.h:54
int _ig
Definition: MEChannel.h:53
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
int _iy
Definition: MEChannel.h:57
ii
Definition: cuy.py:590
std::vector< int > _id
Definition: MEChannel.h:60

Member Data Documentation

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

Definition at line 60 of file MEChannel.h.

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

int MEChannel::_ig
private
int MEChannel::_ix
private

Definition at line 56 of file MEChannel.h.

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

int MEChannel::_iy
private

Definition at line 57 of file MEChannel.h.

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

MEChannel* MEChannel::_m
private

Definition at line 49 of file MEChannel.h.

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