CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RPixChargeShare Class Reference

#include <RPixChargeShare.h>

Public Member Functions

 RPixChargeShare (const edm::ParameterSet &params, uint32_t det_id, const PPSPixelTopology &ppt)
 
std::map< unsigned short, double > Share (const std::vector< RPixSignalPoint > &charge_map, const PPSPixelTopology &ppt)
 

Private Attributes

double chargeMap2E_ [4][60][40]
 
std::string ChargeMapFile2E_ [4]
 
uint32_t det_id_
 
int no_of_pixels_
 
const int pxlColSize_ = pxlInd.getDefaultColDetSize()
 
CTPPSPixelIndices pxlInd
 
const int pxlRowSize_ = pxlInd.getDefaultRowDetSize()
 
std::vector< double > signalCoupling_
 
int verbosity_
 
const int xBinMax_ [4] = {29, 59, 29, 59}
 
const int yBinMax_ [4] = {19, 19, 39, 39}
 

Detailed Description

Definition at line 9 of file RPixChargeShare.h.

Constructor & Destructor Documentation

◆ RPixChargeShare()

RPixChargeShare::RPixChargeShare ( const edm::ParameterSet params,
uint32_t  det_id,
const PPSPixelTopology ppt 
)

Definition at line 6 of file RPixChargeShare.cc.

References chargeMap2E_, ChargeMapFile2E_, Exception, corrVsCorr::filename, PPSPixelTopology::getNoPixels(), mps_fire::i, createfilelist::int, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), no_of_pixels_, submitPVValidationJobs::params, signalCoupling_, AlCaHLTBitMon_QueryRunRegistry::string, verbosity_, and edmStreamStallGrapher::xUpper.

7  : det_id_(det_id) {
8  verbosity_ = params.getParameter<int>("RPixVerbosity");
9  signalCoupling_.clear();
10  ChargeMapFile2E_[0] = params.getParameter<std::string>("ChargeMapFile2E");
11  ChargeMapFile2E_[1] = params.getParameter<std::string>("ChargeMapFile2E_2X");
12  ChargeMapFile2E_[2] = params.getParameter<std::string>("ChargeMapFile2E_2Y");
13  ChargeMapFile2E_[3] = params.getParameter<std::string>("ChargeMapFile2E_2X2Y");
14 
15  double coupling_constant_ = params.getParameter<double>("RPixCoupling");
16 
17  signalCoupling_.push_back(coupling_constant_);
18  signalCoupling_.push_back((1.0 - coupling_constant_) / 2);
19 
20  no_of_pixels_ = ppt.getNoPixels();
21 
22  double xMap, yMap;
23  double chargeprobcollect;
24  int xUpper[] = {75, 150, 75, 150};
25  int yUpper[] = {50, 50, 100, 100};
26  int ix, iy;
27  for (int i = 0; i < 4; i++) {
29  std::ifstream fChargeMap(filename.fullPath().c_str());
30  if (fChargeMap.is_open()) {
31  while (fChargeMap >> xMap >> yMap >> chargeprobcollect) {
32  ix = int((xMap + xUpper[i]) / 5);
33  iy = int((yMap + yUpper[i]) / 5);
34  chargeMap2E_[i][ix][iy] = chargeprobcollect;
35  }
36  fChargeMap.close();
37  } else
38  throw cms::Exception("PPS RPixChargeShare") << "Charge map file not found";
39  }
40 }
unsigned short getNoPixels() const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
double chargeMap2E_[4][60][40]
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
std::vector< double > signalCoupling_
std::string ChargeMapFile2E_[4]

Member Function Documentation

◆ Share()

std::map< unsigned short, double > RPixChargeShare::Share ( const std::vector< RPixSignalPoint > &  charge_map,
const PPSPixelTopology ppt 
)

Definition at line 42 of file RPixChargeShare.cc.

References chargeMap2E_, det_id_, MillePedeFileConverter_cfg::e, PPSPixelTopology::PixelInfo::effFactor(), PPSPixelTopology::getNoPixelsSimX(), PPSPixelTopology::getNoPixelsSimY(), PPSPixelTopology::getPhysActiveEdgeDist(), PPSPixelTopology::getPitchSimX(), PPSPixelTopology::getPitchSimY(), PPSPixelTopology::getPixelsInvolved(), PPSPixelTopology::getSimXWidth(), PPSPixelTopology::getSimYWidth(), mps_fire::i, createfilelist::int, dqmdumpme::k, MainPageGenerator::l, visualization-live-secondInstance_cfg::m, PPSPixelTopology::PixelInfo::pixelColNo(), PPSPixelTopology::pixelIndex(), PPSPixelTopology::pixelRange(), PPSPixelTopology::PixelInfo::pixelRowNo(), funct::pow(), pxlColSize_, pxlRowSize_, signalCoupling_, mathSSE::sqrt(), verbosity_, xBinMax_, and yBinMax_.

43  {
44  std::map<unsigned short, double> thePixelChargeMap;
45  if (verbosity_ > 1)
46  edm::LogInfo("PPS") << "RPixChargeShare " << det_id_ << " : Clouds to be induced= " << charge_map.size();
47 
48  double cH = 0;
49 
50  for (std::vector<RPixSignalPoint>::const_iterator i = charge_map.begin(); i != charge_map.end(); ++i) {
51  double hit_pos_x, hit_pos_y;
52  // Used to avoid the abort due to hits out of detector
53  if (((*i).Position().x() + ppt.getSimXWidth() / 2.) < 0 ||
54  ((*i).Position().x() + ppt.getSimXWidth() / 2.) > ppt.getSimXWidth()) {
55  edm::LogInfo("PPS RPixChargeShare")
56  << "**** Attention ((*i).Position().x()+simX_width_/2.)<0||((*i).Position().x()+simX_width_/2.)>simX_width ";
57  edm::LogInfo("PPS RPixChargeShare") << "(*i).Position().x() = " << (*i).Position().x();
58  continue;
59  }
60  if (((*i).Position().y() + ppt.getSimYWidth() / 2.) < 0 ||
61  ((*i).Position().y() + ppt.getSimYWidth() / 2.) > ppt.getSimYWidth()) {
62  edm::LogInfo("PPS RPixChargeShare")
63  << "**** Attention ((*i).Position().y()+simY_width_/2.)<0||((*i).Position().y()+simY_width_/2.)>simY_width ";
64  edm::LogInfo("PPS RPixChargeShare") << "(*i).Position().y() = " << (*i).Position().y();
65  continue;
66  }
67 
68  PPSPixelTopology::PixelInfo relevant_pixels =
69  ppt.getPixelsInvolved((*i).Position().x(), (*i).Position().y(), (*i).Sigma(), hit_pos_x, hit_pos_y);
70  double effic = relevant_pixels.effFactor();
71  if (effic < 1.e-4)
72  continue;
73 
74  unsigned short pixel_no = ppt.pixelIndex(relevant_pixels);
75 
76  double charge_in_pixel = (*i).Charge() * effic;
77 
78  cH += charge_in_pixel;
79 
80  if (verbosity_ > 1)
81  edm::LogInfo("PPS RPixChargeShare ") << "Efficiency in detector " << det_id_ << " and pixel no " << pixel_no
82  << " : " << effic << " ch: " << charge_in_pixel << " CHtot: " << cH;
83 
84  if (signalCoupling_[0] == 0.) {
85  thePixelChargeMap[pixel_no] += charge_in_pixel;
86  } else {
87  int pixel_row = relevant_pixels.pixelRowNo();
88  int pixel_col = relevant_pixels.pixelColNo();
89  double pixel_lower_x = 0;
90  double pixel_lower_y = 0;
91  double pixel_upper_x = 0;
92  double pixel_upper_y = 0;
93  int psize = 0;
94  ppt.pixelRange(pixel_row, pixel_col, pixel_lower_x, pixel_upper_x, pixel_lower_y, pixel_upper_y);
95  double pixel_width_x = pixel_upper_x - pixel_lower_x;
96  double pixel_width_y = pixel_upper_y - pixel_lower_y;
97  double pixel_center_x = pixel_lower_x + (pixel_width_x) / 2.;
98  double pixel_center_y = pixel_lower_y + (pixel_width_y) / 2.;
99 
100  /*
101  First/last rows/columns are bigger due to sensor edges. 0.2mm is added to the pixel pitch but
102  only 0.15mm is considered sensitive.
103 The pixel size is standard (100x150) but the actual one is +200 and the sensitive +150.
104  Row 0: 100x150 -> 250x150 sensitive (lower x 50, higher x 300) but charge share only in 100x150 and
105  x center in lower_x + active_edge + pitch_x/2.
106  Row 159: 100x150 -> 250x150 sensitive (lower x 16300, higher x 16550) but charge share only in 100x150 and
107  x center in lower_x + pitch_x/2.
108 */
109  if (pixel_row == 0) {
110  pixel_width_x = ppt.getPitchSimX();
111  pixel_center_x = pixel_lower_x + ppt.getPhysActiveEdgeDist() + ppt.getPitchSimX() / 2.;
112  if (fabs((*i).Position().x() - pixel_center_x) > ppt.getPitchSimX() / 2.) {
113  thePixelChargeMap[pixel_no] += charge_in_pixel;
114  continue;
115  }
116  if (pixel_col == 0) {
117  pixel_width_y = ppt.getPitchSimY();
118  pixel_center_y = pixel_lower_y + ppt.getPhysActiveEdgeDist() + ppt.getPitchSimY() / 2.;
119  if (fabs((*i).Position().y() - pixel_center_y) > ppt.getPitchSimY() / 2.) {
120  thePixelChargeMap[pixel_no] += charge_in_pixel;
121  continue;
122  }
123  }
124  if (pixel_col == ppt.getNoPixelsSimY() - 1) {
125  pixel_width_y = ppt.getPitchSimY();
126  pixel_center_y = pixel_lower_y + ppt.getPitchSimY() / 2.;
127  if (fabs((*i).Position().y() - pixel_center_y) > ppt.getPitchSimY() / 2.) {
128  thePixelChargeMap[pixel_no] += charge_in_pixel;
129  continue;
130  }
131  }
132  }
133  if (pixel_row == ppt.getNoPixelsSimX() - 1) {
134  pixel_width_x = ppt.getPitchSimX();
135  pixel_center_x = pixel_lower_x + ppt.getPitchSimX() / 2.;
136  if (fabs((*i).Position().x() - pixel_center_x) > ppt.getPitchSimX() / 2.) {
137  thePixelChargeMap[pixel_no] += charge_in_pixel;
138  continue;
139  }
140  if (pixel_col == 0) {
141  pixel_width_y = ppt.getPitchSimY();
142  pixel_center_y = pixel_lower_y + ppt.getPhysActiveEdgeDist() + ppt.getPitchSimY() / 2.;
143  if (fabs((*i).Position().y() - pixel_center_y) > ppt.getPitchSimY() / 2.) {
144  thePixelChargeMap[pixel_no] += charge_in_pixel;
145  continue;
146  }
147  }
148  if (pixel_col == ppt.getNoPixelsSimY() - 1) {
149  pixel_width_y = ppt.getPitchSimY();
150  pixel_center_y = pixel_lower_y + ppt.getPitchSimY() / 2.;
151  if (fabs((*i).Position().y() - pixel_center_y) > ppt.getPitchSimY() / 2.) {
152  thePixelChargeMap[pixel_no] += charge_in_pixel;
153  continue;
154  }
155  }
156  }
157  if (pixel_col == 0) {
158  pixel_width_y = ppt.getPitchSimY();
159  pixel_center_y = pixel_lower_y + ppt.getPhysActiveEdgeDist() + ppt.getPitchSimY() / 2.;
160  if (fabs((*i).Position().y() - pixel_center_y) > ppt.getPitchSimY() / 2.) {
161  thePixelChargeMap[pixel_no] += charge_in_pixel;
162  continue;
163  }
164  }
165  if (pixel_col == ppt.getNoPixelsSimY() - 1) {
166  pixel_width_y = ppt.getPitchSimY();
167  pixel_center_y = pixel_lower_y + ppt.getPitchSimY() / 2.;
168  if (fabs((*i).Position().y() - pixel_center_y) > ppt.getPitchSimY() / 2.) {
169  thePixelChargeMap[pixel_no] += charge_in_pixel;
170  continue;
171  }
172  }
173 
174  // xbin and ybin are coordinates (um) inside the pixel as in the test beam, swapped wrt plane coordinates.
175  int xbin = int((((*i).Position().y() - pixel_center_y) + pixel_width_y / 2.) * 1.e3 / 5.);
176  int ybin = int((((*i).Position().x() - pixel_center_x) + pixel_width_x / 2.) * 1.e3 / 5.);
177  if (pixel_width_x < 0.11 && pixel_width_y < 0.151) { // pixel 100x150 um^2
178  psize = 0;
179  if (xbin > xBinMax_[psize] || ybin > yBinMax_[psize]) {
180  edm::LogError("PPS RPixChargeShare") << " Array index out of bounds 0";
181  continue;
182  }
183  }
184  if (pixel_width_x > 0.11 && pixel_width_y < 0.151) { // pixel 200x150 um^2
185  psize = 2;
186  if (xbin > xBinMax_[psize] || ybin > yBinMax_[psize]) {
187  edm::LogError("PPS RPixChargeShare") << " Array index out of bounds 2";
188  continue;
189  }
190  }
191  if (pixel_width_x < 0.11 && pixel_width_y > 0.151) { // pixel 100x300 um^2
192  psize = 1;
193  if (xbin > xBinMax_[psize] || ybin > yBinMax_[psize]) {
194  edm::LogError("PPS RPixChargeShare") << " Array index out of bounds 1";
195  continue;
196  }
197  }
198  if (pixel_width_x > 0.11 && pixel_width_y > 0.151) { // pixel 200x300 um^2
199  psize = 3;
200  if (xbin > xBinMax_[psize] || ybin > yBinMax_[psize]) {
201  edm::LogError("PPS RPixChargeShare") << " Array index out of bounds 3";
202  continue;
203  }
204  }
205  if (xbin < 0 || ybin < 0) {
206  edm::LogError("PPS RPixChargeShare") << " Negative array index xbin or ybin";
207  continue;
208  }
209  double hit2neighbour[8];
210  double collect_prob = chargeMap2E_[psize][xbin][ybin];
211  thePixelChargeMap[pixel_no] += charge_in_pixel * collect_prob;
212  unsigned short neighbour_no[8];
213  unsigned short m = 0;
214  double closer_neighbour = 0;
215  unsigned short closer_no = 0;
216  // Considering the 8 neighbours to share charge
217  for (int k = pixel_row - 1; k <= pixel_row + 1; k++) {
218  for (int l = pixel_col - 1; l <= pixel_col + 1; l++) {
219  if ((k < 0) || k > pxlRowSize_ - 1 || l < 0 || l > pxlColSize_ - 1)
220  continue;
221  if ((k == pixel_row) && (l == pixel_col))
222  continue;
223  double neighbour_pixel_lower_x = 0;
224  double neighbour_pixel_lower_y = 0;
225  double neighbour_pixel_upper_x = 0;
226  double neighbour_pixel_upper_y = 0;
227  double neighbour_pixel_center_x = 0;
228  double neighbour_pixel_center_y = 0;
229  // Check the hit approach to the neighbours
230  ppt.pixelRange(
231  k, l, neighbour_pixel_lower_x, neighbour_pixel_upper_x, neighbour_pixel_lower_y, neighbour_pixel_upper_y);
232  neighbour_pixel_center_x = neighbour_pixel_lower_x + (neighbour_pixel_upper_x - neighbour_pixel_lower_x) / 2.;
233  neighbour_pixel_center_y = neighbour_pixel_lower_y + (neighbour_pixel_upper_y - neighbour_pixel_lower_y) / 2.;
234  hit2neighbour[m] = sqrt(pow((*i).Position().x() - neighbour_pixel_center_x, 2.) +
235  pow((*i).Position().y() - neighbour_pixel_center_y, -2.));
236  neighbour_no[m] = l * pxlRowSize_ + k;
237  if (hit2neighbour[m] > closer_neighbour) {
238  closer_neighbour = hit2neighbour[m];
239  closer_no = neighbour_no[m];
240  }
241  m++;
242  }
243  }
244  double chargetransfereff = (1 - collect_prob) * signalCoupling_[0];
245  thePixelChargeMap[closer_no] += charge_in_pixel * chargetransfereff;
246  }
247  }
248 
249  return thePixelChargeMap;
250 }
const int xBinMax_[4]
unsigned short pixelColNo() const
double getPitchSimY() const
double getPitchSimX() const
Log< level::Error, false > LogError
const int yBinMax_[4]
T sqrt(T t)
Definition: SSEVec.h:23
double getSimXWidth() const
unsigned short getNoPixelsSimY() const
void pixelRange(unsigned int arow, unsigned int acol, double &lower_x, double &higher_x, double &lower_y, double &higher_y) const
Log< level::Info, false > LogInfo
unsigned short pixelRowNo() const
double chargeMap2E_[4][60][40]
const int pxlColSize_
unsigned short pixelIndex(PixelInfo pI) const
const int pxlRowSize_
PixelInfo getPixelsInvolved(double x, double y, double sigma, double &hit_pos_x, double &hit_pos_y) const
double getSimYWidth() const
unsigned short getNoPixelsSimX() const
std::vector< double > signalCoupling_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
double getPhysActiveEdgeDist() const

Member Data Documentation

◆ chargeMap2E_

double RPixChargeShare::chargeMap2E_[4][60][40]
private

Definition at line 25 of file RPixChargeShare.h.

Referenced by RPixChargeShare(), and Share().

◆ ChargeMapFile2E_

std::string RPixChargeShare::ChargeMapFile2E_[4]
private

Definition at line 24 of file RPixChargeShare.h.

Referenced by RPixChargeShare().

◆ det_id_

uint32_t RPixChargeShare::det_id_
private

Definition at line 15 of file RPixChargeShare.h.

Referenced by Share().

◆ no_of_pixels_

int RPixChargeShare::no_of_pixels_
private

Definition at line 20 of file RPixChargeShare.h.

Referenced by RPixChargeShare().

◆ pxlColSize_

const int RPixChargeShare::pxlColSize_ = pxlInd.getDefaultColDetSize()
private

Definition at line 19 of file RPixChargeShare.h.

Referenced by Share().

◆ pxlInd

CTPPSPixelIndices RPixChargeShare::pxlInd
private

Definition at line 17 of file RPixChargeShare.h.

◆ pxlRowSize_

const int RPixChargeShare::pxlRowSize_ = pxlInd.getDefaultRowDetSize()
private

Definition at line 18 of file RPixChargeShare.h.

Referenced by Share().

◆ signalCoupling_

std::vector<double> RPixChargeShare::signalCoupling_
private

Definition at line 16 of file RPixChargeShare.h.

Referenced by RPixChargeShare(), and Share().

◆ verbosity_

int RPixChargeShare::verbosity_
private

Definition at line 22 of file RPixChargeShare.h.

Referenced by RPixChargeShare(), and Share().

◆ xBinMax_

const int RPixChargeShare::xBinMax_[4] = {29, 59, 29, 59}
private

Definition at line 26 of file RPixChargeShare.h.

Referenced by Share().

◆ yBinMax_

const int RPixChargeShare::yBinMax_[4] = {19, 19, 39, 39}
private

Definition at line 27 of file RPixChargeShare.h.

Referenced by Share().