|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +/// \file HFJpsiToEECandidateSelector.cxx |
| 12 | +/// \brief Jpsi selection task. |
| 13 | +/// \author Biao Zhang <biao.zhang@cern.ch>, CCNU |
| 14 | +/// \author Nima Zardoshti <nima.zardoshti@cern.ch>, CERN |
| 15 | + |
| 16 | +#include "Framework/runDataProcessing.h" |
| 17 | +#include "Framework/AnalysisTask.h" |
| 18 | +#include "AnalysisDataModel/HFSecondaryVertex.h" |
| 19 | +#include "AnalysisDataModel/HFCandidateSelectionTables.h" |
| 20 | +using namespace o2; |
| 21 | +using namespace o2::framework; |
| 22 | +using namespace o2::aod::hf_cand_prong2; |
| 23 | + |
| 24 | +static const int npTBins = 9; |
| 25 | +static const int nCutVars = 4; |
| 26 | +//temporary until 2D array in configurable is solved - then move to json |
| 27 | +// mass dcaxy dcaz pt_e |
| 28 | +constexpr double cuts[npTBins][nCutVars] = |
| 29 | + {{0.5, 0.2, 0.4, 1}, /* pt<0.5 */ |
| 30 | + {0.5, 0.2, 0.4, 1}, /* 0.5<pt<1 */ |
| 31 | + {0.5, 0.2, 0.4, 1}, /* 1<pt<2 */ |
| 32 | + {0.5, 0.2, 0.4, 1}, /* 2<pt<3 */ |
| 33 | + {0.5, 0.2, 0.4, 1}, /* 3<pt<4 */ |
| 34 | + {0.5, 0.2, 0.4, 1}, /* 4<pt<5 */ |
| 35 | + {0.5, 0.2, 0.4, 1}, /* 5<pt<7 */ |
| 36 | + {0.5, 0.2, 0.4, 1}, /* 7<pt<10 */ |
| 37 | + {0.5, 0.2, 0.4, 1}}; /* 10<pt<15 */ |
| 38 | + |
| 39 | +/// Struct for applying Jpsi selection cuts |
| 40 | + |
| 41 | +struct HFJpsiToEECandidateSelector { |
| 42 | + |
| 43 | + Produces<aod::HFSelJpsiToEECandidate> hfSelJpsiToEECandidate; |
| 44 | + |
| 45 | + Configurable<double> d_pTCandMin{"d_pTCandMin", 0., "Lower bound of candidate pT"}; |
| 46 | + Configurable<double> d_pTCandMax{"d_pTCandMax", 50., "Upper bound of candidate pT"}; |
| 47 | + |
| 48 | + Configurable<double> d_pidTPCMinpT{"d_pidTPCMinpT", 0.15, "Lower bound of track pT for TPC PID"}; |
| 49 | + Configurable<double> d_pidTPCMaxpT{"d_pidTPCMaxpT", 10., "Upper bound of track pT for TPC PID"}; |
| 50 | + |
| 51 | + Configurable<double> d_TPCNClsFindablePIDCut{"d_TPCNClsFindablePIDCut", 70., "Lower bound of TPC findable clusters for good PID"}; |
| 52 | + Configurable<double> d_nSigmaTPC{"d_nSigmaTPC", 3., "Nsigma cut on TPC only"}; |
| 53 | + |
| 54 | + /// Gets corresponding pT bin from cut file array |
| 55 | + /// \param candpT is the pT of the candidate |
| 56 | + /// \return corresponding bin number of array |
| 57 | + template <typename T> |
| 58 | + int getpTBin(T candpT) |
| 59 | + { |
| 60 | + double pTBins[npTBins + 1] = {0, 0.5, 1., 2., 3., 4., 5., 7., 10., 15.}; |
| 61 | + if (candpT < pTBins[0] || candpT >= pTBins[npTBins]) { |
| 62 | + return -1; |
| 63 | + } |
| 64 | + for (int i = 0; i < npTBins; i++) { |
| 65 | + if (candpT < pTBins[i + 1]) { |
| 66 | + return i; |
| 67 | + } |
| 68 | + } |
| 69 | + return -1; |
| 70 | + } |
| 71 | + |
| 72 | + /// Selection on goodness of daughter tracks |
| 73 | + /// \note should be applied at candidate selection |
| 74 | + /// \param track is daughter track |
| 75 | + /// \return true if track is good |
| 76 | + template <typename T> |
| 77 | + bool daughterSelection(const T& track) |
| 78 | + { |
| 79 | + if (track.charge() == 0) { |
| 80 | + return false; |
| 81 | + } |
| 82 | + if (track.tpcNClsFound() == 0) { |
| 83 | + return false; //is it clusters findable or found - need to check |
| 84 | + } |
| 85 | + return true; |
| 86 | + } |
| 87 | + |
| 88 | + /// Conjugate independent toplogical cuts |
| 89 | + /// \param hfCandProng2 is candidate |
| 90 | + /// \param trackPositron is the track with the positron hypothesis |
| 91 | + /// \param trackElectron is the track with the electron hypothesis |
| 92 | + /// \return true if candidate passes all cuts |
| 93 | + template <typename T1, typename T2> |
| 94 | + bool selectionTopol(const T1& hfCandProng2, const T2& trackPositron, const T2& trackElectron) |
| 95 | + { |
| 96 | + auto candpT = hfCandProng2.pt(); |
| 97 | + int pTBin = getpTBin(candpT); |
| 98 | + if (pTBin == -1) { |
| 99 | + return false; |
| 100 | + } |
| 101 | + |
| 102 | + if (candpT < d_pTCandMin || candpT >= d_pTCandMax) { |
| 103 | + return false; //check that the candidate pT is within the analysis range |
| 104 | + } |
| 105 | + |
| 106 | + if (TMath::Abs(InvMassJpsiToEE(hfCandProng2) - RecoDecay::getMassPDG(443)) > cuts[pTBin][0]) { |
| 107 | + return false; |
| 108 | + } |
| 109 | + |
| 110 | + if ((trackElectron.pt() < cuts[pTBin][3]) || (trackPositron.pt() < cuts[pTBin][3])) { |
| 111 | + return false; //cut on daughter pT |
| 112 | + } |
| 113 | + if (TMath::Abs(trackElectron.dcaPrim0()) > cuts[pTBin][1] || TMath::Abs(trackPositron.dcaPrim0()) > cuts[pTBin][1]) { |
| 114 | + return false; //cut on daughter dca - need to add secondary vertex constraint here |
| 115 | + } |
| 116 | + if (TMath::Abs(trackElectron.dcaPrim1()) > cuts[pTBin][2] || TMath::Abs(trackPositron.dcaPrim1()) > cuts[pTBin][2]) { |
| 117 | + return false; //cut on daughter dca - need to add secondary vertex constraint here |
| 118 | + } |
| 119 | + |
| 120 | + return true; |
| 121 | + } |
| 122 | + |
| 123 | + /// Check if track is ok for TPC PID |
| 124 | + /// \param track is the track |
| 125 | + /// \note function to be expanded |
| 126 | + /// \return true if track is ok for TPC PID |
| 127 | + template <typename T> |
| 128 | + bool validTPCPID(const T& track) |
| 129 | + { |
| 130 | + if (TMath::Abs(track.pt()) < d_pidTPCMinpT || TMath::Abs(track.pt()) >= d_pidTPCMaxpT) { |
| 131 | + return false; |
| 132 | + } |
| 133 | + //if (track.TPCNClsFindable() < d_TPCNClsFindablePIDCut) return false; |
| 134 | + return true; |
| 135 | + } |
| 136 | + |
| 137 | + /// Check if track is compatible with given TPC Nsigma cut for a given flavour hypothesis |
| 138 | + /// \param track is the track |
| 139 | + /// \param nPDG is the flavour hypothesis PDG number |
| 140 | + /// \param nSigmaCut is the nsigma threshold to test against |
| 141 | + /// \note nPDG=11 electron |
| 142 | + /// \return true if track satisfies TPC PID hypothesis for given Nsigma cut |
| 143 | + template <typename T> |
| 144 | + bool selectionPIDTPC(const T& track, int nSigmaCut) |
| 145 | + { |
| 146 | + return track.tpcNSigmaEl() < nSigmaCut; |
| 147 | + } |
| 148 | + |
| 149 | + /// PID selection on daughter track |
| 150 | + /// \param track is the daughter track |
| 151 | + /// \param nPDG is the PDG code of the flavour hypothesis |
| 152 | + /// \note nPDG=11 electron |
| 153 | + /// \return 1 if successful PID match, 0 if successful PID rejection, -1 if no PID info |
| 154 | + template <typename T> |
| 155 | + int selectionPID(const T& track) |
| 156 | + { |
| 157 | + |
| 158 | + if (validTPCPID(track)) { |
| 159 | + if (!selectionPIDTPC(track, d_nSigmaTPC)) { |
| 160 | + |
| 161 | + return 0; //rejected by PID |
| 162 | + } else { |
| 163 | + return 1; //positive PID |
| 164 | + } |
| 165 | + } else { |
| 166 | + return -1; //no PID info |
| 167 | + } |
| 168 | + } |
| 169 | + void process(aod::HfCandProng2 const& hfCandProng2s, aod::BigTracksPID const& tracks) |
| 170 | + { |
| 171 | + |
| 172 | + for (auto& hfCandProng2 : hfCandProng2s) { //looping over 2 prong candidates |
| 173 | + |
| 174 | + auto trackPos = hfCandProng2.index0_as<aod::BigTracksPID>(); //positive daughter |
| 175 | + auto trackNeg = hfCandProng2.index1_as<aod::BigTracksPID>(); //negative daughter |
| 176 | + |
| 177 | + if (!(hfCandProng2.hfflag() & 1 << JpsiToEE)) { |
| 178 | + hfSelJpsiToEECandidate(0); |
| 179 | + continue; |
| 180 | + } |
| 181 | + |
| 182 | + // daughter track validity selection |
| 183 | + if (!daughterSelection(trackPos) || !daughterSelection(trackNeg)) { |
| 184 | + hfSelJpsiToEECandidate(0); |
| 185 | + continue; |
| 186 | + } |
| 187 | + |
| 188 | + //implement filter bit 4 cut - should be done before this task at the track selection level |
| 189 | + //need to add special cuts (additional cuts on decay length and d0 norm) |
| 190 | + |
| 191 | + if (!selectionTopol(hfCandProng2, trackPos, trackNeg)) { |
| 192 | + hfSelJpsiToEECandidate(0); |
| 193 | + continue; |
| 194 | + } |
| 195 | + |
| 196 | + if (selectionPID(trackPos) == 0 || selectionPID(trackNeg) == 0) { |
| 197 | + hfSelJpsiToEECandidate(0); |
| 198 | + continue; |
| 199 | + } |
| 200 | + |
| 201 | + hfSelJpsiToEECandidate(1); |
| 202 | + } |
| 203 | + } |
| 204 | +}; |
| 205 | + |
| 206 | +WorkflowSpec defineDataProcessing(ConfigContext const&) |
| 207 | +{ |
| 208 | + return WorkflowSpec{ |
| 209 | + adaptAnalysisTask<HFJpsiToEECandidateSelector>("hf-jpsi-toee-candidate-selector")}; |
| 210 | +} |
0 commit comments