16 #include "boost/multi_array.hpp"
21 const double HALF_PI = 1.57079632679489656;
28 :
PixelCPEBase(conf, mag, lorentzAngle, genErrorParm, templateDBobject)
33 <<
" constructing a generic algorithm for ideal pixel detector.\n"
57 if ( !UseErrorsFromTemplates_ && ( TruncatePixelCharge_ ||
58 IrradiationBiasCorrection_ ||
60 LoadTemplatesFromDB_ ) )
63 <<
"\nERROR: UseErrorsFromTemplates_ is set to False in PixelCPEGeneric_cfi.py. "
64 <<
" In this case it does not make sense to set any of the following to True: "
65 <<
" TruncatePixelCharge_, IrradiationBiasCorrection_, DoCosmics_, LoadTemplatesFromDB_ !!!"
69 if ( UseErrorsFromTemplates_ )
72 if ( LoadTemplatesFromDB_ )
77 <<
"ERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
78 << ( *templateDBobject_ ).version() <<
". Template ID is " <<
templID_;
84 <<
"ERROR: Templates not loaded correctly from text file. Reconstruction will fail." <<
" Template ID is " <<
templID_;
102 yerr_barrel_l1_= {0.00375,0.00230,0.00250,0.00250,0.00230,0.00230,0.00210,0.00210,0.00240};
106 yerr_barrel_ln_= {0.00375,0.00230,0.00250,0.00250,0.00230,0.00230,0.00210,0.00210,0.00240};
113 bool isUpgrade=
false;
118 yerr_barrel_ln_= {0.00299,0.00203,0.0023,0.00237,0.00233,0.00243,0.00232,0.00259,0.00176};
128 yerr_barrel_l1_= {0.00199,0.00136,0.0015,0.00153,0.00152,0.00171,0.00154,0.00157,0.00154};
134 yerr_barrel_l1_= {0.00299,0.00203,0.0023,0.00237,0.00233,0.00243,0.00232,0.00259,0.00176};
165 float qclus = cluster.
charge();
168 float locBz = (*theParam).bz;
220 Q_f_Y, Q_l_Y, Q_m_Y );
258 <<
"\n\t >>> cluster.x = " << cluster.
x()
259 <<
"\n\t >>> cluster.y = " << cluster.
y()
260 <<
"\n\t >>> cluster: minRow = " << cluster.
minPixelRow()
262 <<
"\n\t >>> cluster: maxRow = " << cluster.
maxPixelRow()
264 <<
"\n\t >>> meas: inner lower left = " << meas_URcorn_LLpix.x()
265 <<
"," << meas_URcorn_LLpix.y()
266 <<
"\n\t >>> meas: inner upper right = " << meas_LLcorn_URpix.x()
267 <<
"," << meas_LLcorn_URpix.y()
278 cout <<
"\t >>> Generic:: processing X" << endl;
283 local_URcorn_LLpix.x(), local_LLcorn_URpix.
x(),
295 cout <<
"\t >>> Generic:: processing Y" << endl;
299 local_URcorn_LLpix.y(), local_LLcorn_URpix.
y(),
312 if ( cluster.
sizeX() == 1 )
335 if ( cluster.
sizeY() == 1 )
378 double upper_edge_first_pix,
379 double lower_edge_last_pix,
380 double half_lorentz_shift,
385 double eff_charge_cut_low,
386 double eff_charge_cut_high,
390 double geom_center = 0.5 * ( upper_edge_first_pix + lower_edge_last_pix );
401 return geom_center + half_lorentz_shift;
407 double W_inner = lower_edge_last_pix - upper_edge_first_pix;
413 - 2 * half_lorentz_shift;
417 double sum_of_edge = 0.0;
418 if (first_is_big) sum_of_edge += 2.0;
419 else sum_of_edge += 1.0;
421 if (last_is_big) sum_of_edge += 2.0;
422 else sum_of_edge += 1.0;
426 double W_eff = fabs( W_pred ) - W_inner;
434 bool usedEdgeAlgo =
false;
435 if (( W_eff/pitch < eff_charge_cut_low ) ||
436 ( W_eff/pitch > eff_charge_cut_high ) || (size >= size_cut))
438 W_eff = pitch * 0.5 * sum_of_edge;
445 double Qdiff = Q_l - Q_f;
446 double Qsum = Q_l + Q_f;
449 if(Qsum==0) Qsum=1.0;
450 double hit_pos = geom_center + 0.5*(Qdiff/Qsum) * W_eff + half_lorentz_shift;
455 cout <<
"\t >>> We are in the Barrel." ;
457 cout <<
"\t >>> We are in the Forward." ;
460 <<
"\n\t >>> cot(angle) = " << cot_angle <<
" pitch = " << pitch <<
" size = " << size
461 <<
"\n\t >>> upper_edge_first_pix = " << upper_edge_first_pix
462 <<
"\n\t >>> lower_edge_last_pix = " << lower_edge_last_pix
463 <<
"\n\t >>> geom_center = " << geom_center
464 <<
"\n\t >>> half_lorentz_shift = " << half_lorentz_shift
465 <<
"\n\t >>> W_inner = " << W_inner
466 <<
"\n\t >>> W_pred = " << W_pred
467 <<
"\n\t >>> W_eff(orig) = " << fabs( W_pred ) - W_inner
468 <<
"\n\t >>> W_eff(used) = " << W_eff
469 <<
"\n\t >>> sum_of_edge = " << sum_of_edge
470 <<
"\n\t >>> Qdiff = " << Qdiff <<
" Qsum = " << Qsum
471 <<
"\n\t >>> hit_pos = " << hit_pos
476 cout <<
"\n\t >>> Used Edge algorithm." ;
478 cout <<
"\n\t >>> Used angle information." ;
507 Q_f_X = Q_l_X = Q_m_X = 0.0;
508 Q_f_Y = Q_l_Y = Q_m_Y = 0.0;
520 int isize = cluster.
size();
522 for (
int i = 0;
i != isize; ++
i)
524 auto const & pixel = cluster.
pixel(
i);
526 float pix_adc = pixel.
adc;
532 if ( pixel.x == xmin )
534 else if ( pixel.x == xmax )
540 if ( pixel.y == ymin )
542 else if ( pixel.y == ymax )
564 float xerr_sq = -99999.9f;
565 float yerr_sq = -99999.9f;
594 unsigned int sizex = maxPixelRow - minPixelRow+1;
595 unsigned int sizey = maxPixelCol - minPixelCol+1;
597 bool edgex = (
theRecTopol->isItEdgePixelInX( minPixelRow ) ) || (
theRecTopol->isItEdgePixelInX( maxPixelRow ) );
598 bool edgey = (
theRecTopol->isItEdgePixelInY( minPixelCol ) ) || (
theRecTopol->isItEdgePixelInY( maxPixelCol ) );
601 bool bigInX =
theRecTopol->containsBigPixelInX( minPixelRow, maxPixelRow );
602 bool bigInY =
theRecTopol->containsBigPixelInY( minPixelCol, maxPixelCol );
667 int row_offset = minPixelRow;
668 int col_offset = minPixelCol;
670 for (
int irow = 0; irow < 7; ++irow)
672 if (
theRecTopol->isItBigPixelInX( irow+row_offset ) )
676 for (
int icol = 0; icol < 21; ++icol)
678 if (
theRecTopol->isItBigPixelInY( icol+col_offset ) )
724 if ( edgex && edgey )
731 pair<float,float> errPair =
735 xerr = errPair.first;
737 yerr = errPair.second;
743 " Sizex = " << cluster.
sizeX() <<
" Sizey = " << cluster.
sizeY() <<
744 " Edgex = " << edgex <<
" Edgey = " << edgey <<
745 " ErrX = " << xerr <<
" ErrY = " << yerr;
754 <<
"\nERROR: Negative pixel error xerr = " << xerr <<
"\n\n";
758 <<
"\nERROR: Negative pixel error yerr = " << yerr <<
"\n\n";
T getParameter(std::string const &) const
std::vector< float > xerr_barrel_l1_
Topology::LocalTrackPred loc_trk_pred_
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, float &lorywidth, float &lorxwidth)
void collect_edge_charges(const SiPixelCluster &cluster, float &Q_f_X, float &Q_l_X, float &Q_m_X, float &Q_f_Y, float &Q_l_Y, float &Q_m_Y) const
double generic_position_formula(int size, double Q_f, double Q_l, double upper_edge_first_pix, double lower_edge_last_pix, double half_lorentz_shift, double cot_angle, double pitch, bool first_is_big, bool last_is_big, double eff_charge_cut_low, double eff_charge_cut_high, double size_cut) const
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
SiPixelCPEGenericDBErrorParametrization * genErrorsFromDB_
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
double EdgeClusterErrorY_
std::vector< float > yerr_endcap_
double lorentzShiftInCmY_
uint32_t rawId() const
get the raw id
bool TruncatePixelCharge_
double the_eff_charge_cut_highX
LocalPoint localPosition(const SiPixelCluster &cluster, const GeomDetUnit &det) const
void computeLorentzShifts() const
double the_eff_charge_cut_lowY
bool LoadTemplatesFromDB_
PixelCPEGeneric(edm::ParameterSet const &conf, const MagneticField *, const SiPixelLorentzAngle *, const SiPixelCPEGenericErrorParm *, const SiPixelTemplateDBObject *)
The constructor.
bool inflate_all_errors_no_trk_angle
double lorentzShiftInCmX_
const SiPixelTemplateDBObject * templateDBobject_
DetId geographicalId() const
The label of this GeomDet.
double EdgeClusterErrorX_
float xerr_barrel_l1_def_
std::vector< float > xerr_endcap_
LocalError localError(const SiPixelCluster &cl, const GeomDetUnit &det) const
bool pushfile(int filenum)
const RectangularPixelTopology * theRecTopol
const PixelTopology * theTopol
std::vector< float > yerr_barrel_l1_
float yerr_barrel_l1_def_
std::vector< float > yerr_barrel_ln_
void setTheDet(const GeomDetUnit &det, const SiPixelCluster &cluster) const
Pixel cluster – collection of neighboring pixels above threshold.
double the_eff_charge_cut_lowX
float xerr_barrel_ln_def_
const PixelGeomDetUnit * theDet
double the_eff_charge_cut_highY
float yerr_barrel_ln_def_
tuple size
Write out results.
const SiPixelCPEGenericErrorParm * genErrorParm_