CMS 3D CMS Logo

MEChannel.h
Go to the documentation of this file.
1 #ifndef MEChannel_hh
2 #define MEChannel_hh
3 
4 //
5 // Authors : Gautier Hamel de Monchenault and Julie Malcles, Saclay
6 //
7 // logical navigation in doubly linked list of channels
8 
9 #include <vector>
10 #include <TROOT.h>
11 
12 class MEChannel
13 {
14 public:
15 
16  MEChannel( int ix, int iy, int ii, MEChannel* mother );
17  virtual ~MEChannel();
18 
19  int id() const;
20  int ix() const { return _ix; }
21  int iy() const { return _iy; }
22 
23  MEChannel* getDaughter( int ix, int iy, int ig );
24  MEChannel* m() { return _m; }
25  MEChannel* d( unsigned ii ) { if( ii>=n() ) return nullptr; return _d[ii]; }
26  unsigned n() const { return _d.size(); }
27  int ig() const { return _ig; }
28 
29  bool getListOfChannels( std::vector< MEChannel* >& );
30  bool getListOfAncestors( std::vector< MEChannel* >& );
31  bool getListOfDescendants( std::vector< MEChannel* >& );
32  bool getListOfDescendants( int ig, std::vector< MEChannel* >& );
33  MEChannel* getFirstDescendant( int ig );
34  MEChannel* getDescendant( int ig, int ii );
35  MEChannel* getChannel( int ix, int iy );
36  MEChannel* getChannel( int ig, int ix, int iy );
37  MEChannel* getAncestor( int ig );
38 
39  void print(std::ostream& o, bool recursif=false ) const;
40  TString oneLine( int ig );
41  TString oneLine() { return oneLine( _ig ); }
42  TString oneWord( int ig );
43  TString oneWord() { return oneWord( _ig ); }
44 
45 private:
46 
47  // doubly-linked tree
49  std::vector< MEChannel* > _d;
50 
51  // granularity
52  int _ig;
53 
54  // (local) coordinates
55  int _ix;
56  int _iy;
57 
58  // defines a channel
59  std::vector< int > _id;
60 
61  MEChannel* addDaughter( int ix, int iy, int ii );
62 
63  // ClassDef(MEChannel,0) // MEChannel -- A channel or group of channels
64 };
65 
66 #endif
67 
int _ix
Definition: MEChannel.h:55
bool getListOfDescendants(std::vector< MEChannel * > &)
Definition: MEChannel.cc:112
MEChannel * getChannel(int ix, int iy)
Definition: MEChannel.cc:172
unsigned n() const
Definition: MEChannel.h:26
bool getListOfChannels(std::vector< MEChannel * > &)
Definition: MEChannel.cc:69
int ix() const
Definition: MEChannel.h:20
bool getListOfAncestors(std::vector< MEChannel * > &)
Definition: MEChannel.cc:85
MEChannel * getDaughter(int ix, int iy, int ig)
Definition: MEChannel.cc:42
MEChannel * getDescendant(int ig, int ii)
Definition: MEChannel.cc:135
void print(std::ostream &o, bool recursif=false) const
Definition: MEChannel.cc:193
int _ig
Definition: MEChannel.h:52
int iy() const
Definition: MEChannel.h:21
int _iy
Definition: MEChannel.h:56
MEChannel * addDaughter(int ix, int iy, int ii)
Definition: MEChannel.cc:55
ii
Definition: cuy.py:589
MEChannel * m()
Definition: MEChannel.h:24
virtual ~MEChannel()
Definition: MEChannel.cc:33
int ig() const
Definition: MEChannel.h:27
std::vector< MEChannel * > _d
Definition: MEChannel.h:49
TString oneLine()
Definition: MEChannel.h:41
TString oneWord()
Definition: MEChannel.h:43
MEChannel * getFirstDescendant(int ig)
Definition: MEChannel.cc:150
int id() const
Definition: MEChannel.cc:63
std::vector< int > _id
Definition: MEChannel.h:59
MEChannel * getAncestor(int ig)
Definition: MEChannel.cc:97
MEChannel * _m
Definition: MEChannel.h:48
MEChannel(int ix, int iy, int ii, MEChannel *mother)
Definition: MEChannel.cc:12
MEChannel * d(unsigned ii)
Definition: MEChannel.h:25