CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Geom.h
Go to the documentation of this file.
1 // H4Geom.h
2 //
3 // Class which manages geometry information of the super-module
4 //
5 // last change : $Date: 2010/10/21 17:33:47 $
6 // by : $Author: wmtan $
7 //
8 
9 #ifndef H4Geom_H
10 #define H4Geom_H
11 
12 
13 #include <string>
14 
15 class H4Geom
16 {
17  public:
18  // Geometry is period dependent. The different geometries are listed below
19  enum GeomPeriod_t {
20  Undef, // Cause the program to crash
21  Year2003, // Test beam during 2003: SM0 and SM1
22  Spring2004, // June-July 2004: E0' tests
23  Automn2004 // Tests of one full supermodule
24  };
25 
26  // Constants defining supermodule geometry
27  enum SMGeom_t {
28  kSModulesInEcal = 36, // Number of Super Modules in whole ECAL
29  kModules = 4, // Number of modules per supermodule
30  kTriggerTowers = 68, // Number of trigger towers per supermodule
31  kTTandMems = 70, // Number of tt per supermodule, including MEM boxes
32  kTowersInPhi = 4, // Number of trigger towers in phi
33  kTowersInEta = 17, // Number of trigger towers in eta
34  kCrystals = 1700, // Number of crystals per supermodule
35  kCrystalsWithMems = 1750, // Number of channels per supermodule, mem included
36  kCrystalsM1 = 500, // Number of crystals per supermodule
37  kCrystalsM2 = 400, // Number of crystals per supermodule
38  kCrystalsM3 = 400, // Number of crystals per supermodule
39  kCrystalsM4 = 400, // Number of crystals per supermodule
40  kCrystalsInPhi = 20, // Number of crystals in phi
41  kCrystalsInEta = 85, // Number of crystals in eta
42  kCrystalsInEtaM1 = 25, // Number of crystals in eta for module 1
43  kCrystalsInEtaM2 = 20, // Number of crystals in eta for module 2
44  kCrystalsInEtaM3 = 20, // Number of crystals in eta for module 3
45  kCrystalsInEtaM4 = 20, // Number of crystals in eta for module 4
46  kCrystalsPerTower = 25, // Number of crystals per trigger tower
47  kCardsPerTower = 5, // Number of VFE cards per trigger tower
48  kChannelsPerCard = 5, // Number of channels per VFE card
49  kSamplesInEvent = 10, // Number of samples in event
50  kSamplesInPNEvent = 50, // Number of samples in event
51  kPNs = 10 // number of pn diode for laser monitoring (number [0,9])
52  };
53 
54  // Default Constructor, mainly for Root
55  H4Geom() ;
56 
57  // Destructor: Does nothing?
58  virtual ~H4Geom();
59 
60  // Initialize geometry with config file
61  bool init();
62 
63  // Retuns the crystal number in the super module for a given
64  // tower number in the super module and crystal number in the tower
65  int getSMCrystalNumber(int tower, int crystal) const ;
66 
67  // Retuns the crystal number in the super module for a given
68  // tower number, strip_id number and crystal_id number
69  // necessary for output of the data-parser, Ecal Monitoring
70  int getSMCrystalNumber(int tower, int strip_id, int crystal_id) const ;
71 
72  // Retuns the tower number, strip_id number and crystal_id number
73  // for a given crystal in the SM numbering
74  // This is the inverse of int getSMCrystalNumber(int tower, int strip_id, int crystal_id) const ;
75  void getTowerStripChannelNumber(int& tower, int& strip_id, int& crystal_id, int sm_num) const;
76 
77  // Retuns the crystal number in a tower for a given
78  // crystal number in the super module
79  void getTowerCrystalNumber(int &tower, int &crystal, int smCrystal) const ;
80 
81  // Returns the crystal number (readout order) in a tower
82  // for a given position in the tower (crystalNbGeom=0 is the
83  // lower-right corner and crystalNbGeom=24 is the upper-left corner)
84  int getTowerCrystalNumber(int smTowerNb, int crystalNbGeom) const ;
85 
86  // Returns the crystal coordinates (eta, phi index) for a given
87  // crystal number in the super module
88  void getCrystalCoord(int &eta, int &phi, int smCrystal) const ;
89 
90  // Retuns the crystal number in the super module for given coordinates
91  int getSMCrystalFromCoord(int eta, int phi) const ;
92 
93  // Returns left neighbour of a sm crystal.
94  // Input and output are crystal numbers in the super module.
95  // A negative output means outside of the supermodule.
96  int getLeft(int smCrystal) const ;
97 
98  // Returns right neighbour of a sm crystal.
99  // Input and output are crystal numbers in the super module.
100  // A negative output means outside of the supermodule.
101  int getRight(int smCrystal) const ;
102 
103  // Returns upper neighbour of a sm crystal.
104  // Input and output are crystal numbers in the super module.
105  // A negative output means outside of the supermodule.
106  int getUpper(int smCrystal) const ;
107 
108  // Returns lower neighbour of a sm crystal.
109  // Input and output are crystal numbers in the super module.
110  // A negative output means outside of the supermodule.
111  int getLower(int smCrystal) const ;
112 
113  // Returns left neighbour of a crystal referenced by its coordinates.
114  // New coordonates overwrite the old ones. No check is done to see
115  // if it corresponds to a real crystal. To be used with caution.
116  void mvLeft(int &eta, int &phi) const ;
117 
118  // Returns right neighbour of a crystal referenced by its coordinates.
119  // New coordonates overwrite the old ones. No check is done to see
120  // if it corresponds to a real crystal. To be used with caution.
121  void mvRight(int &eta, int &phi) const ;
122 
123  // Returns upper neighbour of a crystal referenced by its coordinates.
124  // New coordonates overwrite the old ones. No check is done to see
125  // if it corresponds to a real crystal. To be used with caution.
126  void mvUp(int &eta, int &phi) const ;
127 
128 
129  // Returns lower neighbour of a crystal referenced by its coordinates.
130  // New coordonates overwrite the old ones. No check is done to see
131  // if it corresponds to a real crystal. To be used with caution.
132  void mvDown(int &eta, int &phi) const ;
133 
134  // Returns the 25 crystals of tower towerNb in the super module.
135  // Output are crystal numbers in the super module.
136  // By default, the order in the output array (tower) corresponds to
137  // geometric order (index 0 is lower-right corner).
138  // if order=readout, the order in the output array (tower)
139  // corresponds to the readout scheme (depends on the kind of tower)
140  void getTower(int * tower, int towerNb, std::string order = "geom") const ;
141 
142  // Returns the 5 crystals belonging to the same VFE board as smCrystal.
143  // Input and output are crystal numbers in the super module.
144  // By default, the order in the output array (VFE) corresponds to
145  // The geometric order (index 0 is lower-right corner).
146  // if order=readout, the order in the output array (VFE)
147  // corresponds to the readout scheme (depends on the kind of tower)
148  void getVFE(int * VFE, int smCrystal, std::string order = "geom") const ;
149 
150  // Returns sm crystal numbers for crystals in a window of
151  // size widthxheight centered around a given smCrystal.
152  // width and height must be odd.
153  // The order in the output array (window) is defined
154  // by the geometric order (index 0 is lower-right corner).
155  void getWindow(int * window, int smCrystal, int width, int height) const ;
156 
157  // Tests if low voltage board is on the right size of the tower.
158  // Readout scheme depends on that.
159  bool rightTower(int tower) const ;
160 
161  // Tests if low voltage board is on the left size of the tower
162  // Readout scheme depends on that.
163  bool leftTower(int tower) const ;
164 
165  // first half of SM, shown by one laser shot
166  bool isInFirstHalf(int numberInSM)
167  {
168  int eta; int phi;
169  getCrystalCoord(eta,phi, numberInSM);
170  if (phi > 19 || eta < 20 )
171  {return true; }
172  else
173  {return false; }
174  };
175 
176 
178 
179  static void SetGeomPeriod(GeomPeriod_t geometry);
180 
181  int getHalf(int TT);
182  private:
183  bool IsGeomPeriodDefined() const;
184 
185  const static int crystalChannelMap[5][5];
186  const static int crystalMap[25];
187  const static int WhichHalf[69];
189 };
190 
191 #endif
def window
Definition: svgfig.py:642
int getSMCrystalFromCoord(int eta, int phi) const
int getLower(int smCrystal) const
int getHalf(int TT)
bool IsGeomPeriodDefined() const
virtual ~H4Geom()
void mvDown(int &eta, int &phi) const
bool rightTower(int tower) const
bool init()
void getCrystalCoord(int &eta, int &phi, int smCrystal) const
T eta() const
int getSMCrystalNumber(int tower, int crystal) const
void getTower(int *tower, int towerNb, std::string order="geom") const
void getTowerStripChannelNumber(int &tower, int &strip_id, int &crystal_id, int sm_num) const
SMGeom_t
Definition: Geom.h:27
int getRight(int smCrystal) const
static const int crystalMap[25]
Definition: Geom.h:186
GeomPeriod_t
Definition: Geom.h:19
static const int WhichHalf[69]
Definition: Geom.h:187
int getLeft(int smCrystal) const
bool isInFirstHalf(int numberInSM)
Definition: Geom.h:166
int getUpper(int smCrystal) const
Definition: Geom.h:15
GeomPeriod_t GetGeomPeriod() const
Definition: Geom.h:177
bool leftTower(int tower) const
void mvRight(int &eta, int &phi) const
static GeomPeriod_t geometry_
Definition: Geom.h:188
void getVFE(int *VFE, int smCrystal, std::string order="geom") const
ESHandle< TrackerGeometry > geometry
void getWindow(int *window, int smCrystal, int width, int height) const
void mvUp(int &eta, int &phi) const
void mvLeft(int &eta, int &phi) const
static const int crystalChannelMap[5][5]
Definition: Geom.h:185
void getTowerCrystalNumber(int &tower, int &crystal, int smCrystal) const
static void SetGeomPeriod(GeomPeriod_t geometry)
Definition: DDAxes.h:10