15 double coupling_constant_ =
params.getParameter<
double>(
"RPixCoupling");
23 double chargeprobcollect;
24 int xUpper[] = {75, 150, 75, 150};
25 int yUpper[] = {50, 50, 100, 100};
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) {
33 iy =
int((yMap + yUpper[
i]) / 5);
38 throw cms::Exception(
"PPS RPixChargeShare") <<
"Charge map file not found";
44 std::map<unsigned short, double> thePixelChargeMap;
46 edm::LogInfo(
"PPS") <<
"RPixChargeShare " <<
det_id_ <<
" : Clouds to be induced= " << charge_map.size();
50 for (std::vector<RPixSignalPoint>::const_iterator
i = charge_map.begin();
i != charge_map.end(); ++
i) {
51 double hit_pos_x, hit_pos_y;
53 if (((*i).Position().x() + ppt.
getSimXWidth() / 2.) < 0 ||
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();
60 if (((*i).Position().y() + ppt.
getSimYWidth() / 2.) < 0 ||
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();
69 ppt.
getPixelsInvolved((*i).Position().x(), (*i).Position().y(), (*i).Sigma(), hit_pos_x, hit_pos_y);
70 double effic = relevant_pixels.
effFactor();
74 unsigned short pixel_no = ppt.
pixelIndex(relevant_pixels);
76 double charge_in_pixel = (*i).Charge() * effic;
78 cH += charge_in_pixel;
81 edm::LogInfo(
"PPS RPixChargeShare ") <<
"Efficiency in detector " <<
det_id_ <<
" and pixel no " << pixel_no
82 <<
" : " << effic <<
" ch: " << charge_in_pixel <<
" CHtot: " << cH;
85 thePixelChargeMap[pixel_no] += charge_in_pixel;
89 double pixel_lower_x = 0;
90 double pixel_lower_y = 0;
91 double pixel_upper_x = 0;
92 double pixel_upper_y = 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.;
100 int xbin =
int((((*i).Position().y() - pixel_center_y) + pixel_width_y / 2.) * 1.e3 / 5.);
101 int ybin =
int((((*i).Position().x() - pixel_center_x) + pixel_width_x / 2.) * 1.e3 / 5.);
102 if (pixel_width_x < 0.11 && pixel_width_y < 0.151) {
105 edm::LogError(
"PPS RPixChargeShare") <<
" Array index out of bounds";
109 if (pixel_width_x > 0.11 && pixel_width_y < 0.151) {
112 edm::LogError(
"PPS RPixChargeShare") <<
" Array index out of bounds";
116 if (pixel_width_x < 0.11 && pixel_width_y > 0.151) {
119 edm::LogError(
"PPS RPixChargeShare") <<
" Array index out of bounds";
123 if (pixel_width_x > 0.11 && pixel_width_y > 0.151) {
126 edm::LogError(
"PPS RPixChargeShare") <<
" Array index out of bounds";
130 if (xbin < 0 || ybin < 0) {
131 edm::LogError(
"PPS RPixChargeShare") <<
" Negative array index xbin or ybin";
134 double hit2neighbour[8];
136 thePixelChargeMap[pixel_no] += charge_in_pixel * collect_prob;
137 unsigned short neighbour_no[8];
138 unsigned short m = 0;
139 double closer_neighbour = 0;
140 unsigned short closer_no = 0;
142 for (
int k = pixel_row - 1;
k <= pixel_row + 1;
k++) {
143 for (
int l = pixel_col - 1;
l <= pixel_col + 1;
l++) {
146 if ((
k == pixel_row) && (
l == pixel_col))
148 double neighbour_pixel_lower_x = 0;
149 double neighbour_pixel_lower_y = 0;
150 double neighbour_pixel_upper_x = 0;
151 double neighbour_pixel_upper_y = 0;
152 double neighbour_pixel_center_x = 0;
153 double neighbour_pixel_center_y = 0;
156 k,
l, neighbour_pixel_lower_x, neighbour_pixel_upper_x, neighbour_pixel_lower_y, neighbour_pixel_upper_y);
157 neighbour_pixel_center_x = neighbour_pixel_lower_x + (neighbour_pixel_upper_x - neighbour_pixel_lower_x) / 2.;
158 neighbour_pixel_center_y = neighbour_pixel_lower_y + (neighbour_pixel_upper_y - neighbour_pixel_lower_y) / 2.;
159 hit2neighbour[
m] =
sqrt(
pow((*i).Position().x() - neighbour_pixel_center_x, 2.) +
160 pow((*i).Position().y() - neighbour_pixel_center_y, -2.));
162 if (hit2neighbour[
m] > closer_neighbour) {
163 closer_neighbour = hit2neighbour[
m];
164 closer_no = neighbour_no[
m];
170 thePixelChargeMap[closer_no] += charge_in_pixel * chargetransfereff;
174 return thePixelChargeMap;