|
| 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 | +#include <vector> |
| 13 | +#include "Framework/runDataProcessing.h" |
| 14 | +#include "Framework/AnalysisTask.h" |
| 15 | +#include "Framework/AnalysisDataModel.h" |
| 16 | +#include "Framework/ASoAHelpers.h" |
| 17 | +#include "Framework/HistogramRegistry.h" |
| 18 | +#include "Framework/RunningWorkflowInfo.h" |
| 19 | +#include "Common/Core/RecoDecay.h" |
| 20 | +#include "CommonConstants/MathConstants.h" |
| 21 | +#include "Common/DataModel/EventSelection.h" |
| 22 | +#include "Common/DataModel/TrackSelectionTables.h" |
| 23 | +#include "Common/DataModel/Centrality.h" |
| 24 | +#include "PWGCF/Core/CorrelationContainer.h" |
| 25 | +#include "PWGCF/Core/PairCuts.h" |
| 26 | + |
| 27 | +using namespace o2; |
| 28 | +using namespace o2::framework; |
| 29 | +using namespace o2::framework::expressions; |
| 30 | + |
| 31 | +struct CorrSparse { |
| 32 | + Configurable<float> cfgZVtxCut = {"zvtxcut", 10.0, "Vertex z cut. Default 10 cm"}; |
| 33 | + Configurable<float> cfgPtCutMin = {"minpt", 0.2, "Minimum accepted track pT. Default 0.2 GeV"}; |
| 34 | + Configurable<float> cfgPtCutMax = {"maxpt", 5.0, "Maximum accepted track pT. Default 5.0 GeV"}; |
| 35 | + Configurable<float> cfgEtaCut = {"etacut", 0.8, "Eta cut. Default 0.8"}; |
| 36 | + Configurable<float> cfgDCAzCut = {"dcacut", 0.3, "DCA z cut. Default 0.3 cm"}; |
| 37 | + Configurable<float> cfgDCAxyCut = {"dcacutxy", 0.3, "DCA xy cut. Default 0.2 cm"}; |
| 38 | + Configurable<float> cfgDCAxySigmaCut = {"dcacutxysigma", 1, "DCA xy sigma cut. Default 0.3"}; |
| 39 | + Configurable<float> cfgCutChi2prTPCcls = {"chi2cut", 2.5, "Chi2 cut. Default 2.5"}; |
| 40 | + ConfigurableAxis axisVertex{"axisVertex", {7, -7, 7}, "vertex axis for histograms"}; |
| 41 | + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -constants::math::PIHalf, constants::math::PIHalf * 3}, "delta phi axis for histograms"}; |
| 42 | + ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -2, 2}, "delta eta axis for histograms"}; |
| 43 | + ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"}; |
| 44 | + ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt associated axis for histograms"}; |
| 45 | + ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100}, "multiplicity / centrality axis for histograms"}; |
| 46 | + HistogramRegistry registry{"registry"}; |
| 47 | + int logcolls = 0; |
| 48 | + int logcollpairs = 0; |
| 49 | + |
| 50 | + void init(InitContext&) |
| 51 | + { |
| 52 | + LOGF(info, "Starting init"); |
| 53 | + registry.add("Yield", "pT vs eta vs Nch", {HistType::kTH3F, {{40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}, {100, 0, 100, "Nch"}}}); // check to see total number of tracks |
| 54 | + registry.add("etaphi_Trigger", "eta vs phi vs Nch", {HistType::kTH3F, {{100, -2, 2, "#eta"}, {200, 0, 2 * M_PI, "#varphi"}, {100, 0, 100, "Nch"}}}); |
| 55 | + |
| 56 | + registry.add("deltaEta_deltaPhi_same", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); // check to see the delta eta and delta phi distribution |
| 57 | + registry.add("deltaEta_deltaPhi_mixed", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEta}}); |
| 58 | + |
| 59 | + registry.add("Sparse_mixed", "", {HistType::kTHnSparseD, {{axisVertex, axisPtTrigger, axisPtAssoc, axisMultiplicity, axisDeltaPhi, axisDeltaEta}}}); // Make the output sparse |
| 60 | + registry.add("Sparse_same", "", {HistType::kTHnSparseD, {{axisVertex, axisPtTrigger, axisPtAssoc, axisMultiplicity, axisDeltaPhi, axisDeltaEta}}}); |
| 61 | + |
| 62 | + const int maxMixBin = axisMultiplicity->size() * axisVertex->size(); |
| 63 | + registry.add("eventcount", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); // histogram to see how many events are in the same and mixed event |
| 64 | + } |
| 65 | + |
| 66 | + template <typename TCollision, typename TTracks> |
| 67 | + void fillYield(TCollision collision, float centrality, TTracks tracks) // function to fill the yield and etaphi histograms. (This is not needed can be removed) |
| 68 | + { |
| 69 | + for (auto& track1 : tracks) { |
| 70 | + registry.fill(HIST("Yield"), track1.pt(), track1.eta(), track1.size()); |
| 71 | + registry.fill(HIST("etaphi_Trigger"), track1.size(), track1.phi(), track1.eta()); |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + template <typename TCollision> |
| 76 | + bool fillCollision(TCollision collision, float centrality) |
| 77 | + { |
| 78 | + |
| 79 | + if (!collision.sel8()) { |
| 80 | + return false; |
| 81 | + } |
| 82 | + |
| 83 | + return true; |
| 84 | + } |
| 85 | + |
| 86 | + template <typename TTracks> |
| 87 | + void fillCorrelations(TTracks tracks1, TTracks tracks2, float posZ, int system, float Nch) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms |
| 88 | + { |
| 89 | + // loop over all tracks |
| 90 | + for (auto const& track1 : tracks1) { |
| 91 | + |
| 92 | + for (auto const& track2 : tracks2) { |
| 93 | + if (track1 == track2) { |
| 94 | + continue; |
| 95 | + } |
| 96 | + |
| 97 | + float deltaPhi = track1.phi() - track2.phi(); |
| 98 | + float deltaEta = track1.eta() - track2.eta(); |
| 99 | + RecoDecay::constrainAngle(deltaPhi, -PIHalf); |
| 100 | + |
| 101 | + // fill the right sparse and histograms |
| 102 | + if (system == 1) { |
| 103 | + registry.fill(HIST("deltaEta_deltaPhi_same"), deltaPhi, deltaEta); |
| 104 | + registry.fill(HIST("Sparse_same"), posZ, track1.pt(), track2.pt(), Nch, deltaPhi, deltaEta); |
| 105 | + } else if (system == 2) { |
| 106 | + registry.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta); |
| 107 | + registry.fill(HIST("Sparse_mixed"), posZ, track1.pt(), track2.pt(), Nch, deltaPhi, deltaEta); |
| 108 | + } |
| 109 | + } |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | + // make the filters and cuts. I was told not to include chi2 since its not needed for run 3 data. |
| 114 | + |
| 115 | + Filter collisionFilter = nabs(aod::collision::posZ) < cfgZVtxCut; |
| 116 | + |
| 117 | + Filter trackFilter = (nabs(aod::track::eta) < cfgEtaCut) && (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) |
| 118 | + //&& (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls) |
| 119 | + && (nabs(aod::track::dcaZ) > cfgDCAzCut) && (cfgDCAxySigmaCut * (0.0015f + 0.005f / npow(aod::track::pt, 1.1f)) < nabs(aod::track::dcaXY)); |
| 120 | + // |
| 121 | + |
| 122 | + // define the filtered collisions and tracks |
| 123 | + using aodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>>; |
| 124 | + using aodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra, aod::TracksDCA>>; |
| 125 | + |
| 126 | + // process for the same event |
| 127 | + void processSame(aodCollisions::iterator const& collision, aodTracks const& tracks) |
| 128 | + { |
| 129 | + const auto centrality = collision.centFT0C(); |
| 130 | + |
| 131 | + registry.fill(HIST("eventcount"), -2); // because its same event i put it in the -2 bin |
| 132 | + fillYield(collision, centrality, tracks); |
| 133 | + fillCorrelations(tracks, tracks, collision.posZ(), 1, tracks.size()); // fill the SE histogram and Sparse |
| 134 | + } |
| 135 | + PROCESS_SWITCH(CorrSparse, processSame, "Process same event", true); |
| 136 | + |
| 137 | + // i do the event mixing (i have not changed this from the tutorial i got). |
| 138 | + std::vector<double> vtxBinsEdges{VARIABLE_WIDTH, -7.0f, -5.0f, -3.0f, -1.0f, 1.0f, 3.0f, 5.0f, 7.0f}; |
| 139 | + std::vector<double> multBinsEdges{VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0, 100.1f}; |
| 140 | + SliceCache cache; |
| 141 | + |
| 142 | + ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C> |
| 143 | + bindingOnVtxAndMult{{vtxBinsEdges, multBinsEdges}, true}; // true is for 'ignore overflows' (true by default) |
| 144 | + SameKindPair<aodCollisions, |
| 145 | + aodTracks, |
| 146 | + ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C>> |
| 147 | + pair{bindingOnVtxAndMult, 5, -1, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored |
| 148 | + |
| 149 | + // the process for filling the mixed events |
| 150 | + void processMixed(aodCollisions& collisions, aodTracks const& tracks) |
| 151 | + { |
| 152 | + for (auto& [collision1, tracks1, collision2, tracks2] : pair) { |
| 153 | + |
| 154 | + if (fillCollision(collision1, collision1.centFT0C()) == false) { |
| 155 | + continue; |
| 156 | + } |
| 157 | + |
| 158 | + registry.fill(HIST("eventcount"), 1); // fill the mixed event in the 1 bin |
| 159 | + |
| 160 | + fillCorrelations(tracks1, tracks2, collision1.posZ(), 2, tracks1.size()); |
| 161 | + } |
| 162 | + } |
| 163 | + PROCESS_SWITCH(CorrSparse, processMixed, "Process mixed events", true); |
| 164 | +}; |
| 165 | + |
| 166 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 167 | +{ |
| 168 | + return WorkflowSpec{ |
| 169 | + adaptAnalysisTask<CorrSparse>(cfgc), |
| 170 | + }; |
| 171 | +} |
0 commit comments