diff --git a/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx b/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx index b270c628ed8..0e58bbd8b3a 100644 --- a/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx +++ b/DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx @@ -275,6 +275,34 @@ struct DerivedDataCreatorD0Calibration { continue; } + // preselections + // pt + std::array pVecNoVtxD0 = RecoDecay::pVec(trackPos.pVector(), trackNeg.pVector()); + float ptNoVtxD0 = RecoDecay::pt(pVecNoVtxD0); + if (ptNoVtxD0 - ptTolerance < cfgCandCuts.ptMin) { + continue; + } + int ptBinNoVtxD0 = findBin(cfgTrackCuts.binsPt, ptNoVtxD0 + ptTolerance); // assuming tighter selections at lower pT + if (ptBinNoVtxD0 < 0) { + continue; + } + + // random downsampling already here + if (cfgDownsampling.apply) { + int ptBinWeights{0}; + if (ptNoVtxD0 < histDownSampl->GetBinLowEdge(1)) { + ptBinWeights = 1; + } else if (ptNoVtxD0 > histDownSampl->GetXaxis()->GetBinUpEdge(histDownSampl->GetNbinsX())) { + ptBinWeights = histDownSampl->GetNbinsX(); + } else { + ptBinWeights = histDownSampl->GetXaxis()->FindBin(ptNoVtxD0); + } + float weight = histDownSampl->GetBinContent(ptBinWeights); + if (gRandom->Rndm() > weight) { + continue; + } + } + int pidTrackNegKaon{-1}; int pidTrackNegPion{-1}; if (cfgTrackCuts.usePidTpcOnly) { @@ -289,7 +317,6 @@ struct DerivedDataCreatorD0Calibration { pidTrackNegPion = selectorPion.statusTpcAndTof(trackNeg); } - // preselections // PID uint8_t massHypo{D0MassHypo::D0AndD0Bar}; // both mass hypotheses a priori if (pidTrackPosPion == TrackSelectorPID::Rejected || pidTrackNegKaon == TrackSelectorPID::Rejected) { @@ -302,17 +329,6 @@ struct DerivedDataCreatorD0Calibration { continue; } - // pt - std::array pVecNoVtxD0 = RecoDecay::pVec(trackPos.pVector(), trackNeg.pVector()); - float ptNoVtxD0 = RecoDecay::pt(pVecNoVtxD0); - if (ptNoVtxD0 - ptTolerance < cfgCandCuts.ptMin) { - continue; - } - int ptBinNoVtxD0 = findBin(cfgTrackCuts.binsPt, ptNoVtxD0 + ptTolerance); // assuming tighter selections at lower pT - if (ptBinNoVtxD0 < 0) { - continue; - } - // d0xd0 if (dcaPos.getY() * dcaNeg.getY() > cfgCandCuts.topologicalCuts->get(ptBinNoVtxD0, "max d0d0")) { continue; @@ -362,22 +378,6 @@ struct DerivedDataCreatorD0Calibration { continue; } - // random downsampling already here - if (cfgDownsampling.apply) { - int ptBinWeights{0}; - if (ptD0 < histDownSampl->GetBinLowEdge(1)) { - ptBinWeights = 1; - } else if (ptD0 > histDownSampl->GetXaxis()->GetBinUpEdge(histDownSampl->GetNbinsX())) { - ptBinWeights = histDownSampl->GetNbinsX(); - } else { - ptBinWeights = histDownSampl->GetXaxis()->FindBin(ptD0); - } - float weight = histDownSampl->GetBinContent(ptBinWeights); - if (gRandom->Rndm() > weight) { - continue; - } - } - // d0xd0 if (dcaPos.getY() * dcaNeg.getY() > cfgCandCuts.topologicalCuts->get(ptBinD0, "max d0d0")) { continue;