diff --git a/reco/L1/CbmL1CATrdTrackFinderSA.cxx b/reco/L1/CbmL1CATrdTrackFinderSA.cxx index b28c5170898f1cbb87ac9f36eea499b45be6a2e7..69a48c288250449149e29aa39b31c70f14170ac5 100644 --- a/reco/L1/CbmL1CATrdTrackFinderSA.cxx +++ b/reco/L1/CbmL1CATrdTrackFinderSA.cxx @@ -2127,7 +2127,7 @@ void CbmL1CATrdTrackFinderSA::CreateTracks( trdTrackFitterKF->DoFit(*ivTempTrdTrackCand); // Double_t mX = (*ivTempTrdTrackCand)->GetParamLast()->GetX(); // Double_t mY = (*ivTempTrdTrackCand)->GetParamLast()->GetY(); - // Double_t mXY = sqrt(pow(mX,2)+pow(mY,2)); + // Double_t mXY = sqrt(mX*mX+mY*mY); // Double_t mChi2 = (*ivTempTrdTrackCand)->GetChi2(); // (*ivTempTrdTrackCand)->SetChi2(mChi2*mX2); //cout <<"Chi2: "<< (*ivTempTrdTrackCand)->GetChi2() << endl; @@ -2602,7 +2602,7 @@ void CbmL1CATrdTrackFinderSA::CreateSpacePoints( // x = A_X + t*(B_X-A_X); // y = A_Y + t*(B_Y-A_Y); - // //SPlength = sqrt(pow(B_Y-A_Y,2)+pow(B_Y-A_Y,2)); + // //SPlength = sqrt(2*(B_Y-A_Y)*(B_Y-A_Y)); // if(Station == 1){ // if(A_mcTrID == B_mcTrID){ // noMCOverlapsAB++; @@ -2855,12 +2855,12 @@ Double_t CbmL1CATrdTrackFinderSA::Fit( // for(int i = 0; i < 4; i++){ // y = fabs(pHit[t1+2]->Y())-fabs(pHit[t1]->Y()); // z = (pHit[t1+2]->Z())-(pHit[t1]->Z()); - // length1 += sqrt(pow(y,2) + pow(z,2)); + // length1 += sqrt(y*y + z*z); // t1+=2; // x = fabs(pHit[t2+2]->X())-fabs(pHit[t2]->X()); // z = (pHit[t2+2]->Z())-(pHit[t2]->Z()); - // length2 += sqrt(pow(x,2) + pow(z,2)); + // length2 += sqrt(x*x + z*z); // t2+=2; // } @@ -2929,7 +2929,7 @@ Double_t CbmL1CATrdTrackFinderSA::Fit( dist2 = fabs(yS2 - y2); //chi2 += (dist2+dist1)/2; - chi2 += sqrt(pow(dist2, 2) + pow(dist1, 2)); + chi2 += sqrt(dist1 * dist1 + dist2 * dist2); } return chi2; } @@ -3052,14 +3052,18 @@ Double_t CbmL1CATrdTrackFinderSA::FitLSM(Int_t M[]) { } for (int i = 0; i < 12; i += 2) { - sumYiYav_ZiZAv += ((pHit[i]->GetY()) - yAv) * ((pHit[i]->GetZ()) - zAvy); - sumYiYav += pow((pHit[i]->GetY()) - yAv, 2); - sumZiZav_y += pow((pHit[i]->GetZ()) - zAvy, 2); + Double_t dy = pHit[i]->GetY() - yAv; + Double_t dz = pHit[i]->GetZ() - zAvy; + sumYiYav_ZiZAv += dy * dz; + sumYiYav += dy * dy; + sumZiZav_y += dz * dz; } for (int i = 1; i < 12; i += 2) { - sumXiXav_ZiZAv += ((pHit[i]->GetX()) - xAv) * ((pHit[i]->GetZ()) - zAvx); - sumXiXav += pow((pHit[i]->GetX()) - xAv, 2); - sumZiZav_x += pow((pHit[i]->GetZ()) - zAvx, 2); + Double_t dx = pHit[i]->GetX() - xAv; + Double_t dz = pHit[i]->GetZ() - zAvx; + sumXiXav_ZiZAv += dx * dz; + sumXiXav += dx * dx; + sumZiZav_x += dz * dz; } bY = sumYiYav_ZiZAv / sumYiYav; diff --git a/reco/L1/CbmL1TofMerger.cxx b/reco/L1/CbmL1TofMerger.cxx index 08d0065823f2e1b5897b00ab35dba80d0b1be512..e36ff205c3c334107e16006437fdddd0bb7284bc 100644 --- a/reco/L1/CbmL1TofMerger.cxx +++ b/reco/L1/CbmL1TofMerger.cxx @@ -240,9 +240,9 @@ Double_t CbmL1TofMerger::GetChi2ToHit(CbmKFTrack& track, // Get chi2 from the track extrapolation to the TOF hit Double_t dx = track.GetTrack()[0] - tofHit->GetX(); Double_t dy = track.GetTrack()[1] - tofHit->GetY(); - /* Double_t c0 = track.GetCovMatrix()[0] + TMath::Power(tofHit->GetDx(),2); + /* Double_t c0 = track.GetCovMatrix()[0] + tofHit->GetDx()*tofHit->GetDx(); Double_t c1 = track.GetCovMatrix()[1]; - Double_t c2 = track.GetCovMatrix()[2] + TMath::Power(tofHit->GetDy(),2); + Double_t c2 = track.GetCovMatrix()[2] + tofHit->GetDy()*tofHit->GetDy(); Double_t chi2 = 0.5*(dx*dx*c0-2*dx*dy*c1+dy*dy*c2)/(c0*c2-c1*c1);*/ Double_t chi2 = TMath::Sqrt(dx * dx + dy * dy); return chi2; diff --git a/reco/L1/CbmL1TrackMerger.cxx b/reco/L1/CbmL1TrackMerger.cxx index d9f2fc6ee302300c08d338c154940fbf1f0819e9..54ebc9eb7187826ccbd2f0517ebece657832a612 100644 --- a/reco/L1/CbmL1TrackMerger.cxx +++ b/reco/L1/CbmL1TrackMerger.cxx @@ -273,15 +273,13 @@ Int_t CbmL1TrackMerger::MergeImPlane(TClonesArray* stsTracks, kfTrack.Extrapolate(trdTrack->GetParamFirst()->GetZ()); // Fill histogramms + Double_t tx = kfTrack.GetTrack()[2]; + Double_t ty = kfTrack.GetTrack()[3]; dx = kfTrack.GetTrack()[0] - trdTrack->GetParamFirst()->GetX(); dy = kfTrack.GetTrack()[1] - trdTrack->GetParamFirst()->GetY(); - dtx = kfTrack.GetTrack()[2] - trdTrack->GetParamFirst()->GetTx(); - dty = kfTrack.GetTrack()[3] - trdTrack->GetParamFirst()->GetTy(); - theta = - 180. / TMath::Pi() - * TMath::ACos(1. - / TMath::Sqrt(1 + TMath::Power(kfTrack.GetTrack()[2], 2) - + TMath::Power(kfTrack.GetTrack()[3], 2))); + dtx = tx - trdTrack->GetParamFirst()->GetTx(); + dty = ty - trdTrack->GetParamFirst()->GetTy(); + theta = 180. / TMath::Pi() * TMath::ACos(1. / TMath::Sqrt(1 + tx * tx + ty * ty)); if (stsTrackM->GetMCTrackId() == trdTrackM->GetMCTrackId()) { fh_dx_true->Fill(dx, theta); } else { diff --git a/reco/L1/CbmL1TrdTrackFinderSts.cxx b/reco/L1/CbmL1TrdTrackFinderSts.cxx index e936347b86f636e9688ff5c28352b42b5b4fbf96..69df8175ec87f83d5d8c8afa04409ea50435d058 100644 --- a/reco/L1/CbmL1TrdTrackFinderSts.cxx +++ b/reco/L1/CbmL1TrdTrackFinderSts.cxx @@ -729,11 +729,11 @@ Double_t CbmL1TrdTrackFinderSts::GetChi2Hit(CbmKFTrack& track, / (c0 * c2 - c1 * c1); } else if (pHit->GetDx() < pHit->GetDy()) { Double_t dx = track.GetTrack()[0] - pHit->GetX(); - Double_t c0 = track.GetCovMatrix()[0] + TMath::Power(pHit->GetDx(), 2); + Double_t c0 = track.GetCovMatrix()[0] + pHit->GetDx() * pHit->GetDx(); chi2 = dx * dx / c0; } else { Double_t dy = track.GetTrack()[1] - pHit->GetY(); - Double_t c2 = track.GetCovMatrix()[2] + TMath::Power(pHit->GetDy(), 2); + Double_t c2 = track.GetCovMatrix()[2] + pHit->GetDy() * pHit->GetDy(); chi2 = dy * dy / c2; } return chi2; diff --git a/reco/L1/L1Algo/L1FitMaterial.h b/reco/L1/L1Algo/L1FitMaterial.h index 6c0a2d193d075266048a787980d8c6eaa88cde0e..6c58d8d80fea75b066df88cf2af3bfd3463837f9 100644 --- a/reco/L1/L1Algo/L1FitMaterial.h +++ b/reco/L1/L1Algo/L1FitMaterial.h @@ -49,12 +49,12 @@ inline fvec L1Fit::BetheBlochIron(const float qp) inline fvec L1Fit::BetheBlochCarbon(const float qp) { - float K = 0.000307075; // GeV * g^-1 * cm^2 + constexpr float K = 0.000307075; // GeV * g^-1 * cm^2 float z = (qp > 0.) ? 1 : -1.; - float Z = 6; - float A = 12.011; + constexpr float Z = 6; + constexpr float A = 12.011; - float M = 0.10565f; + constexpr float M = 0.10565f; float p = fabs(1. / qp); //GeV float E = sqrt(M * M + p * p); float beta = p / E; @@ -62,17 +62,17 @@ inline fvec L1Fit::BetheBlochCarbon(const float qp) float gamma = E / M; float gammaSq = gamma * gamma; - float I = 16 * std::pow(6, 0.9) * 1e-9; // GeV mean excitation energy in eV + constexpr float I = 16 * std::pow(6, 0.9) * 1e-9; // GeV mean excitation energy in eV - float me = 0.000511; // GeV - float ratio = me / M; + constexpr float me = 0.000511; // GeV + constexpr float ratio = me / M; float Tmax = (2 * me * betaSq * gammaSq) / (1 + 2 * gamma * ratio + ratio * ratio); // density correction float dc = 0.; if (p > 0.5) { // for particles above 1 Gev - float rho = 2.265; - float hwp = 28.816 * sqrt(rho * Z / A) * 1e-9; // GeV + constexpr float rho = 2.265; + constexpr float hwp = 28.816 * sqrt(rho * Z / A) * 1e-9; // GeV dc = log(hwp / I) + log(beta * gamma) - 0.5; } @@ -82,12 +82,12 @@ inline fvec L1Fit::BetheBlochCarbon(const float qp) inline fvec L1Fit::BetheBlochAl(const float qp) { - float K = 0.000307075; // GeV * g^-1 * cm^2 + constexpr float K = 0.000307075; // GeV * g^-1 * cm^2 float z = (qp > 0.) ? 1 : -1.; - float Z = 13; - float A = 26.981; + constexpr float Z = 13; + constexpr float A = 26.981; - float M = 0.10565f; + constexpr float M = 0.10565f; float p = fabs(1. / qp); //GeV float E = sqrt(M * M + p * p); float beta = p / E; @@ -95,17 +95,17 @@ inline fvec L1Fit::BetheBlochAl(const float qp) float gamma = E / M; float gammaSq = gamma * gamma; - float I = 16 * std::pow(6, 0.9) * 1e-9; // GeV mean excitation energy in eV + constexpr float I = 16 * std::pow(6, 0.9) * 1e-9; // GeV mean excitation energy in eV - float me = 0.000511; // GeV - float ratio = me / M; + constexpr float me = 0.000511; // GeV + constexpr float ratio = me / M; float Tmax = (2 * me * betaSq * gammaSq) / (1 + 2 * gamma * ratio + ratio * ratio); // density correction float dc = 0.; if (p > 0.5) { // for particles above 1 Gev - float rho = 2.70; - float hwp = 28.816 * sqrt(rho * Z / A) * 1e-9; // GeV + constexpr float rho = 2.70; + constexpr float hwp = 28.816 * sqrt(rho * Z / A) * 1e-9; // GeV dc = log(hwp / I) + log(beta * gamma) - 0.5; } @@ -134,13 +134,13 @@ inline fvec L1Fit::ApproximateBetheBloch(const fvec& bg2) const fvec kp3 = 173e-9f; const fvec kp4 = 0.49848f; - const float mK = 0.307075e-3f; // [GeV*cm^2/g] - const float _2me = 1.022e-3f; // [GeV/c^2] - const fvec& rho = kp0; - const fvec x0 = kp1 * 2.303f; - const fvec x1 = kp2 * 2.303f; - const fvec& mI = kp3; - const fvec& mZA = kp4; + constexpr float mK = 0.307075e-3f; // [GeV*cm^2/g] + constexpr float _2me = 1.022e-3f; // [GeV/c^2] + const fvec rho = kp0; + const fvec x0 = kp1 * 2.303f; + const fvec x1 = kp2 * 2.303f; + const fvec mI = kp3; + const fvec mZA = kp4; const fvec maxT = _2me * bg2; // neglecting the electron mass //*** Density effect @@ -182,8 +182,8 @@ inline fvec L1Fit::ApproximateBetheBloch(const fvec& bg2, const fvec& kp0, const // const fvec &kp3 = 173e-9f; // const fvec &kp4 = 0.49848f; - const float mK = 0.307075e-3f; // [GeV*cm^2/g] - const float _2me = 1.022e-3f; // [GeV/c^2] + constexpr float mK = 0.307075e-3f; // [GeV*cm^2/g] + constexpr float _2me = 1.022e-3f; // [GeV/c^2] const fvec& rho = kp0; const fvec x0 = kp1 * 2.303f; const fvec x1 = kp2 * 2.303f; @@ -267,10 +267,10 @@ inline void L1Fit::EnergyLossCorrectionAl(L1TrackPar& T, const fvec& radThick, f fvec qp = T.qp; - int atomicZ = 13; - float atomicA = 26.981f; - float rho = 2.70f; - float radLen = 2.265f; + constexpr int atomicZ = 13; + constexpr float atomicA = 26.981f; + constexpr float rho = 2.70f; + constexpr float radLen = 2.265f; // int atomicZ = 18; // float atomicA = 39.95; @@ -332,7 +332,8 @@ inline void L1Fit::EnergyLossCorrectionAl(L1TrackPar& T, const fvec& radThick, f fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12; - fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6); + float P2 = P * P; + fvec SDEDX = ((E2) *DEDX2) / (P2 * P2 * P2); // T.C40 *= corr; @@ -358,10 +359,10 @@ inline void L1Fit::EnergyLossCorrectionCarbon(L1TrackPar& T, const fvec& radThic fvec qp = T.qp; - int atomicZ = 6; - float atomicA = 12.011f; - float rho = 2.265; - float radLen = 18.76f; + constexpr int atomicZ = 6; + constexpr float atomicA = 12.011f; + constexpr float rho = 2.265; + constexpr float radLen = 18.76f; fvec i; if (atomicZ < 13) i = (12. * atomicZ + 7.) * 1.e-9; @@ -416,7 +417,8 @@ inline void L1Fit::EnergyLossCorrectionCarbon(L1TrackPar& T, const fvec& radThic fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12; - fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6); + float P2 = P * P; + fvec SDEDX = ((E2) *DEDX2) / (P2 * P2 * P2); // fvec dqp = CalcQpAfterEloss(qp[0], (direction*dE)[0], fMass2[0]); // qp0 = dqp; @@ -445,10 +447,10 @@ inline void L1Fit::EnergyLossCorrectionIron(L1TrackPar& T, const fvec& radThick, fvec qp = T.qp; - int atomicZ = 26; - float atomicA = 55.845f; - float rho = 7.87; - float radLen = 1.758f; + constexpr int atomicZ = 26; + constexpr float atomicA = 55.845f; + constexpr float rho = 7.87; + constexpr float radLen = 1.758f; fvec i; if (atomicZ < 13) i = (12. * atomicZ + 7.) * 1.e-9; @@ -499,7 +501,8 @@ inline void L1Fit::EnergyLossCorrectionIron(L1TrackPar& T, const fvec& radThick, fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12; - fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6); + float P2 = P * P; + fvec SDEDX = ((E2) *DEDX2) / (P2 * P2 * P2); // T.C40 *= corr; // T.C41 *= corr; diff --git a/reco/L1/L1Algo/L1TrackParFit.cxx b/reco/L1/L1Algo/L1TrackParFit.cxx index c20d8138169124e7d0293a7e1596b0c2d21035dd..38bb5f6cc4a762fd4e64b6b3d9cc4a4cc88560b4 100644 --- a/reco/L1/L1Algo/L1TrackParFit.cxx +++ b/reco/L1/L1Algo/L1TrackParFit.cxx @@ -930,10 +930,10 @@ void L1TrackParFit::EnergyLossCorrectionIron(const fvec& radThick, fvec& qp0, fv const fvec p2 = 1.f / (qp0 * qp0); const fvec E2 = fMass2 + p2; - int atomicZ = 26; - float atomicA = 55.845f; - float rho = 7.87; - float radLen = 1.758f; + constexpr int atomicZ = 26; + constexpr float atomicA = 55.845f; + constexpr float rho = 7.87; + constexpr float radLen = 1.758f; fvec i; if (atomicZ < 13) @@ -981,7 +981,8 @@ void L1TrackParFit::EnergyLossCorrectionIron(const fvec& radThick, fvec& qp0, fv fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12; - fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6); + float P2 = P * P; + fvec SDEDX = ((E2) *DEDX2) / (P2 * P2 * P2); // T.C40 *= corr; // T.C41 *= corr; @@ -996,10 +997,10 @@ void L1TrackParFit::EnergyLossCorrectionCarbon(const fvec& radThick, fvec& qp0, const fvec p2 = 1.f / (qp0 * qp0); const fvec E2 = fMass2 + p2; - int atomicZ = 6; - float atomicA = 12.011f; - float rho = 2.265; - float radLen = 18.76f; + constexpr int atomicZ = 6; + constexpr float atomicA = 12.011f; + constexpr float rho = 2.265; + constexpr float radLen = 18.76f; fvec i; if (atomicZ < 13) @@ -1047,7 +1048,8 @@ void L1TrackParFit::EnergyLossCorrectionCarbon(const fvec& radThick, fvec& qp0, fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12; - fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6); + float P2 = P * P; + fvec SDEDX = ((E2) *DEDX2) / (P2 * P2 * P2); // T.C40 *= corr; // T.C41 *= corr; @@ -1062,10 +1064,10 @@ void L1TrackParFit::EnergyLossCorrectionAl(const fvec& radThick, fvec& qp0, fvec const fvec p2 = 1.f / (qp0 * qp0); const fvec E2 = fMass2 + p2; - int atomicZ = 13; - float atomicA = 26.981f; - float rho = 2.70f; - float radLen = 2.265f; + constexpr int atomicZ = 13; + constexpr float atomicA = 26.981f; + constexpr float rho = 2.70f; + constexpr float radLen = 2.265f; fvec i; if (atomicZ < 13) @@ -1113,7 +1115,8 @@ void L1TrackParFit::EnergyLossCorrectionAl(const fvec& radThick, fvec& qp0, fvec fvec DEDX2 = XI * EMAX * (1. - (BETA * BETA / 2.)) * 1e-12; - fvec SDEDX = ((E2) *DEDX2) / std::pow(P, 6); + float P2 = P * P; + fvec SDEDX = ((E2) *DEDX2) / (P2 * P2 * P2); // T.C40 *= corr; // T.C41 *= corr;