34 #define M_PI_2 1.57079632679489661923
39 recoConditions_( 0 ) {
83 int centralStrip,
float& xWithinChamber,
float& sWidth,
84 const float& tpeak,
float& xWithinStrip,
float& sigma,
int & quality_flag) {
92 xWithinStrip = xWithinChamber;
95 int nStrips = strips.size();
96 int centStrip = nStrips/2 + 1;
97 std::vector<float> adcs = stripHit.
s_adc();
125 for (
int i = 1;
i <= nStrips; ++
i ) {
126 if (
i > (centStrip-2) &&
i < (centStrip+2) ) {
127 std::vector<float> adcsFit;
128 for (
int t = 0;
t < 4; ++
t ) {
141 std::vector<float> xtalks;
143 float dt = 50. * tmax - tpeak;
145 for (
int t = 0;
t < 3; ++
t ) {
158 for (
int t = 0;
t < 3; ++
t ) {
181 if (tmax < 4) tbin = 0;
185 std::vector<float> nmatrix;
187 for (
int istrip =0; istrip < 3; ++istrip ) {
188 a11[istrip] = nmatrix[0+tbin*3+istrip*15];
189 a12[istrip] = nmatrix[1+tbin*3+istrip*15];
190 a13[istrip] = nmatrix[2+tbin*3+istrip*15];
191 a22[istrip] = nmatrix[3+tbin*3+istrip*15];
192 a23[istrip] = nmatrix[4+tbin*3+istrip*15];
193 a33[istrip] = nmatrix[6+tbin*3+istrip*15];
197 for (
int istrip =0; istrip < 3; ++istrip ) {
218 bool peakMismatch =
false;
219 std::vector <float> charges(3);
223 int min_index = min_element(charges.begin(),charges.end()) - charges.begin();
224 int max_index = max_element(charges.begin(),charges.end()) - charges.begin();
225 if(1!=max_index && (1==min_index ||
229 (charges[max_index] - charges[min_index]) > 1.1*(
q_sumC - charges[min_index]) )){
253 xWithinChamber = xWithinChamber + (xWithinStrip *
stripWidth);
261 int maxConsecutiveStrips = 8;
262 if(factorStripWidth){
263 maxConsecutiveStrips /= factorStripWidth ;
265 maxConsecutiveStrips++;
267 std::map <std::string, int> chamberTypes;
268 chamberTypes[
"ME1/a"] = 1;
269 chamberTypes[
"ME1/b"] = 2;
270 chamberTypes[
"ME1/2"] = 3;
271 chamberTypes[
"ME1/3"] = 4;
272 chamberTypes[
"ME2/1"] = 5;
273 chamberTypes[
"ME2/2"] = 6;
274 chamberTypes[
"ME3/1"] = 7;
275 chamberTypes[
"ME3/2"] = 8;
276 chamberTypes[
"ME4/1"] = 9;
277 chamberTypes[
"ME4/2"] = 8;
417 CLHEP::HepMatrix cross_talks(3,3);
418 CLHEP::HepMatrix cross_talks_inv(3,3);
423 for(
int iTime=0;iTime<3;iTime++){
424 cross_talks_inv(1,1) = cross_talks(1,1) =
xt_lr0[iTime];
425 cross_talks_inv(1,2) = cross_talks(1,2) =
xt_l[1][iTime];
426 cross_talks_inv(1,3) = cross_talks(1,3) = 0.;
427 cross_talks_inv(2,1) = cross_talks(2,1) =
xt_r[0][iTime];
428 cross_talks_inv(2,2) = cross_talks(2,2) =
xt_lr1[iTime];
429 cross_talks_inv(2,3) = cross_talks(2,3) =
xt_l[2][iTime];
430 cross_talks_inv(3,1) = cross_talks(3,1) = 0.;
431 cross_talks_inv(3,2) = cross_talks(3,2) =
xt_r[1][iTime];
432 cross_talks_inv(3,3) = cross_talks(3,3) =
xt_lr2[iTime];
433 cross_talks_inv.invert(err);
435 edm::LogWarning(
"FailedXTalkiInversionNoCrosstalkCorrection") <<
"Failed to invert XTalks matrix. No cross-talk correction for this rechit.";
486 const double parm[5] = {.1989337e-02, -.6901542e-04, .8665786, 154.6177, -.680163e-03 };
488 k_3 = ( parm[0]*wspace/
h + parm[1] )
489 * ( parm[2]*wspace/wradius + parm[3] + parm[4]*(wspace/wradius)*(wspace/wradius) );
515 int stripDown = int(10.*stripWidth) - min_SW;
516 int stripUp = stripDown + 1;
525 double half_strip_width = 0.5;
527 const int n_bins =
n_val;
528 double corr_2_xestim = 999.;
535 int xestim_bin = -999;
536 double delta_strip_width = 999.;
537 double delta_strip_widthUpDown = 999.;
538 double diff_2_strip_width = 999.;
539 delta_strip_width = stripWidth - int(stripWidth*10)/10.;
540 delta_strip_widthUpDown = 0.1;
542 if(fabs(x_estimated)>0.5){
543 if(fabs(x_estimated)>1.){
551 xestim_bin = int((1.- fabs(x_estimated))/half_strip_width * n_bins);
554 corr_2_xestim = x_correction_ME1_1[stripDown][xestim_bin] +
555 (delta_strip_width/delta_strip_widthUpDown)*diff_2_strip_width ;
559 corr_2_xestim = x_correction_noME1_1[stripDown][xestim_bin] +
560 (delta_strip_width/delta_strip_widthUpDown)*diff_2_strip_width ;
562 corr_2_xestim = -corr_2_xestim;
566 xestim_bin = int((fabs(x_estimated)/half_strip_width) * n_bins);
569 corr_2_xestim = x_correction_ME1_1[stripDown][xestim_bin] +
570 (delta_strip_width/delta_strip_widthUpDown)*diff_2_strip_width ;
574 corr_2_xestim = x_correction_noME1_1[stripDown][xestim_bin] +
575 (delta_strip_width/delta_strip_widthUpDown)*diff_2_strip_width ;
579 corr_2_xestim = -corr_2_xestim;
583 return corr_2_xestim;
590 double x_gatti = x_estimated + x_corr;
629 double error = dXT * xt_asym;
649 double d_xf =
sqrt(
pow( xf_ErrorNoise, 2) +
pow( xf_ErrorXTasym, 2));
651 double x_shift = d_xf + d_corr;
661 double x_estimated = -99.;
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
double xfError_XTasym(double XTasym)
float a11[3]
Store elements of auto-correlation matrices: 0 = left, 1 = middle, 2 = right.
void getCorrectionValues(std::string Estimator)
static const int n_SW_noME1_1
float xt_l[3][3]
x-talks 0 = left, 1 = middle, 2 = right ; and then second [] is for time bin tmax-1, tmax, tmax+1
int numberOfConsecutiveStrips() const
Number of consecutive strips with charge.
const StripHitADCContainer & s_adc() const
L1A.
double estimated2Gatti(double Xestimated, float StripWidth, bool ME1_1)
void noiseMatrix(const CSCDetId &id, int centralStrip, std::vector< float > &nme) const
const CSCRecoConditions * recoConditions_
short int deadStrip() const
is a neighbouring string a dead strip?
std::string chamberTypeName() const
const CSCChamberSpecs * specs() const
const T & max(const T &a, const T &b)
double xfError_Noise(double noise)
double estimated2GattiCorrection(double Xestimated, float StripWidth, bool ME1_1)
double calculateXonStripError(float stripWidth, bool ME1_1)
float wireSpacing() const
void hardcodedCorrectionInitialization()
const CSCChamberSpecs * specs_
double calculateXonStripPosition(float stripWidth, bool ME1_1)
static const double tmax[3]
void setupMatrix()
Set matrix for XT corrections and noise.
int tmax() const
Strip hit maximum time bin.
float x_correction_noME1_1[n_SW_noME1_1][n_val]
std::vector< int > ChannelContainer
void crossTalk(const CSCDetId &id, int centralStrip, std::vector< float > &xtalks) const
void findXOnStrip(const CSCDetId &id, const CSCLayer *layer, const CSCStripHit &stripHit, int centralStrip, float &xWithinChamber, float &stripWidth, const float &tpeak, float &xWithinStrip, float &sigma, int &quality_flag)
Returns fitted local x position and its estimated error.
int closestMaximum() const
Number of strips to the closest other maximum.
float x_correction_ME1_1[n_SW_ME1_1][n_val]
~CSCXonStrip_MatchGatti()
const ChannelContainer & strips() const
L1A.
float anodeCathodeSpacing() const
void initChamberSpecs()
Use specs to setup Gatti parameters.
const CSCChamber * chamber() const
static const int n_SW_ME1_1
Power< A, B >::type pow(const A &a, const B &b)
CSCXonStrip_MatchGatti(const edm::ParameterSet &ps)