16 #include "boost/multi_array.hpp"
22 constexpr float HALF_PI = 1.57079632679489656;
33 :
PixelCPEBase(conf, mag, lorentzAngle, genErrorParm, templateDBobject)
38 <<
" constructing a generic algorithm for ideal pixel detector.\n"
62 if ( !UseErrorsFromTemplates_ && ( TruncatePixelCharge_ ||
63 IrradiationBiasCorrection_ ||
65 LoadTemplatesFromDB_ ) )
68 <<
"\nERROR: UseErrorsFromTemplates_ is set to False in PixelCPEGeneric_cfi.py. "
69 <<
" In this case it does not make sense to set any of the following to True: "
70 <<
" TruncatePixelCharge_, IrradiationBiasCorrection_, DoCosmics_, LoadTemplatesFromDB_ !!!"
74 if ( UseErrorsFromTemplates_ )
77 if ( LoadTemplatesFromDB_ )
82 <<
"ERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
83 << ( *templateDBobject_ ).version() <<
". Template ID is " <<
templID_;
89 <<
"ERROR: Templates not loaded correctly from text file. Reconstruction will fail." <<
" Template ID is " <<
templID_;
107 yerr_barrel_l1_= {0.00375,0.00230,0.00250,0.00250,0.00230,0.00230,0.00210,0.00210,0.00240};
111 yerr_barrel_ln_= {0.00375,0.00230,0.00250,0.00250,0.00230,0.00230,0.00210,0.00210,0.00240};
118 bool isUpgrade=
false;
123 yerr_barrel_ln_= {0.00299,0.00203,0.0023,0.00237,0.00233,0.00243,0.00232,0.00259,0.00176};
133 yerr_barrel_l1_= {0.00199,0.00136,0.0015,0.00153,0.00152,0.00171,0.00154,0.00157,0.00154};
139 yerr_barrel_l1_= {0.00299,0.00203,0.0023,0.00237,0.00233,0.00243,0.00232,0.00259,0.00176};
168 float qclus = cluster.
charge();
171 float locBz = (*theParam).bz;
260 <<
"\n\t >>> cluster.x = " << cluster.
x()
261 <<
"\n\t >>> cluster.y = " << cluster.
y()
262 <<
"\n\t >>> cluster: minRow = " << cluster.
minPixelRow()
264 <<
"\n\t >>> cluster: maxRow = " << cluster.
maxPixelRow()
266 <<
"\n\t >>> meas: inner lower left = " << meas_URcorn_LLpix.x()
267 <<
"," << meas_URcorn_LLpix.y()
268 <<
"\n\t >>> meas: inner upper right = " << meas_LLcorn_URpix.x()
269 <<
"," << meas_LLcorn_URpix.y()
283 cout <<
"\t >>> Generic:: processing X" << endl;
289 local_URcorn_LLpix.x(), local_LLcorn_URpix.
x(),
302 cout <<
"\t >>> Generic:: processing Y" << endl;
308 local_URcorn_LLpix.y(), local_LLcorn_URpix.
y(),
321 if ( cluster.
sizeX() == 1 )
344 if ( cluster.
sizeY() == 1 )
387 float upper_edge_first_pix,
388 float lower_edge_last_pix,
389 float half_lorentz_shift,
394 float eff_charge_cut_low,
395 float eff_charge_cut_high,
399 float geom_center = 0.5f * ( upper_edge_first_pix + lower_edge_last_pix );
410 return geom_center + half_lorentz_shift;
416 float W_inner = lower_edge_last_pix - upper_edge_first_pix;
422 - 2.f * half_lorentz_shift;
426 float sum_of_edge = 2.0f;
427 if (first_is_big) sum_of_edge += 1.0f;
428 if (last_is_big) sum_of_edge += 1.0f;
432 float W_eff =
std::abs( W_pred ) - W_inner;
441 if ( (size >= size_cut) || (
442 ( W_eff/pitch < eff_charge_cut_low ) |
443 ( W_eff/pitch > eff_charge_cut_high ) ) )
445 W_eff = pitch * 0.5f * sum_of_edge;
452 float Qdiff = Q_l - Q_f;
453 float Qsum = Q_l + Q_f;
456 if(Qsum==0) Qsum=1.0f;
457 float hit_pos = geom_center + 0.5f*(Qdiff/Qsum) * W_eff + half_lorentz_shift;
463 cout <<
"\t >>> We are in the Barrel." ;
465 cout <<
"\t >>> We are in the Forward." ;
468 <<
"\n\t >>> cot(angle) = " << cot_angle <<
" pitch = " << pitch <<
" size = " << size
469 <<
"\n\t >>> upper_edge_first_pix = " << upper_edge_first_pix
470 <<
"\n\t >>> lower_edge_last_pix = " << lower_edge_last_pix
471 <<
"\n\t >>> geom_center = " << geom_center
472 <<
"\n\t >>> half_lorentz_shift = " << half_lorentz_shift
473 <<
"\n\t >>> W_inner = " << W_inner
474 <<
"\n\t >>> W_pred = " << W_pred
475 <<
"\n\t >>> W_eff(orig) = " << fabs( W_pred ) - W_inner
476 <<
"\n\t >>> W_eff(used) = " << W_eff
477 <<
"\n\t >>> sum_of_edge = " << sum_of_edge
478 <<
"\n\t >>> Qdiff = " << Qdiff <<
" Qsum = " << Qsum
479 <<
"\n\t >>> hit_pos = " << hit_pos
484 cout <<
"\n\t >>> Used Edge algorithm." ;
486 cout <<
"\n\t >>> Used angle information." ;
526 int isize = cluster.
size();
528 for (
int i = 0;
i != isize; ++
i)
530 auto const & pixel = cluster.
pixel(
i);
532 float pix_adc = pixel.
adc;
538 if ( pixel.x == xmin ) Q_f_X += pix_adc;
539 if ( pixel.x == xmax ) Q_l_X += pix_adc;
542 if ( pixel.y == ymin ) Q_f_Y += pix_adc;
543 if ( pixel.y == ymax ) Q_l_Y += pix_adc;
585 unsigned int sizex = maxPixelRow - minPixelRow+1;
586 unsigned int sizey = maxPixelCol - minPixelCol+1;
588 bool edgex = (
theRecTopol->isItEdgePixelInX( minPixelRow ) ) || (
theRecTopol->isItEdgePixelInX( maxPixelRow ) );
589 bool edgey = (
theRecTopol->isItEdgePixelInY( minPixelCol ) ) || (
theRecTopol->isItEdgePixelInY( maxPixelCol ) );
592 bool bigInX =
theRecTopol->containsBigPixelInX( minPixelRow, maxPixelRow );
593 bool bigInY =
theRecTopol->containsBigPixelInY( minPixelCol, maxPixelCol );
658 int row_offset = minPixelRow;
659 int col_offset = minPixelCol;
661 for (
int irow = 0; irow < 7; ++irow)
663 if (
theRecTopol->isItBigPixelInX( irow+row_offset ) )
667 for (
int icol = 0; icol < 21; ++icol)
669 if (
theRecTopol->isItBigPixelInY( icol+col_offset ) )
715 if ( edgex && edgey )
727 pair<float,float> errPair =
731 xerr = errPair.first;
733 yerr = errPair.second;
737 " Sizex = " << cluster.
sizeX() <<
" Sizey = " << cluster.
sizeY() <<
738 " Edgex = " << edgex <<
" Edgey = " << edgey <<
739 " ErrX = " << xerr <<
" ErrY = " << yerr;
749 <<
"\nERROR: Negative pixel error xerr = " << xerr <<
"\n\n";
753 <<
"\nERROR: Negative pixel error yerr = " << yerr <<
"\n\n";
756 auto xerr_sq = xerr*xerr;
757 auto yerr_sq = yerr*yerr;
T getParameter(std::string const &) const
std::vector< float > xerr_barrel_l1_
Topology::LocalTrackPred loc_trk_pred_
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
float the_eff_charge_cut_highY
SiPixelCPEGenericDBErrorParametrization * genErrorsFromDB_
int qbin(int id, float cotalpha, float cotbeta, float locBz, float qclus, float &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)
std::vector< float > xerr_barrel_ln_
short getTemplateID(const uint32_t &detid) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
bool UseErrorsFromTemplates_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::pair< float, float > getError(const SiPixelCPEGenericErrorParm *parmErrors, GeomDetType::SubDetector pixelPart, int sizex, int sizey, float alpha, float beta, bool bigInX=false, bool bigInY=false)
GeomDetType::SubDetector thePart
bool IrradiationBiasCorrection_
unsigned int layer() const
layer id
std::vector< float > yerr_endcap_
void collect_edge_charges(const SiPixelCluster &cluster, float &Q_f_X, float &Q_l_X, float &Q_f_Y, float &Q_l_Y) const
LocalPoint localPosition(const SiPixelCluster &cluster) const
uint32_t rawId() const
get the raw id
bool TruncatePixelCharge_
void computeLorentzShifts() const
float the_eff_charge_cut_lowX
LocalError localError(const SiPixelCluster &cl) const
bool LoadTemplatesFromDB_
float generic_position_formula(int size, float Q_f, float Q_l, float upper_edge_first_pix, float lower_edge_last_pix, float half_lorentz_shift, 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) const
PixelCPEGeneric(edm::ParameterSet const &conf, const MagneticField *, const SiPixelLorentzAngle *, const SiPixelCPEGenericErrorParm *, const SiPixelTemplateDBObject *)
The constructor.
bool inflate_all_errors_no_trk_angle
Abs< T >::type abs(const T &t)
const SiPixelTemplateDBObject * templateDBobject_
DetId geographicalId() const
The label of this GeomDet.
float xerr_barrel_l1_def_
std::vector< float > xerr_endcap_
bool pushfile(int filenum)
const RectangularPixelTopology * theRecTopol
const PixelTopology * theTopol
float the_eff_charge_cut_lowY
std::vector< float > yerr_barrel_l1_
float yerr_barrel_l1_def_
std::vector< float > yerr_barrel_ln_
Pixel cluster – collection of neighboring pixels above threshold.
float xerr_barrel_ln_def_
const PixelGeomDetUnit * theDet
float yerr_barrel_ln_def_
tuple size
Write out results.
const SiPixelCPEGenericErrorParm * genErrorParm_
float the_eff_charge_cut_highX