CMS 3D CMS Logo

PPSPixelTopology.cc
Go to the documentation of this file.
2 //#include <iostream>
3 
4 // Constructors
5 
7  : runType_(""),
8  pitch_simY_(0.),
9  pitch_simX_(0.),
10  thickness_(0.),
11  no_of_pixels_simX_(0.),
12  no_of_pixels_simY_(0.),
13  no_of_pixels_(0.),
14  simX_width_(0.),
15  simY_width_(0.),
16  dead_edge_width_(0.),
17  active_edge_sigma_(0.),
18  phys_active_edge_dist_(0.),
19  active_edge_x_(0.),
20  active_edge_y_(0.) {}
21 
22 // Destructor
24 
25 unsigned short PPSPixelTopology::pixelIndex(PixelInfo pI) const {
26  return no_of_pixels_simX_ * pI.pixelColNo() + pI.pixelRowNo();
27 }
28 
29 bool PPSPixelTopology::isPixelHit(float xLocalCoordinate, float yLocalCoordinate, bool is3x2 = true) const {
30  // check hit fiducial boundaries
31  double xModuleSize = 2 * ((no_of_pixels_simX_ / 2. + 1) * pitch_simX_ + dead_edge_width_);
32  if (xLocalCoordinate < -xModuleSize / 2. || xLocalCoordinate > xModuleSize / 2.)
33  return false;
34 
35  double yModuleSize = (no_of_pixels_simY_ + 4.) * pitch_simY_ + 2. * dead_edge_width_;
36  double y2x2top = no_of_pixels_simY_ / 6. * pitch_simY_ + dead_edge_width_;
37  if (is3x2 && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > yModuleSize / 2.))
38  return false;
39 
40  if (!is3x2 && (yLocalCoordinate < -yModuleSize / 2. || yLocalCoordinate > y2x2top))
41  return false;
42 
43  return true;
44 }
45 
47  double x, double y, double sigma, double& hit_pos_x, double& hit_pos_y) const {
48  //hit position wrt the bottom left corner of the sensor (-8.3, -12.2) in sensor view, rocs behind
49  hit_pos_x = x + simX_width_ / 2.;
50  hit_pos_y = y + simY_width_ / 2.;
51  if (!(hit_pos_x * hit_pos_y > 0))
52  throw cms::Exception("PPSPixelTopology") << "pixel out of reference frame";
53 
54  double hit_factor = activeEdgeFactor(x, y);
55 
56  unsigned int interested_row = row(x);
57  unsigned int interested_col = col(y);
58  double low_pixel_range_x, high_pixel_range_x, low_pixel_range_y, high_pixel_range_y;
59  pixelRange(
60  interested_row, interested_col, low_pixel_range_x, high_pixel_range_x, low_pixel_range_y, high_pixel_range_y);
61 
62  return PPSPixelTopology::PixelInfo(low_pixel_range_x,
63  high_pixel_range_x,
64  low_pixel_range_y,
65  high_pixel_range_y,
66  hit_factor,
67  interested_row,
68  interested_col);
69 }
70 
72  unsigned int arow, unsigned int acol, double& lower_x, double& higher_x, double& lower_y, double& higher_y) const {
73  // x and y in the system of Geant4 SIMULATION
74  arow = (2 * ROCSizeInX - 1) - arow;
75  if (arow > (2 * ROCSizeInX - 1) || acol > (3 * ROCSizeInY - 1))
76  throw cms::Exception("PPSPixelTopology") << "pixel rows or columns exceeding limits";
77 
78  // rows (x segmentation)
79  if (arow == 0) {
80  lower_x = dead_edge_width_ - phys_active_edge_dist_; // 50 um
81  higher_x = dead_edge_width_ + pitch_simX_; // 300 um
82  } else if (arow <= (ROCSizeInX - 2)) {
83  lower_x = dead_edge_width_ + arow * pitch_simX_;
84  higher_x = dead_edge_width_ + (arow + 1) * pitch_simX_;
85  } else if (arow == (ROCSizeInX - 1)) {
86  lower_x = dead_edge_width_ + arow * pitch_simX_;
87  higher_x = dead_edge_width_ + (arow + 2) * pitch_simX_;
88  } else if (arow == ROCSizeInX) {
89  lower_x = dead_edge_width_ + (arow + 1) * pitch_simX_;
90  higher_x = dead_edge_width_ + (arow + 3) * pitch_simX_;
91  } else if (arow <= (2 * ROCSizeInX - 2)) {
92  lower_x = dead_edge_width_ + (arow + 2) * pitch_simX_;
93  higher_x = dead_edge_width_ + (arow + 3) * pitch_simX_;
94  } else if (arow == (2 * ROCSizeInX - 1)) {
95  lower_x = dead_edge_width_ + (arow + 2) * pitch_simX_;
96  higher_x = dead_edge_width_ + (arow + 3) * pitch_simX_ + phys_active_edge_dist_;
97  }
98  // columns (y segmentation)
99  if (acol == 0) {
100  lower_y = dead_edge_width_ - phys_active_edge_dist_; // 50 um
101  higher_y = dead_edge_width_ + pitch_simY_; // 350 um
102  } else if (acol <= (ROCSizeInY - 2)) {
103  lower_y = dead_edge_width_ + acol * pitch_simY_;
104  higher_y = dead_edge_width_ + (acol + 1) * pitch_simY_;
105  } else if (acol == (ROCSizeInY - 1)) {
106  lower_y = dead_edge_width_ + acol * pitch_simY_;
107  higher_y = dead_edge_width_ + (acol + 2) * pitch_simY_;
108  } else if (acol == ROCSizeInY) {
109  lower_y = dead_edge_width_ + (acol + 1) * pitch_simY_;
110  higher_y = dead_edge_width_ + (acol + 3) * pitch_simY_;
111  } else if (acol <= (2 * ROCSizeInY - 2)) {
112  lower_y = dead_edge_width_ + (acol + 2) * pitch_simY_;
113  higher_y = dead_edge_width_ + (acol + 3) * pitch_simY_;
114  } else if (acol == (2 * ROCSizeInY - 1)) {
115  lower_y = dead_edge_width_ + (acol + 2) * pitch_simY_;
116  higher_y = dead_edge_width_ + (acol + 4) * pitch_simY_;
117  } else if (acol == (2 * ROCSizeInY)) {
118  lower_y = dead_edge_width_ + (acol + 3) * pitch_simY_;
119  higher_y = dead_edge_width_ + (acol + 5) * pitch_simY_;
120  } else if (acol <= (3 * ROCSizeInY - 2)) {
121  lower_y = dead_edge_width_ + (acol + 4) * pitch_simY_;
122  higher_y = dead_edge_width_ + (acol + 5) * pitch_simY_;
123  } else if (acol == (3 * ROCSizeInY - 1)) {
124  lower_y = dead_edge_width_ + (acol + 4) * pitch_simY_;
125  higher_y = dead_edge_width_ + (acol + 5) * pitch_simY_ + phys_active_edge_dist_;
126  }
127 
128  lower_x = lower_x - simX_width_ / 2.;
129  lower_y = lower_y - simY_width_ / 2.;
130  higher_x = higher_x - simX_width_ / 2.;
131  higher_y = higher_y - simY_width_ / 2.;
132 }
133 
134 double PPSPixelTopology::activeEdgeFactor(double x, double y) const {
135  const double inv_sigma = 1. / active_edge_sigma_; // precaching
136  const double topEdgeFactor = std::erf(-distanceFromTopActiveEdge(x, y) * inv_sigma) * 0.5 + 0.5;
137  const double bottomEdgeFactor = std::erf(-distanceFromBottomActiveEdge(x, y) * inv_sigma) * 0.5 + 0.5;
138  const double rightEdgeFactor = std::erf(-distanceFromRightActiveEdge(x, y) * inv_sigma) * 0.5 + 0.5;
139  const double leftEdgeFactor = std::erf(-distanceFromLeftActiveEdge(x, y) * inv_sigma) * 0.5 + 0.5;
140 
141  const double aEF = topEdgeFactor * bottomEdgeFactor * rightEdgeFactor * leftEdgeFactor;
142 
143  if (aEF > 1.)
144  throw cms::Exception("PPSPixelTopology") << " pixel active edge factor > 1";
145 
146  return aEF;
147 }
148 
149 double PPSPixelTopology::distanceFromTopActiveEdge(double x, double y) const { return (y - active_edge_y_); }
150 double PPSPixelTopology::distanceFromBottomActiveEdge(double x, double y) const { return (-y - active_edge_y_); }
151 double PPSPixelTopology::distanceFromRightActiveEdge(double x, double y) const { return (x - active_edge_x_); }
152 double PPSPixelTopology::distanceFromLeftActiveEdge(double x, double y) const { return (-x - active_edge_x_); }
153 
154 unsigned int PPSPixelTopology::row(double x) const {
155  // x in the G4 simulation system
156  x = x + simX_width_ / 2.;
157 
158  // now x in the system centered in the bottom left corner of the sensor (sensor view, rocs behind)
159  if (x < 0. || x > simX_width_)
160  throw cms::Exception("PPSPixelTopology") << " pixel out of reference frame";
161 
162  // rows (x segmentation)
163  unsigned int arow;
164  if (x <= (dead_edge_width_ + pitch_simX_))
165  arow = 0;
166  else if (x <= (dead_edge_width_ + (ROCSizeInX - 1) * pitch_simX_))
167  arow = int((x - dead_edge_width_ - pitch_simX_) / pitch_simX_) + 1;
168  else if (x <= (dead_edge_width_ + (ROCSizeInX + 1) * pitch_simX_))
169  arow = (ROCSizeInX - 1);
170  else if (x <= (dead_edge_width_ + (ROCSizeInX + 3) * pitch_simX_))
171  arow = ROCSizeInX;
172  else if (x <= (dead_edge_width_ + (2 * ROCSizeInX + 2) * pitch_simX_))
173  arow = int((x - dead_edge_width_ - pitch_simX_) / pitch_simX_) - 1;
174  else
175  arow = (2 * ROCSizeInX - 1);
176 
177  arow = (2 * ROCSizeInX - 1) - arow;
178  if (arow > (2 * ROCSizeInX - 1))
179  throw cms::Exception("PPSPixelTopology") << " pixel row number exceeding limit";
180 
181  return arow;
182 }
183 
184 unsigned int PPSPixelTopology::col(double y) const {
185  // y in the G4 simulation system
186  unsigned int column;
187 
188  // columns (y segmentation)
189  // now y in the system centered in the bottom left corner of the sensor (sensor view, rocs behind)
190  y = y + simY_width_ / 2.;
191  if (y < 0. || y > simY_width_)
192  throw cms::Exception("PPSPixelTopology") << "pixel out of reference frame";
193 
194  if (y <= (dead_edge_width_ + pitch_simY_))
195  column = 0;
196  else if (y <= (dead_edge_width_ + (ROCSizeInY - 1) * pitch_simY_))
197  column = int((y - dead_edge_width_ - pitch_simY_) / pitch_simY_) + 1;
198  else if (y <= (dead_edge_width_ + (ROCSizeInY + 1) * pitch_simY_))
199  column = ROCSizeInY - 1;
200  else if (y <= (dead_edge_width_ + (ROCSizeInY + 3) * pitch_simY_))
201  column = ROCSizeInY;
202  else if (y <= (dead_edge_width_ + (2 * ROCSizeInY + 1) * pitch_simY_))
203  column = int((y - dead_edge_width_ - pitch_simY_) / pitch_simY_) - 1;
204  else if (y <= (dead_edge_width_ + (2 * ROCSizeInY + 3) * pitch_simY_))
205  column = 2 * ROCSizeInY - 1;
206  else if (y <= (dead_edge_width_ + (2 * ROCSizeInY + 5) * pitch_simY_))
207  column = 2 * ROCSizeInY;
208  else if (y <= (dead_edge_width_ + (3 * ROCSizeInY + 3) * pitch_simY_))
209  column = int((y - dead_edge_width_ - pitch_simY_) / pitch_simY_) - 3;
210  else
211  column = (3 * ROCSizeInY - 1);
212 
213  return column;
214 }
215 
216 void PPSPixelTopology::rowCol2Index(unsigned int arow, unsigned int acol, unsigned int& index) const {
217  index = acol * no_of_pixels_simX_ + arow;
218 }
219 
220 void PPSPixelTopology::index2RowCol(unsigned int& arow, unsigned int& acol, unsigned int index) const {
221  acol = index / no_of_pixels_simX_;
222  arow = index % no_of_pixels_simX_;
223 }
224 
225 // Getters
226 
228 double PPSPixelTopology::getPitchSimY() const { return pitch_simY_; }
229 double PPSPixelTopology::getPitchSimX() const { return pitch_simX_; }
230 double PPSPixelTopology::getThickness() const { return thickness_; }
231 unsigned short PPSPixelTopology::getNoPixelsSimX() const { return no_of_pixels_simX_; }
232 unsigned short PPSPixelTopology::getNoPixelsSimY() const { return no_of_pixels_simY_; }
233 unsigned short PPSPixelTopology::getNoPixels() const { return no_of_pixels_; }
234 double PPSPixelTopology::getSimXWidth() const { return simX_width_; }
235 double PPSPixelTopology::getSimYWidth() const { return simY_width_; }
241 
242 // Setters
243 
245 void PPSPixelTopology::setPitchSimY(double psy) { pitch_simY_ = psy; }
246 void PPSPixelTopology::setPitchSimX(double psx) { pitch_simX_ = psx; }
247 void PPSPixelTopology::setThickness(double tss) { thickness_ = tss; }
248 void PPSPixelTopology::setNoPixelsSimX(unsigned short npx) { no_of_pixels_simX_ = npx; }
249 void PPSPixelTopology::setNoPixelsSimY(unsigned short npy) { no_of_pixels_simY_ = npy; }
251 void PPSPixelTopology::setSimXWidth(double sxw) { simX_width_ = sxw; }
252 void PPSPixelTopology::setSimYWidth(double syw) { simY_width_ = syw; }
258 
259 void PPSPixelTopology::printInfo(std::stringstream& s) {
260  s << "\n PPS Topology parameters : \n"
261  << "\n runType_ = " << runType_ << "\n pitch_simY_ = " << pitch_simY_ << "\n pitch_simX_ = " << pitch_simX_
262  << "\n thickness_ = " << thickness_ << "\n no_of_pixels_simX_ " << no_of_pixels_simX_
263  << "\n no_of_pixels_simY_ " << no_of_pixels_simY_ << "\n no_of_pixels_ " << no_of_pixels_ << "\n simX_width_ "
264  << simX_width_ << "\n simY_width_ " << simY_width_ << "\n dead_edge_width_ " << dead_edge_width_
265  << "\n active_edge_sigma_ " << active_edge_sigma_ << "\n phys_active_edge_dist_ " << phys_active_edge_dist_
266 
267  << "\n active_edge_x_ " << active_edge_x_ << "\n active_edge_y_ " << active_edge_y_
268 
269  << std::endl;
270 }
271 
272 std::ostream& operator<<(std::ostream& os, PPSPixelTopology info) {
273  std::stringstream ss;
274  info.printInfo(ss);
275  os << ss.str();
276  return os;
277 }
PPSPixelTopology::pixelIndex
unsigned short pixelIndex(PixelInfo pI) const
Definition: PPSPixelTopology.cc:25
PPSPixelTopology::getNoPixels
unsigned short getNoPixels() const
Definition: PPSPixelTopology.cc:233
PPSPixelTopology.h
DDAxes::y
PPSPixelTopology::getSimXWidth
double getSimXWidth() const
Definition: PPSPixelTopology.cc:234
PPSPixelTopology::PixelInfo
Definition: PPSPixelTopology.h:29
PPSPixelTopology::distanceFromLeftActiveEdge
double distanceFromLeftActiveEdge(double x, double y) const
Definition: PPSPixelTopology.cc:152
PPSPixelTopology::getNoPixelsSimY
unsigned short getNoPixelsSimY() const
Definition: PPSPixelTopology.cc:232
PPSPixelTopology::PixelInfo::pixelColNo
unsigned short pixelColNo() const
Definition: PPSPixelTopology.h:55
PPSPixelTopology::active_edge_sigma_
double active_edge_sigma_
Definition: PPSPixelTopology.h:139
PPSPixelTopology::getActiveEdgeY
double getActiveEdgeY() const
Definition: PPSPixelTopology.cc:240
PPSPixelTopology::pitch_simX_
double pitch_simX_
Definition: PPSPixelTopology.h:131
PPSPixelTopology::setNoPixelsSimX
void setNoPixelsSimX(unsigned short npx)
Definition: PPSPixelTopology.cc:248
hcal_runs.rt
rt
Definition: hcal_runs.py:76
np
int np
Definition: AMPTWrapper.h:43
PPSPixelTopology::getSimYWidth
double getSimYWidth() const
Definition: PPSPixelTopology.cc:235
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
PPSPixelTopology::setPhysActiveEdgeDist
void setPhysActiveEdgeDist(double pae)
Definition: PPSPixelTopology.cc:255
DDAxes::x
PPSPixelTopology::setNoPixels
void setNoPixels(unsigned short np)
Definition: PPSPixelTopology.cc:250
PPSPixelTopology::getNoPixelsSimX
unsigned short getNoPixelsSimX() const
Definition: PPSPixelTopology.cc:231
PPSPixelTopology::phys_active_edge_dist_
double phys_active_edge_dist_
Definition: PPSPixelTopology.h:140
PPSPixelTopology::setNoPixelsSimY
void setNoPixelsSimY(unsigned short npy)
Definition: PPSPixelTopology.cc:249
PPSPixelTopology::pixelRange
void pixelRange(unsigned int arow, unsigned int acol, double &lower_x, double &higher_x, double &lower_y, double &higher_y) const
Definition: PPSPixelTopology.cc:71
PPSPixelTopology::no_of_pixels_simY_
unsigned short no_of_pixels_simY_
Definition: PPSPixelTopology.h:134
PPSPixelTopology::printInfo
void printInfo(std::stringstream &s)
Definition: PPSPixelTopology.cc:259
PPSPixelTopology::index2RowCol
void index2RowCol(unsigned int &arow, unsigned int &acol, unsigned int index) const
Definition: PPSPixelTopology.cc:220
PPSPixelTopology::runType_
std::string runType_
Definition: PPSPixelTopology.h:129
PPSPixelTopology::getRunType
std::string getRunType() const
Definition: PPSPixelTopology.cc:227
PPSPixelTopology::simX_width_
double simX_width_
Definition: PPSPixelTopology.h:136
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
PPSPixelTopology::setActiveEdgeSigma
void setActiveEdgeSigma(double aes)
Definition: PPSPixelTopology.cc:254
PPSPixelTopology::rowCol2Index
void rowCol2Index(unsigned int arow, unsigned int acol, unsigned int &index) const
Definition: PPSPixelTopology.cc:216
PPSPixelTopology::PPSPixelTopology
PPSPixelTopology()
Definition: PPSPixelTopology.cc:6
alignCSCRings.s
s
Definition: alignCSCRings.py:92
PPSPixelTopology::setSimXWidth
void setSimXWidth(double sxw)
Definition: PPSPixelTopology.cc:251
PPSPixelTopology::getPixelsInvolved
PixelInfo getPixelsInvolved(double x, double y, double sigma, double &hit_pos_x, double &hit_pos_y) const
Definition: PPSPixelTopology.cc:46
PPSPixelTopology::active_edge_y_
double active_edge_y_
Definition: PPSPixelTopology.h:143
PPSPixelTopology::distanceFromTopActiveEdge
double distanceFromTopActiveEdge(double x, double y) const
Definition: PPSPixelTopology.cc:149
PPSPixelTopology::getThickness
double getThickness() const
Definition: PPSPixelTopology.cc:230
PPSPixelTopology::setPitchSimY
void setPitchSimY(double psy)
Definition: PPSPixelTopology.cc:245
PPSPixelTopology::dead_edge_width_
double dead_edge_width_
Definition: PPSPixelTopology.h:138
operator<<
std::ostream & operator<<(std::ostream &os, PPSPixelTopology info)
Definition: PPSPixelTopology.cc:272
PPSPixelTopology::no_of_pixels_
unsigned short no_of_pixels_
Definition: PPSPixelTopology.h:135
PPSPixelTopology::thickness_
double thickness_
Definition: PPSPixelTopology.h:132
PPSPixelTopology::setThickness
void setThickness(double tss)
Definition: PPSPixelTopology.cc:247
PPSPixelTopology::getPitchSimY
double getPitchSimY() const
Definition: PPSPixelTopology.cc:228
PPSPixelTopology::getPhysActiveEdgeDist
double getPhysActiveEdgeDist() const
Definition: PPSPixelTopology.cc:238
createfilelist.int
int
Definition: createfilelist.py:10
PPSPixelTopology::distanceFromBottomActiveEdge
double distanceFromBottomActiveEdge(double x, double y) const
Definition: PPSPixelTopology.cc:150
PPSPixelTopology::getDeadEdgeWidth
double getDeadEdgeWidth() const
Definition: PPSPixelTopology.cc:236
PPSPixelTopology
Definition: PPSPixelTopology.h:22
PPSPixelTopology::PixelInfo::pixelRowNo
unsigned short pixelRowNo() const
Definition: PPSPixelTopology.h:54
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PPSPixelTopology::col
unsigned int col(double y) const
Definition: PPSPixelTopology.cc:184
PPSPixelTopology::getPitchSimX
double getPitchSimX() const
Definition: PPSPixelTopology.cc:229
PPSPixelTopology::setActiveEdgeY
void setActiveEdgeY(double aey)
Definition: PPSPixelTopology.cc:257
PPSPixelTopology::setDeadEdgeWidth
void setDeadEdgeWidth(double dew)
Definition: PPSPixelTopology.cc:253
Exception
Definition: hltDiff.cc:245
genVertex_cff.x
x
Definition: genVertex_cff.py:13
PPSPixelTopology::distanceFromRightActiveEdge
double distanceFromRightActiveEdge(double x, double y) const
Definition: PPSPixelTopology.cc:151
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
PPSPixelTopology::row
unsigned int row(double x) const
Definition: PPSPixelTopology.cc:154
PPSPixelTopology::simY_width_
double simY_width_
Definition: PPSPixelTopology.h:137
PPSPixelTopology::~PPSPixelTopology
~PPSPixelTopology()
Definition: PPSPixelTopology.cc:23
PPSPixelTopology::setActiveEdgeX
void setActiveEdgeX(double aex)
Definition: PPSPixelTopology.cc:256
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
cms::Exception
Definition: Exception.h:70
PPSPixelTopology::no_of_pixels_simX_
unsigned short no_of_pixels_simX_
Definition: PPSPixelTopology.h:133
PPSPixelTopology::getActiveEdgeX
double getActiveEdgeX() const
Definition: PPSPixelTopology.cc:239
PPSPixelTopology::getActiveEdgeSigma
double getActiveEdgeSigma() const
Definition: PPSPixelTopology.cc:237
PPSPixelTopology::isPixelHit
bool isPixelHit(float xLocalCoordinate, float yLocalCoordinate, bool is3x2) const
Definition: PPSPixelTopology.cc:29
PPSPixelTopology::setSimYWidth
void setSimYWidth(double syw)
Definition: PPSPixelTopology.cc:252
PPSPixelTopology::setPitchSimX
void setPitchSimX(double psx)
Definition: PPSPixelTopology.cc:246
PPSPixelTopology::activeEdgeFactor
double activeEdgeFactor(double x, double y) const
Definition: PPSPixelTopology.cc:134
PPSPixelTopology::active_edge_x_
double active_edge_x_
Definition: PPSPixelTopology.h:142
PPSPixelTopology::setRunType
void setRunType(std::string rt)
Definition: PPSPixelTopology.cc:244
PPSPixelTopology::pitch_simY_
double pitch_simY_
Definition: PPSPixelTopology.h:130