17 #include "boost/multi_array.hpp" 23 constexpr
float micronsToCm = 1.0e-4;
38 LogDebug(
"PixelCPEGeneric") <<
" constructing a generic algorithm for ideal pixel detector.\n" 65 <<
"\nERROR: useErrorsFromTemplates_ is set to False in PixelCPEGeneric_cfi.py. " 66 <<
" In this case it does not make sense to set any of the following to True: " 67 <<
" truncatePixelCharge_, IrradiationBiasCorrection_, DoCosmics_, LoadTemplatesFromDB_ !!!" 76 <<
"ERROR: GenErrors not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " 77 << (*genErrorDBObject_).version();
78 LogDebug(
"PixelCPEGeneric") <<
"Loaded genErrorDBObject v" << (*genErrorDBObject_).version();
82 <<
"ERROR: GenErrors not loaded correctly from text file. Reconstruction will fail.";
87 cout <<
" Use simple parametrised errors " << endl;
92 cout <<
"From PixelCPEGeneric::PixelCPEGeneric(...)" << endl;
118 if (useErrorsFromTemplates_) {
120 float locBz = theDetParam.
bz;
121 float locBx = theDetParam.
bx;
124 theClusterParam.
pixmx = -999;
125 theClusterParam.
sigmay = -999.9;
126 theClusterParam.
deltay = -999.9;
127 theClusterParam.
sigmax = -999.9;
128 theClusterParam.
deltax = -999.9;
129 theClusterParam.
sy1 = -999.9;
130 theClusterParam.
dy1 = -999.9;
131 theClusterParam.
sy2 = -999.9;
132 theClusterParam.
dy2 = -999.9;
133 theClusterParam.
sx1 = -999.9;
134 theClusterParam.
dx1 = -999.9;
135 theClusterParam.
sx2 = -999.9;
136 theClusterParam.
dx2 = -999.9;
144 theClusterParam.
qBin_ = gtempl.
qbin(gtemplID_,
150 IrradiationBiasCorrection_,
151 theClusterParam.
pixmx,
163 theClusterParam.
dx2);
167 bool useLAWidthFromGenError =
false;
168 if (useLAWidthFromGenError) {
169 chargeWidthX = (-micronsToCm * gtempl.
lorxwidth());
170 chargeWidthY = (-micronsToCm * gtempl.
lorywidth());
171 LogDebug(
"PixelCPE localPosition():") <<
"redefine la width (gen-error)" << chargeWidthX << chargeWidthY;
173 LogDebug(
"PixelCPE localPosition():") <<
"GenError:" << gtemplID_;
176 theClusterParam.
deltax = theClusterParam.
deltax * micronsToCm;
177 theClusterParam.
dx1 = theClusterParam.
dx1 * micronsToCm;
178 theClusterParam.
dx2 = theClusterParam.
dx2 * micronsToCm;
180 theClusterParam.
deltay = theClusterParam.
deltay * micronsToCm;
181 theClusterParam.
dy1 = theClusterParam.
dy1 * micronsToCm;
182 theClusterParam.
dy2 = theClusterParam.
dy2 * micronsToCm;
184 theClusterParam.
sigmax = theClusterParam.
sigmax * micronsToCm;
185 theClusterParam.
sx1 = theClusterParam.
sx1 * micronsToCm;
186 theClusterParam.
sx2 = theClusterParam.
sx2 * micronsToCm;
188 theClusterParam.
sigmay = theClusterParam.
sigmay * micronsToCm;
189 theClusterParam.
sy1 = theClusterParam.
sy1 * micronsToCm;
190 theClusterParam.
sy2 = theClusterParam.
sy2 * micronsToCm;
194 theClusterParam.
qBin_ = 0;
201 collect_edge_charges(theClusterParam, q_f_X, q_l_X, q_f_Y, q_l_Y, useErrorsFromTemplates_ && truncatePixelCharge_);
234 cout <<
"\n\t >>> theClusterParam.theCluster->x = " << theClusterParam.
theCluster->
x()
235 <<
"\n\t >>> theClusterParam.theCluster->y = " << theClusterParam.
theCluster->
y()
240 <<
"\n\t >>> meas: inner lower left = " << meas_URcorn_LLpix.
x() <<
"," << meas_URcorn_LLpix.
y()
241 <<
"\n\t >>> meas: inner upper right = " << meas_LLcorn_URpix.x() <<
"," << meas_LLcorn_URpix.y() << endl;
253 cout <<
"\t >>> Generic:: processing X" << endl;
260 local_URcorn_LLpix.x(),
261 local_LLcorn_URpix.
x(),
268 the_eff_charge_cut_lowX,
269 the_eff_charge_cut_highX,
273 xPos = xPos + shiftX;
277 cout <<
"\t >>> Generic:: processing Y" << endl;
284 local_URcorn_LLpix.y(),
285 local_LLcorn_URpix.
y(),
292 the_eff_charge_cut_lowY,
293 the_eff_charge_cut_highY,
297 yPos = yPos + shiftY;
300 if (IrradiationBiasCorrection_) {
309 xPos -= theClusterParam.
dx1;
311 xPos -= theClusterParam.
dx2;
315 xPos -= theClusterParam.
deltax;
326 yPos -= theClusterParam.
dy1;
328 yPos -= theClusterParam.
dy2;
332 yPos -= theClusterParam.
deltay;
354 bool edgex, edgey, bigInX, bigInY;
355 int maxPixelCol, maxPixelRow, minPixelCol, minPixelRow;
358 initializeLocalErrorVariables(xerr,
374 useErrorsFromTemplates_ && (!NoTemplateErrorsWhenNoTrkAngles_ || theClusterParam.
with_track_angle);
376 if (
int(sizex) != (maxPixelRow - minPixelRow + 1))
377 LogDebug(
"PixelCPEGeneric") <<
" wrong x";
378 if (
int(sizey) != (maxPixelCol - minPixelCol + 1))
379 LogDebug(
"PixelCPEGeneric") <<
" wrong y";
381 LogDebug(
"PixelCPEGeneric") <<
" edge clus " << xerr <<
" " << yerr;
382 if (bigInX || bigInY)
383 LogDebug(
"PixelCPEGeneric") <<
" big " << bigInX <<
" " << bigInY;
385 LogDebug(
"PixelCPEGeneric") <<
" edge " << edgex <<
" " << edgey;
386 LogDebug(
"PixelCPEGeneric") <<
" before if " << useErrorsFromTemplates_ <<
" " << theClusterParam.
qBin_;
387 if (theClusterParam.
qBin_ == 0)
388 LogDebug(
"PixelCPEGeneric") <<
" qbin 0! " << edgex <<
" " << edgey <<
" " << bigInX <<
" " << bigInY <<
" " 389 << sizex <<
" " << sizey;
392 setXYErrors(xerr, yerr, edgex, edgey, sizex, sizey, bigInX, bigInY, useTempErrors, theDetParam, theClusterParam);
394 if (!useTempErrors) {
395 LogDebug(
"PixelCPEGeneric") <<
"Track angles are not known.\n" 396 <<
"Default angle estimation which assumes track from PV (0,0,0) does not work.";
403 for (
int irow = 0; irow < 7; ++irow) {
408 for (
int icol = 0; icol < 21; ++icol) {
419 throw cms::Exception(
"PixelCPEGeneric::localError") <<
"\nERROR: Negative pixel error xerr = " << xerr <<
"\n\n";
422 throw cms::Exception(
"PixelCPEGeneric::localError") <<
"\nERROR: Negative pixel error yerr = " << yerr <<
"\n\n";
425 LogDebug(
"PixelCPEGeneric") <<
" errors " << xerr <<
" " << yerr;
426 if (theClusterParam.
qBin_ == 0)
427 LogDebug(
"PixelCPEGeneric") <<
" qbin 0 " << xerr <<
" " << yerr;
429 auto xerr_sq = xerr * xerr;
430 auto yerr_sq = yerr * yerr;
437 desc.add<
double>(
"eff_charge_cut_highX", 1.0);
438 desc.add<
double>(
"eff_charge_cut_highY", 1.0);
439 desc.add<
double>(
"eff_charge_cut_lowX", 0.0);
440 desc.add<
double>(
"eff_charge_cut_lowY", 0.0);
441 desc.add<
double>(
"size_cutX", 3.0);
442 desc.add<
double>(
"size_cutY", 3.0);
443 desc.add<
double>(
"EdgeClusterErrorX", 50.0);
444 desc.add<
double>(
"EdgeClusterErrorY", 85.0);
445 desc.add<
bool>(
"inflate_errors",
false);
446 desc.add<
bool>(
"inflate_all_errors_no_trk_angle",
false);
447 desc.add<
bool>(
"NoTemplateErrorsWhenNoTrkAngles",
false);
448 desc.add<
bool>(
"UseErrorsFromTemplates",
true);
449 desc.add<
bool>(
"TruncatePixelCharge",
true);
450 desc.add<
bool>(
"IrradiationBiasCorrection",
false);
451 desc.add<
bool>(
"DoCosmics",
false);
452 desc.add<
bool>(
"isPhase2",
false);
453 desc.add<
bool>(
"SmallPitch",
false);
T getParameter(std::string const &) const
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > &pixelTemp, std::string dir="")
float the_eff_charge_cut_highY
const SiPixelCluster * theCluster
LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const override
float generic_position_formula(int size, int q_f, int q_l, float upper_edge_first_pix, float lower_edge_last_pix, float lorentz_shift, float theThickness, float cot_angle, float pitch, bool first_is_big, bool last_is_big, float eff_charge_cut_low, float eff_charge_cut_high, float size_cut)
std::vector< SiPixelGenErrorStore > thePixelGenError_
bool IrradiationBiasCorrection_
bool NoTemplateErrorsWhenNoTrkAngles_
const RectangularPixelTopology * theRecTopol
PixelCPEGeneric(edm::ParameterSet const &conf, const MagneticField *, const TrackerGeometry &, const TrackerTopology &, const SiPixelLorentzAngle *, const SiPixelGenErrorDBObject *, const SiPixelLorentzAngle *)
The constructor.
int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, bool irradiationCorrections, int &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2)
const PixelTopology * theTopol
bool LoadTemplatesFromDB_
bool isItBigPixelInX(const int ixbin) const override
bool useErrorsFromTemplates_
float the_eff_charge_cut_lowX
bool inflate_all_errors_no_trk_angle
const bool truncatePixelCharge_
float lorxwidth()
signed lorentz x-width (microns)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Topology::LocalTrackPred loc_trk_pred
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
static const int theVerboseLevel
const SiPixelGenErrorDBObject * genErrorDBObject_
float the_eff_charge_cut_lowY
float lorywidth()
signed lorentz y-width (microns)
bool isItBigPixelInY(const int iybin) const override
static void fillPSetDescription(edm::ParameterSetDescription &desc)
LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const override
float the_eff_charge_cut_highX