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 public:
14  MEChannel(int ix, int iy, int ii, MEChannel* mother);
15  virtual ~MEChannel();
16 
17  int id() const;
18  int ix() const { return _ix; }
19  int iy() const { return _iy; }
20 
21  MEChannel* getDaughter(int ix, int iy, int ig);
22  MEChannel* m() { return _m; }
23  MEChannel* d(unsigned ii) {
24  if (ii >= n())
25  return nullptr;
26  return _d[ii];
27  }
28  unsigned n() const { return _d.size(); }
29  int ig() const { return _ig; }
30 
31  bool getListOfChannels(std::vector<MEChannel*>&);
32  bool getListOfAncestors(std::vector<MEChannel*>&);
33  bool getListOfDescendants(std::vector<MEChannel*>&);
34  bool getListOfDescendants(int ig, std::vector<MEChannel*>&);
36  MEChannel* getDescendant(int ig, int ii);
37  MEChannel* getChannel(int ix, int iy);
38  MEChannel* getChannel(int ig, int ix, int iy);
39  MEChannel* getAncestor(int ig);
40 
41  void print(std::ostream& o, bool recursif = false) const;
42  TString oneLine(int ig);
43  TString oneLine() { return oneLine(_ig); }
44  TString oneWord(int ig);
45  TString oneWord() { return oneWord(_ig); }
46 
47 private:
48  // doubly-linked tree
50  std::vector<MEChannel*> _d;
51 
52  // granularity
53  int _ig;
54 
55  // (local) coordinates
56  int _ix;
57  int _iy;
58 
59  // defines a channel
60  std::vector<int> _id;
61 
62  MEChannel* addDaughter(int ix, int iy, int ii);
63 
64  // ClassDef(MEChannel,0) // MEChannel -- A channel or group of channels
65 };
66 
67 #endif
int _ix
Definition: MEChannel.h:56
MEChannel * getChannel(int ix, int iy)
Definition: MEChannel.cc:136
int ix() const
Definition: MEChannel.h:18
int id() const
Definition: MEChannel.cc:48
MEChannel * getDaughter(int ix, int iy, int ig)
Definition: MEChannel.cc:33
bool getListOfAncestors(std::vector< MEChannel *> &)
Definition: MEChannel.cc:62
MEChannel * getDescendant(int ig, int ii)
Definition: MEChannel.cc:103
int _ig
Definition: MEChannel.h:53
std::vector< MEChannel * > _d
Definition: MEChannel.h:50
unsigned n() const
Definition: MEChannel.h:28
void print(std::ostream &o, bool recursif=false) const
Definition: MEChannel.cc:152
int _iy
Definition: MEChannel.h:57
MEChannel * addDaughter(int ix, int iy, int ii)
Definition: MEChannel.cc:42
ii
Definition: cuy.py:589
MEChannel * m()
Definition: MEChannel.h:22
virtual ~MEChannel()
Definition: MEChannel.cc:27
TString oneLine()
Definition: MEChannel.h:43
TString oneWord()
Definition: MEChannel.h:45
int iy() const
Definition: MEChannel.h:19
int ig() const
Definition: MEChannel.h:29
MEChannel * getFirstDescendant(int ig)
Definition: MEChannel.cc:117
std::vector< int > _id
Definition: MEChannel.h:60
bool getListOfChannels(std::vector< MEChannel *> &)
Definition: MEChannel.cc:50
MEChannel * getAncestor(int ig)
Definition: MEChannel.cc:71
MEChannel * _m
Definition: MEChannel.h:49
MEChannel(int ix, int iy, int ii, MEChannel *mother)
Definition: MEChannel.cc:12
bool getListOfDescendants(std::vector< MEChannel *> &)
Definition: MEChannel.cc:85
MEChannel * d(unsigned ii)
Definition: MEChannel.h:23