|
8 | 8 | // In applying this license CERN does not waive the privileges and immunities |
9 | 9 | // granted to it by virtue of its status as an Intergovernmental Organization |
10 | 10 | // or submit itself to any jurisdiction. |
| 11 | +#include <vector> |
| 12 | + |
11 | 13 | #include "Framework/runDataProcessing.h" |
12 | 14 | #include "Framework/AnalysisTask.h" |
13 | 15 | #include "Framework/AnalysisDataModel.h" |
@@ -35,8 +37,70 @@ struct Filter2Prong { |
35 | 37 |
|
36 | 38 | HfHelper hfHelper; |
37 | 39 | Produces<aod::CF2ProngTracks> output2ProngTracks; |
| 40 | + Produces<aod::CF2ProngTrackmls> output2ProngTrackmls; |
38 | 41 |
|
39 | 42 | using HFCandidates = soa::Join<aod::HfCand2Prong, aod::HfSelD0>; |
| 43 | + using HFCandidatesML = soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfMlD0>; |
| 44 | + |
| 45 | + void processDataML(aod::Collisions::iterator const&, aod::BCsWithTimestamps const&, aod::CFCollRefs const& cfcollisions, aod::CFTrackRefs const& cftracks, HFCandidatesML const& candidates) |
| 46 | + { |
| 47 | + if (cfcollisions.size() <= 0 || cftracks.size() <= 0) |
| 48 | + return; // rejected collision |
| 49 | + if (cfgVerbosity > 0 && candidates.size() > 0) |
| 50 | + LOGF(info, "Candidates for collision: %lu, cfcollisions: %lu, CFTracks: %lu", candidates.size(), cfcollisions.size(), cftracks.size()); |
| 51 | + for (auto& c : candidates) { |
| 52 | + int prongCFId[2] = {-1, -1}; |
| 53 | + for (auto& cftrack : cftracks) { |
| 54 | + if (c.prong0Id() == cftrack.trackId()) { |
| 55 | + prongCFId[0] = cftrack.globalIndex(); |
| 56 | + break; |
| 57 | + } |
| 58 | + } |
| 59 | + for (auto& cftrack : cftracks) { |
| 60 | + if (c.prong1Id() == cftrack.trackId()) { |
| 61 | + prongCFId[1] = cftrack.globalIndex(); |
| 62 | + break; |
| 63 | + } |
| 64 | + } |
| 65 | + // look-up the collision id |
| 66 | + if ((c.hfflag() & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) == 0) |
| 67 | + continue; |
| 68 | + if (cfgYMax >= 0.0f && std::abs(hfHelper.yD0(c)) > cfgYMax) |
| 69 | + continue; |
| 70 | + |
| 71 | + std::vector<float> mlvecd{}; |
| 72 | + std::vector<float> mlvecdbar{}; |
| 73 | + |
| 74 | + if (c.isSelD0() > 0) { |
| 75 | + output2ProngTracks(cfcollisions.begin().globalIndex(), |
| 76 | + prongCFId[0], prongCFId[1], c.pt(), c.eta(), c.phi(), hfHelper.invMassD0ToPiK(c), aod::cf2prongtrack::D0ToPiK); |
| 77 | + for (float val : c.mlProbD0()) { |
| 78 | + mlvecd.push_back(val); |
| 79 | + } |
| 80 | + for (float val : c.mlProbD0bar()) { |
| 81 | + mlvecdbar.push_back(val); |
| 82 | + } |
| 83 | + output2ProngTrackmls(cfcollisions.begin().globalIndex(), mlvecd, mlvecdbar); |
| 84 | + } |
| 85 | + |
| 86 | + mlvecd.clear(); |
| 87 | + mlvecdbar.clear(); |
| 88 | + |
| 89 | + if (c.isSelD0bar() > 0) { |
| 90 | + output2ProngTracks(cfcollisions.begin().globalIndex(), |
| 91 | + prongCFId[0], prongCFId[1], c.pt(), c.eta(), c.phi(), hfHelper.invMassD0barToKPi(c), aod::cf2prongtrack::D0barToKPi); |
| 92 | + for (float val : c.mlProbD0()) { |
| 93 | + mlvecd.push_back(val); |
| 94 | + } |
| 95 | + for (float val : c.mlProbD0bar()) { |
| 96 | + mlvecdbar.push_back(val); |
| 97 | + } |
| 98 | + output2ProngTrackmls(cfcollisions.begin().globalIndex(), mlvecd, mlvecdbar); |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + PROCESS_SWITCH(Filter2Prong, processDataML, "Process data D0 candidates with ML", false); |
| 103 | + |
40 | 104 | void processData(aod::Collisions::iterator const&, aod::BCsWithTimestamps const&, aod::CFCollRefs const& cfcollisions, aod::CFTrackRefs const& cftracks, HFCandidates const& candidates) |
41 | 105 | { |
42 | 106 | if (cfcollisions.size() <= 0 || cftracks.size() <= 0) |
|
0 commit comments