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 ig, int ix, int iy)
 
MEChannelgetChannel (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 (int ig, std::vector< MEChannel * > &)
 
bool getListOfDescendants (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 ()
 
TString oneLine (int ig)
 
TString oneWord ()
 
TString oneWord (int ig)
 
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.

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 }

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

Referenced by addDaughter().

◆ ~MEChannel()

MEChannel::~MEChannel ( )
virtual

Definition at line 27 of file MEChannel.cc.

27  {
28  for (unsigned ii = 0; ii < _d.size(); ii++) {
29  delete _d[ii];
30  }
31 }

References _d, and cuy::ii.

Member Function Documentation

◆ addDaughter()

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

Definition at line 42 of file MEChannel.cc.

42  {
43  MEChannel* d = new MEChannel(ix, iy, id_, this);
44  _d.push_back(d);
45  return d;
46 }

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

Referenced by getDaughter().

◆ d()

MEChannel* MEChannel::d ( unsigned  ii)
inline

Definition at line 23 of file MEChannel.h.

23  {
24  if (ii >= n())
25  return nullptr;
26  return _d[ii];
27  }

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

Referenced by addDaughter().

◆ getAncestor()

MEChannel * MEChannel::getAncestor ( int  ig)

Definition at line 71 of file MEChannel.cc.

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 }

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

Referenced by getAncestor().

◆ getChannel() [1/2]

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

Definition at line 125 of file MEChannel.cc.

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 }

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

◆ getChannel() [2/2]

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

Definition at line 136 of file MEChannel.cc.

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 }

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

Referenced by getChannel().

◆ getDaughter()

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

Definition at line 33 of file MEChannel.cc.

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 }

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

Referenced by ME::regTree().

◆ getDescendant()

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

Definition at line 103 of file MEChannel.cc.

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 }

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

Referenced by ME::lmrTree().

◆ getFirstDescendant()

MEChannel * MEChannel::getFirstDescendant ( int  ig)

Definition at line 117 of file MEChannel.cc.

117  {
118  std::vector<MEChannel*> vec;
119  bool OK = getListOfDescendants(ig, vec);
120  if (!OK)
121  return nullptr;
122  return vec[0];
123 }

References getListOfDescendants(), and ig().

◆ getListOfAncestors()

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

Definition at line 62 of file MEChannel.cc.

62  {
63  MEChannel* mother = this->m();
64  if (mother != nullptr) {
65  vec.push_back(mother);
66  mother->getListOfAncestors(vec);
67  }
68  return true;
69 }

References getListOfAncestors(), and m().

Referenced by getListOfAncestors().

◆ getListOfChannels()

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

Definition at line 50 of file MEChannel.cc.

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 }

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

Referenced by oneLine().

◆ getListOfDescendants() [1/2]

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

Definition at line 93 of file MEChannel.cc.

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 }

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

◆ getListOfDescendants() [2/2]

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

Definition at line 85 of file MEChannel.cc.

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 }

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

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

◆ id()

int MEChannel::id ( ) const

Definition at line 48 of file MEChannel.cc.

48 { return _id[_ig]; }

References _id, and _ig.

Referenced by getDescendant().

◆ ig()

int MEChannel::ig ( ) const
inline

Definition at line 29 of file MEChannel.h.

29 { return _ig; }

References _ig.

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

◆ ix()

int MEChannel::ix ( ) const
inline

Definition at line 18 of file MEChannel.h.

18 { return _ix; }

References _ix.

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

◆ iy()

int MEChannel::iy ( ) const
inline

Definition at line 19 of file MEChannel.h.

19 { return _iy; }

References _iy.

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

◆ m()

MEChannel* MEChannel::m ( )
inline

Definition at line 22 of file MEChannel.h.

22 { return _m; }

References _m.

Referenced by getAncestor(), and getListOfAncestors().

◆ n()

unsigned MEChannel::n ( ) const
inline

Definition at line 28 of file MEChannel.h.

28 { return _d.size(); }

References _d.

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

◆ oneLine() [1/2]

TString MEChannel::oneLine ( )
inline

Definition at line 43 of file MEChannel.h.

43 { return oneLine(_ig); }

References _ig, and oneLine().

Referenced by oneLine().

◆ oneLine() [2/2]

TString MEChannel::oneLine ( int  ig)

Definition at line 170 of file MEChannel.cc.

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 }

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(), nchan, MillePedeFileConverter_cfg::out, ME::region, and ME::smName().

◆ oneWord() [1/2]

TString MEChannel::oneWord ( )
inline

Definition at line 45 of file MEChannel.h.

45 { return oneWord(_ig); }

References _ig, and oneWord().

Referenced by oneWord().

◆ oneWord() [2/2]

TString MEChannel::oneWord ( int  ig)

Definition at line 249 of file MEChannel.cc.

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 }

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.

◆ print()

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

Definition at line 152 of file MEChannel.cc.

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 }

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

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

ME::iLMRegion
Definition: ME.h:16
MEChannel::_id
std::vector< int > _id
Definition: MEChannel.h:60
cms::cuda::assert
assert(be >=bs)
MEChannel::getAncestor
MEChannel * getAncestor(int ig)
Definition: MEChannel.cc:71
MEChannel::iy
int iy() const
Definition: MEChannel.h:19
MEChannel::ig
int ig() const
Definition: MEChannel.h:29
ME::iLMModule
Definition: ME.h:16
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
reco::OK
std::pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:126
ME::iEcalRegion
Definition: ME.h:16
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
ME::iSuperCrystal
Definition: ME.h:16
MEChannel::getListOfAncestors
bool getListOfAncestors(std::vector< MEChannel * > &)
Definition: MEChannel.cc:62
MEChannel::_ix
int _ix
Definition: MEChannel.h:56
MEEBGeom::XYCoord
std::pair< EBLocalCoord, EBLocalCoord > XYCoord
Definition: MEEBGeom.h:25
ME::granularity
static TString granularity[iSizeG]
Definition: ME.h:54
ME::dccAndSide
static std::pair< int, int > dccAndSide(int ilmr)
Definition: ME.cc:295
ME::iCrystal
Definition: ME.h:16
MEChannel::oneWord
TString oneWord()
Definition: MEChannel.h:45
ME::region
static TString region[4]
Definition: ME.h:51
ME::iEBP
Definition: ME.h:14
MEChannel::m
MEChannel * m()
Definition: MEChannel.h:22
ME::iSector
Definition: ME.h:16
MEChannel::getListOfChannels
bool getListOfChannels(std::vector< MEChannel * > &)
Definition: MEChannel.cc:50
nchan
int nchan
Definition: TauolaWrapper.h:80
MEChannel::oneLine
TString oneLine()
Definition: MEChannel.h:43
ME::smName
static TString smName(int ilmr)
Definition: ME.cc:391
MEChannel::_m
MEChannel * _m
Definition: MEChannel.h:49
MEChannel::addDaughter
MEChannel * addDaughter(int ix, int iy, int ii)
Definition: MEChannel.cc:42
MEChannel::_iy
int _iy
Definition: MEChannel.h:57
MEChannel::getListOfDescendants
bool getListOfDescendants(std::vector< MEChannel * > &)
Definition: MEChannel.cc:85
MEChannel::MEChannel
MEChannel(int ix, int iy, int ii, MEChannel *mother)
Definition: MEChannel.cc:12
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
MEChannel::_ig
int _ig
Definition: MEChannel.h:53
MEChannel::_d
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
MEEBGeom::localCoord
static XYCoord localCoord(int icr)
Definition: MEEBGeom.cc:142
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
MEChannel::ix
int ix() const
Definition: MEChannel.h:18
MEChannel::d
MEChannel * d(unsigned ii)
Definition: MEChannel.h:23
ME::iEBM
Definition: ME.h:14
cuy.ii
ii
Definition: cuy.py:590
g
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
MEChannel
Definition: MEChannel.h:12
MEChannel::n
unsigned n() const
Definition: MEChannel.h:28
MEChannel::getChannel
MEChannel * getChannel(int ix, int iy)
Definition: MEChannel.cc:136