93 int irow_min = topol->
nrows();
98 float chargeBefore = 0;
99 float chargeAfter = 0;
103 for (
std::map<
int,
float, std::less<int> >::const_iterator im = hit_signal.begin(); im != hit_signal.end(); ++im) {
104 int chan = (*im).first;
110 chargeBefore += (*im).second;
112 if (pixelWithCharge.first < irow_min)
113 irow_min = pixelWithCharge.first;
114 if (pixelWithCharge.first > irow_max)
115 irow_max = pixelWithCharge.first;
116 if (pixelWithCharge.second < icol_min)
117 icol_min = pixelWithCharge.second;
118 if (pixelWithCharge.second > icol_max)
119 icol_max = pixelWithCharge.second;
124 float trajectoryScaleToPosition = hitEntryPoint.
z() / direction.
z();
126 if ((hitEntryPoint.
z() > 0 && direction.
z() < 0) || (hitEntryPoint.
z() < 0 && direction.
z() > 0)) {
127 trajectoryScaleToPosition *= -1;
130 LocalPoint hitPosition = hitEntryPoint + trajectoryScaleToPosition * direction;
133 std::pair<int, int> hitPixel =
134 std::pair<int, int>(
int(floor(hitPositionPixel.
x())),
int(floor(hitPositionPixel.
y())));
141 std::pair<int, int> entryPixel =
142 std::pair<int, int>(
int(floor(hitEntryPointPixel.
x())),
int(floor(hitEntryPointPixel.
y())));
143 std::pair<int, int> exitPixel =
144 std::pair<int, int>(
int(floor(hitExitPointPixel.
x())),
int(floor(hitExitPointPixel.
y())));
146 int hitcol_min, hitcol_max, hitrow_min, hitrow_max;
147 if (entryPixel.first > exitPixel.first) {
148 hitrow_min = exitPixel.first;
149 hitrow_max = entryPixel.first;
151 hitrow_min = entryPixel.first;
152 hitrow_max = exitPixel.first;
155 if (entryPixel.second > exitPixel.second) {
156 hitcol_min = exitPixel.second;
157 hitcol_max = entryPixel.second;
159 hitcol_min = entryPixel.second;
160 hitcol_max = exitPixel.second;
167 <<
"Particle ID is: " <<
hit.particleType() <<
"\n"
168 <<
"Process type: " <<
hit.processType() <<
"\n"
171 <<
"Hit entry x/y/z: " <<
hit.entryPoint().
x() <<
" " <<
hit.entryPoint().
y() <<
" "
172 <<
hit.entryPoint().
z() <<
" "
173 <<
"Hit exit x/y/z: " <<
hit.exitPoint().
x() <<
" " <<
hit.exitPoint().
y() <<
" "
174 <<
hit.exitPoint().
z() <<
" "
176 <<
"Pixel Pos - X: " << hitPositionPixel.
x() <<
" Y: " << hitPositionPixel.
y() <<
"\n"
177 <<
"Cart.Cor. - X: " << CMSSWhitPosition.
x() <<
" Y: " << CMSSWhitPosition.
y() <<
"\n"
178 <<
"Z=0 Pos - X: " << hitPosition.
x() <<
" Y: " << hitPosition.
y() <<
"\n"
180 <<
"Origin of the template:"
182 <<
"Pixel Pos - X: " << originPixel.x() <<
" Y: " << originPixel.y() <<
"\n"
183 <<
"Cart.Cor. - X: " << origin.
x() <<
" Y: " << origin.
y() <<
"\n"
187 <<
"Entry - X: " <<
hit.entryPoint().
x() <<
" Y: " <<
hit.entryPoint().
y()
188 <<
" Z: " <<
hit.entryPoint().
z() <<
"\n"
189 <<
"Exit - X: " <<
hit.exitPoint().
x() <<
" Y: " <<
hit.exitPoint().
y()
190 <<
" Z: " <<
hit.exitPoint().
z() <<
"\n"
192 <<
"Entry - X Pixel: " << hitEntryPointPixel.
x() <<
" Y Pixel: " << hitEntryPointPixel.
y()
194 <<
"Exit - X Pixel: " << hitExitPointPixel.
x() <<
" Y Pixel: " << hitExitPointPixel.
y()
197 <<
"row min: " << irow_min <<
" col min: " << icol_min <<
"\n";
200 if (!(irow_min <= hitrow_max && irow_max >= hitrow_min && icol_min <= hitcol_max && icol_max >= hitcol_min)) {
205 float cmToMicrons = 10000.f;
207 track[0] = (hitPosition.
x() - origin.
x()) * cmToMicrons;
208 track[1] = (hitPosition.
y() - origin.
y()) * cmToMicrons;
210 track[3] = direction.x();
211 track[4] = direction.y();
212 track[5] = direction.z();
216 for (
int row = 0; row <
TXSIZE; ++row) {
218 pixrewgt[row][
col] = 0;
222 for (
int row = 0; row <
TXSIZE; ++row) {
230 for (
int row = 0; row <
TXSIZE; ++row) {
239 std::cout <<
"Cluster before reweighting: " << std::endl;
259 LogDebug(
"PixelDigitizer ") <<
"Cluster Charge Reweighting did not work properly.";
265 std::cout <<
"Cluster after reweighting: " << std::endl;
269 for (
int row = 0; row <
TXSIZE; ++row) {
273 if ((hitPixel.first + row -
THX) >= 0 && (hitPixel.first + row -
THX) < topol->
nrows() &&
283 if (chargeBefore != 0. && chargeAfter == 0.) {
289 std::cout <<
"Charges (before->after): " << chargeBefore <<
" -> " << chargeAfter << std::endl;
290 std::cout <<
"Charge loss: " << (1 - chargeAfter / chargeBefore) * 100 <<
" %" << std::endl << std::endl;