|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | +/// |
| 12 | +/// \file taskSingleElectron.cxx |
| 13 | +/// \brief task for electrons from heavy-flavour hadron decays |
| 14 | +/// \author Jonghan Park (Jeonbuk National University) |
| 15 | + |
| 16 | +#include "Common/Core/RecoDecay.h" |
| 17 | +#include "Common/DataModel/EventSelection.h" |
| 18 | +#include "Common/DataModel/PIDResponse.h" |
| 19 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 20 | + |
| 21 | +#include <Framework/ASoAHelpers.h> |
| 22 | +#include <Framework/AnalysisTask.h> |
| 23 | +#include <Framework/runDataProcessing.h> |
| 24 | + |
| 25 | +using namespace o2; |
| 26 | +using namespace o2::constants::math; |
| 27 | +using namespace o2::framework; |
| 28 | +using namespace o2::framework::expressions; |
| 29 | + |
| 30 | +struct HfTaskSingleElectron { |
| 31 | + |
| 32 | + // Produces |
| 33 | + |
| 34 | + // Configurable |
| 35 | + Configurable<int> nContribMin{"nContribMin", 2, "min number of contributors"}; |
| 36 | + Configurable<float> posZMax{"posZMax", 10., "max posZ cut"}; |
| 37 | + Configurable<float> ptTrackMax{"ptTrackMax", 10., "max pt cut"}; |
| 38 | + Configurable<float> ptTrackMin{"ptTrackMin", 0.5, "min pt cut"}; |
| 39 | + Configurable<float> etaTrackMax{"etaTrackMax", 0.8, "eta cut"}; |
| 40 | + Configurable<int> tpcNCrossedRowMin{"tpcNCrossedRowMin", 70, "max of TPC n cluster crossed rows"}; |
| 41 | + Configurable<float> tpcNClsFoundOverFindableMin{"tpcNClsFoundOverFindableMin", 0.8, "min # of TPC found/findable clusters"}; |
| 42 | + Configurable<float> tpcChi2perNClMax{"tpcChi2perNClMax", 4., "min # of tpc chi2 per clusters"}; |
| 43 | + Configurable<int> itsIBClsMin{"itsIBClsMin", 3, "min # of its clusters in IB"}; |
| 44 | + Configurable<float> dcaxyMax{"dcaxyMax", 1., "max of track dca in xy"}; |
| 45 | + Configurable<float> dcazMax{"dcazMax", 2., "max of track dca in z"}; |
| 46 | + Configurable<float> tofNSigmaMax{"tofNSigmaMax", 3., "max of tof nsigma"}; |
| 47 | + Configurable<float> tpcNSigmaMin{"tpcNSigmaMin", -1., "min of tpc nsigma"}; |
| 48 | + Configurable<float> tpcNSigmaMax{"tpcNSigmaMax", 3., "max of tpc nsigma"}; |
| 49 | + |
| 50 | + Configurable<int> nBinsPt{"nBinsPt", 100, "N bins in pT histo"}; |
| 51 | + |
| 52 | + // SliceCache |
| 53 | + SliceCache cache; |
| 54 | + |
| 55 | + // using declarations |
| 56 | + using MyCollisions = soa::Join<aod::Collisions, aod::EvSels>; |
| 57 | + using TracksEl = soa::Join<aod::Tracks, aod::TrackExtra, aod::TracksDCA, aod::pidTOFFullEl, aod::pidTPCFullEl>; |
| 58 | + |
| 59 | + // Filter |
| 60 | + Filter collZFilter = nabs(aod::collision::posZ) < posZMax; |
| 61 | + |
| 62 | + // Partition |
| 63 | + |
| 64 | + // ConfigurableAxis |
| 65 | + ConfigurableAxis axisPtEl{"axisPtEl", {VARIABLE_WIDTH, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.75f, 2.0f, 2.25f, 2.5f, 2.75f, 3.f, 3.5f, 4.0f, 5.0f, 6.0f, 8.0f, 10.0f}, "electron pt bins"}; |
| 66 | + |
| 67 | + // AxisSpec |
| 68 | + const AxisSpec axisEvt{4, 0., 4., "nEvents"}; |
| 69 | + const AxisSpec axisNCont{100, 0., 100., "nCont"}; |
| 70 | + const AxisSpec axisPosZ{600, -30., 30., "Z_{pos}"}; |
| 71 | + const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; |
| 72 | + const AxisSpec axisPt{nBinsPt, 0., 15., "p_{T}"}; |
| 73 | + const AxisSpec axisNsig{800, -20., 20.}; |
| 74 | + const AxisSpec axisTrackIp{4000, -0.2, 0.2, "dca"}; |
| 75 | + |
| 76 | + // Histogram registry |
| 77 | + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; |
| 78 | + |
| 79 | + void init(InitContext const&) |
| 80 | + { |
| 81 | + // create histograms |
| 82 | + histos.add("hEventCounter", "hEventCounter", kTH1F, {axisEvt}); |
| 83 | + histos.add("nEvents", "Number of events", kTH1F, {{1, 0., 1.}}); |
| 84 | + histos.add("VtxZ", "VtxZ; cm; entries", kTH1F, {axisPosZ}); |
| 85 | + histos.add("etaTrack", "etaTrack; #eta; entries", kTH1F, {axisEta}); |
| 86 | + histos.add("ptTrack", "#it{p}_{T} distribution of selected tracks; #it{p}_{T} (GeV/#it{c}); entries", kTH1F, {axisPt}); |
| 87 | + |
| 88 | + // QA plots for trigger track selection |
| 89 | + histos.add("tpcNClsTrack", "tpcNClsTrack", kTH1F, {{200, 0, 200}}); |
| 90 | + histos.add("tpcFoundFindableTrack", "", kTH1F, {{10, 0, 1}}); |
| 91 | + histos.add("tpcChi2Track", "", kTH1F, {{100, 0, 10}}); |
| 92 | + histos.add("itsIBClsTrack", "", kTH1F, {{10, 0, 10}}); |
| 93 | + histos.add("dcaXYTrack", "", kTH1F, {{600, -3, 3}}); |
| 94 | + histos.add("dcaZTrack", "", kTH1F, {{600, -3, 3}}); |
| 95 | + |
| 96 | + // pid |
| 97 | + histos.add("tofNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}}); |
| 98 | + histos.add("tofNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}}); |
| 99 | + histos.add("tpcNSigPt", "", kTH2F, {{axisPtEl}, {axisNsig}}); |
| 100 | + histos.add("tpcNSigPtAfterTofCut", "", kTH2F, {{axisPtEl}, {axisNsig}}); |
| 101 | + histos.add("tpcNSigPtQA", "", kTH2F, {{axisPtEl}, {axisNsig}}); |
| 102 | + |
| 103 | + // track impact parameter |
| 104 | + histos.add("dcaTrack", "", kTH2F, {{axisPtEl}, {axisTrackIp}}); |
| 105 | + } |
| 106 | + |
| 107 | + template <typename TrackType> |
| 108 | + bool trackSel(const TrackType& track) |
| 109 | + { |
| 110 | + if ((track.pt() > ptTrackMax) || (track.pt() < ptTrackMin)) { |
| 111 | + return false; |
| 112 | + } |
| 113 | + if (std::abs(track.eta()) > etaTrackMax) { |
| 114 | + return false; |
| 115 | + } |
| 116 | + |
| 117 | + if (track.tpcNClsCrossedRows() < tpcNCrossedRowMin) { |
| 118 | + return false; |
| 119 | + } |
| 120 | + if (track.tpcCrossedRowsOverFindableCls() < tpcNClsFoundOverFindableMin) { |
| 121 | + return false; |
| 122 | + } |
| 123 | + if (track.tpcChi2NCl() > tpcChi2perNClMax) { |
| 124 | + return false; |
| 125 | + } |
| 126 | + |
| 127 | + if (!(track.itsNClsInnerBarrel() == itsIBClsMin)) { |
| 128 | + return false; |
| 129 | + } |
| 130 | + |
| 131 | + if (std::abs(track.dcaXY()) > dcaxyMax) { |
| 132 | + return false; |
| 133 | + } |
| 134 | + if (std::abs(track.dcaZ()) > dcazMax) { |
| 135 | + return false; |
| 136 | + } |
| 137 | + |
| 138 | + return true; |
| 139 | + } |
| 140 | + |
| 141 | + void process(soa::Filtered<MyCollisions>::iterator const& collision, |
| 142 | + TracksEl const& tracks) |
| 143 | + { |
| 144 | + float flagEventFill = 0.5; |
| 145 | + float flagAnalysedEvt = 0.5; |
| 146 | + histos.fill(HIST("hEventCounter"), flagEventFill); |
| 147 | + |
| 148 | + if (!collision.sel8()) { |
| 149 | + return; |
| 150 | + } |
| 151 | + flagEventFill += 1.; |
| 152 | + histos.fill(HIST("hEventCounter"), flagEventFill); |
| 153 | + |
| 154 | + if (collision.numContrib() < nContribMin) { |
| 155 | + return; |
| 156 | + } |
| 157 | + flagEventFill += 1.; |
| 158 | + histos.fill(HIST("hEventCounter"), flagEventFill); |
| 159 | + |
| 160 | + histos.fill(HIST("VtxZ"), collision.posZ()); |
| 161 | + histos.fill(HIST("nEvents"), flagAnalysedEvt); |
| 162 | + |
| 163 | + for (const auto& track : tracks) { |
| 164 | + |
| 165 | + if (!trackSel(track)) { |
| 166 | + continue; |
| 167 | + } |
| 168 | + |
| 169 | + histos.fill(HIST("etaTrack"), track.eta()); |
| 170 | + histos.fill(HIST("ptTrack"), track.pt()); |
| 171 | + |
| 172 | + histos.fill(HIST("tpcNClsTrack"), track.tpcNClsCrossedRows()); |
| 173 | + histos.fill(HIST("tpcFoundFindableTrack"), track.tpcCrossedRowsOverFindableCls()); |
| 174 | + histos.fill(HIST("tpcChi2Track"), track.tpcChi2NCl()); |
| 175 | + histos.fill(HIST("itsIBClsTrack"), track.itsNClsInnerBarrel()); |
| 176 | + histos.fill(HIST("dcaXYTrack"), track.dcaXY()); |
| 177 | + histos.fill(HIST("dcaZTrack"), track.dcaZ()); |
| 178 | + |
| 179 | + histos.fill(HIST("tofNSigPt"), track.pt(), track.tofNSigmaEl()); |
| 180 | + histos.fill(HIST("tpcNSigPt"), track.pt(), track.tpcNSigmaEl()); |
| 181 | + |
| 182 | + if (std::abs(track.tofNSigmaEl()) > tofNSigmaMax) { |
| 183 | + continue; |
| 184 | + } |
| 185 | + histos.fill(HIST("tofNSigPtQA"), track.pt(), track.tofNSigmaEl()); |
| 186 | + histos.fill(HIST("tpcNSigPtAfterTofCut"), track.pt(), track.tpcNSigmaEl()); |
| 187 | + |
| 188 | + if (track.tpcNSigmaEl() < tpcNSigmaMin || track.tpcNSigmaEl() > tpcNSigmaMax) { |
| 189 | + continue; |
| 190 | + } |
| 191 | + histos.fill(HIST("tpcNSigPtQA"), track.pt(), track.tpcNSigmaEl()); |
| 192 | + |
| 193 | + histos.fill(HIST("dcaTrack"), track.pt(), track.dcaXY()); |
| 194 | + } |
| 195 | + } |
| 196 | +}; |
| 197 | + |
| 198 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 199 | +{ |
| 200 | + return WorkflowSpec{ |
| 201 | + adaptAnalysisTask<HfTaskSingleElectron>(cfgc)}; |
| 202 | +} |
0 commit comments