Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions DPG/Tasks/AOTTrack/derivedDataCreatorD0Calibration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,34 @@ struct DerivedDataCreatorD0Calibration {
continue;
}

// preselections
// pt
std::array<float, 3> pVecNoVtxD0 = RecoDecay::pVec(trackPos.pVector(), trackNeg.pVector());
float ptNoVtxD0 = RecoDecay::pt(pVecNoVtxD0);
Comment on lines +280 to +281

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't need the vector, you can do directly

Suggested change
std::array<float, 3> pVecNoVtxD0 = RecoDecay::pVec(trackPos.pVector(), trackNeg.pVector());
float ptNoVtxD0 = RecoDecay::pt(pVecNoVtxD0);
float ptNoVtxD0 = RecoDecay::pt(trackPos.pVector(), trackNeg.pVector());

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) {
Expand All @@ -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) {
Expand All @@ -302,17 +329,6 @@ struct DerivedDataCreatorD0Calibration {
continue;
}

// pt
std::array<float, 3> 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;
Expand Down Expand Up @@ -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;
Expand Down
Loading