CMS 3D CMS Logo

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