15 chiSquareThreshold_(50),
16 debug_(
pset.getUntrackedParameter<
bool>(
"debug")),
17 chi2Th_(
pset.getUntrackedParameter<double>(
"chi2Th")),
18 tanPhiTh_(
pset.getUntrackedParameter<double>(
"tanPhiTh")),
19 use_LSB_(
pset.getUntrackedParameter<
bool>(
"use_LSB")),
20 tanPsi_precision_(
pset.getUntrackedParameter<double>(
"tanPsi_precision")),
21 x_precision_(
pset.getUntrackedParameter<double>(
"x_precision")) {
23 LogDebug(
"MuonPathAnalyzerPerSL") <<
"MuonPathAnalyzer: constructor";
36 while (ifin3.good()) {
37 ifin3 >> rawId >>
shift;
44 LogDebug(
"MuonPathAnalyzerPerSL") <<
"chosen sl must be 1,3 or 4(both superlayers)";
53 LogDebug(
"MuonPathAnalyzerPerSL") <<
"MuonPathAnalyzer: destructor";
61 LogDebug(
"MuonPathAnalyzerPerSL") <<
"MuonPathAnalyzerPerSL::initialiase";
70 std::vector<metaPrimitive> &metaPrimitives) {
72 LogDebug(
"MuonPathAnalyzerPerSL") <<
"MuonPathAnalyzerPerSL: run";
75 for (
auto &muonpath : muonpaths) {
76 analyze(muonpath, metaPrimitives);
82 LogDebug(
"MuonPathAnalyzerPerSL") <<
"MuonPathAnalyzer: finish";
98 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t starts";
102 if (inMPath->primitive(0)->tdcTimeStamp() != -1)
103 selected_Id = inMPath->primitive(0)->cameraId();
104 else if (inMPath->primitive(1)->tdcTimeStamp() != -1)
105 selected_Id = inMPath->primitive(1)->cameraId();
106 else if (inMPath->primitive(2)->tdcTimeStamp() != -1)
107 selected_Id = inMPath->primitive(2)->cameraId();
108 else if (inMPath->primitive(3)->tdcTimeStamp() != -1)
109 selected_Id = inMPath->primitive(3)->cameraId();
113 LogDebug(
"MuonPathAnalyzerPerSL") <<
"Building up MuonPathSLId from rawId in the Primitive";
116 LogDebug(
"MuonPathAnalyzerPerSL") <<
"The MuonPathSLId is" << MuonPathSLId;
120 <<
"DTp2:analyze \t\t\t\t In analyze function checking if inMPath->isAnalyzable() " << inMPath->isAnalyzable();
125 auto mPath = std::make_shared<MuonPath>(inMPath);
127 if (mPath->isAnalyzable()) {
129 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t yes it is analyzable " << mPath->isAnalyzable();
134 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t no it is NOT analyzable " << mPath->isAnalyzable();
138 int wi[8], tdc[8], lat[8];
140 wi[0] = Prim0->channelId();
141 tdc[0] = Prim0->tdcTimeStamp();
143 wi[1] = Prim1->channelId();
144 tdc[1] = Prim1->tdcTimeStamp();
146 wi[2] = Prim2->channelId();
147 tdc[2] = Prim2->tdcTimeStamp();
149 wi[3] = Prim3->channelId();
150 tdc[3] = Prim3->tdcTimeStamp();
151 for (
int i = 4;
i < 8;
i++) {
157 DTWireId wireId(MuonPathSLId, 2, 1);
160 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t checking if it passes the min quality cut "
164 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t min quality achievedCalidad: " << mPath->quality();
165 for (
int i = 0;
i <= 3;
i++) {
168 <<
"DTp2:analyze \t\t\t\t Capa: " << mPath->primitive(
i)->layerId()
169 <<
" Canal: " << mPath->primitive(
i)->channelId() <<
" TDCTime: " << mPath->primitive(
i)->tdcTimeStamp();
172 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t Starting lateralities loop, totalNumValLateralities: "
175 double best_chi2 = 99999.;
176 double chi2_jm_tanPhi = 999;
177 double chi2_jm_x = -1;
178 double chi2_jm_t0 = -1;
179 double chi2_phi = -1;
180 double chi2_phiB = -1;
181 double chi2_chi2 = -1;
182 int chi2_quality = -1;
184 for (
int i = 0;
i < 8;
i++) {
190 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t laterality #- " <<
i;
192 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t laterality #- " <<
i <<
" checking quality:";
195 <<
"DTp2:analyze \t\t\t\t\t laterality #- " <<
i <<
" checking mPath Quality=" << mPath->quality();
198 <<
"DTp2:analyze \t\t\t\t\t laterality #- " <<
i <<
" latQuality_[i].val=" <<
latQuality_[
i].
valid;
200 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t laterality #- " <<
i <<
" before if:";
206 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t laterality #- " <<
i <<
" inside if";
210 <<
"DTp2:analyze \t\t\t\t\t laterality #- " <<
i <<
" settingLateralCombination";
214 <<
"DTp2:analyze \t\t\t\t\t laterality #- " <<
i <<
" done settingLateralCombination";
217 auto mpAux = std::make_shared<MuonPath>(mPath);
218 lat[0] = mpAux->lateralComb()[0];
219 lat[1] = mpAux->lateralComb()[1];
220 lat[2] = mpAux->lateralComb()[2];
221 lat[3] = mpAux->lateralComb()[3];
224 for (
int lay = 0; lay < 4; lay++) {
231 tdcOk[lay] = tdc[lay];
232 latOk[lay] = lat[lay];
237 if (idxHitNotValid >= 0) {
238 auto dtpAux = std::make_shared<DTPrimitive>();
239 mpAux->setPrimitive(dtpAux, idxHitNotValid);
243 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t calculating parameters ";
254 <<
"DTp2:analyze \t\t\t\t\t HIGHQ or HIGHQGHOST but min chi2 or Q test not satisfied ";
257 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t inside else, returning values: ";
259 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t BX Time = " << mpAux->bxTimeValue();
261 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t BX Id = " << mpAux->bxNumId();
263 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t XCoor = " << mpAux->horizPos();
265 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t tan(Phi)= " << mpAux->tanPhi();
267 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t chi2= " << mpAux->chiSquare();
269 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t lateralities = "
270 <<
" " << mpAux->lateralComb()[0] <<
" " << mpAux->lateralComb()[1] <<
" "
271 << mpAux->lateralComb()[2] <<
" " << mpAux->lateralComb()[3];
273 DTChamberId ChId(MuonPathSLId.wheel(), MuonPathSLId.station(), MuonPathSLId.sector());
275 double jm_tanPhi = -1. * mpAux->tanPhi();
283 double jm_t0 = mpAux->bxTimeValue();
284 int quality = mpAux->quality();
289 double z3 = -1. * z1;
290 if (
ChId.station() == 3
or ChId.station() == 4) {
293 }
else if (MuonPathSLId.superLayer() == 1)
295 else if (MuonPathSLId.superLayer() == 3)
299 int thisec = MuonPathSLId.sector();
305 double psi = atan(jm_tanPhi);
307 double chi2 = mpAux->chiSquare() * 0.01;
311 <<
"DTp2:analyze \t\t\t\t\t\t\t\t pushing back metaPrimitive at x=" << jm_x <<
" tanPhi:" << jm_tanPhi
314 if (mpAux->quality() ==
HIGHQ or
317 chi2_jm_tanPhi = jm_tanPhi;
319 chi2_jm_t0 = mpAux->bxTimeValue();
324 chi2_quality = mpAux->quality();
325 for (
int i = 0;
i < 4;
i++) {
333 <<
"DTp2:analyze \t\t\t\t\t\t\t\t pushing back metaprimitive no HIGHQ or HIGHQGHOST";
334 metaPrimitives.emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
369 <<
"DTp2:analyze \t\t\t\t\t\t\t\t done pushing back metaprimitive no HIGHQ or HIGHQGHOST";
375 <<
"DTp2:analyze \t\t\t\t\t\t\t\t latQuality_[i].valid and (((mPath->quality()==HIGHQ or "
376 "mPath->quality()==HIGHQGHOST) and latQuality_[i].quality==HIGHQ) or ((mPath->quality() "
377 "== LOWQ or mPath->quality()==LOWQGHOST) and latQuality_[i].quality==LOWQ)) not passed";
382 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t\t\t\t pushing back best chi2 metaPrimitive";
383 metaPrimitives.emplace_back(
metaPrimitive({MuonPathSLId.rawId(),
419 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t finishes";
438 for (
int lowLay =
LEFT; lowLay <=
RIGHT; lowLay++)
439 for (
int midLowLay =
LEFT; midLowLay <=
RIGHT; midLowLay++)
440 for (
int midHigLay =
LEFT; midHigLay <=
RIGHT; midHigLay++)
441 for (
int higLay =
LEFT; higLay <=
RIGHT; higLay++) {
442 sideComb[0] = static_cast<LATERAL_CASES>(lowLay);
443 sideComb[1] = static_cast<LATERAL_CASES>(midLowLay);
444 sideComb[2] = static_cast<LATERAL_CASES>(midHigLay);
445 sideComb[3] = static_cast<LATERAL_CASES>(higLay);
468 int i, ajustedLayout[
NUM_LAYERS], pairDiff[3], desfase[3];
470 for (
i = 0;
i <= 3;
i++)
472 for (
i = 0;
i <= 2;
i++)
473 pairDiff[
i] = ajustedLayout[
i + 1] - ajustedLayout[
i];
474 for (
i = 0;
i <= 1;
i++)
475 desfase[
i] =
abs(pairDiff[
i + 1] - pairDiff[
i]);
476 desfase[2] =
abs(pairDiff[2] - pairDiff[0]);
477 bool resultado = (desfase[0] > 1
or desfase[1] > 1
or desfase[2] > 1);
482 int totalHighQ = 0, totalLowQ = 0;
486 <<
"DTp2:evaluatePathQuality \t\t\t\t\t En evaluatePathQuality Evaluando PathQ. Celda base: "
487 << mPath->baseChannelId();
489 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:evaluatePathQuality \t\t\t\t\t Total lateralidades: "
492 mPath->setQuality(
NOPATH);
496 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:evaluatePathQuality \t\t\t\t\t Analizando combinacion de lateralidad: "
505 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:evaluatePathQuality \t\t\t\t\t\t Lateralidad HIGHQ";
510 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:evaluatePathQuality \t\t\t\t\t\t Lateralidad LOWQ";
516 if (totalHighQ == 1) {
517 mPath->setQuality(
HIGHQ);
518 }
else if (totalHighQ > 1) {
520 }
else if (totalLowQ == 1) {
521 mPath->setQuality(
LOWQ);
522 }
else if (totalLowQ > 1) {
533 latQuality->
valid =
false;
544 for (
int i = 0;
i <= 3;
i++) {
548 for (
int j = 0;
j < 3;
j++)
551 validate(sideComb, layerGroup, mPath, &(latQResult[
i]));
560 <<
"DTp2:evaluateLateralQuality \t\t\t\t\t Lateralidad DESCARTADA. Tolerancia de BX excedida";
565 if ((latQResult[0].latQValid && latQResult[1].latQValid)
or (latQResult[0].latQValid && latQResult[2].latQValid)
or
566 (latQResult[0].latQValid && latQResult[3].latQValid)
or (latQResult[1].latQValid && latQResult[2].latQValid)
or
567 (latQResult[1].latQValid && latQResult[3].latQValid)
or (latQResult[2].latQValid && latQResult[3].latQValid)) {
568 latQuality->
valid =
true;
571 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t\t Valid BXs";
572 long int sumBX = 0, numValid = 0;
573 for (
int i = 0;
i <= 3;
i++) {
575 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:analyze \t\t\t\t\t\t "
577 if (latQResult[
i].latQValid) {
586 else if (numValid == 2)
588 else if (numValid == 3)
590 else if (numValid == 4)
596 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:evaluateLateralQuality \t\t\t\t\t Lateralidad ACEPTADA. HIGHQ.";
598 if (latQResult[0].latQValid
or latQResult[1].latQValid
or latQResult[2].latQValid
or latQResult[3].latQValid) {
599 latQuality->
valid =
true;
601 for (
int i = 0;
i < 4;
i++)
602 if (latQResult[
i].latQValid) {
609 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:evaluateLateralQuality \t\t\t\t\t Lateralidad ACEPTADA. LOWQ.";
612 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:evaluateLateralQuality \t\t\t\t\t Lateralidad DESCARTADA. NOPATH.";
630 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:validate \t\t\t\t\t\t\t In validate, checking muon path for layers: "
631 << layerIndex[0] <<
"/" << layerIndex[1] <<
"/" << layerIndex[2];
634 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:validate \t\t\t\t\t\t\t Partial lateralities: " << sideComb[0] <<
"/"
635 << sideComb[1] <<
"/" << sideComb[2];
638 for (
int j = 0;
j < 3;
j++)
639 if (mPath->primitive(layerIndex[
j])->isValidTime())
642 if (validCells != 3) {
644 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:validate \t\t\t\t\t\t\t There is no valid cells.";
649 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:validate \t\t\t\t\t\t\t TDC values: "
650 << mPath->primitive(layerIndex[0])->tdcTimeStamp() <<
"/"
651 << mPath->primitive(layerIndex[1])->tdcTimeStamp() <<
"/"
652 << mPath->primitive(layerIndex[2])->tdcTimeStamp() <<
".";
655 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:validate \t\t\t\t\t\t\t Valid TIMES: "
656 << mPath->primitive(layerIndex[0])->isValidTime() <<
"/"
657 << mPath->primitive(layerIndex[1])->isValidTime() <<
"/"
658 << mPath->primitive(layerIndex[2])->isValidTime() <<
".";
661 int dVertMI = layerIndex[1] - layerIndex[0];
662 int dVertSM = layerIndex[2] - layerIndex[1];
672 int *layPairSM = &layerIndex[1];
673 int *layPairMI = &layerIndex[0];
685 long int bxValue = 0;
686 int coefsAB[2] = {0, 0}, coefsCD[2] = {0, 0};
697 int denominator = dVertMI * (coefsCD[1] + coefsCD[0]) - dVertSM * (coefsAB[1] + coefsAB[0]);
701 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:validate \t\t\t\t\t\t\t Imposible to calculate BX.";
705 long int sumA = (
long int)floor(
MAXDRIFT * (dVertMI * dHorzSM - dVertSM * dHorzMI));
724 LogDebug(
"MuonPathAnalyzerPerSL") <<
"Different!";
727 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:validate \t\t\t\t\t\t\t No-valid combination. Negative BX.";
731 for (
int i = 0;
i < 3;
i++)
732 if (mPath->primitive(layerIndex[
i])->isValidTime()) {
733 int diffTime = mPath->primitive(layerIndex[
i])->tdcTimeStampNoOffset() - bxValue;
735 if (diffTime <= 0 or diffTime > round(
MAXDRIFT)) {
738 <<
"DTp2:validate \t\t\t\t\t\t\t Invalid BX value. at least one crazt TDC time";
743 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:validate \t\t\t\t\t\t\t BX: " << bxValue;
751 int eqTerm = 0, coefs[2];
755 eqTerm = coefs[0] * mPath->primitive(layerIdx[0])->tdcTimeStampNoOffset() +
756 coefs[1] * mPath->primitive(layerIdx[1])->tdcTimeStampNoOffset();
759 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:eqMainBXTerm \t\t\t\t\t In eqMainBXTerm EQTerm(BX): " << eqTerm;
764 int eqTerm = 0, coefs[2];
769 eqTerm = coefs[0] * (mPath->primitive(layerIdx[0])->tdcTimeStampNoOffset() - bxValue) +
770 coefs[1] * (mPath->primitive(layerIdx[1])->tdcTimeStampNoOffset() - bxValue);
773 (mPath->primitive(layerIdx[0])->tdcTimeStampNoOffset() - bxValue)) +
775 (mPath->primitive(layerIdx[1])->tdcTimeStampNoOffset() - bxValue));
778 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:\t\t\t\t\t EQTerm(Main): " << eqTerm;
784 if ((sideComb[0] ==
LEFT) && (sideComb[1] ==
LEFT)) {
787 }
else if ((sideComb[0] ==
LEFT) && (sideComb[1] ==
RIGHT)) {
790 }
else if ((sideComb[0] ==
RIGHT) && (sideComb[1] ==
LEFT)) {
793 }
else if ((sideComb[0] ==
RIGHT) && (sideComb[1] ==
RIGHT)) {
810 LogDebug(
"MuonPathAnalyzerPerSL") <<
"Dtp2:sameBXValue \t\t\t\t\t\t d01:" <<
abs(latq[0].bxValue - latq[1].bxValue);
812 LogDebug(
"MuonPathAnalyzerPerSL") <<
"Dtp2:sameBXValue \t\t\t\t\t\t d02:" <<
abs(latq[0].bxValue - latq[2].bxValue);
814 LogDebug(
"MuonPathAnalyzerPerSL") <<
"Dtp2:sameBXValue \t\t\t\t\t\t d03:" <<
abs(latq[0].bxValue - latq[3].bxValue);
816 LogDebug(
"MuonPathAnalyzerPerSL") <<
"Dtp2:sameBXValue \t\t\t\t\t\t d12:" <<
abs(latq[1].bxValue - latq[2].bxValue);
818 LogDebug(
"MuonPathAnalyzerPerSL") <<
"Dtp2:sameBXValue \t\t\t\t\t\t d13:" <<
abs(latq[1].bxValue - latq[3].bxValue);
820 LogDebug(
"MuonPathAnalyzerPerSL") <<
"Dtp2:sameBXValue \t\t\t\t\t\t d23:" <<
abs(latq[2].bxValue - latq[3].bxValue);
822 bool d01, d02, d03, d12, d13, d23;
823 d01 = (
abs(latq[0].bxValue - latq[1].bxValue) <=
bxTolerance_) ?
true :
false;
824 d02 = (
abs(latq[0].bxValue - latq[2].bxValue) <=
bxTolerance_) ?
true :
false;
825 d03 = (
abs(latq[0].bxValue - latq[3].bxValue) <=
bxTolerance_) ?
true :
false;
826 d12 = (
abs(latq[1].bxValue - latq[2].bxValue) <=
bxTolerance_) ?
true :
false;
827 d13 = (
abs(latq[1].bxValue - latq[3].bxValue) <=
bxTolerance_) ?
true :
false;
828 d23 = (
abs(latq[2].bxValue - latq[3].bxValue) <=
bxTolerance_) ?
true :
false;
831 if ((latq[0].latQValid && latq[1].latQValid && latq[2].latQValid && latq[3].latQValid) && !(d01 && d12 && d23))
835 if (((latq[0].latQValid && latq[1].latQValid && latq[2].latQValid) && !(d01 && d12))
or
836 ((latq[0].latQValid && latq[1].latQValid && latq[3].latQValid) && !(d01 && d13))
or
837 ((latq[0].latQValid && latq[2].latQValid && latq[3].latQValid) && !(d02 && d23))
or
838 ((latq[1].latQValid && latq[2].latQValid && latq[3].latQValid) && !(d12 && d23)))
843 if (((latq[0].latQValid && latq[1].latQValid) && !d01)
or ((latq[0].latQValid && latq[2].latQValid) && !d02)
or
844 ((latq[0].latQValid && latq[3].latQValid) && !d03)
or ((latq[1].latQValid && latq[2].latQValid) && !d12)
or
845 ((latq[1].latQValid && latq[3].latQValid) && !d13)
or ((latq[2].latQValid && latq[3].latQValid) && !d23))
856 <<
"DTp2:calculatePathParameters \t\t\t\t\t\t calculating calcCellDriftAndXcoor(mPath) ";
859 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:calculatePathParameters \t\t\t\t\t\t checking mPath->quality() "
864 <<
"DTp2:calculatePathParameters \t\t\t\t\t\t\t Quality test passed, now calcTanPhiXPosChamber4Hits(mPath) ";
869 <<
"DTp2:calculatePathParameters \t\t\t\t\t\t\t Quality test NOT passed calcTanPhiXPosChamber3Hits(mPath) ";
874 LogDebug(
"MuonPathAnalyzerPerSL") <<
"DTp2:calculatePathParameters \t\t\t\t\t\t calcChiSquare(mPath) ";
891 if (mPath->primitive(0)->isValidTime())
896 if (mPath->primitive(3)->isValidTime())
903 sideComb[0] = (mPath->lateralComb())[layerIdx[0]];
904 sideComb[1] = (mPath->lateralComb())[layerIdx[1]];
907 int dHoriz = (mPath->cellLayout())[layerIdx[1]] - (mPath->cellLayout())[layerIdx[0]];
910 int dVert = layerIdx[1] - layerIdx[0];
920 mPath->setTanPhi(tanPhi);
937 float lowerXPHorizPos = mPath->xCoorCell(layerIdx[0]);
939 float lowerXPVertPos = 0;
940 if (layerIdx[0] == 0)
945 mPath->setHorizPos(lowerXPHorizPos + lowerXPVertPos * tanPhi);
959 int tanPhi_x4096 = (
numerator * CELL_HEIGHT_JM) >> (3 + numberOfBits);
962 float XPos = (mPath->xCoorCell(0) + mPath->xCoorCell(1) + mPath->xCoorCell(2) + mPath->xCoorCell(3)) / 4;
974 if (mPath->primitive(0)->isValidTime())
979 if (mPath->primitive(3)->isValidTime())
988 int tan_division_denominator_bits = 16;
991 ((
int)((
int)(x_prec_inv * mPath->xCoorCell(layerIdx[1])) - (
int)(x_prec_inv * mPath->xCoorCell(layerIdx[0])))
992 << (12 - numberOfBits));
996 float tanPhi = ((
num * denominator_inv) >> tan_division_denominator_bits) / ((1. /
tanPsi_precision_));
998 mPath->setTanPhi(tanPhi);
1004 if (mPath->primitive(0)->isValidTime() and mPath->primitive(3)->isValidTime())
1005 XPos = (mPath->xCoorCell(0) + mPath->xCoorCell(3)) / 2;
1007 XPos = (mPath->xCoorCell(1) + mPath->xCoorCell(2)) / 2;
1016 long int drift_speed_new = 889;
1017 long int drift_dist_um_x4;
1018 long int wireHorizPos_x4;
1022 for (
int i = 0;
i <= 3;
i++)
1023 if (mPath->primitive(
i)->isValidTime()) {
1025 drift_speed_new * ((
long int)mPath->primitive(
i)->tdcTimeStampNoOffset() - (
long int)mPath->bxTimeValue());
1026 wireHorizPos_x4 = (long)(mPath->primitive(
i)->wireHorizPos() * x_prec_inv);
1028 if ((mPath->lateralComb())[
i] ==
LEFT)
1029 pos_mm_x4 = wireHorizPos_x4 - (drift_dist_um_x4 >> 10);
1031 pos_mm_x4 = wireHorizPos_x4 + (drift_dist_um_x4 >> 10);
1034 mPath->setDriftDistance(((
float)(drift_dist_um_x4 >> 10)) * (10 *
x_precision_),
i);
1044 long int Z_FACTOR[
NUM_LAYERS] = {-6, -2, 2, 6};
1045 for (
int i = 0;
i < 4;
i++) {
1048 long int sum_A = 0, sum_B = 0;
1049 long int chi2_mm2_x1024 = 0;
1050 for (
int i = 0;
i < 4;
i++) {
1051 if (mPath->primitive(
i)->isValidTime()) {
1053 << (14 - numberOfBits);
1055 chi2_mm2_x1024 += (sum_A - sum_B) * (sum_A - sum_B);
1058 chi2_mm2_x1024 = chi2_mm2_x1024 >> 18;
1060 mPath->setChiSquare(((
double)chi2_mm2_x1024 / 1024.));