13 #include "boost/multi_array.hpp"
18 const double HALF_PI = 1.57079632679489656;
25 :
PixelCPEBase(conf, mag, lorentzAngle, genErrorParm, templateDBobject)
30 <<
" constructing a generic algorithm for ideal pixel detector.\n"
54 if ( !UseErrorsFromTemplates_ && ( TruncatePixelCharge_ ||
55 IrradiationBiasCorrection_ ||
57 LoadTemplatesFromDB_ ) )
60 <<
"\nERROR: UseErrorsFromTemplates_ is set to False in PixelCPEGeneric_cfi.py. "
61 <<
" In this case it does not make sense to set any of the following to True: "
62 <<
" TruncatePixelCharge_, IrradiationBiasCorrection_, DoCosmics_, LoadTemplatesFromDB_ !!!"
66 if ( UseErrorsFromTemplates_ )
69 if ( LoadTemplatesFromDB_ )
74 <<
"ERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
75 << ( *templateDBobject_ ).version() <<
". Template ID is " <<
templID_;
81 <<
"ERROR: Templates not loaded correctly from text file. Reconstruction will fail." <<
" Template ID is " <<
templID_;
134 float qclus = cluster.
charge();
140 float locBz = Bfield.
z();
192 Q_f_Y, Q_l_Y, Q_m_Y );
230 <<
"\n\t >>> cluster.x = " << cluster.
x()
231 <<
"\n\t >>> cluster.y = " << cluster.
y()
232 <<
"\n\t >>> cluster: minRow = " << cluster.
minPixelRow()
234 <<
"\n\t >>> cluster: maxRow = " << cluster.
maxPixelRow()
236 <<
"\n\t >>> meas: inner lower left = " << meas_URcorn_LLpix.x()
237 <<
"," << meas_URcorn_LLpix.y()
238 <<
"\n\t >>> meas: inner upper right = " << meas_LLcorn_URpix.x()
239 <<
"," << meas_LLcorn_URpix.y()
250 cout <<
"\t >>> Generic:: processing X" << endl;
254 local_URcorn_LLpix.x(), local_LLcorn_URpix.
x(),
266 cout <<
"\t >>> Generic:: processing Y" << endl;
270 local_URcorn_LLpix.y(), local_LLcorn_URpix.
y(),
283 if ( cluster.
sizeX() == 1 )
288 <<
"\nERROR: cluster.maxPixelRow() != cluster.minPixelRow() although x-size = 1 !!!!! " <<
"\n\n";
304 else if ( cluster.
sizeX() > 1 )
311 <<
"\nERROR: Unphysical cluster x-size = " << (int)cluster.
sizeX() <<
"\n\n";
313 if ( cluster.
sizeY() == 1 )
318 <<
"\nERROR: cluster.maxPixelCol() != cluster.minPixelCol() although y-size = 1 !!!!! " <<
"\n\n";
334 else if ( cluster.
sizeY() > 1 )
341 <<
"\nERROR: Unphysical cluster y-size = " << (int)cluster.
sizeY() <<
"\n\n";
363 double upper_edge_first_pix,
364 double lower_edge_last_pix,
365 double half_lorentz_shift,
370 double eff_charge_cut_low,
371 double eff_charge_cut_high,
375 double geom_center = 0.5 * ( upper_edge_first_pix + lower_edge_last_pix );
386 return geom_center + half_lorentz_shift;
392 double W_inner = lower_edge_last_pix - upper_edge_first_pix;
398 - 2 * half_lorentz_shift;
402 double sum_of_edge = 0.0;
403 if (first_is_big) sum_of_edge += 2.0;
404 else sum_of_edge += 1.0;
406 if (last_is_big) sum_of_edge += 2.0;
407 else sum_of_edge += 1.0;
411 double W_eff = fabs( W_pred ) - W_inner;
419 bool usedEdgeAlgo =
false;
420 if (( W_eff/pitch < eff_charge_cut_low ) ||
421 ( W_eff/pitch > eff_charge_cut_high ) || (size >= size_cut))
423 W_eff = pitch * 0.5 * sum_of_edge;
430 double Qdiff = Q_l - Q_f;
431 double Qsum = Q_l + Q_f;
434 if(Qsum==0) Qsum=1.0;
435 double hit_pos = geom_center + 0.5*(Qdiff/Qsum) * W_eff + half_lorentz_shift;
440 cout <<
"\t >>> We are in the Barrel." ;
442 cout <<
"\t >>> We are in the Forward." ;
445 <<
"\n\t >>> cot(angle) = " << cot_angle <<
" pitch = " << pitch <<
" size = " << size
446 <<
"\n\t >>> upper_edge_first_pix = " << upper_edge_first_pix
447 <<
"\n\t >>> lower_edge_last_pix = " << lower_edge_last_pix
448 <<
"\n\t >>> geom_center = " << geom_center
449 <<
"\n\t >>> half_lorentz_shift = " << half_lorentz_shift
450 <<
"\n\t >>> W_inner = " << W_inner
451 <<
"\n\t >>> W_pred = " << W_pred
452 <<
"\n\t >>> W_eff(orig) = " << fabs( W_pred ) - W_inner
453 <<
"\n\t >>> W_eff(used) = " << W_eff
454 <<
"\n\t >>> sum_of_edge = " << sum_of_edge
455 <<
"\n\t >>> Qdiff = " << Qdiff <<
" Qsum = " << Qsum
456 <<
"\n\t >>> hit_pos = " << hit_pos
461 cout <<
"\n\t >>> Used Edge algorithm." ;
463 cout <<
"\n\t >>> Used angle information." ;
492 Q_f_X = Q_l_X = Q_m_X = 0.0;
493 Q_f_Y = Q_l_Y = Q_m_Y = 0.0;
496 const vector<SiPixelCluster::Pixel>& pixelsVec = cluster.
pixels();
511 int isize = pixelsVec.size();
513 for (
int i = 0;
i < isize; ++
i)
515 float pix_adc = -999.9;
521 pix_adc = pixelsVec[
i].adc;
525 if ( pixelsVec[
i].
x == xmin )
527 else if ( pixelsVec[
i].
x == xmax )
533 if ( pixelsVec[
i].
y == ymin )
535 else if ( pixelsVec[
i].
y == ymax )
557 float xerr_sq = -99999.9;
558 float yerr_sq = -99999.9;
560 int sizex = cluster.
sizeX();
561 int sizey = cluster.
sizeY();
606 if ( sizex == 1 ) xerr = 0.00115;
607 else if ( sizex == 2 ) xerr = 0.00120;
608 else if ( sizex == 3 ) xerr = 0.00088;
614 if ( sizey == 1 ) yerr = 0.00375;
615 else if ( sizey == 2 ) yerr = 0.00230;
616 else if ( sizey == 3 ) yerr = 0.00250;
617 else if ( sizey == 4 ) yerr = 0.00250;
618 else if ( sizey == 5 ) yerr = 0.00230;
619 else if ( sizey == 6 ) yerr = 0.00230;
620 else if ( sizey == 7 ) yerr = 0.00210;
621 else if ( sizey == 8 ) yerr = 0.00210;
622 else if ( sizey == 9 ) yerr = 0.00240;
630 if ( sizex == 1 ) xerr = 0.0020;
631 else if ( sizex == 2 ) xerr = 0.0020;
637 if ( sizey == 1 ) yerr = 0.00210;
657 for (
int irow = 0; irow < 7; ++irow)
663 for (
int icol = 0; icol < 21; ++icol)
686 else if ( sizex > 1 )
690 <<
"\nERROR: Unphysical cluster x-size = " << sizex <<
"\n\n";
702 else if ( sizey > 1 )
706 <<
"\nERROR: Unphysical cluster y-size = " << sizex <<
"\n\n";
715 if ( edgex && edgey )
722 pair<float,float> errPair =
726 xerr = errPair.first;
728 yerr = errPair.second;
734 " Sizex = " << cluster.
sizeX() <<
" Sizey = " << cluster.
sizeY() <<
735 " Edgex = " << edgex <<
" Edgey = " << edgey <<
736 " ErrX = " << xerr <<
" ErrY = " << yerr;
745 <<
"\nERROR: Negative pixel error xerr = " << xerr <<
"\n\n";
749 <<
"\nERROR: Negative pixel error yerr = " << yerr <<
"\n\n";
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
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
virtual bool containsBigPixelInX(const int &ixmin, const int &ixmax) const =0
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_
short getTemplateID(const uint32_t &detid) const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
bool UseErrorsFromTemplates_
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_
double EdgeClusterErrorY_
double lorentzShiftInCmY_
uint32_t rawId() const
get the raw id
bool TruncatePixelCharge_
virtual bool isItEdgePixelInX(int ixbin) const =0
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_
const MagneticField * magfield_
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
virtual bool containsBigPixelInY(const int &iymin, const int &iymax) const =0
LocalError localError(const SiPixelCluster &cl, const GeomDetUnit &det) const
MeasurementPoint measurementPosition(const SiPixelCluster &, const GeomDetUnit &det) const
virtual bool isItBigPixelInX(const int ixbin) const =0
bool pushfile(int filenum)
LocalTrajectoryParameters loc_traj_param_
const PixelTopology * theTopol
void setTheDet(const GeomDetUnit &det, const SiPixelCluster &cluster) const
Pixel cluster – collection of neighboring pixels above threshold.
virtual bool isItEdgePixelInY(int iybin) const =0
const BoundPlane & surface() const
The nominal surface of the GeomDet.
double the_eff_charge_cut_lowX
const RotationType & rotation() const
const PixelGeomDetUnit * theDet
double the_eff_charge_cut_highY
const PositionType & position() const
tuple size
Write out results.
const std::vector< Pixel > pixels() const
const SiPixelCPEGenericErrorParm * genErrorParm_
virtual bool isItBigPixelInY(const int iybin) const =0