7 : det_id_(det_id), theRPixDetTopology_() {
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(
"RPixChargeShare") <<
"Charge map file not found";
43 std::map<unsigned short, double> thePixelChargeMap;
45 edm::LogInfo(
"RPixChargeShare") <<
det_id_ <<
" : Clouds to be induced= " << charge_map.size();
49 for (std::vector<RPixSignalPoint>::const_iterator
i = charge_map.begin();
i != charge_map.end(); ++
i) {
50 double hit_pos_x, hit_pos_y;
52 if (((*i).Position().x() + 16.6 / 2) < 0 || ((*i).Position().x() + 16.6 / 2) > 16.6) {
54 <<
"**** Attention ((*i).Position().x()+simX_width_/2.)<0||((*i).Position().x()+simX_width_/2.)>simX_width ";
55 edm::LogInfo(
"RPixChargeShare") <<
"(*i).Position().x() = " << (*i).Position().x();
58 if (((*i).Position().y() + 24.4 / 2.) < 0 || ((*i).Position().y() + 24.4 / 2.) > 24.4) {
60 <<
"**** Attention ((*i).Position().y()+simY_width_/2.)<0||((*i).Position().y()+simY_width_/2.)>simY_width ";
61 edm::LogInfo(
"RPixChargeShare") <<
"(*i).Position().y() = " << (*i).Position().y();
66 (*i).Position().x(), (*i).Position().y(), (*i).Sigma(), hit_pos_x, hit_pos_y);
67 double effic = relevant_pixels.
effFactor();
69 unsigned short pixel_no = relevant_pixels.
pixelIndex();
71 double charge_in_pixel = (*i).Charge() * effic;
73 CH += charge_in_pixel;
76 edm::LogInfo(
"RPixChargeShare") <<
"Efficiency in detector " <<
det_id_ <<
" and pixel no " << pixel_no <<
" : "
77 << effic <<
" ch: " << charge_in_pixel <<
" CHtot: " <<
CH;
82 thePixelChargeMap[pixel_no] += charge_in_pixel;
86 double pixel_lower_x = 0;
87 double pixel_lower_y = 0;
88 double pixel_upper_x = 0;
89 double pixel_upper_y = 0;
92 double pixel_width_x = pixel_upper_x - pixel_lower_x;
93 double pixel_width_y = pixel_upper_y - pixel_lower_y;
98 double pixel_center_x = pixel_lower_x + (pixel_width_x) / 2.;
99 double pixel_center_y = pixel_lower_y + (pixel_width_y) / 2.;
101 int xbin =
int((((*i).Position().y() - pixel_center_y) + pixel_width_y / 2.) * 1.e3 / 5.);
102 int ybin =
int((((*i).Position().x() - pixel_center_x) + pixel_width_x / 2.) * 1.e3 / 5.);
103 if (pixel_width_x < 0.11 && pixel_width_y < 0.151) {
108 if (pixel_width_x > 0.11 && pixel_width_y < 0.151) {
113 if (pixel_width_x < 0.11 && pixel_width_y > 0.151) {
118 if (pixel_width_x > 0.11 && pixel_width_y > 0.151) {
123 double hit2neighbour[8];
125 thePixelChargeMap[pixel_no] += charge_in_pixel * collect_prob;
126 unsigned short neighbour_no[8];
127 unsigned short m = 0;
128 double closer_neighbour = 0;
129 unsigned short closer_no = 0;
131 for (
int k = pixel_row - 1;
k <= pixel_row + 1;
k++) {
132 for (
int l = pixel_col - 1;
l <= pixel_col + 1;
l++) {
135 if ((
k == pixel_row) && (
l == pixel_col))
137 double neighbour_pixel_lower_x = 0;
138 double neighbour_pixel_lower_y = 0;
139 double neighbour_pixel_upper_x = 0;
140 double neighbour_pixel_upper_y = 0;
141 double neighbour_pixel_center_x = 0;
142 double neighbour_pixel_center_y = 0;
145 k,
l, neighbour_pixel_lower_x, neighbour_pixel_upper_x, neighbour_pixel_lower_y, neighbour_pixel_upper_y);
146 neighbour_pixel_center_x = neighbour_pixel_lower_x + (neighbour_pixel_upper_x - neighbour_pixel_lower_x) / 2.;
147 neighbour_pixel_center_y = neighbour_pixel_lower_y + (neighbour_pixel_upper_y - neighbour_pixel_lower_y) / 2.;
148 hit2neighbour[
m] =
sqrt(
pow((*i).Position().x() - neighbour_pixel_center_x, 2.) +
149 pow((*i).Position().y() - neighbour_pixel_center_y, -2.));
151 if (hit2neighbour[
m] > closer_neighbour) {
152 closer_neighbour = hit2neighbour[
m];
153 closer_no = neighbour_no[
m];
159 thePixelChargeMap[closer_no] += charge_in_pixel * chargetransfereff;
163 return thePixelChargeMap;