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>
const & 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.f * 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 ) {
220 bool peakMismatch =
false;
221 std::vector <float> charges(3);
225 int min_index = min_element(charges.begin(),charges.end()) - charges.begin();
226 int max_index = max_element(charges.begin(),charges.end()) - charges.begin();
227 if(1!=max_index && (1==min_index ||
231 (charges[max_index] - charges[min_index]) > 1.1*(
q_sumC - charges[min_index]) )){
255 xWithinChamber = xWithinChamber + (xWithinStrip *
stripWidth);
263 int maxConsecutiveStrips = 8;
264 if(factorStripWidth){
265 maxConsecutiveStrips /= factorStripWidth ;
267 maxConsecutiveStrips++;
269 struct ChamberTypes {
270 std::map <std::string, int> chamberTypes;
271 int operator()(
std::string const &
s)
const {
auto p = chamberTypes.find(s);
return p!=chamberTypes.end() ? (*p).second : 0; }
273 chamberTypes[
"ME1/a"] = 1;
274 chamberTypes[
"ME1/b"] = 2;
275 chamberTypes[
"ME1/2"] = 3;
276 chamberTypes[
"ME1/3"] = 4;
277 chamberTypes[
"ME2/1"] = 5;
278 chamberTypes[
"ME2/2"] = 6;
279 chamberTypes[
"ME3/1"] = 7;
280 chamberTypes[
"ME3/2"] = 8;
281 chamberTypes[
"ME4/1"] = 9;
282 chamberTypes[
"ME4/2"] = 8;
285 static const ChamberTypes chamberTypes;
425 CLHEP::HepMatrix cross_talks_inv(3,3);
430 for(
int iTime=0;iTime<3;iTime++){
431 cross_talks_inv(1,1) =
xt_lr0[iTime];
432 cross_talks_inv(1,2) =
xt_l[1][iTime];
433 cross_talks_inv(1,3) = 0.;
434 cross_talks_inv(2,1) =
xt_r[0][iTime];
435 cross_talks_inv(2,2) =
xt_lr1[iTime];
436 cross_talks_inv(2,3) =
xt_l[2][iTime];
437 cross_talks_inv(3,1) = 0.;
438 cross_talks_inv(3,2) =
xt_r[1][iTime];
439 cross_talks_inv(3,3) =
xt_lr2[iTime];
440 cross_talks_inv.invert(err);
442 edm::LogWarning(
"FailedXTalkiInversionNoCrosstalkCorrection") <<
"Failed to invert XTalks matrix. No cross-talk correction for this rechit.";
493 const double parm[5] = {.1989337e-02, -.6901542e-04, .8665786, 154.6177, -.680163e-03 };
495 k_3 = ( parm[0]*wspace/
h + parm[1] )
496 * ( parm[2]*wspace/wradius + parm[3] + parm[4]*(wspace/wradius)*(wspace/wradius) );
522 int stripDown = int(10.*stripWidth) - min_SW;
523 int stripUp = stripDown + 1;
532 double half_strip_width = 0.5;
534 const int n_bins =
n_val;
535 double corr_2_xestim = 999.;
542 int xestim_bin = -999;
543 double delta_strip_width = 999.;
544 double delta_strip_widthUpDown = 999.;
545 double diff_2_strip_width = 999.;
546 delta_strip_width = stripWidth - int(stripWidth*10)/10.;
547 delta_strip_widthUpDown = 0.1;
549 if(fabs(x_estimated)>0.5){
550 if(fabs(x_estimated)>1.){
558 xestim_bin = int((1.- fabs(x_estimated))/half_strip_width * n_bins);
561 corr_2_xestim = x_correction_ME1_1[stripDown][xestim_bin] +
562 (delta_strip_width/delta_strip_widthUpDown)*diff_2_strip_width ;
566 corr_2_xestim = x_correction_noME1_1[stripDown][xestim_bin] +
567 (delta_strip_width/delta_strip_widthUpDown)*diff_2_strip_width ;
569 corr_2_xestim = -corr_2_xestim;
573 xestim_bin = int((fabs(x_estimated)/half_strip_width) * n_bins);
576 corr_2_xestim = x_correction_ME1_1[stripDown][xestim_bin] +
577 (delta_strip_width/delta_strip_widthUpDown)*diff_2_strip_width ;
581 corr_2_xestim = x_correction_noME1_1[stripDown][xestim_bin] +
582 (delta_strip_width/delta_strip_widthUpDown)*diff_2_strip_width ;
586 corr_2_xestim = -corr_2_xestim;
590 return corr_2_xestim;
597 double x_gatti = x_estimated + x_corr;
636 double error = dXT * xt_asym;
658 double x_shift = d_xf + d_corr;
668 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)