Skip to content

Commit 540317d

Browse files
committed
fix o2-linter for utilites in IP and SV side
1 parent c3e909b commit 540317d

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

PWGJE/Core/JetTaggingUtilities.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int jetTrackFromHFShower(T const& jet, U const& /*tracks*/, V const& particles,
176176

177177
bool hasMcParticle = false;
178178
int origin = -1;
179-
for (auto& track : jet.template tracks_as<U>()) {
179+
for (auto const& track : jet.template tracks_as<U>()) {
180180
hftrack = track; // for init if origin is 1 or 2, the track is not hftrack
181181
if (!track.has_mcParticle()) {
182182
continue;
@@ -322,7 +322,7 @@ int jetOrigin(T const& jet, U const& particles, float dRMax = 0.25)
322322
bool firstPartonFound = false;
323323
typename U::iterator parton1;
324324
typename U::iterator parton2;
325-
for (auto& particle : particles) {
325+
for (auto const& particle : particles) {
326326
if (std::abs(particle.getGenStatusCode() == 23)) {
327327
if (!firstPartonFound) {
328328
parton1 = particle;
@@ -358,15 +358,15 @@ template <typename AnyJet, typename AllMCParticles>
358358
int16_t getJetFlavor(AnyJet const& jet, AllMCParticles const& mcparticles)
359359
{
360360
bool charmQuark = false;
361-
for (auto& mcpart : mcparticles) {
361+
for (auto const& mcpart : mcparticles) {
362362
int pdgcode = mcpart.pdgCode();
363-
if (TMath::Abs(pdgcode) == 21 || (TMath::Abs(pdgcode) >= 1 && TMath::Abs(pdgcode) <= 5)) {
363+
if (std::abs(pdgcode) == 21 || (std::abs(pdgcode) >= 1 && std::abs(pdgcode) <= 5)) {
364364
double dR = jetutilities::deltaR(jet, mcpart);
365365

366366
if (dR < jet.r() / 100.f) {
367-
if (TMath::Abs(pdgcode) == 5) {
367+
if (std::abs(pdgcode) == 5) {
368368
return JetTaggingSpecies::beauty; // Beauty jet
369-
} else if (TMath::Abs(pdgcode) == 4) {
369+
} else if (std::abs(pdgcode) == 4) {
370370
charmQuark = true;
371371
}
372372
}
@@ -391,7 +391,7 @@ int16_t getJetFlavorHadron(AnyJet const& jet, AllMCParticles const& mcparticles)
391391
{
392392
bool charmHadron = false;
393393

394-
for (auto& mcpart : mcparticles) {
394+
for (auto const& mcpart : mcparticles) {
395395
int pdgcode = mcpart.pdgCode();
396396
if (isBHadron(pdgcode) || isCHadron(pdgcode)) {
397397
double dR = jetutilities::deltaR(jet, mcpart);
@@ -490,7 +490,7 @@ int getGeoSign(T const& jet, U const& jtrack)
490490
template <typename T, typename U, typename Vec = std::vector<float>>
491491
void orderForIPJetTracks(T const& jet, U const& /*jtracks*/, float const& trackDcaXYMax, float const& trackDcaZMax, Vec& vecSignImpSig, bool useIPxyz)
492492
{
493-
for (auto& jtrack : jet.template tracks_as<U>()) {
493+
for (auto const& jtrack : jet.template tracks_as<U>()) {
494494
if (!trackAcceptanceWithDca(jtrack, trackDcaXYMax, trackDcaZMax))
495495
continue;
496496
auto geoSign = getGeoSign(jet, jtrack);
@@ -564,7 +564,7 @@ template <typename T, typename U>
564564
float getTrackProbability(T const& fResoFuncjet, U const& track, const float& minSignImpXYSig = -40)
565565
{
566566
float probTrack = 0;
567-
auto varSignImpXYSig = TMath::Abs(track.dcaXY()) / track.sigmadcaXY();
567+
auto varSignImpXYSig = std::abs(track.dcaXY()) / track.sigmadcaXY();
568568
if (-varSignImpXYSig < minSignImpXYSig)
569569
varSignImpXYSig = -minSignImpXYSig - 0.01; // To avoid overflow for integral
570570
probTrack = fResoFuncjet->Integral(minSignImpXYSig, -varSignImpXYSig) / fResoFuncjet->Integral(minSignImpXYSig, 0);
@@ -599,7 +599,7 @@ float getJetProbability(T const& fResoFuncjet, U const& jet, V const& jtracks, f
599599
std::vector<float> jetTracksPt;
600600
float trackjetProb = 1.;
601601

602-
for (auto& jtrack : jet.template tracks_as<V>()) {
602+
for (auto const& jtrack : jet.template tracks_as<V>()) {
603603
if (!trackAcceptanceWithDca(jtrack, trackDcaXYMax, trackDcaZMax))
604604
continue;
605605

@@ -612,17 +612,17 @@ float getJetProbability(T const& fResoFuncjet, U const& jet, V const& jtracks, f
612612
}
613613
}
614614

615-
float JP = -1.;
615+
float jetProb = -1.;
616616
if (jetTracksPt.size() < 2)
617617
return -1;
618618

619619
float sumjetProb = 0.;
620620
for (std::vector<float>::size_type i = 0; i < jetTracksPt.size(); i++) {
621-
sumjetProb += (TMath::Power(-1 * TMath::Log(trackjetProb), static_cast<int>(i)) / TMath::Factorial(i));
621+
sumjetProb += (std::pow(-1 * std::log(trackjetProb), static_cast<int>(i)) / TMath::Factorial(i));
622622
}
623623

624-
JP = trackjetProb * sumjetProb;
625-
return JP;
624+
jetProb = trackjetProb * sumjetProb;
625+
return jetProb;
626626
}
627627

628628
// For secaondy vertex method utilites
@@ -637,13 +637,13 @@ typename ProngType::iterator jetFromProngMaxDecayLength(const JetType& jet, floa
637637
if (!prongAcceptance(prong, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, doXYZ))
638638
continue;
639639
*checkSv = true;
640-
float Sxy = -1.0f;
640+
float sxy = -1.0f;
641641
if (!doXYZ) {
642-
Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY();
642+
sxy = prong.decayLengthXY() / prong.errorDecayLengthXY();
643643
} else {
644-
Sxy = prong.decayLength() / prong.errorDecayLength();
644+
sxy = prong.decayLength() / prong.errorDecayLength();
645645
}
646-
if (maxSxy < Sxy) {
646+
if (maxSxy < sxy) {
647647
bjetCand = prong;
648648
}
649649
}
@@ -798,7 +798,7 @@ int vertexClustering(AnyCollision const& collision, AnalysisJet const& jet, AnyT
798798

799799
trkLabels["trkVtxIndex"] = std::vector<int>(n_trks, -1);
800800
if (count.size() != 0) { // If there is any SV cluster not only PV cluster
801-
for (auto& [idx, avgDistance] : avgDistances)
801+
for (auto const& [idx, avgDistance] : avgDistances)
802802
avgDistance /= count[idx];
803803

804804
n_vertices += avgDistances.size();
@@ -824,7 +824,7 @@ int vertexClustering(AnyCollision const& collision, AnalysisJet const& jet, AnyT
824824
// trkOrigin
825825

826826
int trkIdx = 0;
827-
for (auto& constituent : jet.template tracks_as<AnyTracks>()) {
827+
for (auto const& constituent : jet.template tracks_as<AnyTracks>()) {
828828
if (!constituent.has_mcParticle() || !constituent.template mcParticle_as<AnyParticles>().isPhysicalPrimary() || constituent.pt() < trackPtMin) {
829829
trkLabels["trkOrigin"].push_back(0);
830830
} else {

0 commit comments

Comments
 (0)