|
| 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 kaDaughterProducer.cxx |
| 13 | +/// \brief Table producer for shared kaon/pion daughter derived data (K*(892), phi) |
| 14 | +/// |
| 15 | +/// \author sarjeeta.gami@cern.ch |
| 16 | + |
| 17 | +#include "PWGLF/DataModel/EPCalibrationTables.h" |
| 18 | +#include "PWGLF/DataModel/LFKaonDaughterTables.h" |
| 19 | + |
| 20 | +#include "Common/CCDB/EventSelectionParams.h" |
| 21 | +#include "Common/CCDB/RCTSelectionFlags.h" |
| 22 | +#include "Common/DataModel/Centrality.h" |
| 23 | +#include "Common/DataModel/EventSelection.h" |
| 24 | +#include "Common/DataModel/Multiplicity.h" |
| 25 | +#include "Common/DataModel/PIDResponseTOF.h" |
| 26 | +#include "Common/DataModel/PIDResponseTPC.h" |
| 27 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 28 | + |
| 29 | +#include <CommonConstants/MathConstants.h> |
| 30 | +#include <Framework/AnalysisDataModel.h> |
| 31 | +#include <Framework/AnalysisTask.h> |
| 32 | +#include <Framework/Configurable.h> |
| 33 | +#include <Framework/HistogramRegistry.h> |
| 34 | +#include <Framework/HistogramSpec.h> |
| 35 | +#include <Framework/InitContext.h> |
| 36 | +#include <Framework/runDataProcessing.h> |
| 37 | + |
| 38 | +#include <cmath> |
| 39 | +#include <cstdint> |
| 40 | +#include <string> |
| 41 | +#include <vector> |
| 42 | + |
| 43 | +using namespace o2; |
| 44 | +using namespace o2::framework; |
| 45 | +using namespace o2::framework::expressions; |
| 46 | +using namespace o2::aod::rctsel; |
| 47 | + |
| 48 | +struct KaDaughterProducer { |
| 49 | + Produces<aod::KaDaughterEvents> kaEvent; |
| 50 | + Produces<aod::KaDaughterTracks> kaTrack; |
| 51 | + |
| 52 | + struct RCTCut : ConfigurableGroup { |
| 53 | + Configurable<bool> requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; |
| 54 | + Configurable<std::string> cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; |
| 55 | + Configurable<bool> cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; |
| 56 | + Configurable<bool> cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; |
| 57 | + RCTFlagsChecker rctChecker; |
| 58 | + }; |
| 59 | + RCTCut rctCut; |
| 60 | + |
| 61 | + Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; |
| 62 | + Configurable<float> cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"}; |
| 63 | + Configurable<float> cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; |
| 64 | + Configurable<float> cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; |
| 65 | + Configurable<float> cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; |
| 66 | + Configurable<float> cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; |
| 67 | + Configurable<bool> useGlobalTrack{"useGlobalTrack", true, "use Global track"}; |
| 68 | + Configurable<int> cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; |
| 69 | + Configurable<int> cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; |
| 70 | + Configurable<bool> additionalEvSel1{"additionalEvSel1", true, "Additional evsel1"}; |
| 71 | + Configurable<bool> additionalEvSel2{"additionalEvSel2", true, "Additional evsel2"}; |
| 72 | + Configurable<bool> additionalEvSel3{"additionalEvSel3", true, "Additional evsel3"}; |
| 73 | + Configurable<bool> additionalEvSel4{"additionalEvSel4", true, "Additional evsel4"}; |
| 74 | + Configurable<bool> fillOccupancy{"fillOccupancy", false, "fill Occupancy"}; |
| 75 | + Configurable<int> cfgOccupancyCut{"cfgOccupancyCut", 500, "Occupancy cut"}; |
| 76 | + Configurable<bool> additionalQAplots1{"additionalQAplots1", true, "Additional QA plots (event-plane resolution etc.)"}; |
| 77 | + |
| 78 | + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; |
| 79 | + Filter centralityFilter = nabs(aod::cent::centFT0C) < cfgCutCentrality; |
| 80 | + Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); |
| 81 | + Filter dcacutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); |
| 82 | + |
| 83 | + using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, |
| 84 | + aod::EPCalibrationTables, aod::Mults>>; |
| 85 | + using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, |
| 86 | + aod::TrackSelection, aod::pidTOFbeta, |
| 87 | + aod::pidTPCFullKa, aod::pidTOFFullKa, |
| 88 | + aod::pidTPCFullPi, aod::pidTOFFullPi>>; |
| 89 | + |
| 90 | + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; |
| 91 | + |
| 92 | + void init(InitContext&) |
| 93 | + { |
| 94 | + rctCut.rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, rctCut.cfgEvtRCTFlagCheckerZDCCheck, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad); |
| 95 | + |
| 96 | + histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}}); |
| 97 | + if (additionalQAplots1) { |
| 98 | + std::vector<double> occupancyBinning = {0.0, 500.0, 1000.0, 1500.0, 2000.0, 3000.0, 4000.0, 5000.0, 50000.0}; |
| 99 | + AxisSpec phiAxis = {500, -6.28, 6.28, "phi"}; |
| 100 | + AxisSpec resAxis = {6000, -30, 30, "Res"}; |
| 101 | + AxisSpec centAxis = {8, 0, 80, "V0M (%)"}; |
| 102 | + AxisSpec occupancyAxis = {occupancyBinning, "Occupancy"}; |
| 103 | + histos.add("hFTOCvsTPCSelected", "Mult correlation FT0C vs. TPC after selection", kTH2F, {{80, 0.0f, 80.0f}, {100, -0.5f, 5999.5f}}); |
| 104 | + histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}}); |
| 105 | + histos.add("hOccupancy", "Occupancy distribution", kTH1F, {occupancyAxis}); |
| 106 | + histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); |
| 107 | + histos.add("hPsiFT0C", "PsiFT0C", kTH2F, {centAxis, phiAxis}); |
| 108 | + histos.add("hPsiFT0A", "PsiFT0A", kTH2F, {centAxis, phiAxis}); |
| 109 | + histos.add("hPsiTPC", "PsiTPC", kTH2F, {centAxis, phiAxis}); |
| 110 | + histos.add("ResFT0CTPC", "ResFT0CTPC", kTH2F, {centAxis, resAxis}); |
| 111 | + histos.add("ResFT0CFT0A", "ResFT0CFT0A", kTH2F, {centAxis, resAxis}); |
| 112 | + histos.add("ResFT0ATPC", "ResFT0ATPC", kTH2F, {centAxis, resAxis}); |
| 113 | + histos.add("ResFT0CTPCSP", "ResFT0CTPCSP", kTH2F, {centAxis, resAxis}); |
| 114 | + histos.add("ResFT0CFT0ASP", "ResFT0CFT0ASP", kTH2F, {centAxis, resAxis}); |
| 115 | + histos.add("ResFT0ATPCSP", "ResFT0ATPCSP", kTH2F, {centAxis, resAxis}); |
| 116 | + histos.add("ResTrackSPFT0CTPC", "ResTrackSPFT0CTPC", kTH3F, {centAxis, occupancyAxis, resAxis}); |
| 117 | + histos.add("ResTrackSPFT0CFT0A", "ResTrackSPFT0CFT0A", kTH3F, {centAxis, occupancyAxis, resAxis}); |
| 118 | + histos.add("ResTrackSPFT0ATPC", "ResTrackSPFT0ATPC", kTH3F, {centAxis, occupancyAxis, resAxis}); |
| 119 | + } |
| 120 | + } |
| 121 | + |
| 122 | + template <typename T> |
| 123 | + bool selectionTrack(const T& candidate) |
| 124 | + { |
| 125 | + if (useGlobalTrack && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) { |
| 126 | + return false; |
| 127 | + } |
| 128 | + if (!useGlobalTrack && !(candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster)) { |
| 129 | + return false; |
| 130 | + } |
| 131 | + return true; |
| 132 | + } |
| 133 | + |
| 134 | + void processData(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCsWithTimestamps const&) |
| 135 | + { |
| 136 | + histos.fill(HIST("hEvtSelInfo"), 0.5); |
| 137 | + if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(collision)) return; |
| 138 | + histos.fill(HIST("hEvtSelInfo"), 1.5); |
| 139 | + if (!collision.sel8()) return; |
| 140 | + if (!collision.triggereventep()) return; |
| 141 | + if (additionalEvSel1 && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) return; |
| 142 | + if (additionalEvSel2 && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) return; |
| 143 | + if (additionalEvSel3 && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) return; |
| 144 | + if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) return; |
| 145 | + histos.fill(HIST("hEvtSelInfo"), 2.5); |
| 146 | + |
| 147 | + auto centrality = collision.centFT0C(); |
| 148 | + int occupancy = collision.trackOccupancyInTimeRange(); |
| 149 | + auto psiFT0C = collision.psiFT0C(); |
| 150 | + auto qFT0C = collision.qFT0C(); |
| 151 | + |
| 152 | + if (fillOccupancy && occupancy > cfgOccupancyCut) return; |
| 153 | + histos.fill(HIST("hEvtSelInfo"), 3.5); |
| 154 | + |
| 155 | + if (additionalQAplots1) { |
| 156 | + auto multTPC = collision.multNTracksPV(); |
| 157 | + auto psiFT0A = collision.psiFT0A(); |
| 158 | + auto psiTPC = collision.psiTPC(); |
| 159 | + auto qFT0A = collision.qFT0A(); |
| 160 | + auto qTPC = collision.qTPC(); |
| 161 | + histos.fill(HIST("hFTOCvsTPCSelected"), centrality, multTPC); |
| 162 | + histos.fill(HIST("hPsiFT0C"), centrality, psiFT0C); |
| 163 | + histos.fill(HIST("hPsiFT0A"), centrality, psiFT0A); |
| 164 | + histos.fill(HIST("hPsiTPC"), centrality, psiTPC); |
| 165 | + histos.fill(HIST("ResFT0CTPC"), centrality, std::cos(2.0 * (psiFT0C - psiTPC))); |
| 166 | + histos.fill(HIST("ResFT0CFT0A"), centrality, std::cos(2.0 * (psiFT0C - psiFT0A))); |
| 167 | + histos.fill(HIST("ResFT0ATPC"), centrality, std::cos(2.0 * (psiTPC - psiFT0A))); |
| 168 | + histos.fill(HIST("ResFT0CTPCSP"), centrality, qFT0C * qTPC * std::cos(2.0 * (psiFT0C - psiTPC))); |
| 169 | + histos.fill(HIST("ResFT0CFT0ASP"), centrality, qFT0C * qFT0A * std::cos(2.0 * (psiFT0C - psiFT0A))); |
| 170 | + histos.fill(HIST("ResFT0ATPCSP"), centrality, qTPC * qFT0A * std::cos(2.0 * (psiTPC - psiFT0A))); |
| 171 | + histos.fill(HIST("hCentrality"), centrality); |
| 172 | + histos.fill(HIST("hOccupancy"), occupancy); |
| 173 | + histos.fill(HIST("hVtxZ"), collision.posZ()); |
| 174 | + // filled once per event now, instead of once per track-pair as in the original processSE |
| 175 | + histos.fill(HIST("ResTrackSPFT0CTPC"), centrality, occupancy, qFT0C * qTPC * std::cos(2.0 * (psiFT0C - psiTPC))); |
| 176 | + histos.fill(HIST("ResTrackSPFT0CFT0A"), centrality, occupancy, qFT0C * qFT0A * std::cos(2.0 * (psiFT0C - psiFT0A))); |
| 177 | + histos.fill(HIST("ResTrackSPFT0ATPC"), centrality, occupancy, qTPC * qFT0A * std::cos(2.0 * (psiTPC - psiFT0A))); |
| 178 | + } |
| 179 | + |
| 180 | + struct Stored { |
| 181 | + float px, py, pz, dcaXY, dcaZ, tpcKa, tofKa, tpcPi, tofPi, beta; |
| 182 | + int8_t sign; |
| 183 | + int64_t id; |
| 184 | + bool hasTOF; |
| 185 | + }; |
| 186 | + std::vector<Stored> sel; |
| 187 | + for (const auto& t : tracks) { |
| 188 | + if (!selectionTrack(t)) continue; |
| 189 | + sel.push_back({t.px(), t.py(), t.pz(), t.dcaXY(), t.dcaZ(), |
| 190 | + t.tpcNSigmaKa(), t.tofNSigmaKa(), t.tpcNSigmaPi(), t.tofNSigmaPi(), |
| 191 | + t.hasTOF() ? t.beta() : -999.f, static_cast<int8_t>(t.sign()), t.globalIndex(), t.hasTOF()}); |
| 192 | + } |
| 193 | + if (sel.empty()) return; |
| 194 | + |
| 195 | + auto bc = collision.bc_as<aod::BCsWithTimestamps>(); |
| 196 | + kaEvent(centrality, collision.posZ(), occupancy, psiFT0C, qFT0C, /*psiZDCC=*/0.f, |
| 197 | + collision.bcId(), bc.runNumber(), bc.timestamp()); |
| 198 | + const int64_t idx = kaEvent.lastIndex(); |
| 199 | + for (const auto& s : sel) { |
| 200 | + kaTrack(idx, s.px, s.py, s.pz, s.sign, s.id, s.dcaXY, s.dcaZ, |
| 201 | + s.tpcKa, s.tofKa, s.tpcPi, s.tofPi, s.hasTOF, s.beta); |
| 202 | + } |
| 203 | + } |
| 204 | + PROCESS_SWITCH(KaDaughterProducer, processData, "Produce shared kaon/pion daughter candidates", true); |
| 205 | +}; |
| 206 | + |
| 207 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 208 | +{ |
| 209 | + return WorkflowSpec{adaptAnalysisTask<KaDaughterProducer>(cfgc)}; |
| 210 | +} |
0 commit comments