573 LogError(
"Pixel Digitizer") <<
" ******************************** \n";
574 LogError(
"Pixel Digitizer") <<
" ******************************** \n";
575 LogError(
"Pixel Digitizer") <<
" ******************************** \n";
576 LogError(
"Pixel Digitizer") <<
" ***** INCONSISTENCY !!! ***** \n";
578 <<
" applyLateReweighting_ and UseReweighting can not be true at the same time for PU ! \n";
579 LogError(
"Pixel Digitizer") <<
" ---> DO NOT APPLY CHARGE REWEIGHTING TWICE !!! \n";
580 LogError(
"Pixel Digitizer") <<
" ******************************** \n";
581 LogError(
"Pixel Digitizer") <<
" ******************************** \n";
587 int irow_min = topol->
nrows();
592 float chargeBefore = 0;
593 float chargeAfter = 0;
596 std::vector<PixelDigi>::const_iterator loopDigi;
597 for (loopDigi = digis.begin(); loopDigi != digis.end(); ++loopDigi) {
598 unsigned int chan = loopDigi->channel();
600 float corresponding_charge = loopDigi->adc();
602 chargeBefore += corresponding_charge;
603 if (loopDigi->row() < irow_min)
604 irow_min = loopDigi->row();
605 if (loopDigi->row() > irow_max)
606 irow_max = loopDigi->row();
607 if (loopDigi->column() < icol_min)
608 icol_min = loopDigi->column();
609 if (loopDigi->column() > icol_max)
610 icol_max = loopDigi->column();
617 float trajectoryScaleToPosition =
std::abs(hitEntryPoint.
z() / direction.
z());
618 LocalPoint hitPosition = hitEntryPoint + trajectoryScaleToPosition * direction;
622 LocalPoint hitLocalPosition = hitEntryPoint + 0.5 * direction;
624 std::pair<int, int> hitPixel =
625 std::pair<int, int>(
int(floor(hitPositionPixel.
x())),
int(floor(hitPositionPixel.
y())));
632 std::pair<int, int> entryPixel =
633 std::pair<int, int>(
int(floor(hitEntryPointPixel.
x())),
int(floor(hitEntryPointPixel.
y())));
634 std::pair<int, int> exitPixel =
635 std::pair<int, int>(
int(floor(hitExitPointPixel.
x())),
int(floor(hitExitPointPixel.
y())));
637 int hitcol_min, hitcol_max, hitrow_min, hitrow_max;
638 if (entryPixel.first > exitPixel.first) {
639 hitrow_min = exitPixel.first;
640 hitrow_max = entryPixel.first;
642 hitrow_min = entryPixel.first;
643 hitrow_max = exitPixel.first;
646 if (entryPixel.second > exitPixel.second) {
647 hitcol_min = exitPixel.second;
648 hitcol_max = entryPixel.second;
650 hitcol_min = entryPixel.second;
651 hitcol_max = exitPixel.second;
654 if (!(irow_min <= hitrow_max && irow_max >= hitrow_min && icol_min <= hitcol_max && icol_max >= hitcol_min)) {
662 track[3] = direction.x();
663 track[4] = direction.y();
664 track[5] = direction.z();
676 for (
int row = 0; row <
TXSIZE; ++row) {
684 for (
int row = 0; row <
TXSIZE; ++row) {
693 LogDebug(
"Pixel Digitizer") <<
" Cluster before reweighting: ";
704 LogDebug(
"Pixel Digitizer") <<
" same template for num and den ";
710 LogDebug(
"PixelDigitizer ") <<
"Cluster Charge Reweighting did not work properly.";
715 LogDebug(
"Pixel Digitizer") <<
" Cluster after reweighting: ";
719 for (
int row = 0; row <
TXSIZE; ++row) {
723 if ((hitPixel.first + row -
THX) >= 0 && (hitPixel.first + row -
THX) < topol->
nrows() &&
732 if (chargeBefore != 0. && chargeAfter == 0.) {
737 LogDebug(
"Pixel Digitizer") <<
"Charges (before->after): " << chargeBefore <<
" -> " << chargeAfter;
738 LogDebug(
"Pixel Digitizer") <<
"Charge loss: " << (1 - chargeAfter / chargeBefore) * 100 <<
" %";
744 int chanDigi = (*i).first;
746 int row_digi = ip.first;
747 int col_digi = ip.second;
748 int i_transformed_row = row_digi - hitPixel.first +
THX;
749 int i_transformed_col = col_digi - hitPixel.second +
THY;
750 if (i_transformed_row < 0 || i_transformed_row >
TXSIZE || i_transformed_col < 0 || i_transformed_col >
TYSIZE) {
752 if (chanDigi >= 0 && (*i).second > 0) {
static std::pair< int, int > channelToPixel(int ch)
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
virtual int ncolumns() const =0
std::vector< bool > xdouble
virtual int nrows() const =0
std::map< int, SiPixelDigitizerAlgorithm::Amplitude, std::less< int > > signal_map_type
const bool UseReweighting
const SiPixel2DTemplateDBObject * dbobject_den
Log< level::Error, false > LogError
static int pixelToChannel(int row, int col)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual bool isItBigPixelInX(int ixbin) const =0
virtual bool isItBigPixelInY(int iybin) const =0
Abs< T >::type abs(const T &t)
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
signal_map_type::const_iterator signal_map_const_iterator
DetId geographicalId() const
The label of this GeomDet.
boost::multi_array< float, 2 > array_2d
const SiPixel2DTemplateDBObject * dbobject_num
void printCluster(array_2d &cluster)
int PixelTempRewgt2D(int id_gen, int id_rewgt, array_2d &cluster)
constexpr uint32_t rawId() const
get the raw id
std::vector< bool > ydouble
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
short getTemplateID(const uint32_t &detid) const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
std::vector< float > track
static constexpr float cmToMicrons