@@ -275,6 +275,34 @@ struct DerivedDataCreatorD0Calibration {
275275 continue ;
276276 }
277277
278+ // preselections
279+ // pt
280+ std::array<float , 3 > pVecNoVtxD0 = RecoDecay::pVec (trackPos.pVector (), trackNeg.pVector ());
281+ float ptNoVtxD0 = RecoDecay::pt (pVecNoVtxD0);
282+ if (ptNoVtxD0 - ptTolerance < cfgCandCuts.ptMin ) {
283+ continue ;
284+ }
285+ int ptBinNoVtxD0 = findBin (cfgTrackCuts.binsPt , ptNoVtxD0 + ptTolerance); // assuming tighter selections at lower pT
286+ if (ptBinNoVtxD0 < 0 ) {
287+ continue ;
288+ }
289+
290+ // random downsampling already here
291+ if (cfgDownsampling.apply ) {
292+ int ptBinWeights{0 };
293+ if (ptNoVtxD0 < histDownSampl->GetBinLowEdge (1 )) {
294+ ptBinWeights = 1 ;
295+ } else if (ptNoVtxD0 > histDownSampl->GetXaxis ()->GetBinUpEdge (histDownSampl->GetNbinsX ())) {
296+ ptBinWeights = histDownSampl->GetNbinsX ();
297+ } else {
298+ ptBinWeights = histDownSampl->GetXaxis ()->FindBin (ptNoVtxD0);
299+ }
300+ float weight = histDownSampl->GetBinContent (ptBinWeights);
301+ if (gRandom ->Rndm () > weight) {
302+ continue ;
303+ }
304+ }
305+
278306 int pidTrackNegKaon{-1 };
279307 int pidTrackNegPion{-1 };
280308 if (cfgTrackCuts.usePidTpcOnly ) {
@@ -289,7 +317,6 @@ struct DerivedDataCreatorD0Calibration {
289317 pidTrackNegPion = selectorPion.statusTpcAndTof (trackNeg);
290318 }
291319
292- // preselections
293320 // PID
294321 uint8_t massHypo{D0MassHypo::D0AndD0Bar}; // both mass hypotheses a priori
295322 if (pidTrackPosPion == TrackSelectorPID::Rejected || pidTrackNegKaon == TrackSelectorPID::Rejected) {
@@ -302,17 +329,6 @@ struct DerivedDataCreatorD0Calibration {
302329 continue ;
303330 }
304331
305- // pt
306- std::array<float , 3 > pVecNoVtxD0 = RecoDecay::pVec (trackPos.pVector (), trackNeg.pVector ());
307- float ptNoVtxD0 = RecoDecay::pt (pVecNoVtxD0);
308- if (ptNoVtxD0 - ptTolerance < cfgCandCuts.ptMin ) {
309- continue ;
310- }
311- int ptBinNoVtxD0 = findBin (cfgTrackCuts.binsPt , ptNoVtxD0 + ptTolerance); // assuming tighter selections at lower pT
312- if (ptBinNoVtxD0 < 0 ) {
313- continue ;
314- }
315-
316332 // d0xd0
317333 if (dcaPos.getY () * dcaNeg.getY () > cfgCandCuts.topologicalCuts ->get (ptBinNoVtxD0, " max d0d0" )) {
318334 continue ;
@@ -362,22 +378,6 @@ struct DerivedDataCreatorD0Calibration {
362378 continue ;
363379 }
364380
365- // random downsampling already here
366- if (cfgDownsampling.apply ) {
367- int ptBinWeights{0 };
368- if (ptD0 < histDownSampl->GetBinLowEdge (1 )) {
369- ptBinWeights = 1 ;
370- } else if (ptD0 > histDownSampl->GetXaxis ()->GetBinUpEdge (histDownSampl->GetNbinsX ())) {
371- ptBinWeights = histDownSampl->GetNbinsX ();
372- } else {
373- ptBinWeights = histDownSampl->GetXaxis ()->FindBin (ptD0);
374- }
375- float weight = histDownSampl->GetBinContent (ptBinWeights);
376- if (gRandom ->Rndm () > weight) {
377- continue ;
378- }
379- }
380-
381381 // d0xd0
382382 if (dcaPos.getY () * dcaNeg.getY () > cfgCandCuts.topologicalCuts ->get (ptBinD0, " max d0d0" )) {
383383 continue ;
0 commit comments