CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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().

13  : _m(mother)
14 {
15  if( _m==0 )
16  {
17  _ig=0;
18  }
19  else
20  {
21  _ig = _m->_ig+1;
22  }
23  _id.resize( _ig+1, -1 );
24  for( int ii=0; ii<_ig; ii++ )
25  {
26  _id[ii] = _m->_id[ii];
27  }
28  _id[_ig] = id_;
29  _ix = ix;
30  _iy = iy;
31 }
int _ix
Definition: MEChannel.h:55
int ix() const
Definition: MEChannel.h:20
int ii
Definition: cuy.py:588
int _ig
Definition: MEChannel.h:52
int iy() const
Definition: MEChannel.h:21
int _iy
Definition: MEChannel.h:56
std::vector< int > _id
Definition: MEChannel.h:59
MEChannel * _m
Definition: MEChannel.h:48
MEChannel::~MEChannel ( )
virtual

Definition at line 33 of file MEChannel.cc.

References _d, and cuy::ii.

34 {
35  for( unsigned ii=0; ii<_d.size(); ii++ )
36  {
37  delete _d[ii];
38  }
39 }
int ii
Definition: cuy.py:588
std::vector< MEChannel * > _d
Definition: MEChannel.h:49

Member Function Documentation

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

Definition at line 55 of file MEChannel.cc.

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

Referenced by getDaughter().

56 {
57  MEChannel* d = new MEChannel( ix, iy, id_, this );
58  _d.push_back( d );
59  return d;
60 }
int ix() const
Definition: MEChannel.h:20
int iy() const
Definition: MEChannel.h:21
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
MEChannel(int ix, int iy, int ii, MEChannel *mother)
Definition: MEChannel.cc:12
MEChannel * d(unsigned ii)
Definition: MEChannel.h:25
MEChannel* MEChannel::d ( unsigned  ii)
inline

Definition at line 25 of file MEChannel.h.

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

Referenced by addDaughter().

25 { if( ii>=n() ) return 0; return _d[ii]; }
unsigned n() const
Definition: MEChannel.h:26
int ii
Definition: cuy.py:588
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
MEChannel * MEChannel::getAncestor ( int  ig)

Definition at line 97 of file MEChannel.cc.

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

Referenced by getAncestor().

98 {
99  if( _ig==g ) return this;
100 
101  MEChannel* mother = this->m();
102  if( mother!=0 )
103  {
104  if( mother->_ig==g ) return mother;
105  return mother->getAncestor( g );
106  }
107 
108  return 0;
109 }
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:52
MEChannel * m()
Definition: MEChannel.h:24
MEChannel * getAncestor(int ig)
Definition: MEChannel.cc:97
MEChannel * MEChannel::getChannel ( int  ix,
int  iy 
)

Definition at line 172 of file MEChannel.cc.

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

Referenced by getChannel().

173 {
174  if( n()==0 )
175  {
176  if( ix==_ix && iy==_iy )
177  {
178  return this;
179  }
180  else
181  return 0;
182  }
183  MEChannel* leaf(0);
184  for( unsigned ii=0; ii<n(); ii++ )
185  {
186  leaf = _d[ii]->getChannel( ix, iy );
187  if( leaf!=0 ) break;
188  }
189  return leaf;
190 }
int _ix
Definition: MEChannel.h:55
unsigned n() const
Definition: MEChannel.h:26
int ix() const
Definition: MEChannel.h:20
int ii
Definition: cuy.py:588
tuple leaf
Definition: Node.py:62
int iy() const
Definition: MEChannel.h:21
int _iy
Definition: MEChannel.h:56
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
MEChannel * MEChannel::getChannel ( int  ig,
int  ix,
int  iy 
)

Definition at line 159 of file MEChannel.cc.

References _ig, _m, getChannel(), and python.Node::leaf.

160 {
161  assert( ig>=0 );
162  MEChannel* leaf = getChannel( ix, iy );
163  if( leaf==0 ) return 0;
164  while( ig!=leaf->_ig )
165  {
166  leaf = leaf->_m;
167  }
168  return leaf;
169 }
MEChannel * getChannel(int ix, int iy)
Definition: MEChannel.cc:172
int ix() const
Definition: MEChannel.h:20
int _ig
Definition: MEChannel.h:52
tuple leaf
Definition: Node.py:62
int iy() const
Definition: MEChannel.h:21
int ig() const
Definition: MEChannel.h:27
MEChannel * _m
Definition: MEChannel.h:48
MEChannel * MEChannel::getDaughter ( int  ix,
int  iy,
int  ig 
)

Definition at line 42 of file MEChannel.cc.

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

Referenced by ME::regTree().

43 {
44  for( unsigned ii=0; ii<_d.size(); ii++ )
45  {
46  if( _d[ii]->id()==id_ )
47  {
48  return _d[ii];
49  }
50  }
51  return addDaughter( ix, iy, id_ );
52 }
int ix() const
Definition: MEChannel.h:20
int ii
Definition: cuy.py:588
int iy() const
Definition: MEChannel.h:21
MEChannel * addDaughter(int ix, int iy, int ii)
Definition: MEChannel.cc:55
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
MEChannel * MEChannel::getDescendant ( int  ig,
int  ii 
)

Definition at line 135 of file MEChannel.cc.

References getListOfDescendants(), id(), cuy::ii, and python.Node::leaf.

Referenced by ME::lmrTree().

136 {
137  std::vector< MEChannel* > vec;
138  bool OK = getListOfDescendants( ig, vec );
139  if( !OK ) return 0;
140  MEChannel* leaf(0);
141  for( unsigned int ii=0; ii<vec.size(); ii++ )
142  {
143  leaf = vec[ii];
144  if( leaf->id()==id_ ) return leaf;
145  }
146  return leaf;
147 }
bool getListOfDescendants(std::vector< MEChannel * > &)
Definition: MEChannel.cc:112
pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:70
int ii
Definition: cuy.py:588
tuple leaf
Definition: Node.py:62
int ig() const
Definition: MEChannel.h:27
MEChannel * MEChannel::getFirstDescendant ( int  ig)

Definition at line 150 of file MEChannel.cc.

References getListOfDescendants().

151 {
152  std::vector< MEChannel* > vec;
153  bool OK = getListOfDescendants( ig, vec );
154  if( !OK ) return 0;
155  return vec[0];
156 }
bool getListOfDescendants(std::vector< MEChannel * > &)
Definition: MEChannel.cc:112
pair< int, edm::FunctionWithDict > OK
Definition: findMethod.cc:70
int ig() const
Definition: MEChannel.h:27
bool MEChannel::getListOfAncestors ( std::vector< MEChannel * > &  vec)

Definition at line 85 of file MEChannel.cc.

References getListOfAncestors(), and m().

Referenced by getListOfAncestors().

86 {
87  MEChannel* mother = this->m();
88  if( mother!=0 )
89  {
90  vec.push_back( mother );
91  mother->getListOfAncestors( vec );
92  }
93  return true;
94 }
bool getListOfAncestors(std::vector< MEChannel * > &)
Definition: MEChannel.cc:85
MEChannel * m()
Definition: MEChannel.h:24
bool MEChannel::getListOfChannels ( std::vector< MEChannel * > &  vec)

Definition at line 69 of file MEChannel.cc.

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

Referenced by oneLine().

70 {
71  if( n()==0 )
72  {
73  vec.push_back( this );
74  return true;
75  }
76  for( unsigned ii=0; ii<n(); ii++ )
77  {
78  bool ok = _d[ii]->getListOfChannels( vec );
79  assert( ok );
80  }
81  return true;
82 }
unsigned n() const
Definition: MEChannel.h:26
int ii
Definition: cuy.py:588
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
bool MEChannel::getListOfDescendants ( std::vector< MEChannel * > &  vec)

Definition at line 112 of file MEChannel.cc.

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

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

113 {
114  for( unsigned ii=0; ii<n(); ii++ )
115  {
116  vec.push_back(_d[ii]);
117  _d[ii]->getListOfDescendants( vec );
118  }
119  return true;
120 }
unsigned n() const
Definition: MEChannel.h:26
int ii
Definition: cuy.py:588
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
bool MEChannel::getListOfDescendants ( int  ig,
std::vector< MEChannel * > &  vec 
)

Definition at line 123 of file MEChannel.cc.

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

124 {
125  for( unsigned ii=0; ii<n(); ii++ )
126  {
127  MEChannel* curLeaf = _d[ii];
128  if( curLeaf->_ig==ig ) vec.push_back(curLeaf);
129  curLeaf->getListOfDescendants( ig, vec );
130  }
131  return true;
132 }
bool getListOfDescendants(std::vector< MEChannel * > &)
Definition: MEChannel.cc:112
unsigned n() const
Definition: MEChannel.h:26
int ii
Definition: cuy.py:588
int _ig
Definition: MEChannel.h:52
int ig() const
Definition: MEChannel.h:27
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
int MEChannel::id ( void  ) const

Definition at line 63 of file MEChannel.cc.

References _id, and _ig.

Referenced by getDescendant().

64 {
65  return _id[_ig];
66 }
int _ig
Definition: MEChannel.h:52
std::vector< int > _id
Definition: MEChannel.h:59
int MEChannel::ig ( ) const
inline

Definition at line 27 of file MEChannel.h.

References _ig.

27 { return _ig; }
int _ig
Definition: MEChannel.h:52
int MEChannel::ix ( ) const
inline

Definition at line 20 of file MEChannel.h.

References _ix.

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

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

Definition at line 21 of file MEChannel.h.

References _iy.

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

21 { return _iy; }
int _iy
Definition: MEChannel.h:56
MEChannel* MEChannel::m ( )
inline

Definition at line 24 of file MEChannel.h.

References _m.

Referenced by getAncestor(), and getListOfAncestors().

24 { return _m; }
MEChannel * _m
Definition: MEChannel.h:48
unsigned MEChannel::n ( ) const
inline

Definition at line 26 of file MEChannel.h.

References _d.

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

26 { return _d.size(); }
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
TString MEChannel::oneLine ( int  ig)

Definition at line 219 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, dbtoconf::out, ME::region, and ME::smName().

220 {
221  assert( ig>=ME::iEcalRegion );
222  int reg_ = _id[ME::iEcalRegion];
223  TString out;
224  if( ig<ME::iLMRegion )
225  {
226  out += ME::region[reg_];
227  if( ig==ME::iSector ) out+="/S="; out+=_id[ME::iSector];
228  return out;
229  }
230  int lmr_ = _id[ME::iLMRegion];
231  std::pair<int,int> p_ = ME::dccAndSide( lmr_ );
233  out+="=";out += lmr_;
234  int dcc_=p_.first;
235  int side_=p_.second;
236  out+="(DCC="; out+=dcc_; out+=",";
237  out+= ME::smName(lmr_);
238  out+="/"; out+=side_; out+=")";
239  if( ig>=_ig ) ig=_ig;
240  if( ig>=ME::iLMModule )
241  {
242  int lmm_=_id[ME::iLMModule];
243  out+="/";
245  out+="=";
246  out+=lmm_;
247  if( ig>=ME::iSuperCrystal )
248  {
249  int sc_=_id[ME::iSuperCrystal];
250  out+="/";
252  out+="=";
253  out+=sc_;
254  if( ig>=ME::iCrystal )
255  {
256  int c_=_id[ME::iCrystal];
257  out+="/";
259  out+="=";
260  out+=c_;
261  if( reg_==ME::iEBM || reg_==ME::iEBP )
262  {
263  out += "/ieta="; out+=ix();
264  out += "/iphi="; out+=iy();
265  MEEBGeom::XYCoord ixy_ =
266  MEEBGeom::localCoord( ix(), iy() );
267  out += "(ix="; out+=ixy_.first;
268  out += "/iy="; out+=ixy_.second;
269  out += ")";
270  }
271  else
272  {
273  out += "/ix="; out+=ix();
274  out += "/iy="; out+=iy();
275  }
276  }
277  }
278  }
279  if( ig<ME::iCrystal )
280  {
281  std::vector< MEChannel* > _channels;
282  getListOfChannels( _channels );
283  int nchan = _channels.size();
284  if( nchan>1 )
285  {
286  out += "(";
287  out += nchan;
288  out += "xTals)";
289  }
290  }
291  return out;
292 }
static XYCoord localCoord(int icr)
Definition: MEEBGeom.cc:153
Definition: ME.h:16
bool getListOfChannels(std::vector< MEChannel * > &)
Definition: MEChannel.cc:69
int ix() const
Definition: MEChannel.h:20
static TString granularity[iSizeG]
Definition: ME.h:60
int nchan
Definition: TauolaWrapper.h:80
int _ig
Definition: MEChannel.h:52
static std::pair< int, int > dccAndSide(int ilmr)
Definition: ME.cc:313
int iy() const
Definition: MEChannel.h:21
Definition: ME.h:16
std::pair< EBLocalCoord, EBLocalCoord > XYCoord
Definition: MEEBGeom.h:27
static TString region[4]
Definition: ME.h:57
tuple out
Definition: dbtoconf.py:99
int ig() const
Definition: MEChannel.h:27
std::vector< int > _id
Definition: MEChannel.h:59
Definition: ME.h:18
static TString smName(int ilmr)
Definition: ME.cc:415
TString MEChannel::oneLine ( )
inline

Definition at line 41 of file MEChannel.h.

References _ig, and oneLine().

Referenced by oneLine().

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

Definition at line 295 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(), dbtoconf::out, and ME::region.

296 {
297  assert( ig>=ME::iEcalRegion );
298  int reg_ = _id[ME::iEcalRegion];
299  TString out;
300  if( ig<ME::iLMRegion )
301  {
302  out = "ECAL_";
303  out += ME::region[reg_];
304  if( ig==ME::iSector ) out+="_S"; out+=_id[ME::iSector];
305  return out;
306  }
307  int lmr_ = _id[ME::iLMRegion];
309  out+=lmr_;
310  if( ig>=_ig ) ig=_ig;
311  if( ig>=ME::iLMModule )
312  {
313  int lmm_=_id[ME::iLMModule];
314  out+="_";
316  out+=lmm_;
317  if( ig>=ME::iSuperCrystal )
318  {
319  int sc_=_id[ME::iSuperCrystal];
320  out+="_";
322  out+=sc_;
323  if( ig>=ME::iCrystal )
324  {
325  int c_=_id[ME::iCrystal];
326  out+="_";
328  out+=c_;
329  if( reg_==ME::iEBM || reg_==ME::iEBP )
330  {
331  MEEBGeom::XYCoord ixy_ =
332  MEEBGeom::localCoord( ix(), iy() );
333  out += "_"; out+=ixy_.first;
334  out += "_"; out+=ixy_.second;
335  }
336  else
337  {
338  out += "_"; out+=ix();
339  out += "_"; out+=iy();
340  }
341  }
342  }
343  }
344  return out;
345 }
static XYCoord localCoord(int icr)
Definition: MEEBGeom.cc:153
Definition: ME.h:16
int ix() const
Definition: MEChannel.h:20
static TString granularity[iSizeG]
Definition: ME.h:60
int _ig
Definition: MEChannel.h:52
int iy() const
Definition: MEChannel.h:21
Definition: ME.h:16
std::pair< EBLocalCoord, EBLocalCoord > XYCoord
Definition: MEEBGeom.h:27
static TString region[4]
Definition: ME.h:57
tuple out
Definition: dbtoconf.py:99
int ig() const
Definition: MEChannel.h:27
std::vector< int > _id
Definition: MEChannel.h:59
Definition: ME.h:18
TString MEChannel::oneWord ( )
inline

Definition at line 43 of file MEChannel.h.

References _ig, and oneWord().

Referenced by oneWord().

43 { return oneWord( _ig ); }
int _ig
Definition: MEChannel.h:52
TString oneWord()
Definition: MEChannel.h:43
void MEChannel::print ( std::ostream &  o,
bool  recursif = false 
) const

Definition at line 193 of file MEChannel.cc.

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

194 {
195  o << ME::granularity[_ig] << " ";
196  for( int ii=0; ii<=_ig; ii++ )
197  {
198  o << ME::granularity[ii] << "=" << _id[ii] << " ";
199  }
200  if( n()>0 )
201  {
202  o << "NDau=" << n() << " " ;
203  }
204  else
205  {
206  o << "ix=" << _ix << " iy=" << _iy << " " ;
207  }
208  o << std::endl;
209  if( recursif )
210  {
211  for( unsigned jj=0; jj<n(); jj++ )
212  {
213  _d[jj]->print( o, true );
214  }
215  }
216 }
int _ix
Definition: MEChannel.h:55
unsigned n() const
Definition: MEChannel.h:26
static TString granularity[iSizeG]
Definition: ME.h:60
int ii
Definition: cuy.py:588
int _ig
Definition: MEChannel.h:52
int _iy
Definition: MEChannel.h:56
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
std::vector< int > _id
Definition: MEChannel.h:59

Member Data Documentation

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

Definition at line 59 of file MEChannel.h.

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

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

Definition at line 55 of file MEChannel.h.

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

int MEChannel::_iy
private

Definition at line 56 of file MEChannel.h.

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

MEChannel* MEChannel::_m
private

Definition at line 48 of file MEChannel.h.

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