CMS 3D CMS Logo

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

#include <SiPixelChargeReweightingAlgorithm.h>

Public Types

typedef signal_map_type::const_iterator signal_map_const_iterator
 
typedef signal_map_type::iterator signal_map_iterator
 
typedef std::map< int, SiPixelDigitizerAlgorithm::Amplitude, std::less< int > > signal_map_type
 

Public Member Functions

bool hitSignalReweight (const PSimHit &hit, std::map< int, float, std::less< int > > &hit_signal, const size_t hitIndex, const unsigned int tofBin, const PixelTopology *topol, uint32_t detID, signal_map_type &theSignal, unsigned short int processType, const bool &boolmakeDigiSimLinks)
 
void init (const edm::EventSetup &es)
 
 SiPixelChargeReweightingAlgorithm (const edm::ParameterSet &conf)
 
 ~SiPixelChargeReweightingAlgorithm ()
 

Private Types

typedef boost::multi_array< float, 2 > array_2d
 
typedef GloballyPositioned< double > Frame
 
typedef std::vector< edm::ParameterSetParameters
 
typedef std::map< uint32_t, signal_map_typesignalMaps
 

Private Member Functions

int PixelTempRewgt2D (int id_gen, int id_rewgt, array_2d &cluster)
 
void printCluster (array_2d &cluster)
 
void printCluster (float arr[13+2][21+2])
 
void printCluster (float arr[13][21])
 

Private Attributes

const SiPixel2DTemplateDBObjectdbobject_den
 
const SiPixel2DTemplateDBObjectdbobject_num
 
int IDden
 
int IDnum
 
const bool PrintClusters
 
const bool PrintTemplates
 
SiPixelTemplate2D templ2D
 
std::vector< SiPixelTemplateStore2DtemplateStores_
 
std::vector< float > track
 
const bool UseReweighting
 
std::vector< bool > xdouble
 
std::vector< bool > ydouble
 

Detailed Description

Definition at line 34 of file SiPixelChargeReweightingAlgorithm.h.

Member Typedef Documentation

◆ array_2d

typedef boost::multi_array<float, 2> SiPixelChargeReweightingAlgorithm::array_2d
private

Definition at line 61 of file SiPixelChargeReweightingAlgorithm.h.

◆ Frame

Definition at line 59 of file SiPixelChargeReweightingAlgorithm.h.

◆ Parameters

Definition at line 60 of file SiPixelChargeReweightingAlgorithm.h.

◆ signal_map_const_iterator

typedef signal_map_type::const_iterator SiPixelChargeReweightingAlgorithm::signal_map_const_iterator

Definition at line 44 of file SiPixelChargeReweightingAlgorithm.h.

◆ signal_map_iterator

typedef signal_map_type::iterator SiPixelChargeReweightingAlgorithm::signal_map_iterator

Definition at line 43 of file SiPixelChargeReweightingAlgorithm.h.

◆ signal_map_type

Definition at line 42 of file SiPixelChargeReweightingAlgorithm.h.

◆ signalMaps

Definition at line 58 of file SiPixelChargeReweightingAlgorithm.h.

Constructor & Destructor Documentation

◆ SiPixelChargeReweightingAlgorithm()

SiPixelChargeReweightingAlgorithm::SiPixelChargeReweightingAlgorithm ( const edm::ParameterSet conf)

Definition at line 100 of file SiPixelChargeReweightingAlgorithm.cc.

101  :
102 
104  xdouble(TXSIZE),
105  ydouble(TYSIZE),
106  IDnum(conf.exists("TemplateIDnumerator") ? conf.getParameter<int>("TemplateIDnumerator") : 0),
107  IDden(conf.exists("TemplateIDdenominator") ? conf.getParameter<int>("TemplateIDdenominator") : 0),
108 
109  UseReweighting(conf.getParameter<bool>("UseReweighting")),
110  PrintClusters(conf.getParameter<bool>("PrintClusters")),
111  PrintTemplates(conf.getParameter<bool>("PrintTemplates")) {
112  edm::LogVerbatim("PixelDigitizer ") << "SiPixelChargeReweightingAlgorithm constructed"
113  << " with UseReweighting = " << UseReweighting;
114 }

References UseReweighting.

◆ ~SiPixelChargeReweightingAlgorithm()

SiPixelChargeReweightingAlgorithm::~SiPixelChargeReweightingAlgorithm ( )

Definition at line 117 of file SiPixelChargeReweightingAlgorithm.cc.

117  {
118  LogDebug("PixelDigitizer") << "SiPixelChargeReweightingAlgorithm deleted";
119 }

References LogDebug.

Member Function Documentation

◆ hitSignalReweight()

bool SiPixelChargeReweightingAlgorithm::hitSignalReweight ( const PSimHit hit,
std::map< int, float, std::less< int > > &  hit_signal,
const size_t  hitIndex,
const unsigned int  tofBin,
const PixelTopology topol,
uint32_t  detID,
signal_map_type theSignal,
unsigned short int  processType,
const bool &  boolmakeDigiSimLinks 
)

Definition at line 123 of file SiPixelChargeReweightingAlgorithm.cc.

131  {
132  int irow_min = topol->nrows();
133  int irow_max = 0;
134  int icol_min = topol->ncolumns();
135  int icol_max = 0;
136 
137  float chargeBefore = 0;
138  float chargeAfter = 0;
139  signal_map_type hitSignal;
140  LocalVector direction = hit.exitPoint() - hit.entryPoint();
141 
142  for (std::map<int, float, std::less<int> >::const_iterator im = hit_signal.begin(); im != hit_signal.end(); ++im) {
143  int chan = (*im).first;
144  std::pair<int, int> pixelWithCharge = PixelDigi::channelToPixel(chan);
145 
146  hitSignal[chan] +=
147  (boolmakeDigiSimLinks ? SiPixelDigitizerAlgorithm::Amplitude((*im).second, &hit, hitIndex, tofBin, (*im).second)
149  chargeBefore += (*im).second;
150 
151  if (pixelWithCharge.first < irow_min)
152  irow_min = pixelWithCharge.first;
153  if (pixelWithCharge.first > irow_max)
154  irow_max = pixelWithCharge.first;
155  if (pixelWithCharge.second < icol_min)
156  icol_min = pixelWithCharge.second;
157  if (pixelWithCharge.second > icol_max)
158  icol_max = pixelWithCharge.second;
159  }
160 
161  LocalPoint hitEntryPoint = hit.entryPoint();
162 
163  float trajectoryScaleToPosition = hitEntryPoint.z() / direction.z();
164 
165  if ((hitEntryPoint.z() > 0 && direction.z() < 0) || (hitEntryPoint.z() < 0 && direction.z() > 0)) {
166  trajectoryScaleToPosition *= -1;
167  }
168 
169  LocalPoint hitPosition = hitEntryPoint + trajectoryScaleToPosition * direction;
170 
171  MeasurementPoint hitPositionPixel = topol->measurementPosition(hit.localPosition());
172  std::pair<int, int> hitPixel =
173  std::pair<int, int>(int(floor(hitPositionPixel.x())), int(floor(hitPositionPixel.y())));
174 
175  MeasurementPoint originPixel = MeasurementPoint(hitPixel.first - THX + 0.5, hitPixel.second - THY + 0.5);
176  LocalPoint origin = topol->localPosition(originPixel);
177 
178  MeasurementPoint hitEntryPointPixel = topol->measurementPosition(hit.entryPoint());
179  MeasurementPoint hitExitPointPixel = topol->measurementPosition(hit.exitPoint());
180  std::pair<int, int> entryPixel =
181  std::pair<int, int>(int(floor(hitEntryPointPixel.x())), int(floor(hitEntryPointPixel.y())));
182  std::pair<int, int> exitPixel =
183  std::pair<int, int>(int(floor(hitExitPointPixel.x())), int(floor(hitExitPointPixel.y())));
184 
185  int hitcol_min, hitcol_max, hitrow_min, hitrow_max;
186  if (entryPixel.first > exitPixel.first) {
187  hitrow_min = exitPixel.first;
188  hitrow_max = entryPixel.first;
189  } else {
190  hitrow_min = entryPixel.first;
191  hitrow_max = exitPixel.first;
192  }
193 
194  if (entryPixel.second > exitPixel.second) {
195  hitcol_min = exitPixel.second;
196  hitcol_max = entryPixel.second;
197  } else {
198  hitcol_min = entryPixel.second;
199  hitcol_max = exitPixel.second;
200  }
201 
202 #ifdef TP_DEBUG
203  LocalPoint CMSSWhitPosition = hit.localPosition();
204 
205  LogDebug("Pixel Digitizer") << "\n"
206  << "Particle ID is: " << hit.particleType() << "\n"
207  << "Process type: " << hit.processType() << "\n"
208  << "HitPosition:"
209  << "\n"
210  << "Hit entry x/y/z: " << hit.entryPoint().x() << " " << hit.entryPoint().y() << " "
211  << hit.entryPoint().z() << " "
212  << "Hit exit x/y/z: " << hit.exitPoint().x() << " " << hit.exitPoint().y() << " "
213  << hit.exitPoint().z() << " "
214 
215  << "Pixel Pos - X: " << hitPositionPixel.x() << " Y: " << hitPositionPixel.y() << "\n"
216  << "Cart.Cor. - X: " << CMSSWhitPosition.x() << " Y: " << CMSSWhitPosition.y() << "\n"
217  << "Z=0 Pos - X: " << hitPosition.x() << " Y: " << hitPosition.y() << "\n"
218 
219  << "Origin of the template:"
220  << "\n"
221  << "Pixel Pos - X: " << originPixel.x() << " Y: " << originPixel.y() << "\n"
222  << "Cart.Cor. - X: " << origin.x() << " Y: " << origin.y() << "\n"
223  << "\n"
224  << "Entry/Exit:"
225  << "\n"
226  << "Entry - X: " << hit.entryPoint().x() << " Y: " << hit.entryPoint().y()
227  << " Z: " << hit.entryPoint().z() << "\n"
228  << "Exit - X: " << hit.exitPoint().x() << " Y: " << hit.exitPoint().y()
229  << " Z: " << hit.exitPoint().z() << "\n"
230 
231  << "Entry - X Pixel: " << hitEntryPointPixel.x() << " Y Pixel: " << hitEntryPointPixel.y()
232  << "\n"
233  << "Exit - X Pixel: " << hitExitPointPixel.x() << " Y Pixel: " << hitExitPointPixel.y()
234  << "\n"
235 
236  << "row min: " << irow_min << " col min: " << icol_min << "\n";
237 #endif
238 
239  if (!(irow_min <= hitrow_max && irow_max >= hitrow_min && icol_min <= hitcol_max && icol_max >= hitcol_min)) {
240  // The clusters do not have an overlap, hence the hit is NOT reweighted
241  return false;
242  }
243 
244  float cmToMicrons = 10000.f;
245 
246  track[0] = (hitPosition.x() - origin.x()) * cmToMicrons;
247  track[1] = (hitPosition.y() - origin.y()) * cmToMicrons;
248  track[2] = 0.0f; //Middle of sensor is origin for Z-axis
249  track[3] = direction.x();
250  track[4] = direction.y();
251  track[5] = direction.z();
252 
253  array_2d pixrewgt(boost::extents[TXSIZE][TYSIZE]);
254 
255  for (int row = 0; row < TXSIZE; ++row) {
256  for (int col = 0; col < TYSIZE; ++col) {
257  pixrewgt[row][col] = 0;
258  }
259  }
260 
261  for (int row = 0; row < TXSIZE; ++row) {
262  xdouble[row] = topol->isItBigPixelInX(hitPixel.first + row - THX);
263  }
264 
265  for (int col = 0; col < TYSIZE; ++col) {
266  ydouble[col] = topol->isItBigPixelInY(hitPixel.second + col - THY);
267  }
268 
269  for (int row = 0; row < TXSIZE; ++row) {
270  for (int col = 0; col < TYSIZE; ++col) {
271  //Fill charges into 21x13 Pixel Array with hitPixel in centre
272  pixrewgt[row][col] =
273  hitSignal[PixelDigi::pixelToChannel(hitPixel.first + row - THX, hitPixel.second + col - THY)];
274  }
275  }
276 
277  if (PrintClusters) {
278  std::cout << "Cluster before reweighting: " << std::endl;
279  printCluster(pixrewgt);
280  }
281 
282  int ierr;
283  // for unirradiated: 2nd argument is IDden
284  // for irradiated: 2nd argument is IDnum
285  if (UseReweighting == true) {
286  int ID1 = dbobject_num->getTemplateID(detID);
287  int ID0 = dbobject_den->getTemplateID(detID);
288 
289  if (ID0 == ID1) {
290  return false;
291  }
292  ierr = PixelTempRewgt2D(ID0, ID1, pixrewgt);
293  } else {
294  ierr = PixelTempRewgt2D(IDden, IDden, pixrewgt);
295  }
296  if (ierr != 0) {
297 #ifdef TP_DEBUG
298  LogDebug("PixelDigitizer ") << "Cluster Charge Reweighting did not work properly.";
299 #endif
300  return false;
301  }
302 
303  if (PrintClusters) {
304  std::cout << "Cluster after reweighting: " << std::endl;
305  printCluster(pixrewgt);
306  }
307 
308  for (int row = 0; row < TXSIZE; ++row) {
309  for (int col = 0; col < TYSIZE; ++col) {
310  float charge = 0;
311  charge = pixrewgt[row][col];
312  if ((hitPixel.first + row - THX) >= 0 && (hitPixel.first + row - THX) < topol->nrows() &&
313  (hitPixel.second + col - THY) >= 0 && (hitPixel.second + col - THY) < topol->ncolumns() && charge > 0) {
314  chargeAfter += charge;
315  theSignal[PixelDigi::pixelToChannel(hitPixel.first + row - THX, hitPixel.second + col - THY)] +=
316  (boolmakeDigiSimLinks ? SiPixelDigitizerAlgorithm::Amplitude(charge, &hit, hitIndex, tofBin, charge)
318  }
319  }
320  }
321 
322  if (chargeBefore != 0. && chargeAfter == 0.) {
323  return false;
324  }
325 
326  if (PrintClusters) {
327  std::cout << std::endl;
328  std::cout << "Charges (before->after): " << chargeBefore << " -> " << chargeAfter << std::endl;
329  std::cout << "Charge loss: " << (1 - chargeAfter / chargeBefore) * 100 << " %" << std::endl << std::endl;
330  }
331 
332  return true;
333 }

References LaserClient_cfi::Amplitude, officialStyle::chan, PixelDigi::channelToPixel(), ALCARECOTkAlJpsiMuMu_cff::charge, cuy::col, gather_cfg::cout, dbobject_den, dbobject_num, SiPixel2DTemplateDBObject::getTemplateID(), IDden, createfilelist::int, PixelTopology::isItBigPixelInX(), PixelTopology::isItBigPixelInY(), Topology::localPosition(), LogDebug, genParticles_cff::map, Topology::measurementPosition(), PixelTopology::ncolumns(), PixelTopology::nrows(), PixelTempRewgt2D(), PixelDigi::pixelToChannel(), printCluster(), PrintClusters, THX, THY, track, TXSIZE, TYSIZE, UseReweighting, PV2DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::x(), hit::x, xdouble, PV2DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::y(), hit::y, ydouble, PV3DBase< T, PVType, FrameType >::z(), and hit::z.

◆ init()

void SiPixelChargeReweightingAlgorithm::init ( const edm::EventSetup es)

Definition at line 78 of file SiPixelChargeReweightingAlgorithm.cc.

78  {
79  // Read template files for charge reweighting
80  if (UseReweighting) {
82  es.get<SiPixel2DTemplateDBObjectRcd>().get("denominator", SiPixel2DTemp_den);
83  dbobject_den = SiPixel2DTemp_den.product();
84 
86  es.get<SiPixel2DTemplateDBObjectRcd>().get("numerator", SiPixel2DTemp_num);
87  dbobject_num = SiPixel2DTemp_num.product();
88 
89  int numOfTemplates = dbobject_den->numOfTempl() + dbobject_num->numOfTempl();
90  templateStores_.reserve(numOfTemplates);
93 
94  track.resize(6);
95  }
96 }

References edm::EventSetup::get(), edm::get(), SiPixel2DTemplateDBObject::numOfTempl(), edm::ESHandle< T >::product(), SiPixelTemplate2D::pushfile(), HLT_FULL_cff::track, and HIPAlignmentAlgorithm_cfi::UseReweighting.

◆ PixelTempRewgt2D()

int SiPixelChargeReweightingAlgorithm::PixelTempRewgt2D ( int  id_in,
int  id_rewgt,
array_2d cluster 
)
private

Reweight CMSSW clusters to look like clusters corresponding to Pixelav Templates.

Parameters
id_in- (input) identifier of the template corresponding to the input events
id_rewgt- (input) identifier of the template corresponding to the output events
cluster- (input/output) boost multi_array container of 7x21 array of pixel signals, origin of local coords (0,0) at center of pixel cluster[3][10]. returns 0 if everything is OK, 1 if angles are outside template coverage (cluster is probably still usable, > 1 if something is wrong (no reweight done).

Definition at line 344 of file SiPixelChargeReweightingAlgorithm.cc.

344  {
345  // Local variables
346  int i, j, k, l, kclose;
347  int nclusx, nclusy, success;
348  float xsize, ysize, q50i, q100i, q50r, q10r, q100r, xhit2D, yhit2D, qclust, dist2, dmin2;
349  float xy_in[BXM2][BYM2], xy_rewgt[BXM2][BYM2], xy_clust[TXSIZE][TYSIZE];
350  int denx_clust[TXSIZE][TYSIZE], deny_clust[TXSIZE][TYSIZE];
351  int goodWeightsUsed, nearbyWeightsUsed, noWeightsUsed;
352  float cotalpha, cotbeta;
353  // success = 0 is returned if everthing is OK
354  success = 0;
355 
356  // Copy the array to remember original charges
357  array_2d clust(cluster);
358 
359  // Take the pixel dimensions from the 2D template
360  templ2D.getid(id_in);
361  xsize = templ2D.xsize();
362  ysize = templ2D.ysize();
363 
364  // Calculate the track angles
365 
366  if (std::abs(track[5]) > 0.f) {
367  cotalpha = track[3] / track[5]; //if track[5] (direction in z) is 0 the hit is not processed by re-weighting
368  cotbeta = track[4] / track[5];
369  } else {
370  LogDebug("Pixel Digitizer") << "Reweighting angle is not good!" << std::endl;
371  return 9; //returned value here indicates that no reweighting was done in this case
372  }
373 
374  // The 2-D templates are defined on a shifted coordinate system wrt the 1D templates
375  if (ydouble[0]) {
376  yhit2D = track[1] - cotbeta * track[2] + ysize;
377  } else {
378  yhit2D = track[1] - cotbeta * track[2] + 0.5f * ysize;
379  }
380  if (xdouble[0]) {
381  xhit2D = track[0] - cotalpha * track[2] + xsize;
382  } else {
383  xhit2D = track[0] - cotalpha * track[2] + 0.5f * xsize;
384  }
385 
386  // Zero the input and output templates
387  for (i = 0; i < BYM2; ++i) {
388  for (j = 0; j < BXM2; ++j) {
389  xy_in[j][i] = 0.f;
390  xy_rewgt[j][i] = 0.f;
391  }
392  }
393 
394  // Next, interpolate the CMSSW template needed to analyze this cluster
395 
396  if (!templ2D.xytemp(id_in, cotalpha, cotbeta, xhit2D, yhit2D, ydouble, xdouble, xy_in)) {
397  success = 1;
398  }
399  if (success != 0) {
400 #ifdef TP_DEBUG
401  LogDebug("Pixel Digitizer") << "No matching template found" << std::endl;
402 #endif
403  return 2;
404  }
405 
406  if (PrintTemplates) {
407  std::cout << "Template unirrad: " << std::endl;
408  printCluster(xy_in);
409  }
410 
411  q50i = templ2D.s50();
412  //q50i = 0;
413  q100i = 2.f * q50i;
414 
415  // Check that the cluster container is a 13x21 matrix
416 
417  if (cluster.num_dimensions() != 2) {
418  LogWarning("Pixel Digitizer") << "Cluster is not 2-dimensional. Return." << std::endl;
419  return 3;
420  }
421  nclusx = (int)cluster.shape()[0];
422  nclusy = (int)cluster.shape()[1];
423  if (nclusx != TXSIZE || xdouble.size() != TXSIZE) {
424  LogWarning("Pixel Digitizer") << "Sizes in x do not match: nclusx=" << nclusx << " xdoubleSize=" << xdouble.size()
425  << " TXSIZE=" << TXSIZE << ". Return." << std::endl;
426  return 4;
427  }
428  if (nclusy != TYSIZE || ydouble.size() != TYSIZE) {
429  LogWarning("Pixel Digitizer") << "Sizes in y do not match. Return." << std::endl;
430  return 5;
431  }
432 
433  // Sum initial charge in the cluster
434 
435  qclust = 0.f;
436  for (i = 0; i < TYSIZE; ++i) {
437  for (j = 0; j < TXSIZE; ++j) {
438  xy_clust[j][i] = 0.f;
439  denx_clust[j][i] = 0;
440  deny_clust[j][i] = 0;
441  if (cluster[j][i] > q100i) {
442  qclust += cluster[j][i];
443  }
444  }
445  }
446 
447  // Next, interpolate the physical output template needed to reweight
448 
449  if (!templ2D.xytemp(id_rewgt, cotalpha, cotbeta, xhit2D, yhit2D, ydouble, xdouble, xy_rewgt)) {
450  success = 1;
451  }
452 
453  if (PrintTemplates) {
454  std::cout << "Template irrad: " << std::endl;
455  printCluster(xy_rewgt);
456  }
457 
458  q50r = templ2D.s50();
459  q100r = 2.f * q50r;
460  q10r = 0.2f * q50r;
461 
462  // Find all non-zero denominator pixels in the input template and generate "inside" weights
463 
464  int ntpix = 0;
465  int ncpix = 0;
466  std::vector<int> ytclust;
467  std::vector<int> xtclust;
468  std::vector<int> ycclust;
469  std::vector<int> xcclust;
470  qclust = 0.f;
471  for (i = 0; i < TYSIZE; ++i) {
472  for (j = 0; j < TXSIZE; ++j) {
473  if (xy_in[j + 1][i + 1] > q100i) {
474  ++ntpix;
475  ytclust.push_back(i);
476  xtclust.push_back(j);
477  xy_clust[j][i] = xy_rewgt[j + 1][i + 1] / xy_in[j + 1][i + 1];
478  denx_clust[j][i] = j;
479  deny_clust[j][i] = i;
480  }
481  }
482  }
483 
484  // Find all non-zero numerator pixels not matched to denominator in the output template and generate "inside" weights
485 
486  for (i = 0; i < TYSIZE; ++i) {
487  for (j = 0; j < TXSIZE; ++j) {
488  if (xy_rewgt[j + 1][i + 1] > q10r && xy_clust[j][i] == 0.f && ntpix > 0) {
489  // Search for nearest denominator pixel
490  dmin2 = 10000.f;
491  kclose = 0;
492  for (k = 0; k < ntpix; ++k) {
493  dist2 = (i - ytclust[k]) * (i - ytclust[k]) + 0.44444f * (j - xtclust[k]) * (j - xtclust[k]);
494  if (dist2 < dmin2) {
495  dmin2 = dist2;
496  kclose = k;
497  }
498  }
499  xy_clust[j][i] = xy_rewgt[j + 1][i + 1] / xy_in[xtclust[kclose] + 1][ytclust[kclose] + 1];
500  denx_clust[j][i] = xtclust[kclose];
501  deny_clust[j][i] = ytclust[kclose];
502  }
503  }
504  }
505 
506  if (PrintTemplates) {
507  std::cout << "Weights:" << std::endl;
508  printCluster(xy_clust);
509  }
510 
511  // Do the reweighting
512  goodWeightsUsed = 0;
513  nearbyWeightsUsed = 0;
514  noWeightsUsed = 0;
515 
516  for (i = 0; i < TYSIZE; ++i) {
517  for (j = 0; j < TXSIZE; ++j) {
518  if (xy_clust[j][i] > 0.f) {
519  cluster[j][i] = xy_clust[j][i] * clust[denx_clust[j][i]][deny_clust[j][i]];
520  if (cluster[j][i] > q100r) {
521  qclust += cluster[j][i];
522  }
523  if (cluster[j][i] > 0) {
524  goodWeightsUsed++;
525  }
526  } else {
527  if (clust[j][i] > 0.f) {
528  ++ncpix;
529  ycclust.push_back(i);
530  xcclust.push_back(j);
531  }
532  }
533  }
534  }
535 
536  // Now reweight pixels outside of template footprint using closest weights
537 
538  if (ncpix > 0) {
539  for (l = 0; l < ncpix; ++l) {
540  i = ycclust[l];
541  j = xcclust[l];
542  dmin2 = 10000.f;
543  kclose = 0;
544  for (k = 0; k < ntpix; ++k) {
545  dist2 = (i - ytclust[k]) * (i - ytclust[k]) + 0.44444f * (j - xtclust[k]) * (j - xtclust[k]);
546  if (dist2 < dmin2) {
547  dmin2 = dist2;
548  kclose = k;
549  }
550  }
551  if (dmin2 < 5.f) {
552  nearbyWeightsUsed++;
553  cluster[j][i] *= xy_clust[xtclust[kclose]][ytclust[kclose]];
554  if (cluster[j][i] > q100r) {
555  qclust += cluster[j][i];
556  }
557  } else {
558  noWeightsUsed++;
559  cluster[j][i] = 0.f;
560  }
561  }
562  }
563 
564  return success;
565 } // PixelTempRewgt2D

References funct::abs(), BXM2, BYM2, gather_cfg::cout, f, SiPixelTemplate2D::getid(), mps_fire::i, createfilelist::int, dqmiolumiharvest::j, dqmdumpme::k, cmsLHEtoEOSManager::l, LogDebug, printCluster(), PrintTemplates, SiPixelTemplate2D::s50(), summarizeEdmComparisonLogfiles::success, templ2D, track, TXSIZE, TYSIZE, xdouble, xsize, SiPixelTemplate2D::xsize(), SiPixelTemplate2D::xytemp(), ydouble, ysize, and SiPixelTemplate2D::ysize().

Referenced by hitSignalReweight().

◆ printCluster() [1/3]

void SiPixelChargeReweightingAlgorithm::printCluster ( array_2d cluster)
private

Definition at line 567 of file SiPixelChargeReweightingAlgorithm.cc.

567  {
568  for (int col = 0; col < TYSIZE; ++col) {
569  for (int row = 0; row < TXSIZE; ++row) {
570  std::cout << std::setw(10) << std::setprecision(0) << std::fixed;
571  std::cout << cluster[row][col];
572  }
573  std::cout << std::endl;
574  }
575  std::cout.copyfmt(std::ios(nullptr));
576 }

References cuy::col, gather_cfg::cout, alignBH_cfg::fixed, TXSIZE, and TYSIZE.

Referenced by hitSignalReweight(), and PixelTempRewgt2D().

◆ printCluster() [2/3]

void SiPixelChargeReweightingAlgorithm::printCluster ( float  arr[13+2][21+2])
private

Definition at line 578 of file SiPixelChargeReweightingAlgorithm.cc.

578  {
579  for (int col = 0; col < BYM2; ++col) {
580  for (int row = 0; row < BXM2; ++row) {
581  std::cout << std::setw(10) << std::setprecision(0) << std::fixed;
582  std::cout << arr[row][col];
583  }
584  std::cout << std::endl;
585  }
586  std::cout.copyfmt(std::ios(nullptr));
587 }

References BXM2, BYM2, cuy::col, gather_cfg::cout, and alignBH_cfg::fixed.

◆ printCluster() [3/3]

void SiPixelChargeReweightingAlgorithm::printCluster ( float  arr[13][21])
private

Definition at line 589 of file SiPixelChargeReweightingAlgorithm.cc.

589  {
590  for (int col = 0; col < TYSIZE; ++col) {
591  for (int row = 0; row < TXSIZE; ++row) {
592  std::cout << std::setw(10) << std::fixed;
593  std::cout << arr[row][col];
594  }
595  std::cout << std::endl;
596  }
597  std::cout.copyfmt(std::ios(nullptr));
598 }

References cuy::col, gather_cfg::cout, alignBH_cfg::fixed, TXSIZE, and TYSIZE.

Member Data Documentation

◆ dbobject_den

const SiPixel2DTemplateDBObject* SiPixelChargeReweightingAlgorithm::dbobject_den
private

Definition at line 76 of file SiPixelChargeReweightingAlgorithm.h.

Referenced by hitSignalReweight().

◆ dbobject_num

const SiPixel2DTemplateDBObject* SiPixelChargeReweightingAlgorithm::dbobject_num
private

Definition at line 77 of file SiPixelChargeReweightingAlgorithm.h.

Referenced by hitSignalReweight().

◆ IDden

int SiPixelChargeReweightingAlgorithm::IDden
private

Definition at line 68 of file SiPixelChargeReweightingAlgorithm.h.

Referenced by hitSignalReweight().

◆ IDnum

int SiPixelChargeReweightingAlgorithm::IDnum
private

Definition at line 68 of file SiPixelChargeReweightingAlgorithm.h.

◆ PrintClusters

const bool SiPixelChargeReweightingAlgorithm::PrintClusters
private

Definition at line 71 of file SiPixelChargeReweightingAlgorithm.h.

Referenced by hitSignalReweight().

◆ PrintTemplates

const bool SiPixelChargeReweightingAlgorithm::PrintTemplates
private

Definition at line 72 of file SiPixelChargeReweightingAlgorithm.h.

Referenced by PixelTempRewgt2D().

◆ templ2D

SiPixelTemplate2D SiPixelChargeReweightingAlgorithm::templ2D
private

Definition at line 64 of file SiPixelChargeReweightingAlgorithm.h.

Referenced by PixelTempRewgt2D().

◆ templateStores_

std::vector<SiPixelTemplateStore2D> SiPixelChargeReweightingAlgorithm::templateStores_
private

Definition at line 74 of file SiPixelChargeReweightingAlgorithm.h.

◆ track

std::vector<float> SiPixelChargeReweightingAlgorithm::track
private

Definition at line 67 of file SiPixelChargeReweightingAlgorithm.h.

Referenced by hitSignalReweight(), and PixelTempRewgt2D().

◆ UseReweighting

const bool SiPixelChargeReweightingAlgorithm::UseReweighting
private

◆ xdouble

std::vector<bool> SiPixelChargeReweightingAlgorithm::xdouble
private

Definition at line 65 of file SiPixelChargeReweightingAlgorithm.h.

Referenced by hitSignalReweight(), and PixelTempRewgt2D().

◆ ydouble

std::vector<bool> SiPixelChargeReweightingAlgorithm::ydouble
private

Definition at line 66 of file SiPixelChargeReweightingAlgorithm.h.

Referenced by hitSignalReweight(), and PixelTempRewgt2D().

Vector3DBase< float, LocalTag >
SiPixelTemplate2D::xsize
float xsize()
pixel x-size (microns)
Definition: SiPixelTemplate2D.h:266
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
Point2DBase
Definition: Point2DBase.h:9
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
array_2d
boost::multi_array< float, 2 > array_2d
Definition: SiPixelDigitizerAlgorithm.h:24
SiPixelTemplate2D::xytemp
bool xytemp(float xhit, float yhit, bool ydouble[21+2], bool xdouble[13+2], float template2d[13+2][21+2], bool dervatives, float dpdx2d[2][13+2][21+2], float &QTemplate)
Definition: SiPixelTemplate2D.cc:1016
mps_fire.i
i
Definition: mps_fire.py:428
SiPixelChargeReweightingAlgorithm::dbobject_num
const SiPixel2DTemplateDBObject * dbobject_num
Definition: SiPixelChargeReweightingAlgorithm.h:77
SiPixel2DTemplateDBObjectRcd
Definition: SiPixel2DTemplateDBObjectRcd.h:24
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
SiPixelDigitizerAlgorithm
Definition: SiPixelDigitizerAlgorithm.h:55
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
SiPixelChargeReweightingAlgorithm::signal_map_type
std::map< int, SiPixelDigitizerAlgorithm::Amplitude, std::less< int > > signal_map_type
Definition: SiPixelChargeReweightingAlgorithm.h:42
SiPixelChargeReweightingAlgorithm::templ2D
SiPixelTemplate2D templ2D
Definition: SiPixelChargeReweightingAlgorithm.h:64
cuy.col
col
Definition: cuy.py:1010
gather_cfg.cout
cout
Definition: gather_cfg.py:144
THX
#define THX
Definition: SiPixelTemplateDefs.h:31
SiPixelTemplate2D::getid
bool getid(int id)
Definition: SiPixelTemplate2D.cc:569
SiPixelChargeReweightingAlgorithm::PixelTempRewgt2D
int PixelTempRewgt2D(int id_gen, int id_rewgt, array_2d &cluster)
Definition: SiPixelChargeReweightingAlgorithm.cc:344
ysize
const Int_t ysize
Definition: trackSplitPlot.h:43
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
Topology::localPosition
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
SiPixelChargeReweightingAlgorithm::UseReweighting
const bool UseReweighting
Definition: SiPixelChargeReweightingAlgorithm.h:70
SiPixelChargeReweightingAlgorithm::IDnum
int IDnum
Definition: SiPixelChargeReweightingAlgorithm.h:68
xsize
const Int_t xsize
Definition: trackSplitPlot.h:42
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
TXSIZE
#define TXSIZE
Definition: SiPixelTemplateDefs.h:30
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
PixelTopology::isItBigPixelInX
virtual bool isItBigPixelInX(int ixbin) const =0
SiPixelTemplate2D::s50
float s50()
1/2 of the pixel threshold signal in adc units
Definition: SiPixelTemplate2D.h:210
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
BYM2
#define BYM2
Definition: SiPixelTemplateDefs.h:28
SiPixelChargeReweightingAlgorithm::xdouble
std::vector< bool > xdouble
Definition: SiPixelChargeReweightingAlgorithm.h:65
SiPixelChargeReweightingAlgorithm::templateStores_
std::vector< SiPixelTemplateStore2D > templateStores_
Definition: SiPixelChargeReweightingAlgorithm.h:74
SiPixelChargeReweightingAlgorithm::PrintTemplates
const bool PrintTemplates
Definition: SiPixelChargeReweightingAlgorithm.h:72
BXM2
#define BXM2
Definition: SiPixelTemplateDefs.h:36
edm::ESHandle
Definition: DTSurvey.h:22
SiPixelChargeReweightingAlgorithm::ydouble
std::vector< bool > ydouble
Definition: SiPixelChargeReweightingAlgorithm.h:66
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
PixelTopology::ncolumns
virtual int ncolumns() const =0
dqmdumpme.k
k
Definition: dqmdumpme.py:60
PixelDigi::pixelToChannel
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:71
Point3DBase< float, LocalTag >
SiPixelChargeReweightingAlgorithm::track
std::vector< float > track
Definition: SiPixelChargeReweightingAlgorithm.h:67
hit::z
double z
Definition: SiStripHitEffFromCalibTree.cc:91
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
MeasurementPoint
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Definition: MeasurementPoint.h:12
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
SiPixel2DTemplateDBObject::getTemplateID
short getTemplateID(const uint32_t &detid) const
Definition: SiPixel2DTemplateDBObject.h:90
PV2DBase::y
T y() const
Definition: PV2DBase.h:44
PV2DBase::x
T x() const
Definition: PV2DBase.h:43
PixelTopology::isItBigPixelInY
virtual bool isItBigPixelInY(int iybin) const =0
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
createfilelist.int
int
Definition: createfilelist.py:10
TYSIZE
#define TYSIZE
Definition: SiPixelTemplateDefs.h:21
SiPixelChargeReweightingAlgorithm::printCluster
void printCluster(array_2d &cluster)
Definition: SiPixelChargeReweightingAlgorithm.cc:567
Topology::measurementPosition
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
SiPixelChargeReweightingAlgorithm::IDden
int IDden
Definition: SiPixelChargeReweightingAlgorithm.h:68
get
#define get
SiPixelTemplate2D::ysize
float ysize()
pixel y-size (microns)
Definition: SiPixelTemplate2D.h:267
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
THY
#define THY
Definition: SiPixelTemplateDefs.h:22
LaserClient_cfi.Amplitude
Amplitude
Definition: LaserClient_cfi.py:39
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
genParticles_cff.map
map
Definition: genParticles_cff.py:11
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SiPixelChargeReweightingAlgorithm::PrintClusters
const bool PrintClusters
Definition: SiPixelChargeReweightingAlgorithm.h:71
SiPixel2DTemplateDBObject::numOfTempl
int numOfTempl() const
Definition: SiPixel2DTemplateDBObject.h:62
PixelTopology::nrows
virtual int nrows() const =0
SiPixelTemplate2D::pushfile
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > &pixelTemp, std::string dir="CalibTracker/SiPixelESProducers/data/")
Definition: SiPixelTemplate2D.cc:61
hit
Definition: SiStripHitEffFromCalibTree.cc:88
SiPixelChargeReweightingAlgorithm::dbobject_den
const SiPixel2DTemplateDBObject * dbobject_den
Definition: SiPixelChargeReweightingAlgorithm.h:76
PixelDigi::channelToPixel
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:65