CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RectangularPixelTopology.h
Go to the documentation of this file.
1 #ifndef Geometry_TrackerGeometryBuilder_RectangularPixelTopology_H
2 #define Geometry_TrackerGeometryBuilder_RectangularPixelTopology_H
3 
7 // Modified for the large pixels. Should work for barrel and forward.
8 // Danek Kotlinski & Michele Pioppi, 3/06.
9 // The bigger pixels are on the ROC boundries.
10 // For columns (Y direction, longer direction):
11 // the normal pixel are 150um long, big pixels are 300um long,
12 // the pixel index goes from 0 to 416 (or less for smaller modules)
13 // the big pixel are in 0, 52,104,156,208,260,312,363
14 // 51,103,155,207,259,311,363,415 .
15 // For rows (X direction, shorter direction):
16 // the normal pixel are 100um wide, big pixels are 200um wide,
17 // the pixel index goes from 0 to 159 (or less for smaller modules)
18 // the big pixel are in 79,80.
19 // The ROC has rows=80, cols=52.
20 // There are a lot of hardwired constants, sorry but this is a very
21 // specific class. For any other sensor design it has to be rewritten.
22 
23 // G. Giurgiu 11/27/06 ---------------------------------------------
24 // Check whether the pixel is at the edge of the module by adding the
25 // following functions (ixbin and iybin are the pixel row and column
26 // inside the module):
27 // bool isItEdgePixelInX (int ixbin)
28 // bool isItEdgePixelInY (int iybin)
29 // bool isItEdgePixel (int ixbin, int iybin)
30 // ------------------------------------------------------------------
31 // Add the individual measurement to local trasformations classes 01/07 d.k.
32 // ------------------------------------------------------------------
33 // Add big pixel flags for cluster range 15/3/07 V.Chiochia
34 
37 #include <iostream>
38 #include <iomanip>
39 
40 namespace {
41  const float EPS = 0.001; // accuray in pixel units, so about 0.1 um
42  const float EPSCM = 0.00001; // accuray in cm, so about 0.1 um
43  const bool TP_DEBUG = false; // print flag
44 }
45 
46 class RectangularPixelTopology GCC11_FINAL : public PixelTopology {
47  private:
48  // This is temporary before we find a better way
49  static const int ROWS_PER_ROC = 80; // Num of cols per ROC
50  static const int COLS_PER_ROC = 52; // Num of Rows per ROC
51  static const int BIG_PIX_PER_ROC_X = 1; // in x direction, rows
52  static const int BIG_PIX_PER_ROC_Y = 2; // in y direction, cols
53 
54 public:
55 
56  // Constructor, initilize
57  RectangularPixelTopology( int nrows, int ncols, float pitchx,
58  float pitchy) :
59  m_nrows(nrows), m_ncols(ncols),
60  m_pitchx(pitchx), m_pitchy(pitchy) {
61 
62  //using std::cout;
63  //using std::endl;
64 
65  // Calculate the edge of the active sensor with respect to the center,
66  // that is simply the half-size.
67  // Take into account large pixels
68  m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X*m_nrows/ROWS_PER_ROC)/2. *
69  m_pitchx;
70  m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y*m_ncols/COLS_PER_ROC)/2. *
71  m_pitchy;
72 
73  if(TP_DEBUG) std::cout<<" RectangularPixelTopology: "
74  <<m_nrows<<" "<<m_ncols<<" "
75  <<m_pitchx<<" "<<m_pitchy<<" "<<m_xoffset<<" "<<m_yoffset
77  <<ROWS_PER_ROC<<" "<<COLS_PER_ROC<<std::endl;
78  }
79 
80  // Topology interface, go from Masurement to Local corrdinates
81  // pixel coordinates (mp) -> cm (LocalPoint)
82  virtual LocalPoint localPosition( const MeasurementPoint& mp) const;
83 
84  // Transform LocalPoint to Measurement. Call pixel().
86  const {
87  std::pair<float,float> p = pixel(lp);
88  return MeasurementPoint( p.first, p.second);
89  }
90 
91  // PixelTopology interface.
92  // Transform LocalPoint in cm to measurement in pitch units.
93  virtual std::pair<float,float> pixel( const LocalPoint& p) const;
94 
95  // Errors
96  // Error in local (cm) from the masurement errors
97  virtual LocalError localError( const MeasurementPoint&,
98  const MeasurementError& ) const;
99  // Errors in pitch units from localpoint error (in cm)
101  const LocalError& ) const;
102 
103  //
104  // Transform LocalPoint to channel. Call pixel()
105  virtual int channel( const LocalPoint& lp) const {
106  std::pair<float,float> p = pixel(lp);
107  return PixelChannelIdentifier::pixelToChannel( int(p.first),
108  int(p.second));
109  }
110 
111 
112  // Transform measurement to local coordinates individually in each dimension
113  virtual float localX(const float mpX) const;
114  virtual float localY(const float mpY) const;
115 
116  //-------------------------------------------------------------
117  // Return the BIG pixel information for a given pixel
118  //
119  virtual bool isItBigPixelInX(const int ixbin) const {
120  return ( (ixbin == 79) || (ixbin == 80));
121  }
122  virtual bool isItBigPixelInY(const int iybin) const {
123  int iybin0 = iybin%52;
124  return ( (iybin0 == 0) || (iybin0 == 51));
125  }
126  //-------------------------------------------------------------
127  // Return BIG pixel flag in a given pixel range
128  //
129  bool containsBigPixelInX(const int& ixmin, const int& ixmax) const;
130  bool containsBigPixelInY(const int& iymin, const int& iymax) const;
131 
132 
133  // Check whether the pixel is at the edge of the module
134  bool isItEdgePixelInX (int ixbin) const {
135  return ( (ixbin == 0) || (ixbin == (m_nrows-1)) );
136  }
137  bool isItEdgePixelInY (int iybin) const {
138  return ( (iybin == 0) || (iybin == (m_ncols-1)) );
139  }
140  bool isItEdgePixel (int ixbin, int iybin) const {
141  return ( isItEdgePixelInX( ixbin ) || isItEdgePixelInY( iybin ) );
142  }
143 
144  //------------------------------------------------------------------
145  // Return pitch
146  virtual std::pair<float,float> pitch() const {
147  return std::pair<float,float>( float(m_pitchx), float(m_pitchy));
148  }
149  // Return number of rows
150  virtual int nrows() const {
151  return m_nrows;
152  }
153  // Return number of cols
154  virtual int ncolumns() const {
155  return m_ncols;
156  }
157 
158 private:
159  int m_nrows;
160  int m_ncols;
161  float m_pitchx;
162  float m_pitchy;
163  float m_xoffset;
164  float m_yoffset;
165 };
166 
167 #endif
168 
169 
virtual bool containsBigPixelInX(const int &ixmin, const int &ixmax) const =0
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
static const int COLS_PER_ROC
Definition: TrackUtils.cc:62
#define EPS
virtual MeasurementPoint measurementPosition(const LocalPoint &lp) const
static const int BIG_PIX_PER_ROC_Y
Definition: TrackUtils.cc:61
virtual bool isItBigPixelInX(const int ixbin) const
virtual bool isItBigPixelInY(const int iybin) const
static const int ROWS_PER_ROC
Definition: TrackUtils.cc:63
static const int BIG_PIX_PER_ROC_X
Definition: TrackUtils.cc:64
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual bool isItEdgePixelInX(int ixbin) const =0
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
virtual std::pair< float, float > pixel(const LocalPoint &p) const =0
#define TP_DEBUG
virtual bool containsBigPixelInY(const int &iymin, const int &iymax) const =0
virtual int channel(const LocalPoint &lp) const
virtual float localX(const float mpX) const =0
bool isItEdgePixelInY(int iybin) const
virtual LocalError localError(const MeasurementPoint &, const MeasurementError &) const =0
virtual int nrows() const
virtual int ncolumns() const
RectangularPixelTopology(int nrows, int ncols, float pitchx, float pitchy)
virtual bool isItEdgePixelInY(int iybin) const =0
static int pixelToChannel(int row, int col)
virtual std::pair< float, float > pitch() const
tuple cout
Definition: gather_cfg.py:121
bool isItEdgePixel(int ixbin, int iybin) const
bool isItEdgePixelInX(int ixbin) const
virtual float localY(const float mpY) const =0
Our base class.
Definition: SiPixelRecHit.h:22