32 #define M_PI_2 1.57079632679489661923
78 float& xWithinChamber,
91 xWithinStrip = xWithinChamber;
95 int centStrip = nStrips / 2 + 1;
96 std::vector<float>
const& adcs = stripHit.
s_adc();
125 if (
i > (centStrip - 2) &&
i < (centStrip + 2)) {
126 std::vector<float> adcsFit;
127 for (
int t = 0;
t < 4; ++
t) {
128 int k =
t + 4 * (
i - 1);
140 std::vector<float> xtalks;
142 float dt = 50.f * tmax - tpeak;
144 for (
int t = 0;
t < 3; ++
t) {
157 for (
int t = 0;
t < 3; ++
t) {
184 std::vector<float> nmatrix;
186 for (
int istrip = 0; istrip < 3; ++istrip) {
187 a11[istrip] = nmatrix[0 + tbin * 3 + istrip * 15];
188 a12[istrip] = nmatrix[1 + tbin * 3 + istrip * 15];
189 a13[istrip] = nmatrix[2 + tbin * 3 + istrip * 15];
190 a22[istrip] = nmatrix[3 + tbin * 3 + istrip * 15];
191 a23[istrip] = nmatrix[4 + tbin * 3 + istrip * 15];
192 a33[istrip] = nmatrix[6 + tbin * 3 + istrip * 15];
196 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]))) {
252 xWithinChamber = xWithinChamber + (xWithinStrip *
stripWidth);
258 int maxConsecutiveStrips = 8;
259 if (factorStripWidth) {
260 maxConsecutiveStrips /= factorStripWidth;
262 maxConsecutiveStrips++;
264 struct ChamberTypes {
265 std::map<std::string, int> chamberTypes;
267 auto p = chamberTypes.find(s);
268 return p != chamberTypes.end() ? (*p).second : 0;
271 chamberTypes[
"ME1/a"] = 1;
272 chamberTypes[
"ME1/b"] = 2;
273 chamberTypes[
"ME1/2"] = 3;
274 chamberTypes[
"ME1/3"] = 4;
275 chamberTypes[
"ME2/1"] = 5;
276 chamberTypes[
"ME2/2"] = 6;
277 chamberTypes[
"ME3/1"] = 7;
278 chamberTypes[
"ME3/2"] = 8;
279 chamberTypes[
"ME4/1"] = 9;
280 chamberTypes[
"ME4/2"] = 8;
283 static const ChamberTypes chamberTypes;
421 CLHEP::HepMatrix cross_talks_inv(3, 3);
426 for (
int iTime = 0; iTime < 3; iTime++) {
427 cross_talks_inv(1, 1) =
xt_lr0[iTime];
428 cross_talks_inv(1, 2) =
xt_l[1][iTime];
429 cross_talks_inv(1, 3) = 0.;
430 cross_talks_inv(2, 1) =
xt_r[0][iTime];
431 cross_talks_inv(2, 2) =
xt_lr1[iTime];
432 cross_talks_inv(2, 3) =
xt_l[2][iTime];
433 cross_talks_inv(3, 1) = 0.;
434 cross_talks_inv(3, 2) =
xt_r[1][iTime];
435 cross_talks_inv(3, 3) =
xt_lr2[iTime];
436 cross_talks_inv.invert(err);
439 <<
"Failed to invert XTalks matrix. No cross-talk correction for this rechit.";
489 const double parm[5] = {.1989337e-02, -.6901542e-04, .8665786, 154.6177, -.680163e-03};
491 k_3 = (parm[0] * wspace /
h + parm[1]) *
492 (parm[2] * wspace / wradius + parm[3] + parm[4] * (wspace / wradius) * (wspace / wradius));
514 int stripDown = int(10. * stripWidth) - min_SW;
515 int stripUp = stripDown + 1;
516 if (stripUp > n_SW - 1) {
524 double half_strip_width = 0.5;
526 const int n_bins =
n_val;
527 double corr_2_xestim = 999.;
533 int xestim_bin = -999;
534 double delta_strip_width = 999.;
535 double delta_strip_widthUpDown = 999.;
536 double diff_2_strip_width = 999.;
537 delta_strip_width = stripWidth - int(stripWidth * 10) / 10.;
538 delta_strip_widthUpDown = 0.1;
548 xestim_bin = int((1. -
std::abs(x_estimated)) / half_strip_width * n_bins);
551 corr_2_xestim = x_correction_ME1_1[stripDown][xestim_bin] +
552 (delta_strip_width / delta_strip_widthUpDown) * diff_2_strip_width;
555 corr_2_xestim = x_correction_noME1_1[stripDown][xestim_bin] +
556 (delta_strip_width / delta_strip_widthUpDown) * diff_2_strip_width;
558 corr_2_xestim = -corr_2_xestim;
561 xestim_bin = int((
std::abs(x_estimated) / half_strip_width) * n_bins);
564 corr_2_xestim = x_correction_ME1_1[stripDown][xestim_bin] +
565 (delta_strip_width / delta_strip_widthUpDown) * diff_2_strip_width;
568 corr_2_xestim = x_correction_noME1_1[stripDown][xestim_bin] +
569 (delta_strip_width / delta_strip_widthUpDown) * diff_2_strip_width;
572 if (x_estimated < 0.) {
573 corr_2_xestim = -corr_2_xestim;
577 return corr_2_xestim;
582 double x_gatti = x_estimated + x_corr;
617 double error = dXT * xt_asym;
638 double x_shift = d_xf + d_corr;
647 double x_estimated = -99.;
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_
tuple nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
constexpr std::array< uint8_t, layerIndexSize > layer
short int deadStrip() const
is a neighbouring string a dead strip?
std::string chamberTypeName() const
const CSCChamberSpecs * specs() const
tuple strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
double xfError_Noise(double noise)
Abs< T >::type abs(const T &t)
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.
T getParameter(std::string const &) const
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
size_t max_index(const std::vector< T > &v)
Log< level::Warning, false > LogWarning
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)
uint16_t *__restrict__ uint16_t const *__restrict__ adc